Changeset 11420:58c976c2d17f in orange


Ignore:
Timestamp:
03/21/13 16:31:05 (13 months ago)
Author:
Ales Erjavec <ales.erjavec@…>
Branch:
default
Message:

Added sphinx documentation for QuickMenu

Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • Orange/OrangeCanvas/document/quickmenu.py

    r11371 r11420  
    4848    A menu page in a :class:`QuickMenu` widget, showing a list of actions. 
    4949    Shown actions can be disabled by setting a filtering function using the 
    50     :ref:`setFilterFunc`. 
     50    :func:`setFilterFunc`. 
    5151 
    5252    """ 
     
    8080        return self.__title 
    8181 
    82     title_ = Property(unicode, fget=title, fset=setTitle) 
     82    title_ = Property(unicode, fget=title, fset=setTitle, 
     83                      doc="Title of the page.") 
    8384 
    8485    def setIcon(self, icon): 
     
    9697        return self.__icon 
    9798 
    98     icon_ = Property(QIcon, fget=icon, fset=setIcon) 
     99    icon_ = Property(QIcon, fget=icon, fset=setIcon, 
     100                     doc="Page icon") 
    99101 
    100102    def setFilterFunc(self, func): 
     
    111113    def setModel(self, model): 
    112114        """ 
    113         Reimplemented from :ref:`ToolTree.setModel`. 
     115        Reimplemented from :func:`ToolTree.setModel`. 
    114116        """ 
    115117        proxyModel = ItemDisableFilter(self) 
     
    119121    def setRootIndex(self, index): 
    120122        """ 
    121         Reimplemented from :ref:`ToolTree.setRootIndex` 
     123        Reimplemented from :func:`ToolTree.setRootIndex` 
    122124        """ 
    123125        proxyModel = self.view().model() 
     
    127129    def rootIndex(self): 
    128130        """ 
    129         Reimplemented from :ref:`ToolTree.rootIndex` 
     131        Reimplemented from :func:`ToolTree.rootIndex` 
    130132        """ 
    131133        proxyModel = self.view().model() 
     
    630632    A quick menu popup for the widgets. 
    631633 
    632     The widgets are set using :ref:`setModel` which must be a 
    633     model as returned by QtWidgetRegistry.model() 
    634  
    635     """ 
    636  
     634    The widgets are set using :func:`QuickMenu.setModel` which must be a 
     635    model as returned by :func:`QtWidgetRegistry.model` 
     636 
     637    """ 
     638 
     639    #: An action has been triggered in the menu. 
    637640    triggered = Signal(QAction) 
     641 
     642    #: An action has been hovered in the menu 
    638643    hovered = Signal(QAction) 
    639644 
     
    723728    def addPage(self, name, page): 
    724729        """ 
    725         Add the page and return it's index. 
     730        Add the `page` (:class:`MenuPage`) with `name` and return it's index. 
     731        The `page.icon()` will be used as the icon in the tab bar. 
     732 
    726733        """ 
    727734        icon = page.icon() 
     
    732739 
    733740        index = self.__pages.addPage(page, name, icon, tip) 
    734         # TODO: get the background. 
    735741 
    736742        # Route the page's signals 
     
    738744        page.hovered.connect(self.hovered) 
    739745 
    740         # Install event filter to process key presses. 
     746        # Install event filter to intercept key presses. 
    741747        page.view().installEventFilter(self) 
    742748 
     
    868874 
    869875    def exec_(self, pos=None): 
     876        """ 
     877        Execute the menu at position `pos` (in global screen coordinates). 
     878        Return the triggered :class:`QAction` or `None` if no action was 
     879        triggered. 
     880 
     881        """ 
    870882        self.popup(pos) 
    871883        self.setFocus(Qt.PopupFocusReason) 
     
    882894 
    883895    def hideEvent(self, event): 
     896        """ 
     897        Reimplemented from :class:`QWidget` 
     898        """ 
    884899        FramelessWindow.hideEvent(self, event) 
    885900        if self.__loop: 
     
    962977 
    963978class ItemViewKeyNavigator(QObject): 
     979    """ 
     980    A event filter class listening to key press events and responding 
     981    by moving 'currentItem` on a :class:`QListView`. 
     982 
     983    """ 
    964984    def __init__(self, parent=None): 
    965985        QObject.__init__(self, parent) 
     
    967987 
    968988    def setView(self, view): 
     989        """ 
     990        Set the QListView. 
     991        """ 
    969992        if self.__view != view: 
    970993            self.__view = view 
    971994 
    972995    def view(self): 
     996        """ 
     997        Return the view 
     998        """ 
    973999        return self.__view 
    9741000 
     
    10211047            curr = self.__view.currentIndex() 
    10221048            if curr.isValid(): 
    1023                 # TODO: Does this work 
     1049                # TODO: Does this work? We are emitting signals that are 
     1050                # defined by a different class. This might break some things. 
     1051                # Should we just send the keyPress events to the view, and let 
     1052                # it handle them. 
    10241053                self.__view.activated.emit(curr) 
    10251054 
     
    10421071    """ 
    10431072    Automatically positioning :class:`QSizeGrip`. 
     1073    The widget automatically maintains its position in the window 
     1074    corner during resize events. 
     1075 
    10441076    """ 
    10451077    def __init__(self, parent): 
     
    10531085    def setCorner(self, corner): 
    10541086        """ 
    1055         Set the corner where the size grip should position itself. 
     1087        Set the corner (:class:`Qt.Corner`) where the size grip should 
     1088        position itself. 
     1089 
    10561090        """ 
    10571091        if corner not in [Qt.TopLeftCorner, Qt.TopRightCorner, 
  • docs/canvas/document.rst

    r11390 r11420  
    99 
    1010   document.schemeedit 
     11   document.quickmenu 
Note: See TracChangeset for help on using the changeset viewer.