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


Python QDialogButtonBox.Cancel方法代码示例

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


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

示例1: on_button_4_clicked

# 需要导入模块: from PyQt5.QtWidgets import QDialogButtonBox [as 别名]
# 或者: from PyQt5.QtWidgets.QDialogButtonBox import Cancel [as 别名]
def on_button_4_clicked(self):
        log.debug("clicked: B4: {}".format(self.winId()))

        dialog_b4 = QDialog(flags=(Qt.Dialog | Qt.FramelessWindowHint))
        ui = Ui_DialogConfirmOff()
        ui.setupUi(dialog_b4)

        dialog_b4.move(0, 0)

        ui.buttonBox.button(QDialogButtonBox.Yes).setText("Shutdown")
        ui.buttonBox.button(QDialogButtonBox.Retry).setText("Restart")
        ui.buttonBox.button(QDialogButtonBox.Cancel).setText("Cancel")

        ui.buttonBox.button(QDialogButtonBox.Yes).clicked.connect(self.b4_shutdown)
        ui.buttonBox.button(QDialogButtonBox.Retry).clicked.connect(self.b4_restart)

        dialog_b4.show()
        rsp = dialog_b4.exec_()

        if rsp == QDialog.Accepted:
            log.info("B4: pressed is: Accepted - Shutdown or Restart")
        else:
            log.info("B4: pressed is: Cancel") 
开发者ID:rootzoll,项目名称:raspiblitz,代码行数:25,代码来源:main.py

示例2: __init__

# 需要导入模块: from PyQt5.QtWidgets import QDialogButtonBox [as 别名]
# 或者: from PyQt5.QtWidgets.QDialogButtonBox import Cancel [as 别名]
def __init__(self, parent=None, rename_existing_id=None):
        super().__init__(parent)
        self.setupUi(self)
        self.edited_profile = None

        self.buttonBox.rejected.connect(self.close)
        self.buttonBox.accepted.connect(self.save)
        self.profileNameField.textChanged.connect(self.button_validation)

        self.buttonBox.button(QDialogButtonBox.Save).setText(self.tr("Save"))
        self.buttonBox.button(QDialogButtonBox.Cancel).setText(self.tr("Cancel"))

        if rename_existing_id is not None:
            existing_profile = BackupProfileModel.get(id=rename_existing_id)
            self.profileNameField.setText(existing_profile.name)
            self.existing_id = rename_existing_id
            self.modalTitle.setText(self.tr('Rename Profile'))

        # Call validate to set inital messages
        self.buttonBox.button(QDialogButtonBox.Save).setEnabled(self.validate()) 
开发者ID:borgbase,项目名称:vorta,代码行数:22,代码来源:profile_add_edit_dialog.py

示例3: remove_user_list

# 需要导入模块: from PyQt5.QtWidgets import QDialogButtonBox [as 别名]
# 或者: from PyQt5.QtWidgets.QDialogButtonBox import Cancel [as 别名]
def remove_user_list(self):
        text = 'Are you sure you want to remove this list? Information for every user in the list will be lost'
        reply = message.warning(self, 'Remove User List?', text, message.Ok, message.Cancel)
        return reply == message.Ok 
开发者ID:MalloyDelacroix,项目名称:DownloaderForReddit,代码行数:6,代码来源:Messages.py

示例4: remove_subreddit_list

# 需要导入模块: from PyQt5.QtWidgets import QDialogButtonBox [as 别名]
# 或者: from PyQt5.QtWidgets.QDialogButtonBox import Cancel [as 别名]
def remove_subreddit_list(self):
        text = 'Are you sure you want to remove this list? Information for every subreddit in the list will be lost'
        reply = message.warning(self, 'Remove Subreddit List?', text, message.Ok, message.Cancel)
        return reply == message.Ok 
开发者ID:MalloyDelacroix,项目名称:DownloaderForReddit,代码行数:6,代码来源:Messages.py

示例5: downloader_running_warning

# 需要导入模块: from PyQt5.QtWidgets import QDialogButtonBox [as 别名]
# 或者: from PyQt5.QtWidgets.QDialogButtonBox import Cancel [as 别名]
def downloader_running_warning(self):
        text = 'The user finder is still currently running.  Closing now may cause unexpected behaviour and corrupted '\
               'files.  Are you sure you want to close?'
        reply = message.warning(self, 'User Finder Still Running', text, message.Ok, message.Cancel)
        return reply == message.Ok 
开发者ID:MalloyDelacroix,项目名称:DownloaderForReddit,代码行数:7,代码来源:Messages.py

示例6: restore_defaults_warning

# 需要导入模块: from PyQt5.QtWidgets import QDialogButtonBox [as 别名]
# 或者: from PyQt5.QtWidgets.QDialogButtonBox import Cancel [as 别名]
def restore_defaults_warning(self):
        text = 'Defaults have been restored. If you save now, any settings controlled from this window will be ' \
               'restored to their original values.\n\nAny user or subreddit who\'s custom settings have been changed ' \
               'will also be restored to their default values.\n\nDo you wish to proceed?'
        reply = message.warning(self, 'Defaults Restored', text, message.Ok, message.Cancel)
        return reply == message.Ok 
开发者ID:MalloyDelacroix,项目名称:DownloaderForReddit,代码行数:8,代码来源:Messages.py

示例7: update_reddit_objects_message

# 需要导入模块: from PyQt5.QtWidgets import QDialogButtonBox [as 别名]
# 或者: from PyQt5.QtWidgets.QDialogButtonBox import Cancel [as 别名]
def update_reddit_objects_message(self):
        text = "Saved reddit objects are from a previous version of the program and are no\n" \
               "longer compatible. These objects will now be updated to the latest version\n" \
               "and the application will be saved. All of the objects settings and download list\n" \
               "will be carried over to new objects.\n" \
               "If you do not update these objects, the saved objects will not work correctly\n" \
               "and will most likely cause the application to crash"
        reply = message.information(self, "Update Reddit Objects", text, message.Ok, message.Cancel)
        return reply == message.Ok 
开发者ID:MalloyDelacroix,项目名称:DownloaderForReddit,代码行数:11,代码来源:Messages.py

示例8: __init__

# 需要导入模块: from PyQt5.QtWidgets import QDialogButtonBox [as 别名]
# 或者: from PyQt5.QtWidgets.QDialogButtonBox import Cancel [as 别名]
def __init__(self):
        """
        A small class to display an unfinished dialog message to the user.  It is made into its own class so the names
        of the buttons can be renamed to be better understood in the situation it is used in
        """
        QDialog.__init__(self)
        self.setupUi(self)

        self.button_box.button(QDialogButtonBox.Ok).setText('Close Anyway')
        self.button_box.button(QDialogButtonBox.Cancel).setText('Do Not Close')

        self.button_box.accepted.connect(self.accept)
        self.button_box.rejected.connect(self.close) 
开发者ID:MalloyDelacroix,项目名称:DownloaderForReddit,代码行数:15,代码来源:Messages.py

示例9: initUI

# 需要导入模块: from PyQt5.QtWidgets import QDialogButtonBox [as 别名]
# 或者: from PyQt5.QtWidgets.QDialogButtonBox import Cancel [as 别名]
def initUI(self):
        self.setWindowTitle("请稍等……")
        self.setWindowIcon(QIcon(SRC_DIR + "password.ico"))
        self.lb_oldpwd = QLabel()
        self.lb_oldpwd.setText("当前提取码:")
        self.lb_oldpwd.setAlignment(Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter)
        self.tx_oldpwd = QLineEdit()
        # 当前提取码 只读
        self.tx_oldpwd.setFocusPolicy(Qt.NoFocus)
        self.tx_oldpwd.setReadOnly(True)
        self.lb_newpwd = QLabel()
        self.lb_newpwd.setText("新的提取码:")
        self.lb_newpwd.setAlignment(Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter)
        self.tx_newpwd = QLineEdit()

        self.buttonBox = QDialogButtonBox()
        self.buttonBox.setOrientation(Qt.Horizontal)
        self.buttonBox.setStandardButtons(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
        self.buttonBox.button(QDialogButtonBox.Ok).setText("确定")
        self.buttonBox.button(QDialogButtonBox.Cancel).setText("取消")

        self.grid = QGridLayout()
        self.grid.setSpacing(10)
        self.grid.addWidget(self.lb_oldpwd, 1, 0)
        self.grid.addWidget(self.tx_oldpwd, 1, 1)
        self.grid.addWidget(self.lb_newpwd, 2, 0)
        self.grid.addWidget(self.tx_newpwd, 2, 1)
        self.grid.addWidget(self.buttonBox, 3, 0, 1, 2)
        self.setLayout(self.grid)
        self.buttonBox.accepted.connect(self.btn_ok)
        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.accepted.connect(self.set_tip)
        self.buttonBox.rejected.connect(self.reject)
        self.buttonBox.rejected.connect(self.set_tip)
        self.setMinimumWidth(280) 
开发者ID:rachpt,项目名称:lanzou-gui,代码行数:37,代码来源:setpwd.py

示例10: initUI

# 需要导入模块: from PyQt5.QtWidgets import QDialogButtonBox [as 别名]
# 或者: from PyQt5.QtWidgets.QDialogButtonBox import Cancel [as 别名]
def initUI(self):
        self.setWindowTitle("确认删除")
        self.setWindowIcon(QIcon(SRC_DIR + "delete.ico"))
        self.layout = QVBoxLayout()
        self.list_view = QListView()
        self.list_view.setViewMode(QListView.ListMode)
        # 列表
        self.slm = QStandardItem()
        self.model = QStandardItemModel()
        max_len = 10
        count = 0
        for info in self.infos:
            if info.is_file:  # 文件
                self.model.appendRow(QStandardItem(set_file_icon(info.name), info.name))
            else:
                self.model.appendRow(QStandardItem(QIcon(SRC_DIR + "folder.gif"), info.name))
            self.out.append({'fid': info.id, 'is_file': info.is_file, 'name': info.name})  # id,文件标示, 文件名
            count += 1
            if max_len < len(info.name):  # 使用最大文件名长度
                max_len = len(info.name)
        self.list_view.setModel(self.model)

        self.lb_name = QLabel("尝试删除以下{}个文件(夹):".format(count))
        self.buttonBox = QDialogButtonBox()
        self.buttonBox.setOrientation(Qt.Horizontal)
        self.buttonBox.setStandardButtons(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
        self.buttonBox.button(QDialogButtonBox.Ok).setText("确定")
        self.buttonBox.button(QDialogButtonBox.Cancel).setText("取消")

        self.layout.addWidget(self.lb_name)
        self.layout.addWidget(self.list_view)
        self.layout.addWidget(self.buttonBox)
        self.setLayout(self.layout)

        self.buttonBox.accepted.connect(self.btn_ok)
        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.rejected.connect(self.reject)
        self.setMinimumWidth(400)
        self.resize(int(max_len*8), int(count*34+60)) 
开发者ID:rachpt,项目名称:lanzou-gui,代码行数:41,代码来源:delete.py

示例11: initUI

# 需要导入模块: from PyQt5.QtWidgets import QDialogButtonBox [as 别名]
# 或者: from PyQt5.QtWidgets.QDialogButtonBox import Cancel [as 别名]
def initUI(self):
        self.setWindowIcon(QIcon(SRC_DIR + "desc.ico"))
        self.lb_name = QLabel()
        self.lb_name.setText("文件夹名:")
        self.lb_name.setAlignment(Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter)
        self.tx_name = QLineEdit()
        self.lb_desc = QLabel()
        self.tx_desc = QTextEdit()
        self.lb_desc.setText("描  述:")
        self.lb_desc.setAlignment(Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter)

        self.buttonBox = QDialogButtonBox()
        self.buttonBox.setOrientation(Qt.Horizontal)
        self.buttonBox.setStandardButtons(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
        self.buttonBox.button(QDialogButtonBox.Ok).setText("确定")
        self.buttonBox.button(QDialogButtonBox.Cancel).setText("取消")

        self.grid = QGridLayout()
        self.grid.setSpacing(10)
        self.grid.addWidget(self.lb_name, 1, 0)
        self.grid.addWidget(self.tx_name, 1, 1)
        self.grid.addWidget(self.lb_desc, 2, 0)
        self.grid.addWidget(self.tx_desc, 2, 1, 5, 1)
        self.grid.addWidget(self.buttonBox, 7, 1, 1, 1)
        self.setLayout(self.grid)
        self.buttonBox.accepted.connect(self.btn_ok)
        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.rejected.connect(self.reject) 
开发者ID:rachpt,项目名称:lanzou-gui,代码行数:30,代码来源:rename.py

示例12: initUI

# 需要导入模块: from PyQt5.QtWidgets import QDialogButtonBox [as 别名]
# 或者: from PyQt5.QtWidgets.QDialogButtonBox import Cancel [as 别名]
def initUI(self):
        self.setWindowTitle("移动文件(夹)")
        self.setWindowIcon(QIcon(SRC_DIR + "move.ico"))
        self.lb_name = QLabel()
        self.lb_name.setText("文件(夹)名:")
        self.lb_name.setAlignment(Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter)
        self.tx_name = AutoResizingTextEdit()
        self.tx_name.setFocusPolicy(Qt.NoFocus)  # 只读
        self.tx_name.setReadOnly(True)
        self.lb_new_path = QLabel()
        self.lb_new_path.setText("目标文件夹:")
        self.lb_new_path.setAlignment(Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter)
        self.tx_new_path = QComboBox()

        self.buttonBox = QDialogButtonBox()
        self.buttonBox.setOrientation(Qt.Horizontal)
        self.buttonBox.setStandardButtons(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
        self.buttonBox.button(QDialogButtonBox.Ok).setText("确定")
        self.buttonBox.button(QDialogButtonBox.Cancel).setText("取消")

        self.grid = QGridLayout()
        self.grid.setSpacing(10)
        self.grid.addWidget(self.lb_name, 1, 0)
        self.grid.addWidget(self.tx_name, 1, 1)
        self.grid.addWidget(self.lb_new_path, 2, 0)
        self.grid.addWidget(self.tx_new_path, 2, 1)
        self.grid.addWidget(self.buttonBox, 3, 0, 1, 2)
        self.setLayout(self.grid)
        self.buttonBox.accepted.connect(self.btn_ok)
        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.rejected.connect(self.reject)
        self.setMinimumWidth(280) 
开发者ID:rachpt,项目名称:lanzou-gui,代码行数:34,代码来源:move.py

示例13: initUI

# 需要导入模块: from PyQt5.QtWidgets import QDialogButtonBox [as 别名]
# 或者: from PyQt5.QtWidgets.QDialogButtonBox import Cancel [as 别名]
def initUI(self):
        self.setWindowTitle('搜索设置')
        self.setWindowIcon(QIcon('logo.jpg'))
        self.resize(280, 200)

        self.l1 = QLabel(self.info, self)
        self.l1.setGeometry(30, 40, 100, 30)
        self.l1.setAlignment(Qt.AlignCenter)

        self.e1 = QLineEdit(self)
        self.e1.setGeometry(130, 40, 100, 25)

        self.l2 = QLabel('只抓取原创微博', self)
        self.l2.setGeometry(30, 100, 100, 30)
        self.l2.setAlignment(Qt.AlignCenter)

        # 创建复选框1,并默认选中,当状态改变时信号触发事件
        # self.checkBox1 = QCheckBox("&Checkbox1",self)
        self.checkBox1 = QCheckBox(self)
        self.checkBox1.setGeometry(170, 100, 80, 30)
        self.checkBox1.setChecked(True)
        self.checkBox1.stateChanged.connect(self.btnClicked)

        # 确定取消按钮

        self.buttonBox = QDialogButtonBox(self)
        self.buttonBox.setGeometry(120,160,100,30)
        self.buttonBox.setOrientation(Qt.Horizontal)
        self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel |QDialogButtonBox.Ok)

        self.buttonBox.accepted.connect(self.accept)
        self.buttonBox.rejected.connect(self.reject) 
开发者ID:Python3Spiders,项目名称:WeiboSuperSpider,代码行数:34,代码来源:MyDialog.py

示例14: __init__

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

        # etykiety, pola edycyjne i przyciski ###
        loginLbl = QLabel('Login')
        hasloLbl = QLabel('Hasło')
        self.login = QLineEdit()
        self.haslo = QLineEdit()
        self.przyciski = QDialogButtonBox(
            QDialogButtonBox.Ok | QDialogButtonBox.Cancel,
            Qt.Horizontal, self)

        # układ główny ###
        uklad = QGridLayout(self)
        uklad.addWidget(loginLbl, 0, 0)
        uklad.addWidget(self.login, 0, 1)
        uklad.addWidget(hasloLbl, 1, 0)
        uklad.addWidget(self.haslo, 1, 1)
        uklad.addWidget(self.przyciski, 2, 0, 2, 0)

        # sygnały i sloty ###
        self.przyciski.accepted.connect(self.accept)
        self.przyciski.rejected.connect(self.reject)

        # właściwości widżetu ###
        self.setModal(True)
        self.setWindowTitle('Logowanie') 
开发者ID:koduj-z-klasa,项目名称:python101,代码行数:29,代码来源:gui_z1.py

示例15: textChanged

# 需要导入模块: from PyQt5.QtWidgets import QDialogButtonBox [as 别名]
# 或者: from PyQt5.QtWidgets.QDialogButtonBox import Cancel [as 别名]
def textChanged(self,_):
        login = self.textName.text()
        passwd = self.textPass.text()
        if len(passwd) >= config.min_passwd_len and len(login) >= config.min_login_len and "@" in login and "." in login:
            self.dialogbuttons.button(QDialogButtonBox.Cancel).setDefault(False)
            self.dialogbuttons.button(QDialogButtonBox.Ok).setEnabled(True)
            self.dialogbuttons.button(QDialogButtonBox.Ok).setDefault(True)
        else:
            self.dialogbuttons.button(QDialogButtonBox.Cancel).setDefault(True)
            self.dialogbuttons.button(QDialogButtonBox.Ok).setDefault(False)
            self.dialogbuttons.button(QDialogButtonBox.Ok).setEnabled(False) 
开发者ID:artisan-roaster-scope,项目名称:artisan,代码行数:13,代码来源:login.py


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