Esempio n. 1
0
 def _getTitleButton(self, 
                     parentWidget = None,
                     title        = '', 
                     showExpanded = True ):
     """
     Return the group box title push button. The push button is customized 
     such that it appears as a title bar at the top of the group box. 
     If the user clicks on this 'title bar' it sends a signal to open or 
     close the group box.
     
     @param parentWidget: The parent dialog or group box containing this 
                          widget.
     @type  parentWidget: PM_Dialog or PM_GroupBox
     
     @param title: The button title.
     @type  title: str 
     
     @param showExpanded: dDetermines whether the expand or collapse image is 
                          displayed on the title button.
     @type  showExpanded: bool
                          
     @see: L{_getTitleButtonStyleSheet()}
     
     @Note: Including a title button should only be legal if the parentWidget
            is a PM_Dialog.
     """
     
     button  = QPushButton(title, parentWidget)
     button.setFlat(False)
     button.setAutoFillBackground(True)
     
     button.setStyleSheet(self._getTitleButtonStyleSheet(showExpanded))     
     
     return button
Esempio n. 2
0
    def getTitleButton(self,
                       title,
                       parent=None,
                       showExpanded=True):  #Ninad 070206
        """ Return the groupbox title pushbutton. The pushbutton is customized
        such that  it appears as a title bar to the user. If the user clicks on
        this 'titlebar' it sends appropriate signals to open or close the
        groupboxes   'name = string -- title of the groupbox
        'showExpanded' = boolean .. NE1 uses a different background
        image in the button's  Style Sheet depending on the bool.
        (i.e. if showExpanded = True it uses a opened group image  '^')
        See also: getGroupBoxTitleCheckBox , getGroupBoxButtonStyleSheet  methods
        """

        button = QPushButton(title, parent)
        button.setFlat(False)
        button.setAutoFillBackground(True)

        button.setStyleSheet(self.getTitleButtonStyleSheet(showExpanded))
        button.setPalette(self.getTitleButtonPalette())

        #ninad 070221 set a non existant 'Ghost Icon' for this button
        #By setting such an icon, the button text left aligns!
        #(which what we want :-) )
        #So this might be a bug in Qt4.2.  If we don't use the following kludge,
        #there is no way to left align the push button text but to subclass it.
        #(could mean a lot of work for such a minor thing)  So OK for now

        button.setIcon(geticon("ui/actions/Properties Manager/GHOST_ICON"))

        return button
    def getTitleButton(self, title, parent=None, showExpanded=True): #Ninad 070206
        """ Return the groupbox title pushbutton. The pushbutton is customized
        such that  it appears as a title bar to the user. If the user clicks on
        this 'titlebar' it sends appropriate signals to open or close the
        groupboxes   'name = string -- title of the groupbox
        'showExpanded' = boolean .. NE1 uses a different background
        image in the button's  Style Sheet depending on the bool.
        (i.e. if showExpanded = True it uses a opened group image  '^')
        See also: getGroupBoxTitleCheckBox , getGroupBoxButtonStyleSheet  methods
        """

        button  = QPushButton(title, parent)
        button.setFlat(False)
        button.setAutoFillBackground(True)

        button.setStyleSheet(self.getTitleButtonStyleSheet(showExpanded))
        button.setPalette(self.getTitleButtonPalette())

        #ninad 070221 set a non existant 'Ghost Icon' for this button
        #By setting such an icon, the button text left aligns!
        #(which what we want :-) )
        #So this might be a bug in Qt4.2.  If we don't use the following kludge,
        #there is no way to left align the push button text but to subclass it.
        #(could mean a lot of work for such a minor thing)  So OK for now

        button.setIcon(geticon("ui/actions/Properties Manager/GHOST_ICON"))

        return button