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


Python QMessageBox.warning方法代码示例

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


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

示例1: connect

# 需要导入模块: from PyQt4.QtGui import QMessageBox [as 别名]
# 或者: from PyQt4.QtGui.QMessageBox import warning [as 别名]
def connect(self):
        userName = str(self.userName.text()).strip()
        password = str(self.password.toPlainText()).strip()
        if len(userName) <= 0 or len(password) <= 0:
            QMessageBox.warning(self, u'获取策略', u'输入用户名和密码')
        else:
            strategyList = self.gateway.getStrategyList(userName, password)
            if strategyList is not None and len(strategyList) > 0:
                self.comboStrategy.clear()
                strategyList_sl = []
                for strategy in strategyList:
                    strategyList_sl.append(str(strategy))
                strategyList_sl.sort()
                self.comboStrategy.addItems(strategyList_sl)
                self.userName.setEnabled(False)
                self.password.setEnabled(False)

            else:
                QMessageBox.warning(self, u'获取策略', u'无法获取相关策略')
                self.comboStrategy.clear()
            
            self.comboStrategy.setFocus() 
开发者ID:quantOS-org,项目名称:TradeSim,代码行数:24,代码来源:quantosLoginWidget.py

示例2: show_update_warning

# 需要导入模块: from PyQt4.QtGui import QMessageBox [as 别名]
# 或者: from PyQt4.QtGui.QMessageBox import warning [as 别名]
def show_update_warning():
    """
    Show a graphical warning reminding the user to check for security updates
    using the preflight updater.
    """
    app = QtGui.QApplication([])  # noqa: F841

    QMessageBox.warning(
        None,
        "Security check recommended",
        "This computer has not been checked for security updates recently. "
        "We recommend that you launch or restart the SecureDrop app to "
        "check for security updates.",
        QMessageBox.Ok,
        QMessageBox.Ok,
    ) 
开发者ID:freedomofpress,项目名称:securedrop-workstation,代码行数:18,代码来源:sdw-notify.py

示例3: login

# 需要导入模块: from PyQt4.QtGui import QMessageBox [as 别名]
# 或者: from PyQt4.QtGui.QMessageBox import warning [as 别名]
def login(self):
        selectedStrat = self.comboStrategy.currentText()
        if selectedStrat is not None and len(selectedStrat) > 0:
            username = str(self.userName.text()).strip()
            password = str(self.password.toPlainText()).strip()
            if len(username) <= 0 or len(password) <= 0:
                QMessageBox.warning(self, u'登录', u'输入用户名和密码')
            else:
                self.close()
                self.gateway.login(username, password, selectedStrat)
        else:
            self.connect() 
开发者ID:quantOS-org,项目名称:TradeSim,代码行数:14,代码来源:quantosLoginWidget.py

示例4: accept

# 需要导入模块: from PyQt4.QtGui import QMessageBox [as 别名]
# 或者: from PyQt4.QtGui.QMessageBox import warning [as 别名]
def accept(self):
        user = self.ui.userTX.text().strip()
        apiKey = self.ui.apiKeyTX.text().strip()
        multiuser = self.ui.multiuserCH.isChecked()

        if any([user == '', apiKey == '']):
            QMessageBox.warning(self, QApplication.translate('CartoDBPlugin', 'Save connection'),
                                QApplication.translate('CartoDBPlugin', 'Both User and Api Key must be provided'))
            return

        if user is not None:
            key = '/CartoDBPlugin/%s' % user
            keyapi = '%s/api' % key
            keymultiuser = '%s/multiuser' % key
            key_orig = '/CartoDBPlugin/%s' % self.user_orig
            # warn if entry was renamed to an existing connection
            if all([self.user_orig != user,
                    self.settings.contains(keyapi)]):
                res = QMessageBox.warning(self, QApplication.translate('CartoDBPlugin', 'Save connection'),
                                          QApplication.translate('CartoDBPlugin', 'Overwrite {}?').format(user),
                                          QMessageBox.Ok | QMessageBox.Cancel)
                if res == QMessageBox.Cancel:
                    return

            # on rename delete original entry first
            if all([self.user_orig is not None, self.user_orig != user]):
                self.settings.remove(key_orig)

            self.settings.setValue(keyapi, apiKey)
            self.settings.setValue(keymultiuser, multiuser)
            self.settings.setValue('/CartoDBPlugin/selected', user)

            QDialog.accept(self) 
开发者ID:gkudos,项目名称:qgis-cartodb,代码行数:35,代码来源:NewConnection.py

示例5: error

# 需要导入模块: from PyQt4.QtGui import QMessageBox [as 别名]
# 或者: from PyQt4.QtGui.QMessageBox import warning [as 别名]
def error(self):
        QMessageBox.warning(self, QApplication.translate('CartoDBPlugin', 'Error'),
                            QApplication.translate('CartoDBPlugin', 'Error loading data from CartoDB')) 
开发者ID:gkudos,项目名称:qgis-cartodb,代码行数:5,代码来源:Main.py

示例6: save

# 需要导入模块: from PyQt4.QtGui import QMessageBox [as 别名]
# 或者: from PyQt4.QtGui.QMessageBox import warning [as 别名]
def save(self, fileName, pretty=True, showDialog=False):
		"""
		Saves the xml document to the given file, converting it to a 
		pretty XML document if so desired.
		
		:param fileName: path to the save location
		:param pretty: if set to True, will format spaces and line breaks.
		:param showDialog: if set to True, if an error occurs while saving,
		                   a dialog will be displayed showing the errors.
		:type fileName: str
		:type pretty: bool
		:type showDialog: bool

		"""
		if (os.path.exists(os.path.split(fileName)[0])):
			self.__file__ = fileName
			try:
				if (pretty):
					text = self.formatXml(self.toxml())
				else:
					text = self.toxml(encoding=None)
			except:
				print 'Encoding error while saving XML'
				if showDialog:
					from PyQt4.QtGui	import QMessageBox
					QMessageBox.critical(None, 'Encoding Error', 'Unable to save xml data, please check for unsupported characters.')
				return False
			f = open(fileName, 'w')
			f.write(text)
			f.close()
			return True
		if showDialog:
			from PyQt4.QtGui	import QMessageBox
			QMessageBox.warning(None, 'Unable to Save', 'Unable to save xml data, please verify you have the correct privileges.')
		return False 
开发者ID:blurstudio,项目名称:cross3d,代码行数:37,代码来源:xmldocument.py

示例7: compare_config_version

# 需要导入模块: from PyQt4.QtGui import QMessageBox [as 别名]
# 或者: from PyQt4.QtGui.QMessageBox import warning [as 别名]
def compare_config_version(self, path=None):
        """
        Method to check the version of the two files being copied and return the latest one
        :param newfile: QFile
        :return: QFile
        """
        if not path:
            path = self.userPath
        else:
            path = path
        base_file = self.baseSQLPath()
        user_file = path + '/%s' % DEFAULT_CONFIG
        if os.path.isfile(user_file):
            if QMessageBox.warning(None, QApplication.translate("FilePaths",
                                                                "Previous user configuration found"),
                                   QApplication.translate("FilePaths",
                                                          "Wizard detected previous configuration exists in the current directory."
                                                          "\nDo you want to overwrite the existing config?"),
                                   QMessageBox.Yes | QMessageBox.No) == QMessageBox.Yes:
                if filecmp.cmp(base_file, user_file, shallow=False):
                    pass
                else:
                    try:
                        os.remove(user_file)
                        shutil.copy(base_file, self.userPath)
                    except:
                        pass
            else:
                QMessageBox.information(None,
                                        QApplication.translate("FilePaths",
                                                               "Configuration Exist"),
                                        QApplication.translate("FilePaths",
                                                               "Previous configuration retained"))
        else:
            shutil.copy(base_file, user_file)
        self.createBackup() 
开发者ID:gltn,项目名称:stdm,代码行数:38,代码来源:configfile_paths.py

示例8: main

# 需要导入模块: from PyQt4.QtGui import QMessageBox [as 别名]
# 或者: from PyQt4.QtGui.QMessageBox import warning [as 别名]
def main():
    """
    Show security warning, if and only if a warning is not already displayed,
    the preflight updater is running, and certain checks suggest that the
    system has not been updated for a specified period
    """

    Util.configure_logging(Notify.LOG_FILE)

    if Util.is_conflicting_process_running(Notify.CONFLICTING_PROCESSES):
        # Conflicting system process may be running in dom0. Logged.
        sys.exit(1)

    if Util.can_obtain_lock(Updater.LOCK_FILE) is False:
        # Preflight updater is already running. Logged.
        sys.exit(1)

    # Hold on to lock handle during execution
    lock_handle = Util.obtain_lock(Notify.LOCK_FILE)
    if lock_handle is None:
        # Can't write to lockfile or notifier already running. Logged.
        sys.exit(1)

    warning_should_be_shown = Notify.is_update_check_necessary()
    if warning_should_be_shown is None:
        # Data integrity issue with update timestamp. Logged.
        sys.exit(1)
    elif warning_should_be_shown is True:
        show_update_warning() 
开发者ID:freedomofpress,项目名称:securedrop-workstation,代码行数:31,代码来源:sdw-notify.py


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