當前位置: 首頁>>代碼示例>>Python>>正文


Python LeapSettings.set_alert_missing_scripts方法代碼示例

本文整理匯總了Python中leap.bitmask.config.leapsettings.LeapSettings.set_alert_missing_scripts方法的典型用法代碼示例。如果您正苦於以下問題:Python LeapSettings.set_alert_missing_scripts方法的具體用法?Python LeapSettings.set_alert_missing_scripts怎麽用?Python LeapSettings.set_alert_missing_scripts使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在leap.bitmask.config.leapsettings.LeapSettings的用法示例。


在下文中一共展示了LeapSettings.set_alert_missing_scripts方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: check_missing

# 需要導入模塊: from leap.bitmask.config.leapsettings import LeapSettings [as 別名]
# 或者: from leap.bitmask.config.leapsettings.LeapSettings import set_alert_missing_scripts [as 別名]
def check_missing():
    """
    Check for the need of installing missing scripts, and
    raises a dialog to ask user for permission to do it.
    """
    config = LeapSettings()
    complain_missing = False
    alert_missing = config.get_alert_missing_scripts()

    if alert_missing and not flags.STANDALONE:
        # We refuse to install missing stuff if not running with standalone
        # flag. Right now we rely on the flag alone, but we can disable this
        # by overwriting some constant from within the debian package.
        alert_missing = False
        complain_missing = True

    launcher = get_vpn_launcher()
    missing_scripts = launcher.missing_updown_scripts
    missing_other = launcher.missing_other_files

    logger.debug("MISSING OTHER: %s" % (str(missing_other())))

    missing_some = missing_scripts() or missing_other()
    if alert_missing and missing_some:
        msg = get_missing_helpers_dialog()
        ret = msg.exec_()

        if ret == QtGui.QMessageBox.Yes:
            install_missing_fun = globals().get(
                "_%s_install_missing_scripts" % (_system.lower(),),
                None)
            if not install_missing_fun:
                logger.warning(
                    "Installer not found for platform %s." % (_system,))
                return

            # XXX maybe move constants to fun
            ok = install_missing_fun(HELPERS_BADEXEC_MSG, HELPERS_NOTFOUND_MSG)
            if not ok:
                msg = QtGui.QMessageBox()
                msg.setWindowTitle(msg.tr("Problem installing files"))
                msg.setText(msg.tr('Some of the files could not be copied.'))
                msg.setIcon(QtGui.QMessageBox.Warning)
                msg.exec_()

        elif ret == QtGui.QMessageBox.No:
            logger.debug("Not installing missing scripts, "
                         "user decided to ignore our warning.")
            init_signals.eip_missing_helpers.emit()

        elif ret == QtGui.QMessageBox.Rejected:
            logger.debug(
                "Setting alert_missing_scripts to False, we will not "
                "ask again")
            config.set_alert_missing_scripts(False)

    if complain_missing and missing_some:
        missing = missing_scripts() + missing_other()
        msg = _get_missing_complain_dialog(missing)
        ret = msg.exec_()
開發者ID:bwagnerr,項目名稱:bitmask_client,代碼行數:62,代碼來源:initializers.py

示例2: check_missing

# 需要導入模塊: from leap.bitmask.config.leapsettings import LeapSettings [as 別名]
# 或者: from leap.bitmask.config.leapsettings.LeapSettings import set_alert_missing_scripts [as 別名]
def check_missing():
    """
    Checks for the need of installing missing scripts, and
    raises a dialog to ask user for permission to do it.
    """
    config = LeapSettings()
    alert_missing = config.get_alert_missing_scripts()

    launcher = get_vpn_launcher()
    missing_scripts = launcher.missing_updown_scripts
    missing_other = launcher.missing_other_files

    if alert_missing and (missing_scripts() or missing_other()):
        msg = get_missing_updown_dialog()
        ret = msg.exec_()

        if ret == QtGui.QMessageBox.Yes:
            install_missing_fun = globals().get(
                "_%s_install_missing_scripts" % (_system.lower(),),
                None)
            if not install_missing_fun:
                logger.warning(
                    "Installer not found for platform %s." % (_system,))
                return

            # XXX maybe move constants to fun
            ok = install_missing_fun(UPDOWN_BADEXEC_MSG, UPDOWN_NOTFOUND_MSG)
            if not ok:
                msg = QtGui.QMessageBox()
                msg.setWindowTitle(msg.tr("Problem installing files"))
                msg.setText(msg.tr('Some of the files could not be copied.'))
                msg.setIcon(QtGui.QMessageBox.Warning)
                msg.exec_()

        elif ret == QtGui.QMessageBox.No:
            logger.debug("Not installing missing scripts, "
                         "user decided to ignore our warning.")

        elif ret == QtGui.QMessageBox.Rejected:
            logger.debug(
                "Setting alert_missing_scripts to False, we will not "
                "ask again")
            config.set_alert_missing_scripts(False)
開發者ID:abhikandoi2000,項目名稱:bitmask_client,代碼行數:45,代碼來源:initializers.py


注:本文中的leap.bitmask.config.leapsettings.LeapSettings.set_alert_missing_scripts方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。