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


Python QMessageBox.show方法代码示例

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


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

示例1: show_survey

# 需要导入模块: from AnyQt.QtWidgets import QMessageBox [as 别名]
# 或者: from AnyQt.QtWidgets.QMessageBox import show [as 别名]
def show_survey():
    # If run for the first time, open a browser tab with a survey
    settings = QSettings()
    show_survey = settings.value("startup/show-survey", True, type=bool)
    if show_survey:
        question = QMessageBox(
            QMessageBox.Question,
            'Orange Survey',
            'We would like to know more about how our software is used.\n\n'
            'Would you care to fill our short 1-minute survey?',
            QMessageBox.Yes | QMessageBox.No)
        question.setDefaultButton(QMessageBox.Yes)
        later = question.addButton('Ask again later', QMessageBox.NoRole)
        question.setEscapeButton(later)

        def handle_response(result):
            if result == QMessageBox.Yes:
                success = QDesktopServices.openUrl(
                    QUrl("https://orange.biolab.si/survey/short.html"))
                settings.setValue("startup/show-survey", not success)
            else:
                settings.setValue("startup/show-survey", result != QMessageBox.No)

        question.finished.connect(handle_response)
        question.show()
        return question
开发者ID:astaric,项目名称:orange3,代码行数:28,代码来源:__main__.py

示例2: compare_versions

# 需要导入模块: from AnyQt.QtWidgets import QMessageBox [as 别名]
# 或者: from AnyQt.QtWidgets.QMessageBox import show [as 别名]
 def compare_versions(latest):
     version = pkg_resources.parse_version
     if version(latest) <= version(current):
         return
     question = QMessageBox(
         QMessageBox.Information,
         'Orange Update Available',
         'A newer version of Orange is available.<br><br>'
         '<b>Current version:</b> {}<br>'
         '<b>Latest version:</b> {}'.format(current, latest),
         textFormat=Qt.RichText)
     ok = question.addButton('Download Now', question.AcceptRole)
     question.setDefaultButton(ok)
     question.addButton('Remind Later', question.RejectRole)
     question.finished.connect(
         lambda:
         question.clickedButton() == ok and
         QDesktopServices.openUrl(QUrl("https://orange.biolab.si/download/")))
     question.show()
开发者ID:astaric,项目名称:orange3,代码行数:21,代码来源:__main__.py

示例3: main

# 需要导入模块: from AnyQt.QtWidgets import QMessageBox [as 别名]
# 或者: from AnyQt.QtWidgets.QMessageBox import show [as 别名]
def main(argv=None):
    if argv is None:
        argv = sys.argv

    usage = "usage: %prog [options] [workflow_file]"
    parser = optparse.OptionParser(usage=usage)

    parser.add_option("--no-discovery",
                      action="store_true",
                      help="Don't run widget discovery "
                           "(use full cache instead)")
    parser.add_option("--force-discovery",
                      action="store_true",
                      help="Force full widget discovery "
                           "(invalidate cache)")
    parser.add_option("--clear-widget-settings",
                      action="store_true",
                      help="Remove stored widget setting")
    parser.add_option("--no-welcome",
                      action="store_true",
                      help="Don't show welcome dialog.")
    parser.add_option("--no-splash",
                      action="store_true",
                      help="Don't show splash screen.")
    parser.add_option("-l", "--log-level",
                      help="Logging level (0, 1, 2, 3, 4)",
                      type="int", default=1)
    parser.add_option("--style",
                      help="QStyle to use",
                      type="str", default=None)
    parser.add_option("--stylesheet",
                      help="Application level CSS style sheet to use",
                      type="str", default="orange.qss")
    parser.add_option("--qt",
                      help="Additional arguments for QApplication",
                      type="str", default=None)

    (options, args) = parser.parse_args(argv[1:])

    levels = [logging.CRITICAL,
              logging.ERROR,
              logging.WARN,
              logging.INFO,
              logging.DEBUG]

    # Fix streams before configuring logging (otherwise it will store
    # and write to the old file descriptors)
    fix_win_pythonw_std_stream()

    # Try to fix fonts on OSX Mavericks
    fix_osx_10_9_private_font()

    # File handler should always be at least INFO level so we need
    # the application root level to be at least at INFO.
    root_level = min(levels[options.log_level], logging.INFO)
    rootlogger = logging.getLogger(canvas.__name__)
    rootlogger.setLevel(root_level)

    # Initialize SQL query and execution time logger (in SqlTable)
    sql_level = min(levels[options.log_level], logging.INFO)
    make_sql_logger(sql_level)

    # Standard output stream handler at the requested level
    stream_hander = logging.StreamHandler()
    stream_hander.setLevel(level=levels[options.log_level])
    rootlogger.addHandler(stream_hander)

    log.info("Starting 'Orange Canvas' application.")

    qt_argv = argv[:1]

    if options.style is not None:
        qt_argv += ["-style", options.style]

    if options.qt is not None:
        qt_argv += shlex.split(options.qt)

    qt_argv += args

    log.debug("Starting CanvasApplicaiton with argv = %r.", qt_argv)
    app = CanvasApplication(qt_argv)

    # NOTE: config.init() must be called after the QApplication constructor
    config.init()

    clear_settings_flag = os.path.join(
        config.widget_settings_dir(), "DELETE_ON_START")

    if options.clear_widget_settings or \
            os.path.isfile(clear_settings_flag):
        log.info("Clearing widget settings")
        shutil.rmtree(
            config.widget_settings_dir(),
            ignore_errors=True)

    file_handler = logging.FileHandler(
        filename=os.path.join(config.log_dir(), "canvas.log"),
        mode="w"
    )

#.........这里部分代码省略.........
开发者ID:rekonder,项目名称:orange3,代码行数:103,代码来源:__main__.py


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