def step_config_monitor_password(self, curui): if curui.get_variable().get() == 'configureSetPassword': self._change_pwd = ui.VarString("", True) self._change_repwd = ui.VarString("", True) ipt = ui.Inputs() ipt.set_key("set_password") ipt.set_message(self._get_message('configurePassword')) ipt.add('password', self._get_message('password'), self._change_pwd, True) ipt.add('rePassword', self._get_message('rePassword'), self._change_repwd, True) ipt.prev_step(self.step_menu_monitor_password) ipt.next_step(self.step_config_monitor_password_procede) return ipt elif curui.get_variable().get() == 'configureRemovePassword': chs = ui.Chooser() chs.set_key("remove_password") chs.set_message( self._get_message('configureRemovePasswordQuestion')) chs.add("yes", self._get_message('yes')) chs.add("no", self._get_message('no')) chs.set_variable(ui.VarString("no")) chs.set_accept_key("yes") chs.prev_step(self.step_menu_monitor_password) chs.next_step(self.step_config_monitor_password_procede) return chs
def step_menu_monitor_desktop_notification(self, curui): try: chs = ui.Chooser() chs.set_message( self._get_message('configureDesktopNotification') + "\n\n" + self._get_message('warningSpyingTool')) chs.add("visible", self._get_message('desktopNotificationVisible')) chs.add("autohide", self._get_message('desktopNotificationAutoHide')) chs.add("none", self._get_message('desktopNotificationNone')) appv = self.get_config("monitor_desktop_notification") if appv == "autohide": chs.set_variable(ui.VarString("autohide")) elif appv == "none": chs.set_variable(ui.VarString("none")) else: chs.set_variable(ui.VarString("visible")) chs.prev_step(self.step_menu_monitor) chs.next_step(self.step_menu_monitor_desktop_notification_procede) return chs except: return ui.ErrorDialog( self._get_message('configureErrorConnection'))
def step_menu_monitor(self, curui): chs = ui.Chooser() chs.set_message(self._get_message('configureChooseOperation')) chs.add("configureTrayIconVisibility", self._get_message('configureTrayIconVisibility')) chs.set_variable(ui.VarString("configureTrayIconVisibility")) chs.prev_step(self.step_menu_main) chs.next_step(self.step_menu_monitor_selected) return chs
def step_check_install_code(self, curui): if curui.get_key() is not None and curui.get_key() == 'tryAgain': if curui.get_variable().get() == 'configureLater': return self.step_menu_main(curui) elif curui.get_variable().get() == 'configProxy': curui.set_key("installCode") return self.step_configure_proxy_type(curui) elif curui.get_variable().get() == 'reEnterCode': return self.step_menu_agent_install_key_selected(curui) msg = self._get_message('checkInstallCode') self._uinterface.wait_message(msg) key = self._install_code.get() try: self.install_key(key) msg = ui.Message(self._get_message('configureKeyInstalled')) msg.next_step(self.step_menu_main) return msg except Exception as e: s = str(e) if s == "INVALID_CODE": chs = ui.Chooser() chs.set_key("tryAgain") chs.set_message(self._get_message('errorInvalidCode')) chs.add("reEnterCode", self._get_message('reEnterCode')) chs.add("configureLater", self._get_message('configureLater')) chs.set_variable(ui.VarString("reEnterCode")) chs.prev_step(self.step_menu_agent_install_key_selected) chs.next_step(self.step_check_install_code) return chs elif s == "CONNECT_ERROR": chs = ui.Chooser() chs.set_key("tryAgain") chs.set_message(self._get_message('errorConnectionQuestion')) chs.add("configProxy", self._get_message('yes')) chs.add("noTryAgain", self._get_message('noTryAgain')) chs.add("configureLater", self._get_message('configureLater')) chs.set_variable(ui.VarString("noTryAgain")) chs.prev_step(self.step_menu_agent_install_key_selected) chs.next_step(self.step_check_install_code) return chs elif s == "REQUEST_TIMEOUT": return ui.ErrorDialog( self._get_message('configureErrorConnection')) else: return ui.ErrorDialog(s)
def step_menu_password(self, curui): chs = ui.Chooser() chs.set_message(self._get_message('configureChooseOperation')) chs.add("configureSetPassword", self._get_message('configureSetPassword')) chs.add("configureRemovePassword", self._get_message('configureRemovePassword')) chs.set_variable(self._password_menu_sel) chs.prev_step(self.step_menu_main) chs.next_step(self.step_config_password) return chs
def step_menu_agent_disable(self, curui): chs = ui.Chooser() chs.set_message(self._get_message('configureDisableAgentQuestion')) chs.add("yes", self._get_message('yes')) chs.add("no", self._get_message('no')) chs.set_variable(ui.VarString("no")) chs.set_accept_key("yes") chs.prev_step(self.step_menu_agent) chs.next_step(self.step_menu_agent_disable_procede) return chs
def step_menu_agent_install_key(self, curui): chs = ui.Chooser() chs.set_message(self._get_message('configureUninstallKeyQuestion')) chs.add("yes", self._get_message('yes')) chs.add("no", self._get_message('no')) chs.set_variable(ui.VarString("no")) chs.set_accept_key("yes") chs.prev_step(self.step_menu_agent) chs.next_step(self.step_menu_agent_remove_key_selected) return chs
def step_configure_proxy_set(self, curui): ar = curui.get_key().split('_') curui.set_key(ar[0]) if len(ar) == 2 and ar[1] == 'tryAgain': if curui.get_variable() is not None and curui.get_variable().get( ) == 'configureLater': if curui.get_key() == "menuProxy": return self.step_menu_main(curui) elif curui.get_key() == "installCode": return self.step_menu_agent_install_key_selected(curui) try: if self._proxy_type.get() == 'HTTP' or self._proxy_type.get( ) == 'SOCKS4' or self._proxy_type.get( ) == 'SOCKS4A' or self._proxy_type.get() == 'SOCKS5': try: int(self._proxy_port.get()) except: return ui.ErrorDialog( self._get_message("validInteger").format( self._get_message('proxyPort'))) sret = self.send_req( "set_proxy", { 'type': self._proxy_type.get(), 'host': self._proxy_host.get(), 'port': self._proxy_port.get(), 'user': self._proxy_user.get(), 'password': self._proxy_password.get() }) if sret != "OK": raise Exception(sret[6:]) except: chs = ui.Chooser() chs.set_key(curui.get_key() + "_tryAgain") chs.set_message(self._get_message('errorConnectionConfig')) chs.add("noTryAgain", self._get_message('noTryAgain')) chs.add("configureLater", self._get_message('configureLater')) chs.set_variable(ui.VarString("noTryAgain")) if curui.get_key() == "menuProxy": chs.prev_step(self.step_menu_main) elif curui.get_key() == "installCode": chs.prev_step(self.step_menu_agent_install_key_selected) chs.next_step(self.step_configure_proxy_set) return chs if curui.get_key() == "menuProxy": msg = ui.Message(self._get_message('configureProxyEnd')) msg.next_step(self.step_menu_main) return msg elif curui.get_key() == "installCode": return self.step_check_install_code(curui)
def step_menu_monitor_selected(self, ui): try: chs = ui.Chooser() chs.set_message(self._get_message('configureChooseMonitorTrayIconVisibility')) chs.add("yes", self._get_message('yes')) chs.add("no", self._get_message('no')) if self.get_config("monitor_tray_icon")=="True": chs.set_variable(ui.VarString("yes")) else: chs.set_variable(ui.VarString("no")) chs.prev_step(self.step_menu_monitor) chs.next_step(self.step_menu_monitor_procede) return chs except: return ui.ErrorDialog(self._get_message('configureErrorConnection'))
def step_menu_main(self, curui): try: self.read_proxy_info() except: return ui.ErrorDialog(self._get_message('configureErrorConnection')) chs = ui.Chooser() chs.set_message(self._get_message('configureChooseOperation')) chs.add("configureAgent", self._get_message('configureAgent')) chs.add("configureProxy", self._get_message('configureProxy')) #chs.add("configureMonitor", self._get_message('configureMonitor')) chs.add("configurePassword", self._get_message('configurePassword')) #chs.add("configureExit", self._get_message('configureExit')) chs.set_variable(self._main_menu_sel) chs.next_step(self.step_menu_main_selected) return chs
def step_configure_proxy_type(self, curui): chs = ui.Chooser() chs.set_key(curui.get_key()) chs.set_message(self._get_message('chooseProxyType')) chs.add("SYSTEM", self._get_message('proxySystem')) chs.add("HTTP", self._get_message('proxyHttp')) chs.add("SOCKS4", self._get_message('proxySocks4')) chs.add("SOCKS4A", self._get_message('proxySocks4a')) chs.add("SOCKS45", self._get_message('proxySocks5')) chs.add("NONE", self._get_message('proxyNone')) chs.set_variable(self._proxy_type) if curui.get_key()=="menuProxy": chs.prev_step(self.step_menu_main) elif curui.get_key()=="installCode": chs.prev_step(self.step_menu_agent_install_key_selected) chs.next_step(self.step_configure_proxy_info) return chs
def step_menu_agent(self, curui): try: self._install_code.set("") key = self.get_config("key") if key == "": return self.step_menu_agent_install_key_selected(curui) else: chs = ui.Chooser() chs.set_message(self._get_message('configureChooseOperation')) chs.add("configureChangeInstallKey", self._get_message('configureChangeInstallKey')) if self.is_agent_enable(): chs.add("configureDisableAgent", self._get_message('configureDisableAgent')) else: chs.add("configureEnableAgent", self._get_message('configureEnableAgent')) chs.set_variable(self._agent_menu_sel) chs.prev_step(self.step_menu_main) chs.next_step(self.step_menu_agent_selected) return chs except: return ui.ErrorDialog(self._get_message('configureErrorConnection'))