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


Python QtWidgets.QDialogButtonBox方法代码示例

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


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

示例1: __init__

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QDialogButtonBox [as 别名]
def __init__(self, parent, session):
        super(SimulationOptionsDialog, self).__init__(parent)

        self.session = session


        self.fields_box = self.selectFields()

        self.options_box = self.selectOtherOptions()
        self.button_box = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Ok|QtWidgets.QDialogButtonBox.Cancel)
        self.button_box.accepted.connect(self.accept)
        self.button_box.rejected.connect(self.reject)


        mainLayout = QtWidgets.QVBoxLayout()

        mainLayout.addWidget(self.fields_box)
        mainLayout.addWidget(self.options_box)
        mainLayout.addWidget(self.button_box)

        self.setLayout(mainLayout)  

        self.setWindowTitle('Simulation Options') 
开发者ID:simnibs,项目名称:simnibs,代码行数:25,代码来源:simulation_menu.py

示例2: __init__

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QDialogButtonBox [as 别名]
def __init__(self):
            super().__init__()
            button_box = QtWidgets.QDialogButtonBox(
            QtWidgets.QDialogButtonBox.Ok|QtWidgets.QDialogButtonBox.Cancel)
            button_box.accepted.connect(self.accept)
            button_box.rejected.connect(self.reject)
            mainLayout = QtWidgets.QVBoxLayout()
            mainLayout.addWidget(
                QtWidgets.QLabel(
                    f'SimNIBS version {__version__} will be uninstalled. '
                    'Are you sure?'))
            mainLayout.addWidget(button_box)
            self.setLayout(mainLayout)
            self.setWindowTitle('SimNIBS Uninstaller')
            gui_icon = os.path.join(SIMNIBSDIR,'resources', 'gui_icon.ico')
            self.setWindowIcon(QtGui.QIcon(gui_icon)) 
开发者ID:simnibs,项目名称:simnibs,代码行数:18,代码来源:postinstall_simnibs.py

示例3: __init__

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QDialogButtonBox [as 别名]
def __init__(self, title="Calendar"):
        super(CalendarWidget, self).__init__()

        self.setWindowTitle(title)
        layout = qt_widgets.QGridLayout()
        layout.setColumnStretch(1, 1)

        self.cal = qt_widgets.QCalendarWidget(self)
        self.cal.setGridVisible(True)
        self.cal.clicked[QtCore.QDate].connect(self.show_date)
        layout.addWidget(self.cal, 0, 0, 1, 2)

        self.date_label = qt_widgets.QLabel()
        self.date = self.cal.selectedDate()
        self.date_label.setText(self.date.toString())
        layout.addWidget(self.date_label, 1, 0)

        button_box = qt_widgets.QDialogButtonBox()
        confirm_button = button_box.addButton(qt_widgets.QDialogButtonBox.Ok)
        confirm_button.clicked.connect(self.confirm)
        layout.addWidget(button_box, 1, 1)

        self.setLayout(layout)
        self.show()
        self.raise_() 
开发者ID:aroberge,项目名称:easygui_qt,代码行数:27,代码来源:calendar_widget.py

示例4: __init__

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QDialogButtonBox [as 别名]
def __init__(self, i_description_str, i_parent = None):
        super(SafeDeleteDialog, self).__init__(i_parent)

        vbox = QtWidgets.QVBoxLayout(self)

        self.description_qll = QtWidgets.QLabel(i_description_str)
        vbox.addWidget(self.description_qll)

        self.button_box = QtWidgets.QDialogButtonBox(
            QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel,
            QtCore.Qt.Horizontal,
            self
        )
        vbox.addWidget(self.button_box)
        self.button_box.accepted.connect(self.accept)
        self.button_box.rejected.connect(self.reject)
        # -accept and reject are "slots" built into Qt 
开发者ID:mindfulness-at-the-computer,项目名称:mindfulness-at-the-computer,代码行数:19,代码来源:experimental_list_widget.py

示例5: __init__

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QDialogButtonBox [as 别名]
def __init__(self, i_description_str: str, i_parent=None) -> None:
        super(SafeDeleteDlg, self).__init__(i_parent)

        vbox = QtWidgets.QVBoxLayout(self)

        self.description_qll = QtWidgets.QLabel(i_description_str)
        vbox.addWidget(self.description_qll)

        self.button_box = QtWidgets.QDialogButtonBox(
            QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel,
            QtCore.Qt.Horizontal,
            self
        )
        vbox.addWidget(self.button_box)
        self.button_box.accepted.connect(self.accept)
        self.button_box.rejected.connect(self.reject)
        # -accept and reject are "slots" built into Qt 
开发者ID:mindfulness-at-the-computer,项目名称:mindfulness-at-the-computer,代码行数:19,代码来源:safe_delete_dlg.py

示例6: __init__

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QDialogButtonBox [as 别名]
def __init__(self, i_description_str: str, i_parent=None) -> None:
        super(WarningDlg, self).__init__(i_parent)

        vbox = QtWidgets.QVBoxLayout(self)

        self.description_qll = QtWidgets.QLabel(i_description_str)
        vbox.addWidget(self.description_qll)

        self.button_box = QtWidgets.QDialogButtonBox(
            QtWidgets.QDialogButtonBox.Ok ,
            QtCore.Qt.Horizontal,
            self
        )
        vbox.addWidget(self.button_box)
        self.button_box.accepted.connect(self.accept)
        # -accept and reject are "slots" built into Qt 
开发者ID:mindfulness-at-the-computer,项目名称:mindfulness-at-the-computer,代码行数:18,代码来源:warning_dlg.py

示例7: setupUi

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QDialogButtonBox [as 别名]
def setupUi(self, DocDlg):
        DocDlg.setObjectName("DocDlg")
        DocDlg.resize(714, 454)
        self.verticalLayout = QtWidgets.QVBoxLayout(DocDlg)
        self.verticalLayout.setContentsMargins(6, 6, 6, 6)
        self.verticalLayout.setSpacing(6)
        self.verticalLayout.setObjectName("verticalLayout")
        self.textMain = QtWidgets.QTextBrowser(DocDlg)
        self.textMain.setStyleSheet("")
        self.textMain.setLineWrapMode(QtWidgets.QTextEdit.NoWrap)
        self.textMain.setOpenExternalLinks(True)
        self.textMain.setObjectName("textMain")
        self.verticalLayout.addWidget(self.textMain)
        self.buttonBox = QtWidgets.QDialogButtonBox(DocDlg)
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Close)
        self.buttonBox.setObjectName("buttonBox")
        self.verticalLayout.addWidget(self.buttonBox)

        self.retranslateUi(DocDlg)
        self.buttonBox.accepted.connect(DocDlg.accept)
        self.buttonBox.rejected.connect(DocDlg.reject)
        QtCore.QMetaObject.connectSlotsByName(DocDlg) 
开发者ID:Bertrand256,项目名称:dash-masternode-tool,代码行数:25,代码来源:ui_doc_dlg.py

示例8: eventFilter

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QDialogButtonBox [as 别名]
def eventFilter(self, obj, event):
        def is_colors_dialog():
            return isinstance(
                obj, QDialog) and 'IDA Colors' in obj.windowTitle()

        if isinstance(event, QShowEvent) and is_colors_dialog():
            qApp.removeEventFilter(self)

            # Hide window and find &Import button
            obj.windowHandle().setOpacity(0)
            buttons = [widget for widget in obj.children() if isinstance(
                widget, QDialogButtonBox)][0]
            button = [widget for widget in buttons.buttons() if widget.text()
                      == '&Import'][0]

            with NativeHook(ask_file=self.ask_file_handler):
                button.click()

            QTimer.singleShot(0, lambda: obj.accept())
            return 1
        return 0 
开发者ID:zyantific,项目名称:IDASkins,代码行数:23,代码来源:clrapplier.py

示例9: loadUI

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QDialogButtonBox [as 别名]
def loadUI(self):
        """Define common widget for chid class"""
        layoutBottom = QtWidgets.QHBoxLayout()
        self.status = Status()
        layoutBottom.addWidget(self.status)
        self.buttonShowDetails = QtWidgets.QPushButton(
            QtWidgets.QApplication.translate("pychemqt", "Show Details"))
        self.buttonShowDetails.clicked.connect(self.showDetails)
        self.buttonShowDetails.setEnabled(False)
        layoutBottom.addWidget(self.buttonShowDetails)
        self.btonBox = QtWidgets.QDialogButtonBox(
            QtWidgets.QDialogButtonBox.Cancel |
            QtWidgets.QDialogButtonBox.Save)
        self.btonBox.button(QtWidgets.QDialogButtonBox.Save).setEnabled(False)
        self.btonBox.accepted.connect(self.save)
        self.btonBox.rejected.connect(self.reject)
        layoutBottom.addWidget(self.btonBox)
        self.layout().addLayout(layoutBottom) 
开发者ID:jjgomera,项目名称:pychemqt,代码行数:20,代码来源:newComponent.py

示例10: changeproject

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QDialogButtonBox [as 别名]
def changeproject(self, path):
        st = QtWidgets.QApplication.translate("pychemqt", "Loading project...")
        self.status.setText(st)
        QtWidgets.QApplication.processEvents()
        try:
            with open(path, "r") as file:
                self.project = json.load(file)
        except Exception as e:
            print(e)
            self.status.setText(QtGui.QApplication.translate(
                "pychemqt", "Failed to loading project..."))
        self.buttonBox.button(QtWidgets.QDialogButtonBox.Ok).setEnabled(True)
        self.status.setText(QtWidgets.QApplication.translate(
            "pychemqt", "Project loaded succesfully"))
        self.stream.clear()
        for stream in sorted(self.project["stream"].keys()):
            self.stream.addItem(stream) 
开发者ID:jjgomera,项目名称:pychemqt,代码行数:19,代码来源:flujo.py

示例11: __init__

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QDialogButtonBox [as 别名]
def __init__(self, parent=None):
        super(AutoDialog, self).__init__(parent)
        layout = QtWidgets.QGridLayout(self)
        layout.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "T<sub>min</sub>")), 1, 1)
        self.Tmin = Entrada_con_unidades(Temperature)
        layout.addWidget(self.Tmin, 1, 2)
        layout.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "T<sub>max</sub>")), 2, 1)
        self.Tmax = Entrada_con_unidades(Temperature)
        layout.addWidget(self.Tmax, 2, 2)
        layout.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "P<sub>min</sub>")), 3, 1)
        self.Pmin = Entrada_con_unidades(Pressure)
        layout.addWidget(self.Pmin, 3, 2)
        layout.addWidget(QtWidgets.QLabel(QtWidgets.QApplication.translate(
            "pychemqt", "P<sub>max</sub>")), 4, 1)
        self.Pmax = Entrada_con_unidades(Pressure)
        layout.addWidget(self.Pmax, 4, 2)

        self.buttonBox = QtWidgets.QDialogButtonBox(
            QtWidgets.QDialogButtonBox.Cancel | QtWidgets.QDialogButtonBox.Ok)
        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.rejected.connect(self.reject)
        layout.addWidget(self.buttonBox, 5, 1, 1, 2) 
开发者ID:jjgomera,项目名称:pychemqt,代码行数:27,代码来源:wizard.py

示例12: __init__

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QDialogButtonBox [as 别名]
def __init__(self, columnas=2, help=False, helpFile="", **kwargs):
        """
        title: window title
        help: boolean to show help button
        helpFile: Path for help file, file or url
        """
        parent = kwargs.get("parent", None)
        super(InputTableDialog, self).__init__(parent)
        title = kwargs.get("title", "")
        self.setWindowTitle(title)
        self.helpFile = helpFile
        layout = QtWidgets.QVBoxLayout(self)
        self.widget = InputTableWidget(columnas, **kwargs)
        layout.addWidget(self.widget)
        self.buttonBox = QtWidgets.QDialogButtonBox(
            QtWidgets.QDialogButtonBox.Cancel | QtWidgets.QDialogButtonBox.Ok)
        if help:
            self.buttonBox.addButton(QtWidgets.QDialogButtonBox.Help)
            self.buttonBox.helpRequested.connect(self.ayuda)
        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.rejected.connect(self.reject)
        layout.addWidget(self.buttonBox) 
开发者ID:jjgomera,项目名称:pychemqt,代码行数:24,代码来源:inputTable.py

示例13: buttonClicked

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QDialogButtonBox [as 别名]
def buttonClicked(self, boton):
        role = self.btnBox.buttonRole(boton)
        if role == QtWidgets.QDialogButtonBox.AcceptRole:
            componente = self.getComponent()
            sql.inserElementsFromArray(sql.databank_Custom_name, [componente])
            self.accept()
        elif role == QtWidgets.QDialogButtonBox.ApplyRole:
            componente = self.getComponent()
            sql.updateElement(componente, self.index)
            self.accept()
        elif role == QtWidgets.QDialogButtonBox.DestructiveRole:
            componente = self.getComponent()
            if self.index == 0:
                func = sql.inserElementsFromArray
                arg = (sql.databank_Custom_name, [componente])
            elif self.index > 1000:
                func = sql.updateElement
                arg = (componente, self.index)
            if okToContinue(self, self.dirty, func, arg):
                self.accept()
            else:
                self.reject()
        else:
            self.reject() 
开发者ID:jjgomera,项目名称:pychemqt,代码行数:26,代码来源:viewComponents.py

示例14: __init__

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QDialogButtonBox [as 别名]
def __init__(self, parent=None):
        super(UI_unitConverter, self).__init__(parent)
        self.setWindowTitle(
            QtWidgets.QApplication.translate("pychemqt", "Units converter"))

        self.verticalLayout = QtWidgets.QVBoxLayout(self)
        self.lista = QtWidgets.QListWidget()
        self.lista.itemDoubleClicked.connect(self.showChildWindow)
        self.verticalLayout.addWidget(self.lista)
        self.buttonBox = QtWidgets.QDialogButtonBox(
            QtWidgets.QDialogButtonBox.Close)
        self.buttonBox.rejected.connect(self.reject)
        self.verticalLayout.addWidget(self.buttonBox)
        for unidad in _all:
            self.lista.addItem(unidad.__title__)

        self.lista.setCurrentRow(-1)
        logging.info(QtWidgets.QApplication.translate(
            "pychemqt", "Starting unit converte tool")) 
开发者ID:jjgomera,项目名称:pychemqt,代码行数:21,代码来源:UI_unitConverter.py

示例15: buttonClicked

# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QDialogButtonBox [as 别名]
def buttonClicked(self, boton):
        """Actions for dialogbuttonbox functionality"""
        if self.buttonBox.buttonRole(boton) == \
                QtWidgets.QDialogButtonBox.AcceptRole:
            self.accept()
        elif self.buttonBox.buttonRole(boton) == \
                QtWidgets.QDialogButtonBox.RejectRole:
            self.reject()
        else:
            if boton == \
                    self.buttonBox.button(QtWidgets.QDialogButtonBox.Reset):
                values = self._default
            elif boton.text() == \
                    QtWidgets.QApplication.translate("pychemqt", "No Mark"):
                values = [0]*N_PROP
            else:
                values = [1]*N_PROP

            for i, propiedad in enumerate(values):
                if propiedad == 1:
                    val = "1"
                else:
                    val = ""
                self.prop.item(i, 0).setText(val) 
开发者ID:jjgomera,项目名称:pychemqt,代码行数:26,代码来源:reference.py


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