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


Python QDialogButtonBox.Ok方法代码示例

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


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

示例1: __init__

# 需要导入模块: from PyQt5.QtWidgets import QDialogButtonBox [as 别名]
# 或者: from PyQt5.QtWidgets.QDialogButtonBox import Ok [as 别名]
def __init__(self, parent, plotting_frame, controller):
        super().__init__(parent)
        self._extension_filters = [['png', '(*.png)'], ['svg', '(*.svg)']]
        self.setupUi(self)
        self._plotting_frame = plotting_frame
        self._controller = controller

        self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False)
        self.buttonBox.button(QDialogButtonBox.Ok).clicked.connect(self._export_image)
        self.outputFile_box.textChanged.connect(self._update_ok_button)
        self.outputFile_chooser.clicked.connect(lambda: self._select_file())

        if self.previous_values['width']:
            self.width_box.setValue(self.previous_values['width'])
        else:
            self.width_box.setValue(self._plotting_frame.width())

        if self.previous_values['height']:
            self.height_box.setValue(self.previous_values['height'])
        else:
            self.height_box.setValue(self._plotting_frame.height())

        if self.previous_values['dpi']:
            self.dpi_box.setValue(self.previous_values['dpi'])
        if self.previous_values['output_file']:
            self.outputFile_box.setText(self.previous_values['output_file'])
        if self.previous_values['writeScriptsAndConfig'] is not None:
            self.writeScriptsAndConfig.setChecked(self.previous_values['writeScriptsAndConfig']) 
开发者ID:robbert-harms,项目名称:MDT,代码行数:30,代码来源:main.py

示例2: checkScanAlreadyRunning

# 需要导入模块: from PyQt5.QtWidgets import QDialogButtonBox [as 别名]
# 或者: from PyQt5.QtWidgets.QDialogButtonBox import Ok [as 别名]
def checkScanAlreadyRunning(self):
        errcode, errmsg, hasBluetooth, hasUbertooth, spectrumScanRunning, discoveryScanRunning =  getRemoteBluetoothRunningServices(self.remoteAgentIP, self.remoteAgentPort)      
        
        if errcode == 0:
            if discoveryScanRunning:
                self.btnScan.setStyleSheet("background-color: rgba(255,0,0,255); border: none;")
                self.btnScan.setText('&Stop scanning')
                self.comboScanType.setEnabled(False)
            else:
                self.btnScan.setStyleSheet("background-color: rgba(2,128,192,255); border: none;")
                self.btnScan.setText('&Scan')
                self.comboScanType.setEnabled(True)
        else:
                QMessageBox.question(self, 'Error',"Error getting remote agent discovery status: " + errmsg, QMessageBox.Ok)

                self.btnScan.setStyleSheet("background-color: rgba(2,128,192,255); border: none;")
                self.btnScan.setText('&Scan')
                self.comboScanType.setEnabled(True) 
开发者ID:ghostop14,项目名称:sparrow-wifi,代码行数:20,代码来源:sparrowdialogs.py

示例3: validateAllowedIPs

# 需要导入模块: from PyQt5.QtWidgets import QDialogButtonBox [as 别名]
# 或者: from PyQt5.QtWidgets.QDialogButtonBox import Ok [as 别名]
def validateAllowedIPs(self, allowedIPstr):
        if len(allowedIPstr) > 0:
            ippattern = re.compile('([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})')
            if ',' in allowedIPstr:
                tmpList = allowedIPstr.split(',')
                for curItem in tmpList:
                    ipStr = curItem.replace(' ', '')
                    try:
                        ipValue = ippattern.search(ipStr).group(1)
                    except:
                        QMessageBox.question(self, 'Error','ERROR: Unknown IP pattern: ' + ipStr, QMessageBox.Ok)
                        return False
            else:
                ipStr = allowedIPstr.replace(' ', '')
                try:
                    ipValue = ippattern.search(ipStr).group(1)
                except:
                    QMessageBox.question(self, 'Error','ERROR: Unknown IP pattern: ' + ipStr, QMessageBox.Ok)
                    return False
                    
        return True 
开发者ID:ghostop14,项目名称:sparrow-wifi,代码行数:23,代码来源:sparrowdialogs.py

示例4: on_abbrListWidget_itemChanged

# 需要导入模块: from PyQt5.QtWidgets import QDialogButtonBox [as 别名]
# 或者: from PyQt5.QtWidgets.QDialogButtonBox import Ok [as 别名]
def on_abbrListWidget_itemChanged(self, item):
        if ui_common.EMPTY_FIELD_REGEX.match(item.text()):
            row = self.abbrListWidget.row(item)
            self.abbrListWidget.takeItem(row)
            logger.debug("User deleted abbreviation content. Deleted empty list element.")
            del item
        else:
            # The item is non-empty. Therefore there is at least one element in the list, thus input is valid.
            # Allow the user to accept his edits.
            self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(True)

        if self.abbrListWidget.count() == 0:
            logger.debug("Last abbreviation deleted, disabling delete and OK buttons.")
            self.removeButton.setEnabled(False)
            # The user can only accept the dialog if the content is valid
            self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) 
开发者ID:autokey,项目名称:autokey,代码行数:18,代码来源:abbrsettings.py

示例5: test_PackageDialog_setup

# 需要导入模块: from PyQt5.QtWidgets import QDialogButtonBox [as 别名]
# 或者: from PyQt5.QtWidgets.QDialogButtonBox import Ok [as 别名]
def test_PackageDialog_setup(qtapp):
    """
    Ensure the PackageDialog is set up correctly and kicks off the process of
    removing and adding packages.
    """
    pd = mu.interface.dialogs.PackageDialog()
    pd.remove_packages = mock.MagicMock()
    pd.run_pip = mock.MagicMock()
    to_remove = {"foo"}
    to_add = {"bar"}
    module_dir = "baz"
    pd.setup(to_remove, to_add, module_dir)
    pd.remove_packages.assert_called_once_with()
    pd.run_pip.assert_called_once_with()
    assert pd.button_box.button(QDialogButtonBox.Ok).isEnabled() is False
    assert pd.pkg_dirs == {} 
开发者ID:mu-editor,项目名称:mu,代码行数:18,代码来源:test_dialogs.py

示例6: showAbout

# 需要导入模块: from PyQt5.QtWidgets import QDialogButtonBox [as 别名]
# 或者: from PyQt5.QtWidgets.QDialogButtonBox import Ok [as 别名]
def showAbout():
    dialog = QDialog(mw)

    label = QLabel()
    label.setStyleSheet('QLabel { font-size: 14px; }')

    contributors = [
        'Alex Griffin',
        'Chris Hatch',
        'Roland Sieker',
        'Thomas TEMPÉ',
    ]

    text = '''
<div style="font-weight: bold">Chinese Support Redux v%s</div><br>
<div><span style="font-weight: bold">
    Maintainer</span>: Joseph Lorimer &lt;joseph@lorimer.me&gt;</div>
<div><span style="font-weight: bold">Contributors</span>: %s</div>
<div><span style="font-weight: bold">Website</span>: <a href="%s">%s</a></div>
<div style="font-size: 12px">
    <br>Based on the Chinese Support add-on by Thomas TEMPÉ and many others.
    <br>If your name is missing from here, please open an issue on GitHub.
</div>
''' % (__version__, ', '.join(contributors), CSR_GITHUB_URL, CSR_GITHUB_URL)

    label.setText(text)
    label.setOpenExternalLinks(True)

    buttonBox = QDialogButtonBox(QDialogButtonBox.Ok)
    buttonBox.accepted.connect(dialog.accept)

    layout = QVBoxLayout()
    layout.addWidget(label)
    layout.addWidget(buttonBox)

    dialog.setLayout(layout)
    dialog.setWindowTitle('About')
    dialog.exec_() 
开发者ID:luoliyan,项目名称:chinese-support-redux,代码行数:40,代码来源:about.py

示例7: _update_ok_button

# 需要导入模块: from PyQt5.QtWidgets import QDialogButtonBox [as 别名]
# 或者: from PyQt5.QtWidgets.QDialogButtonBox import Ok [as 别名]
def _update_ok_button(self):
        self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(self.outputFile_box.text() != '') 
开发者ID:robbert-harms,项目名称:MDT,代码行数:4,代码来源:main.py

示例8: __init__

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

        self.all_cl_devices = CLEnvironmentFactory.smart_device_selection()
        self.user_selected_devices = mot.configuration.get_cl_environments()
        self.cldevicesSelection.itemSelectionChanged.connect(self.selection_updated)

        self.cldevicesSelection.insertItems(0, [str(cl_device) for cl_device in self.all_cl_devices])

        for ind, device in enumerate(self.all_cl_devices):
            self.cldevicesSelection.item(ind).setSelected(device in self.user_selected_devices
                                                          and device in self.all_cl_devices)

        self.buttonBox.button(QDialogButtonBox.Ok).clicked.connect(self._update_settings) 
开发者ID:robbert-harms,项目名称:MDT,代码行数:17,代码来源:qt_main.py

示例9: selection_updated

# 需要导入模块: from PyQt5.QtWidgets import QDialogButtonBox [as 别名]
# 或者: from PyQt5.QtWidgets.QDialogButtonBox import Ok [as 别名]
def selection_updated(self):
        self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(
            any(self.cldevicesSelection.item(ind).isSelected() for ind in range(self.cldevicesSelection.count()))) 
开发者ID:robbert-harms,项目名称:MDT,代码行数:5,代码来源:qt_main.py

示例10: _check_enable_ok_button

# 需要导入模块: from PyQt5.QtWidgets import QDialogButtonBox [as 别名]
# 或者: from PyQt5.QtWidgets.QDialogButtonBox import Ok [as 别名]
def _check_enable_ok_button(self):
        enabled = True
        if self.defaultOptimizer_False.isChecked():
            try:
                int(self.patience.text())
            except ValueError:
                enabled = False

        self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enabled) 
开发者ID:robbert-harms,项目名称:MDT,代码行数:11,代码来源:fit_model_tab.py

示例11: done

# 需要导入模块: from PyQt5.QtWidgets import QDialogButtonBox [as 别名]
# 或者: from PyQt5.QtWidgets.QDialogButtonBox import Ok [as 别名]
def done(self, result):
        if result == QDialog.Accepted:
            if len(self.fileinput.text()) == 0:
                QMessageBox.question(self, 'Error',"Please provide an output file.", QMessageBox.Ok)

                return
            
        super().done(result) 
开发者ID:ghostop14,项目名称:sparrow-wifi,代码行数:10,代码来源:sparrowdialogs.py

示例12: onShowInterfaces

# 需要导入模块: from PyQt5.QtWidgets import QDialogButtonBox [as 别名]
# 或者: from PyQt5.QtWidgets.QDialogButtonBox import Ok [as 别名]
def onShowInterfaces(self):
        validlist = ""
        for curInt in self.interfaces:
            if len(validlist) > 0:
                validlist += ', ' + curInt
            else:
                validlist = curInt

        if len(validlist) > 0:
            QMessageBox.question(self, 'Error',"Interfaces reported by the remote agent are:\n\n" + validlist, QMessageBox.Ok)
        else:
            QMessageBox.question(self, 'Error',"No wireless interfaces found.", QMessageBox.Ok) 
开发者ID:ghostop14,项目名称:sparrow-wifi,代码行数:14,代码来源:sparrowdialogs.py

示例13: onRefreshFiles

# 需要导入模块: from PyQt5.QtWidgets import QDialogButtonBox [as 别名]
# 或者: from PyQt5.QtWidgets.QDialogButtonBox import Ok [as 别名]
def onRefreshFiles(self):
        retVal, errmsg, filelist = getRemoteRecordingsFiles(self.remoteAgentIP, self.remoteAgentPort)
        
        if retVal != 0:
            QMessageBox.question(self, 'Error',"Could not list remote files: " + errmsg, QMessageBox.Ok)
            return
            
        self.populateTable(filelist) 
开发者ID:ghostop14,项目名称:sparrow-wifi,代码行数:10,代码来源:sparrowdialogs.py

示例14: onCopyFiles

# 需要导入模块: from PyQt5.QtWidgets import QDialogButtonBox [as 别名]
# 或者: from PyQt5.QtWidgets.QDialogButtonBox import Ok [as 别名]
def onCopyFiles(self):
        filenames = self.getSelectedFilenames()
        
        if len(filenames) == 0:
            return
        
        for curFile in filenames:
            retVal, errmsg = self.getRemoteFile(self.remoteAgentIP, self.remoteAgentPort, curFile)
            
            if retVal != 0:
                QMessageBox.question(self, 'Error',errmsg, QMessageBox.Ok)

        self.onRefreshFiles() 
开发者ID:ghostop14,项目名称:sparrow-wifi,代码行数:15,代码来源:sparrowdialogs.py

示例15: no_user_list

# 需要导入模块: from PyQt5.QtWidgets import QDialogButtonBox [as 别名]
# 或者: from PyQt5.QtWidgets.QDialogButtonBox import Ok [as 别名]
def no_user_list(self):
        text = 'There are no user lists available. To add a user, please add a user list'
        reply = message.warning(self, 'No User List', text, message.Ok)
        return reply == message.Ok 
开发者ID:MalloyDelacroix,项目名称:DownloaderForReddit,代码行数:6,代码来源:Messages.py


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