Ignore:
Timestamp:
02/19/13 15:01:43 (14 months ago)
Author:
Ales Erjavec <ales.erjavec@…>
Branch:
default
Message:

Added rst documentation for the canvas gui package.

Fixing docstrings in the process.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Orange/OrangeCanvas/gui/dock.py

    r11232 r11366  
    44======================= 
    55 
    6 A dock widget with a header that can be a collapsed/expanded. 
     6A dock widget that can be a collapsed/expanded. 
    77 
    88""" 
     
    1414) 
    1515 
    16 from PyQt4.QtCore import Qt, QTimer, QEvent 
     16from PyQt4.QtCore import Qt, QEvent 
    1717 
    1818from PyQt4.QtCore import pyqtProperty as Property 
     
    2525 
    2626class CollapsibleDockWidget(QDockWidget): 
    27     """A Dock widget for which the close action collapses the widget 
    28     to a smaller size. 
     27    """ 
     28    This :class:`QDockWidget` subclass overrides the `close` header 
     29    button to instead collapse to a smaller size. The contents contents 
     30    to show when in each state can be set using the ``setExpandedWidget`` 
     31    and ``setCollapsedWidget``. 
     32 
     33    .. note:: Do use the base class ``QDockWidget.setWidget`` method to set 
     34              the contents. 
    2935 
    3036    """ 
     
    7985 
    8086    def setExpanded(self, state): 
    81         """Set the expanded state. 
     87        """ 
     88        Set the widgets `expanded` state. 
    8289        """ 
    8390        if self.__expanded != state: 
     
    9299 
    93100    def expanded(self): 
    94         """Is the dock widget in expanded state 
     101        """ 
     102        Is the dock widget in expanded state. When `True` the 
     103        ``expandedWidget`` will be shown, and ``collapsedWidget`` otherwise. 
     104 
    95105        """ 
    96106        return self.__expanded 
     
    100110    def setWidget(self, w): 
    101111        raise NotImplementedError( 
    102                 "Please use the setExpandedWidget/setCollapsedWidget method." 
     112                "Please use the 'setExpandedWidget'/'setCollapsedWidget' " 
     113                "methods to set the contents of the dock widget." 
    103114              ) 
    104115 
    105116    def setExpandedWidget(self, widget): 
    106         """Set the widget with contents to show while expanded. 
     117        """ 
     118        Set the widget with contents to show while expanded. 
    107119        """ 
    108120        if widget is self.__expandedWidget: 
     
    119131            self.updateGeometry() 
    120132 
     133    def expandedWidet(self): 
     134        """ 
     135        Return the widget previously set with ``setExpandedWidget``, 
     136        or ``None`` if no widget has been set. 
     137 
     138        """ 
     139        return self.__expandedWidget 
     140 
    121141    def setCollapsedWidget(self, widget): 
    122         """Set the widget with contents to show while collapsed. 
     142        """ 
     143        Set the widget with contents to show while collapsed. 
    123144        """ 
    124145        if widget is self.__collapsedWidget: 
     
    135156            self.updateGeometry() 
    136157 
     158    def collapsedWidget(self): 
     159        """ 
     160        Return the widget previously set with ``setCollapsedWidget``, 
     161        or ``None`` if no widget has been set. 
     162 
     163        """ 
     164        return self.__collapsedWidget 
     165 
    137166    def setAnimationEnabled(self, animationEnabled): 
    138         """Enable/disable the transition animation. 
     167        """ 
     168        Enable/disable the transition animation. 
    139169        """ 
    140170        self.__stack.setAnimationEnabled(animationEnabled) 
    141171 
    142172    def animationEnabled(self): 
     173        """ 
     174        Is transition animation enabled. 
     175        """ 
    143176        return self.__stack.animationEnabled() 
    144177 
    145178    def currentWidget(self): 
    146         """Return the current widget. 
     179        """ 
     180        Return the current shown widget depending on the `expanded` state. 
    147181        """ 
    148182        if self.__expanded: 
     
    152186 
    153187    def expand(self): 
    154         """Expand the dock (same as `setExpanded(True)`) 
     188        """ 
     189        Expand the dock (same as ``setExpanded(True)``) 
    155190        """ 
    156191        self.setExpanded(True) 
    157192 
    158193    def collapse(self): 
    159         """Collapse the dock (same as `setExpanded(False)`) 
     194        """ 
     195        Collapse the dock (same as ``setExpanded(False)``) 
    160196        """ 
    161197        self.setExpanded(False) 
Note: See TracChangeset for help on using the changeset viewer.