Changeset 11215:a55eaa72e6ef in orange


Ignore:
Timestamp:
11/30/12 11:58:25 (17 months ago)
Author:
Ales Erjavec <ales.erjavec@…>
Branch:
default
Message:

Select and accept a scheme with a double click on an item in the preview list.

Location:
Orange/OrangeCanvas/preview
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • Orange/OrangeCanvas/preview/previewbrowser.py

    r11212 r11215  
    152152    currentIndexChanged = Signal(int) 
    153153 
     154    # Emitted when an item is double clicked in the preview list. 
     155    activated = Signal(int) 
     156 
    154157    def __init__(self, *args): 
    155158        QWidget.__init__(self, *args) 
     
    206209        # An list view with small preview icons. 
    207210        self.__previewList = LinearIconView(objectName="preview-list-view") 
     211        self.__previewList.doubleClicked.connect(self.__onDoubleClicked) 
    208212 
    209213        vlayout.addWidget(self.__previewList) 
     
    290294            self.__update() 
    291295 
     296    def __onDoubleClicked(self, index): 
     297        """Double click on an item in the preview item list. 
     298        """ 
     299        self.activated.emit(index.row()) 
     300 
    292301    def __update(self): 
    293         """Update the description. 
     302        """Update the current description. 
    294303        """ 
    295304        if self.__currentIndex != -1: 
  • Orange/OrangeCanvas/preview/previewdialog.py

    r11206 r11215  
    6767            self.__on_currentIndexChanged 
    6868        ) 
     69        self.__browser.activated.connect(self.__on_activated) 
    6970 
    7071        layout.setSizeConstraint(QVBoxLayout.SetFixedSize) 
     
    110111        button.setEnabled(index >= 0) 
    111112        self.currentIndexChanged.emit(index) 
     113 
     114    def __on_activated(self, index): 
     115        if self.currentIndex() != index: 
     116            self.setCurrentIndex(index) 
     117 
     118        self.accept() 
Note: See TracChangeset for help on using the changeset viewer.