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 = vpnlaunchers.get_platform_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)
def __init__(self, eipconfig, providerconfig, socket_host, socket_port, qtsigs, openvpn_verb): """ :param eipconfig: eip configuration object :type eipconfig: EIPConfig :param providerconfig: provider specific configuration :type providerconfig: ProviderConfig :param socket_host: either socket path (unix) or socket IP :type socket_host: str :param socket_port: either string "unix" if it's a unix socket, or port otherwise :type socket_port: str :param qtsigs: a QObject containing the Qt signals used to notify the UI. :type qtsigs: QObject :param openvpn_verb: the desired level of verbosity in the openvpn invocation :type openvpn_verb: int """ VPNManager.__init__(self, qtsigs=qtsigs) leap_assert_type(eipconfig, EIPConfig) leap_assert_type(providerconfig, ProviderConfig) leap_assert_type(qtsigs, QtCore.QObject) #leap_assert(not self.isRunning(), "Starting process more than once!") self._eipconfig = eipconfig self._providerconfig = providerconfig self._socket_host = socket_host self._socket_port = socket_port self._launcher = get_platform_launcher() self._last_state = None self._last_status = None self._alive = False self._openvpn_verb = openvpn_verb