當前位置: 首頁>>代碼示例>>Python>>正文


Python QDialogButtonBox.Ok方法代碼示例

本文整理匯總了Python中PyQt4.QtGui.QDialogButtonBox.Ok方法的典型用法代碼示例。如果您正苦於以下問題:Python QDialogButtonBox.Ok方法的具體用法?Python QDialogButtonBox.Ok怎麽用?Python QDialogButtonBox.Ok使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PyQt4.QtGui.QDialogButtonBox的用法示例。


在下文中一共展示了QDialogButtonBox.Ok方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_dialog_ok

# 需要導入模塊: from PyQt4.QtGui import QDialogButtonBox [as 別名]
# 或者: from PyQt4.QtGui.QDialogButtonBox import Ok [as 別名]
def test_dialog_ok(self):
        """Test we can click OK."""

        button = self.dialog.button_box.button(QDialogButtonBox.Ok)
        button.click()
        result = self.dialog.result()
        self.assertEqual(result, QDialog.Accepted) 
開發者ID:MACBIO,項目名稱:GeoWrap,代碼行數:9,代碼來源:test_geometry_wrapper_dialog.py

示例2: __init__

# 需要導入模塊: from PyQt4.QtGui import QDialogButtonBox [as 別名]
# 或者: from PyQt4.QtGui.QDialogButtonBox import Ok [as 別名]
def __init__( self, parent ): 
        QDialog.__init__( self, parent ) 
        self.setupUi( self )
        self.setModal( True )
        self.expressionBuilderWidget.loadRecent( 'fieldcalc' )
        self.buttonBox.button( QDialogButtonBox.Ok ).setEnabled( False )
        self.expression = ''
        self.expressionBuilderWidget.expressionParsed.connect( self.expressionChanged ) 
開發者ID:gacarrillor,項目名稱:AutoFields,代碼行數:10,代碼來源:ExpressionBuilderDialog.py

示例3: expressionChanged

# 需要導入模塊: from PyQt4.QtGui import QDialogButtonBox [as 別名]
# 或者: from PyQt4.QtGui.QDialogButtonBox import Ok [as 別名]
def expressionChanged( self, valid ):
        self.buttonBox.button( QDialogButtonBox.Ok ).setEnabled( valid ) 
開發者ID:gacarrillor,項目名稱:AutoFields,代碼行數:4,代碼來源:ExpressionBuilderDialog.py

示例4: __init__

# 需要導入模塊: from PyQt4.QtGui import QDialogButtonBox [as 別名]
# 或者: from PyQt4.QtGui.QDialogButtonBox import Ok [as 別名]
def __init__(self, definition_dict, config = None, configspec = None, parent = None):
        """
        Initialization of the Configuration window. ConfigObj must be instanciated before this one.
        @param definition_dict: the dict that describes our window
        @param config: data readed from the configfile. This dict is created by ConfigObj module.
        @param configspec: specifications of the configfile. This variable is created by ConfigObj module.
        """
        QDialog.__init__(self, parent)
        self.setWindowTitle("Configuration")

        self.cfg_window_def = definition_dict #This is the dict that describes our window
        self.var_dict = config #This is the data from the configfile (dictionary created by ConfigObj class)
        self.configspec = configspec #This is the specifications for all the entries defined in the config file
        
        #Create the config window according to the description dict received
        config_widget = self.createWidgetFromDefinitionDict()
        
        #Create 3 buttons
        button_box = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel | QDialogButtonBox.Apply)
        button_box.accepted.connect(self.accept) #OK button
        button_box.rejected.connect(self.reject) #Cancel button
        apply_button = button_box.button(QDialogButtonBox.Apply)
        apply_button.clicked.connect(self.applyChanges) #Apply button
        
        #Layout the 2 above widgets vertically
        v_box = QVBoxLayout(self)
        v_box.addWidget(config_widget)
        v_box.addWidget(button_box)
        self.setLayout(v_box)
        
        #Populate our Configuration widget with the values from the config file
        self.setValuesFromConfig(self.cfg_window_def, self.var_dict, self.configspec) 
開發者ID:cnc-club,項目名稱:dxf2gcode,代碼行數:34,代碼來源:configwindow.py

示例5: __init__

# 需要導入模塊: from PyQt4.QtGui import QDialogButtonBox [as 別名]
# 或者: from PyQt4.QtGui.QDialogButtonBox import Ok [as 別名]
def __init__(self, parent=None):
        super(CalibrationDialog, self).__init__(parent)

        layout = QtGui.QVBoxLayout(self)

        self.table = QtGui.QTableWidget()
        tableitem = QtGui.QTableWidgetItem()
        self.table.setWindowTitle('Noise Model Calibration')
        self.setWindowTitle('Noise Model Calibration')
        self.resize(800, 400)

        layout.addWidget(self.table)

        # ADD BUTTONS:
        self.loadTifButton = QtGui.QPushButton("Load Tifs")
        layout.addWidget(self.loadTifButton)

        self.evalTifButton = QtGui.QPushButton("Evaluate Tifs")
        layout.addWidget(self.evalTifButton)

        self.pbar = QtGui.QProgressBar(self)
        layout.addWidget(self.pbar)

        self.loadTifButton.clicked.connect(self.loadTif)
        self.evalTifButton.clicked.connect(self.evalTif)

        self.buttons = QDialogButtonBox(
            QDialogButtonBox.ActionRole | QDialogButtonBox.Ok | QDialogButtonBox.Cancel,
            Qt.Horizontal, self)

        layout.addWidget(self.buttons)

        self.buttons.accepted.connect(self.accept)
        self.buttons.rejected.connect(self.reject) 
開發者ID:jungmannlab,項目名稱:picasso,代碼行數:36,代碼來源:simulate.py

示例6: test_form_changed

# 需要導入模塊: from PyQt4.QtGui import QDialogButtonBox [as 別名]
# 或者: from PyQt4.QtGui.QDialogButtonBox import Ok [as 別名]
def test_form_changed(self):
        """Add form changed test."""
        self.assertEqual(
            self.dialog.buttonBox.button(QDialogButtonBox.Ok).isEnabled(),
            False)
        self.dialog.line_edit_name.setText('Repository Name')
        self.dialog.line_edit_url.setText(test_repository_url())
        self.assertEqual(
            self.dialog.buttonBox.button(QDialogButtonBox.Ok).isEnabled(),
            True) 
開發者ID:akbargumbira,項目名稱:qgis_resources_sharing,代碼行數:12,代碼來源:test_manage_dialog.py

示例7: __init__

# 需要導入模塊: from PyQt4.QtGui import QDialogButtonBox [as 別名]
# 或者: from PyQt4.QtGui.QDialogButtonBox import Ok [as 別名]
def __init__(self, parent=None):
        """Create the dialog and configure the UI."""
        super(ManageRepositoryDialog, self).__init__(parent)
        self.setupUi(self)
        self.line_edit_url.setText('http://')
        self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False)
        self.line_edit_name.textChanged.connect(self.form_changed)
        self.line_edit_url.textChanged.connect(self.form_changed)
        self.button_add_auth.clicked.connect(self.add_authentication)
        self.button_clear_auth.clicked.connect(self.line_edit_auth_id.clear)

        if qgis_version() < 21200:
            self.disable_authentication() 
開發者ID:akbargumbira,項目名稱:qgis_resources_sharing,代碼行數:15,代碼來源:manage_dialog.py

示例8: form_changed

# 需要導入模塊: from PyQt4.QtGui import QDialogButtonBox [as 別名]
# 或者: from PyQt4.QtGui.QDialogButtonBox import Ok [as 別名]
def form_changed(self):
        """Slot for when the form changed."""
        is_enabled = (len(self.line_edit_name.text()) > 0 and
                      len(self.line_edit_url.text()) > 0)
        self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(is_enabled) 
開發者ID:akbargumbira,項目名稱:qgis_resources_sharing,代碼行數:7,代碼來源:manage_dialog.py

示例9: add_authentication

# 需要導入模塊: from PyQt4.QtGui import QDialogButtonBox [as 別名]
# 或者: from PyQt4.QtGui.QDialogButtonBox import Ok [as 別名]
def add_authentication(self):
        """Slot for when the add auth button is clicked."""
        if qgis_version() >= 21200:
            from qgis.gui import QgsAuthConfigSelect

            dlg = QDialog(self)
            dlg.setWindowTitle(self.tr("Select Authentication"))
            layout = QVBoxLayout(dlg)

            acs = QgsAuthConfigSelect(dlg)
            if self.line_edit_auth_id.text():
                acs.setConfigId(self.line_edit_auth_id.text())
            layout.addWidget(acs)

            button_box = QDialogButtonBox(
                QDialogButtonBox.Ok | QDialogButtonBox.Cancel,
                Qt.Horizontal,
                dlg)
            layout.addWidget(button_box)
            button_box.accepted.connect(dlg.accept)
            button_box.rejected.connect(dlg.close)

            dlg.setLayout(layout)
            dlg.setWindowModality(Qt.WindowModal)
            if dlg.exec_():
                self.line_edit_auth_id.setText(acs.configId())
            del dlg 
開發者ID:akbargumbira,項目名稱:qgis_resources_sharing,代碼行數:29,代碼來源:manage_dialog.py


注:本文中的PyQt4.QtGui.QDialogButtonBox.Ok方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。