本文整理汇总了Python中PyQt4.QtGui.QDialogButtonBox.Cancel方法的典型用法代码示例。如果您正苦于以下问题:Python QDialogButtonBox.Cancel方法的具体用法?Python QDialogButtonBox.Cancel怎么用?Python QDialogButtonBox.Cancel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QDialogButtonBox
的用法示例。
在下文中一共展示了QDialogButtonBox.Cancel方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_dialog_cancel
# 需要导入模块: from PyQt4.QtGui import QDialogButtonBox [as 别名]
# 或者: from PyQt4.QtGui.QDialogButtonBox import Cancel [as 别名]
def test_dialog_cancel(self):
"""Test we can click cancel."""
button = self.dialog.button_box.button(QDialogButtonBox.Cancel)
button.click()
result = self.dialog.result()
self.assertEqual(result, QDialog.Rejected)
示例2: __init__
# 需要导入模块: from PyQt4.QtGui import QDialogButtonBox [as 别名]
# 或者: from PyQt4.QtGui.QDialogButtonBox import Cancel [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)
示例3: reject
# 需要导入模块: from PyQt4.QtGui import QDialogButtonBox [as 别名]
# 或者: from PyQt4.QtGui.QDialogButtonBox import Cancel [as 别名]
def reject(self):
"""
Reload our configuration widget with the values from the config file (=> Cancel the changes in the config window), then close the config window
"""
self.setValuesFromConfig(self.cfg_window_def, self.var_dict, self.configspec)
QDialog.reject(self)
logger.info('New configuration cancelled')
示例4: __init__
# 需要导入模块: from PyQt4.QtGui import QDialogButtonBox [as 别名]
# 或者: from PyQt4.QtGui.QDialogButtonBox import Cancel [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)
示例5: add_authentication
# 需要导入模块: from PyQt4.QtGui import QDialogButtonBox [as 别名]
# 或者: from PyQt4.QtGui.QDialogButtonBox import Cancel [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