本文整理汇总了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)
示例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 )
示例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 )
示例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)
示例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)
示例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)
示例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()
示例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)
示例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