Ignore:
Timestamp:
02/26/13 11:48:28 (14 months ago)
Author:
Ales Erjavec <ales.erjavec@…>
Branch:
default
Message:

Moved 'icon' and 'title' property from ToolTree widget, to quickmenu.MenuPage.

File:
1 edited

Legend:

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

    r11366 r11370  
    11""" 
     2========= 
     3Tool Tree 
     4========= 
     5 
    26A ToolTree widget presenting the user with a set of actions 
    37organized in a tree structure. 
     
    913from PyQt4.QtGui import ( 
    1014    QTreeView, QWidget, QVBoxLayout, QSizePolicy, QStandardItemModel, 
    11     QAbstractProxyModel, QStyledItemDelegate, QStyle, QAction, QIcon 
     15    QAbstractProxyModel, QStyledItemDelegate, QStyle, QAction 
    1216) 
    1317 
    1418from PyQt4.QtCore import Qt, QEvent, QModelIndex 
    15 from PyQt4.QtCore import pyqtSignal as Signal, pyqtProperty as Property 
     19from PyQt4.QtCore import pyqtSignal as Signal 
    1620 
    1721log = logging.getLogger(__name__) 
     
    2125    """ 
    2226    A ListView like presentation of a list of actions. 
    23  
    2427    """ 
    2528    triggered = Signal(QAction) 
    2629    hovered = Signal(QAction) 
    2730 
    28     def __init__(self, parent=None, title=None, icon=None, **kwargs): 
     31    def __init__(self, parent=None, **kwargs): 
    2932        QTreeView.__init__(self, parent, **kwargs) 
    3033        self.setSizePolicy(QSizePolicy.MinimumExpanding, 
    3134                           QSizePolicy.Expanding) 
    32  
    33         if title is None: 
    34             title = "" 
    35  
    36         if icon is None: 
    37             icon = QIcon() 
    38  
    39         self.__title = title 
    40         self.__icon = icon 
    4135 
    4236        self.__model = QStandardItemModel() 
     
    7266 
    7367        self.setLayout(layout) 
    74  
    75     def setTitle(self, title): 
    76         """ 
    77         Set the title 
    78         """ 
    79         if self.__title != title: 
    80             self.__title = title 
    81             self.update() 
    82  
    83     def title(self): 
    84         """ 
    85         Return the title of this tool tree. 
    86         """ 
    87         return self.__title 
    88  
    89     title_ = Property(unicode, fget=title, fset=setTitle) 
    90  
    91     def setIcon(self, icon): 
    92         """ 
    93         Set icon for this tool tree. 
    94         """ 
    95         if self.__icon != icon: 
    96             self.__icon = icon 
    97             self.update() 
    98  
    99     def icon(self): 
    100         """ 
    101         Return the icon of this tool tree. 
    102         """ 
    103         return self.__icon 
    104  
    105     icon_ = Property(QIcon, fget=icon, fset=setIcon) 
    10668 
    10769    def setFlattened(self, flatten): 
Note: See TracChangeset for help on using the changeset viewer.