当前位置: 首页>>代码示例>>Python>>正文


Python QPushButton.setMinimumHeight方法代码示例

本文整理汇总了Python中python_qt_binding.QtGui.QPushButton.setMinimumHeight方法的典型用法代码示例。如果您正苦于以下问题:Python QPushButton.setMinimumHeight方法的具体用法?Python QPushButton.setMinimumHeight怎么用?Python QPushButton.setMinimumHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在python_qt_binding.QtGui.QPushButton的用法示例。


在下文中一共展示了QPushButton.setMinimumHeight方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: ButtonSetPopupSelector

# 需要导入模块: from python_qt_binding.QtGui import QPushButton [as 别名]
# 或者: from python_qt_binding.QtGui.QPushButton import setMinimumHeight [as 别名]
class ButtonSetPopupSelector(QDialog):
    '''
    An interactive dialog that displays successive sets of
    buttons. When each set is displayed, user may ask for the
    next available set, the previous. already seen set, or the
    user may accept the currently displayed set. A cancel is 
    available as well. 
    
    The call and return protocol is as follows:

      - The caller creates a fresh dialog instance of this class,
        passing an iterator. The iterator's next() method returns 
        an array of ButtonProgram instances each time it is called. (When the
        iterator is exhausted, the user is able to use a 'Previous'
        button to view the previously seen sets again).
      - The caller invokes the exec_() method on the dialog instance.
      - The exec_() method returns:
          
              - -1, if the iterator yielded no button label arrays at all.
              - 0, if the user canceled, and 
              - 1 if the user accepted one of the sets.

      - If the exec_() method returned 1, the caller may obtain an array with the
        ButtonProgram instances of the currently showing (and therefore accepted) buttons.
        The array is obtained from the dialog instance via method getCurrentlyShowingSetLabels(self). 
    '''
    #------------------------------------------------------   Public  Methods ---------------------------
    
    def __init__(self, buttonProgramArrayIterator):
        
        super(ButtonSetPopupSelector, self).__init__();

        self.setStyleSheet(SpeakEasyGUI.stylesheetAppBG);
        
        self.programButtonDict = {};
        self.buttonProgramArrayIt = buttonProgramArrayIterator;
        self.buttonProgramArrays = []; # saved ButtonProgram arrays
        self.shownLabelArrays = [];
        self.currentlyShowingSetIndex = None;
        self.rootLayout = None;
        
        self.cancelButton = QPushButton("Cancel");
        self.cancelButton.setStyleSheet(SpeakEasyGUI.recorderButtonStylesheet);
        self.cancelButton.setMinimumHeight(SpeakEasyGUI.BUTTON_MIN_HEIGHT);
        #self.cancelButton.clicked.connect(partial(QDialog.done, self, 0));
        self.cancelButton.clicked.connect(self.clickedCancelButton);
        
        self.OKButton = QPushButton("Pick this One");
        self.OKButton.setStyleSheet(SpeakEasyGUI.recorderButtonStylesheet);
        self.OKButton.setMinimumHeight(SpeakEasyGUI.BUTTON_MIN_HEIGHT);
        self.OKButton.clicked.connect(self.clickedOKButton);
        
        self.currentNextPrevDirection = NextPrev.NEXT;

        self.nextButton = QPushButton("Next");
        self.nextButton.setStyleSheet(SpeakEasyGUI.recorderButtonStylesheet);
        self.nextButton.setMinimumHeight(SpeakEasyGUI.BUTTON_MIN_HEIGHT);
        self.nextButton.clicked.connect(self.clickedNextButton);

        self.prevButton = QPushButton("Previous");
        self.prevButton.setStyleSheet(SpeakEasyGUI.recorderButtonStylesheet);
        self.prevButton.setMinimumHeight(SpeakEasyGUI.BUTTON_MIN_HEIGHT);
        self.prevButton.clicked.connect(self.clickedPrevButton);

        self.setNextPrevButtonsEnabledness();
        
        self.endOfSetsLabel = QLabel("<b>No more button sets.</b>")
        self.noSetsLabel = QLabel("<b>No button sets available.</b>")

        self.noAvailableSets = False;
        self.offerNewButtonSet();
    
    
    def exec_(self):
        '''
        If the prior initialization revealed that the caller does not
        deliver any sets of button labels at all, then return -1, without
        displaying any dialog.
        @return: -1 if no button sets available. 1 if user accepted one of the button
                 label sets as the one they want, or 0, if the user cancelled.
        @rtype: int
        '''
        if self.noAvailableSets:
            return -1;
        return super(ButtonSetPopupSelector, self).exec_();

    def getCurrentlyShowingSet(self):
        '''
        Returns an array of ButtonProgram instances that are currently showing on
        the dialog, or were showing when the user clicked OK.
        @return: Array of ButtonProgram instances.
        @rtype: [ButtonProgram]
        '''
        return self.buttonProgramArrays[self.currentlyShowingSetIndex];

    def getCurrentlyShowingSetLabels(self):
        '''
        Returns an array of labels of buttons that are currently showing on
        the dialog, or were showing when the user clicked OK.
        @return: Array of labels.
#.........这里部分代码省略.........
开发者ID:ros-visualization,项目名称:speakeasy,代码行数:103,代码来源:buttonSetPopupSelector_ui.py


注:本文中的python_qt_binding.QtGui.QPushButton.setMinimumHeight方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。