當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。