本文整理匯總了Python中PyQt5.QtWidgets.QDialogButtonBox.Close方法的典型用法代碼示例。如果您正苦於以下問題:Python QDialogButtonBox.Close方法的具體用法?Python QDialogButtonBox.Close怎麽用?Python QDialogButtonBox.Close使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PyQt5.QtWidgets.QDialogButtonBox
的用法示例。
在下文中一共展示了QDialogButtonBox.Close方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from PyQt5.QtWidgets import QDialogButtonBox [as 別名]
# 或者: from PyQt5.QtWidgets.QDialogButtonBox import Close [as 別名]
def __init__(self, parent=None, flags=Qt.Dialog | Qt.WindowCloseButtonHint):
super(ConsoleWidget, self).__init__(parent, flags)
self.parent = parent
self.edit = VideoConsole(self)
buttons = QDialogButtonBox()
buttons.setCenterButtons(True)
clearButton = buttons.addButton('Clear', QDialogButtonBox.ResetRole)
clearButton.clicked.connect(self.edit.clear)
closeButton = buttons.addButton(QDialogButtonBox.Close)
closeButton.clicked.connect(self.close)
closeButton.setDefault(True)
layout = QVBoxLayout()
layout.addWidget(self.edit)
layout.addWidget(buttons)
self.setLayout(layout)
self.setWindowTitle('{0} Console'.format(qApp.applicationName()))
self.setWindowModality(Qt.NonModal)
示例2: setupUi
# 需要導入模塊: from PyQt5.QtWidgets import QDialogButtonBox [as 別名]
# 或者: from PyQt5.QtWidgets.QDialogButtonBox import Close [as 別名]
def setupUi(self):
ui_cmd_console_dlg.Ui_CmdConsoleDlg.setupUi(self, self)
self.setWindowTitle("Command console")
self.restore_cache_settings()
btn = self.buttonBox.button(QDialogButtonBox.Close)
btn.setAutoDefault(False)
self.edtCommand.setFocus()
self.edtCommand.installEventFilter(self)
示例3: _buttonsWidget
# 需要導入模塊: from PyQt5.QtWidgets import QDialogButtonBox [as 別名]
# 或者: from PyQt5.QtWidgets.QDialogButtonBox import Close [as 別名]
def _buttonsWidget(self):
buttons = QDialogButtonBox()
buttons.addButton(QDialogButtonBox.Close)
# Like above, this will be served as a separate detailed report dialog if the application has not yet been
# fully loaded. In this case, "send report" will be a check box in the early crash dialog, so there is no
# need for this extra button.
if self.has_started:
buttons.addButton(catalog.i18nc("@action:button", "Send report"), QDialogButtonBox.AcceptRole)
buttons.accepted.connect(self._sendCrashReport)
buttons.rejected.connect(self.dialog.close)
return buttons
示例4: __init__
# 需要導入模塊: from PyQt5.QtWidgets import QDialogButtonBox [as 別名]
# 或者: from PyQt5.QtWidgets.QDialogButtonBox import Close [as 別名]
def __init__(self, parent=None):
super(Changelog, self).__init__(parent, Qt.Dialog | Qt.WindowCloseButtonHint)
self.parent = parent
self.setWindowTitle('{} changelog'.format(qApp.applicationName()))
changelog = QFile(':/CHANGELOG')
changelog.open(QFile.ReadOnly | QFile.Text)
content = QTextStream(changelog).readAll()
label = QLabel(content, self)
label.setWordWrap(True)
label.setTextFormat(Qt.PlainText)
buttons = QDialogButtonBox(QDialogButtonBox.Close, self)
buttons.rejected.connect(self.close)
scrollarea = QScrollArea(self)
scrollarea.setStyleSheet('QScrollArea { background:transparent; }')
scrollarea.setWidgetResizable(True)
scrollarea.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
scrollarea.setFrameShape(QScrollArea.NoFrame)
scrollarea.setWidget(label)
if sys.platform in {'win32', 'darwin'}:
scrollarea.setStyle(QStyleFactory.create('Fusion'))
# noinspection PyUnresolvedReferences
if parent.parent.stylename == 'fusion' or sys.platform in {'win32', 'darwin'}:
self.setStyleSheet('''
QScrollArea {{
background-color: transparent;
margin-bottom: 10px;
border: none;
border-right: 1px solid {};
}}'''.format('#4D5355' if parent.theme == 'dark' else '#C0C2C3'))
else:
self.setStyleSheet('''
QScrollArea {{
background-color: transparent;
margin-bottom: 10px;
border: none;
}}''')
layout = QVBoxLayout()
layout.addWidget(scrollarea)
layout.addWidget(buttons)
self.setLayout(layout)
self.setMinimumSize(self.sizeHint())
示例5: initUI
# 需要導入模塊: from PyQt5.QtWidgets import QDialogButtonBox [as 別名]
# 或者: from PyQt5.QtWidgets.QDialogButtonBox import Close [as 別名]
def initUI(self):
self.setWindowTitle("查看回收站文件夾內容")
self.form = QVBoxLayout()
for item in iter(self.files):
ico = QPushButton(set_file_icon(item.name), item.name)
ico.setStyleSheet("QPushButton {border:none; background:transparent; color:black;}")
ico.adjustSize()
it = QLabel(f"<font color='#CCCCCC'>({item.size})</font>")
hbox = QHBoxLayout()
hbox.addWidget(ico)
hbox.addStretch(1)
hbox.addWidget(it)
self.form.addLayout(hbox)
self.form.setSpacing(10)
self.buttonBox = QDialogButtonBox()
self.buttonBox.setOrientation(Qt.Horizontal)
self.buttonBox.setStandardButtons(QDialogButtonBox.Close)
self.buttonBox.button(QDialogButtonBox.Close).setText("關閉")
self.buttonBox.setStyleSheet(btn_style)
self.buttonBox.rejected.connect(self.reject)
vbox = QVBoxLayout()
vbox.addLayout(self.form)
vbox.addStretch(1)
vbox.addWidget(self.buttonBox)
self.setLayout(vbox)
示例6: __init__
# 需要導入模塊: from PyQt5.QtWidgets import QDialogButtonBox [as 別名]
# 或者: from PyQt5.QtWidgets.QDialogButtonBox import Close [as 別名]
def __init__(self, device, *args, **kwargs):
super(GPIODialog, self).__init__(*args, **kwargs)
self.setWindowTitle("GPIO [{}]".format(device.p['FriendlyName1']))
self.setMinimumWidth(300)
self.device = device
self.gb = {}
btns = QDialogButtonBox(QDialogButtonBox.Close)
btns.rejected.connect(self.reject)
gbxGPIO = QGroupBox("Select GPIO")
fl = QFormLayout()
if self.device.gpio:
btns.addButton(QDialogButtonBox.Save)
btns.accepted.connect(self.accept)
for gp_name, gp_id in self.device.gpio.items():
gb = DictComboBox(self.device.gpios)
gb.setCurrentText(self.device.gpios[gp_id])
self.gb[gp_name] = gb
fl.addRow(gp_name, gb)
else:
fl.addWidget(QLabel("No configurable GPIOs"))
gbxGPIO.setLayout(fl)
vl = VLayout()
vl.addWidgets([gbxGPIO, btns])
self.setLayout(vl)
示例7: __init__
# 需要導入模塊: from PyQt5.QtWidgets import QDialogButtonBox [as 別名]
# 或者: from PyQt5.QtWidgets.QDialogButtonBox import Close [as 別名]
def __init__(self, env, *args, **kwargs):
super(ClearLWTDialog, self).__init__(*args, **kwargs)
self.setWindowTitle("Clear obsolete retained LWTs")
self.setMinimumSize(QSize(320, 480))
self.env = env
vl = VLayout()
sel_btns = QDialogButtonBox()
sel_btns.setCenterButtons(True)
btnSelAll = sel_btns.addButton("Select all", QDialogButtonBox.ActionRole)
btnSelNone = sel_btns.addButton("Select none", QDialogButtonBox.ActionRole)
self.lw = QListWidget()
for lwt in self.env.lwts:
itm = QListWidgetItem(lwt)
itm.setCheckState(Qt.Unchecked)
self.lw.addItem(itm)
btnSelAll.clicked.connect(lambda: self.select(Qt.Checked))
btnSelNone.clicked.connect(lambda: self.select(Qt.Unchecked))
btns = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Close)
btns.accepted.connect(self.accept)
btns.rejected.connect(self.reject)
vl.addWidgets([sel_btns, self.lw, btns])
self.setLayout(vl)
示例8: __init__
# 需要導入模塊: from PyQt5.QtWidgets import QDialogButtonBox [as 別名]
# 或者: from PyQt5.QtWidgets.QDialogButtonBox import Close [as 別名]
def __init__(self, device, *args, **kwargs):
super(ButtonsDialog, self).__init__(*args, **kwargs)
self.setWindowTitle("Buttons settings [{}]".format(device.p['FriendlyName1']))
self.setMinimumWidth(300)
self.device = device
self.commands_list = ["ButtonDebounce", "ButtonRetain"]
self.command_widgets = {}
self.setoption_list = [11, 13, 32, 40, 61]
self.setoption_widgets = {}
vl = VLayout()
vl_cmd = VLayout(0, 0)
for cmd in self.commands_list:
cw = Command(cmd, commands[cmd], self.device.p.get(cmd))
vl_cmd.addWidget(cw)
self.command_widgets[cmd] = cw
vl_cmd.addStretch(1)
vl_so = VLayout(0, 0)
for so in self.setoption_list:
cw = Command("SetOption{}".format(so), setoptions[str(so)], self.device.setoption(so))
vl_so.addWidget(cw)
self.setoption_widgets[so] = cw
tabs = QTabWidget()
tab_cm = QWidget()
tab_cm.setLayout(vl_cmd)
tabs.addTab(tab_cm, "Settings")
tab_so = QWidget()
tab_so.setLayout(vl_so)
tabs.addTab(tab_so, "SetOptions")
vl.addWidget(tabs)
btns = QDialogButtonBox(QDialogButtonBox.Save | QDialogButtonBox.Close)
btns.accepted.connect(self.accept)
btns.rejected.connect(self.reject)
vl.addWidgets([HTMLLabel("<a href=https://github.com/arendst/Sonoff-Tasmota/wiki/Buttons-and-Switches>Buttons and Switches</a>"), btns])
self.setLayout(vl)
示例9: _createEarlyCrashDialog
# 需要導入模塊: from PyQt5.QtWidgets import QDialogButtonBox [as 別名]
# 或者: from PyQt5.QtWidgets.QDialogButtonBox import Close [as 別名]
def _createEarlyCrashDialog(self):
dialog = QDialog()
dialog.setMinimumWidth(500)
dialog.setMinimumHeight(170)
dialog.setWindowTitle(catalog.i18nc("@title:window", "Cura can't start"))
dialog.finished.connect(self._closeEarlyCrashDialog)
layout = QVBoxLayout(dialog)
label = QLabel()
label.setText(catalog.i18nc("@label crash message", """<p><b>Oops, Ultimaker Cura has encountered something that doesn't seem right.</p></b>
<p>We encountered an unrecoverable error during start up. It was possibly caused by some incorrect configuration files. We suggest to backup and reset your configuration.</p>
<p>Backups can be found in the configuration folder.</p>
<p>Please send us this Crash Report to fix the problem.</p>
"""))
label.setWordWrap(True)
layout.addWidget(label)
# "send report" check box and show details
self._send_report_checkbox = QCheckBox(catalog.i18nc("@action:button", "Send crash report to Ultimaker"), dialog)
self._send_report_checkbox.setChecked(True)
show_details_button = QPushButton(catalog.i18nc("@action:button", "Show detailed crash report"), dialog)
show_details_button.setMaximumWidth(200)
show_details_button.clicked.connect(self._showDetailedReport)
show_configuration_folder_button = QPushButton(catalog.i18nc("@action:button", "Show configuration folder"), dialog)
show_configuration_folder_button.setMaximumWidth(200)
show_configuration_folder_button.clicked.connect(self._showConfigurationFolder)
layout.addWidget(self._send_report_checkbox)
layout.addWidget(show_details_button)
layout.addWidget(show_configuration_folder_button)
# "backup and start clean" and "close" buttons
buttons = QDialogButtonBox()
buttons.addButton(QDialogButtonBox.Close)
buttons.addButton(catalog.i18nc("@action:button", "Backup and Reset Configuration"), QDialogButtonBox.AcceptRole)
buttons.rejected.connect(self._closeEarlyCrashDialog)
buttons.accepted.connect(self._backupAndStartClean)
layout.addWidget(buttons)
return dialog
示例10: __init__
# 需要導入模塊: from PyQt5.QtWidgets import QDialogButtonBox [as 別名]
# 或者: from PyQt5.QtWidgets.QDialogButtonBox import Close [as 別名]
def __init__(self, device, *args, **kwargs):
super(SwitchesDialog, self).__init__(*args, **kwargs)
self.setWindowTitle("Switches settings [{}]".format(device.p['FriendlyName1']))
self.setMinimumWidth(300)
self.device = device
self.commands_list = ["SwitchDebounce", "SwitchRetain"]
self.command_widgets = {}
self.setoption_list = [32]
self.setoption_widgets = {}
vl = VLayout()
vl_cmd = VLayout(0, 0)
for cmd in self.commands_list:
cw = Command(cmd, commands[cmd], self.device.p.get(cmd))
vl_cmd.addWidget(cw)
self.command_widgets[cmd] = cw
self.sm = CommandMultiSelect("SwitchMode", commands["SwitchMode"], self.device.p.get("SwitchMode"))
vl_cmd.addWidget(self.sm)
vl_cmd.addStretch(1)
vl_so = VLayout(0, 0)
for so in self.setoption_list:
cw = Command("SetOption{}".format(so), setoptions[str(so)], self.device.setoption(so))
vl_so.addWidget(cw)
self.setoption_widgets[so] = cw
vl_so.addStretch(1)
tabs = QTabWidget()
tab_cm = QWidget()
tab_cm.setLayout(vl_cmd)
tabs.addTab(tab_cm, "Settings")
tab_so = QWidget()
tab_so.setLayout(vl_so)
tabs.addTab(tab_so, "SetOptions")
vl.addWidget(tabs)
btns = QDialogButtonBox(QDialogButtonBox.Save | QDialogButtonBox.Close)
btns.accepted.connect(self.accept)
btns.rejected.connect(self.reject)
vl.addWidgets([HTMLLabel("<a href=https://github.com/arendst/Sonoff-Tasmota/wiki/Buttons-and-Switches>Buttons and Switches</a>"), btns])
self.setLayout(vl)
示例11: __init__
# 需要導入模塊: from PyQt5.QtWidgets import QDialogButtonBox [as 別名]
# 或者: from PyQt5.QtWidgets.QDialogButtonBox import Close [as 別名]
def __init__(self, device, *args, **kwargs):
super(PowerDialog, self).__init__(*args, **kwargs)
self.setWindowTitle("Power settings [{}]".format(device.p['FriendlyName1']))
self.setMinimumWidth(300)
self.device = device
self.commands_list = ["BlinkCount", "BlinkTime", "PowerOnState", "PowerRetain"]
self.command_widgets = {}
self.setoption_list = [0, 26, 63]
self.setoption_widgets = {}
vl = VLayout()
vl_cmd = VLayout(0, 0)
for cmd in self.commands_list:
cw = Command(cmd, commands[cmd], self.device.p.get(cmd))
vl_cmd.addWidget(cw)
self.command_widgets[cmd] = cw
self.ci = Interlock("Interlock", commands["Interlock"], {"Interlock": self.device.p.get("Interlock", "OFF"), "Groups": self.device.p.get("Groups", "")})
vl_cmd.addWidget(self.ci)
self.cpt = PulseTime("PulseTime", commands["PulseTime"], self.device.pulsetime())
vl_cmd.addWidget(self.cpt)
vl_cmd.addStretch(1)
vl_so = VLayout(0, 0)
for so in self.setoption_list:
cw = Command("SetOption{}".format(so), setoptions[str(so)], self.device.setoption(so))
vl_so.addWidget(cw)
self.setoption_widgets[so] = cw
vl_so.addStretch(1)
tabs = QTabWidget()
tab_cm = QWidget()
tab_cm.setLayout(vl_cmd)
tabs.addTab(tab_cm, "Settings")
tab_so = QWidget()
tab_so.setLayout(vl_so)
tabs.addTab(tab_so, "SetOptions")
vl.addWidget(tabs)
btns = QDialogButtonBox(QDialogButtonBox.Save | QDialogButtonBox.Close)
btns.accepted.connect(self.accept)
btns.rejected.connect(self.reject)
vl.addWidgets([HTMLLabel("<a href=https://github.com/arendst/Sonoff-Tasmota/wiki/Buttons-and-Switches>Buttons and Switches</a>"), btns])
self.setLayout(vl)