Changeset 8549:6c990f4f8dac in orange


Ignore:
Timestamp:
07/31/11 17:03:21 (3 years ago)
Author:
Noughmad <Noughmad@…>
Branch:
default
Convert:
f3a69b1100e91d3c793cfb5a9ddc07aecdc21747
Message:

Improvements to point selection GUI

Location:
orange/OrangeWidgets
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • orange/OrangeWidgets/Prototypes/OWNxExplorerQt.py

    r8546 r8549  
    248248                                        G.default_zoom_select_buttons +  
    249249                                        [ 
    250                                             ("buttonM2S", "Add marked to selection", None, None, "markedToSelection", 'Dlg_Mark2Sel') 
     250                                            G.Spacing, 
     251                                            ("buttonM2S", "Add marked to selection", None, None, "markedToSelection", 'Dlg_Mark2Sel'), 
     252                                            ("buttonS2M", "Add selection to marked", None, None, "selectionToMarked",  
     253                                            'Dlg_Sel2Mark'), 
     254                                            ("buttonRMS", "Remove selection", None, None, "removeSelection", 'Dlg_SelisMark'), 
     255                                            G.Spacing, 
     256                                            ("buttonSEL", "Hide selected", None, None, "hideSelectedVertices", 'Dlg_UnselectedNodes'), 
     257                                            ("buttonUN", "Hide unselected", None, None, "hideUnSelectedVertices", 'Dlg_SelectedNodes'), 
     258                                            ("buttonSW", "Show all nodes", None, None, "showAllVertices", 'Dlg_clear'), 
    251259                                        ]) 
    252          
    253         T = OWToolbars.NavigateSelectToolbar 
    254         self.zoomSelectToolbar = T(self, self.hcontroArea, self.networkCanvas, self.autoSendSelection, 
    255                                   buttons = (T.IconZoom,  
    256                                              T.IconZoomExtent,  
    257                                              T.IconZoomSelection,  
    258                                              T.IconPan,  
    259                                              ("", "", "", None, None, 0), 
    260                                              #("Move selection", "buttonMoveSelection", "activateMoveSelection", QIcon(OWToolbars.dlg_select), Qt.ArrowCursor, 1), 
    261                                              T.IconRectangle,  
    262                                              #T.IconPolygon,   
    263                                              T.IconSendSelection, 
    264                                              ("", "", "", None, None, 0, "select"), 
    265                                              ("Add marked to selection", "buttonM2S", "markedToSelection", QIcon(dlg_mark2sel), Qt.ArrowCursor, 0), 
    266                                              ("Add selection to marked", "buttonS2M", "selectionToMarked", QIcon(dlg_sel2mark), Qt.ArrowCursor, 0), 
    267                                              ("Remove selection", "buttonRMS", "removeSelection", QIcon(dlg_selIsmark), Qt.ArrowCursor, 0), 
    268                                              ("", "", "", None, None, 0, "select"), 
    269                                              ("Hide selected", "buttonSEL", "hideSelectedVertices", QIcon(dlg_selected), Qt.ArrowCursor, 0), 
    270                                              ("Hide unselected", "buttonUN", "hideUnSelectedVertices", QIcon(dlg_unselected), Qt.ArrowCursor, 0), 
    271                                              ("Show all nodes", "buttonSW", "showAllVertices", QIcon(dlg_showall), Qt.ArrowCursor, 0))) 
    272                          
     260        self.zoomSelectToolbar.buttons[G.SendSelection].clicked.connect(self.sendData) 
    273261        OWGUI.rubber(self.zoomSelectToolbar) 
    274262         
  • orange/OrangeWidgets/Prototypes/OWScatterPlotQt.py

    r8538 r8549  
    9797        OWGUI.button(self.optimizationButtons, self, "VizRank", callback = self.vizrank.reshow, tooltip = "Opens VizRank dialog, where you can search for interesting projections with different subsets of attributes", debuggingEnabled = 0) 
    9898 
     99        g = self.graph.gui 
     100 
    99101        # zooming / selection 
    100         self.zoomSelectToolbar = OWToolbars.ZoomSelectToolbar(self, self.GeneralTab, self.graph, self.autoSendSelection) 
    101         self.connect(self.zoomSelectToolbar.buttonSendSelections, SIGNAL("clicked()"), self.sendSelections) 
    102          
    103         self.graph.gui.zoom_select_toolbar(self.GeneralTab, send_selection_callback=self.sendSelections) 
     102        self.zoomSelectToolbar = g.zoom_select_toolbar(self.GeneralTab) 
     103        self.zoomSelectToolbar.buttons[g.SendSelection].clicked.connect(self.sendSelections) 
    104104 
    105105        # #################################### 
    106106        # SETTINGS TAB 
    107107        # point width 
    108         self.graph.gui.point_properties_box(self.SettingsTab) 
     108        g.point_properties_box(self.SettingsTab) 
    109109 
    110110        # ##### 
     
    120120        OWGUI.checkBox(box4, self, 'graph.showAxisScale', 'Show axis scale', callback = self.updateGraph) 
    121121         
    122         g = self.graph.gui 
    123122        g.add_widgets([g.ShowLegend, g.ShowFilledSymbols, g.ShowGridLines, g.UseAnimations, g.Antialiasing], box4) 
    124123         
     
    164163        self.graph.enableGridYL(self.showGridlines) 
    165164 
    166         apply([self.zoomSelectToolbar.actionZooming, self.zoomSelectToolbar.actionRectangleSelection, self.zoomSelectToolbar.actionPolygonSelection][self.toolbarSelection], []) 
    167165        #self.SettingsTab.resize(self.SettingsTab.sizeHint()) 
    168166 
     
    357355 
    358356    def selectionChanged(self): 
    359         self.zoomSelectToolbar.buttonSendSelections.setEnabled(not self.autoSendSelection) 
     357        self.zoomSelectToolbar.buttons[OWPlotGUI.SendSelection].setEnabled(not self.autoSendSelection) 
    360358        if self.autoSendSelection: 
    361359            self.sendSelections() 
  • orange/OrangeWidgets/plot/owconstants.py

    r8540 r8549  
    2626NOTHING = 0 
    2727ZOOMING = 1 
    28 SELECT_RECTANGLE = 2 
     28SELECT = 2 
    2929SELECT_POLYGON = 3 
    3030PANNING = 4 
    31 SELECT = 5 
     31SELECT_RECTANGLE = SELECT 
    3232 
    3333SELECTION_ADD = 0 
  • orange/OrangeWidgets/plot/owplot.py

    r8547 r8549  
    218218        self._marker_items = [] 
    219219         
    220         self._zoom_factor = 1 
     220        self._zoom_factor = 1.0 
    221221        self._zoom_point = None 
    222222        self.zoom_transform = QTransform() 
     
    669669            c.update_properties() 
    670670             
    671     def update_zoom(self): 
     671    def update_zoom(self, recalculate_transform = True): 
    672672        ''' 
    673673            Updates the zoom transformation of the plot items.  
    674674        ''' 
    675         self.zoom_transform = self.transform_for_zoom(self._zoom_factor, self._zoom_point, self.graph_area) 
     675        if recalculate_transform: 
     676            self.zoom_transform = self.transform_for_zoom(self._zoom_factor, self._zoom_point, self.graph_area) 
    676677        self.zoom_rect = self.zoom_transform.mapRect(self.graph_area) 
    677678        for c in self.plot_items(): 
     
    794795        self.static_click = True 
    795796        self._pressed_mouse_button = event.button() 
    796         if event.button() == Qt.LeftButton and self.state == SELECT_RECTANGLE and self.graph_area.contains(point): 
    797             self._selection_start_point = self.mapToScene(event.pos()) 
    798             self._current_rs_item = QGraphicsRectItem(scene=self.scene()) 
    799             self._current_rs_item.setPen(SelectionPen) 
    800             self._current_rs_item.setBrush(SelectionBrush) 
    801             self._current_rs_item.setZValue(SelectionZValue) 
     797        if event.button() == Qt.LeftButton and self.state == PANNING: 
     798            self._last_pan_pos = point 
    802799             
    803800    def mouseMoveEvent(self, event): 
     
    819816            return 
    820817         
    821                  
    822818        if self._pressed_mouse_button == Qt.LeftButton: 
    823             if self.state == SELECT_RECTANGLE and self._current_rs_item and self.graph_area.contains(point): 
    824                 self._current_rs_item.setRect(QRectF(self._selection_start_point, point).normalized()) 
     819            if self.state == SELECT_RECTANGLE and self.graph_area.contains(point): 
     820                if not self._current_rs_item: 
     821                    self._selection_start_point = self.mapToScene(event.pos()) 
     822                    self._current_rs_item = QGraphicsRectItem(scene=self.scene()) 
     823                    self._current_rs_item.setPen(SelectionPen) 
     824                    self._current_rs_item.setBrush(SelectionBrush) 
     825                    self._current_rs_item.setZValue(SelectionZValue) 
     826                if self._current_rs_item: 
     827                    self._current_rs_item.setRect(QRectF(self._selection_start_point, point).normalized()) 
     828            elif self.state == PANNING: 
     829                self._zoom_point = self._zoom_point - (point - self._last_pan_pos) * (self._zoom_factor - 1.0) 
     830                self._last_pan_pos = point 
     831                self.update_zoom() 
    825832        elif not self._pressed_mouse_button and self.state == SELECT_POLYGON and self._current_ps_item: 
    826833            self._current_ps_polygon[-1] = point 
  • orange/OrangeWidgets/plot/owplotgui.py

    r8548 r8549  
    294294            :param id: If ``id`` is an ``int``, a button is constructed from the default table.  
    295295                       Otherwise, ``id`` must be tuple of size 4 or 5 with members. The first is optional and  
    296                        is a unique identifier for the button, the second is its name, and 
    297                        the last three are the ``attr_name``, ``attr_value`` and ``callback`` arguments to :obj:`.OWButton` 
     296                       is a unique identifier for the button, the second is its name, 
     297                       the next three are the ``attr_name``, ``attr_value`` and ``callback`` arguments to :obj:`.OWButton`,  
     298                       and the last one is the icon name 
    298299            :type if: int or tuple 
    299300             
Note: See TracChangeset for help on using the changeset viewer.