示例#1
0
 def step_config_password_procede(self, ui):
     if ui.get_key() is not None and ui.get_key() == 'set_password':
         if self._change_pwd.get() == self._change_repwd.get():
             try:
                 self.change_pwd(self._change_pwd.get())
                 self._password = self._change_pwd.get()
                 msg = user_interface.Message(
                     resources.get_message('configurePasswordUpdated'))
                 msg.next_step(self.step_menu_main)
                 return msg
             except:
                 return user_interface.ErrorDialog(
                     resources.get_message('configureErrorConnection'))
         else:
             return user_interface.ErrorDialog(
                 resources.get_message('configurePasswordErrNoMatch'))
     elif ui.get_key() is not None and ui.get_key() == 'remove_password':
         if ui.get_variable().get() == 'yes':
             try:
                 self.change_pwd("")
                 self._password = ""
                 msg = user_interface.Message(
                     resources.get_message('configurePasswordUpdated'))
                 msg.next_step(self.step_menu_main)
                 return msg
             except:
                 return user_interface.ErrorDialog(
                     resources.get_message('configureErrorConnection'))
示例#2
0
 def step_check_install_code(self, ui):
     if ui.get_key() is not None and ui.get_key() == 'tryAgain':
         if ui.get_variable().get() == 'configureLater':
             return self.step_menu_main(ui)
         elif ui.get_variable().get() == 'configProxy':
             ui.set_key("installCode")
             return self.step_configure_proxy_type(ui)
         elif ui.get_variable().get() == 'reEnterCode':
             return self.step_menu_agent_install_key_selected(ui)
     msg = resources.get_message('checkInstallCode')
     self._uinterface.wait_message(msg)
     key = self._install_code.get()
     try:
         self.install_key(key)
         msg = user_interface.Message(
             resources.get_message('configureKeyInstalled'))
         msg.next_step(self.step_menu_main)
         return msg
     except Exception as e:
         s = str(e)
         if s == "INVALID_CODE":
             chs = user_interface.Chooser()
             chs.set_key("tryAgain")
             chs.set_message(resources.get_message('errorInvalidCode'))
             chs.add("reEnterCode", resources.get_message('reEnterCode'))
             chs.add("configureLater",
                     resources.get_message('configureLater'))
             chs.set_variable(user_interface.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 = user_interface.Chooser()
             chs.set_key("tryAgain")
             chs.set_message(
                 resources.get_message('errorConnectionQuestion'))
             chs.add("configProxy", resources.get_message('yes'))
             chs.add("noTryAgain", resources.get_message('noTryAgain'))
             chs.add("configureLater",
                     resources.get_message('configureLater'))
             chs.set_variable(user_interface.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 user_interface.ErrorDialog(
                 resources.get_message('configureErrorConnection'))
         else:
             return user_interface.ErrorDialog(s)
示例#3
0
 def step_check_password(self, ui):
     try:
         if ui.get_key() is not None and ui.get_key() == 'insert_password':
             self._password = self._ins_pwd.get()
         if not self.check_auth():
             if ui.get_key() is not None and ui.get_key(
             ) == 'insert_password':
                 return user_interface.ErrorDialog(
                     resources.get_message('configureInvalidPassword'))
             return self.step_password(ui)
         else:
             return self.step_menu_main(ui)
     except:
         return user_interface.ErrorDialog(
             resources.get_message('configureErrorConnection'))
示例#4
0
 def step_menu_agent(self, ui):
     try:
         self._install_code.set("")
         key = self.get_config("key")
         if key == "":
             return self.step_menu_agent_install_key_selected(ui)
         else:
             chs = user_interface.Chooser()
             chs.set_message(
                 resources.get_message('configureChooseOperation'))
             chs.add("configureChangeInstallKey",
                     resources.get_message('configureChangeInstallKey'))
             if self.is_agent_enable():
                 chs.add("configureDisableAgent",
                         resources.get_message('configureDisableAgent'))
             else:
                 chs.add("configureEnableAgent",
                         resources.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 user_interface.ErrorDialog(
             resources.get_message('configureErrorConnection'))
示例#5
0
 def step_menu_agent_remove_key_selected(self, ui):
     if ui.get_variable().get() == 'yes':
         try:
             self._uinterface.wait_message(
                 resources.get_message('configureUninstallationKey'), 0)
             self.uninstall_key()
         except:
             return user_interface.ErrorDialog(
                 resources.get_message('configureErrorConnection'))
         return self.step_menu_agent_install_key_selected(ui)
     else:
         return self.step_menu_agent(ui)
示例#6
0
 def step_menu_monitor_procede(self, ui):
     try:
         if ui.get_variable().get() == 'yes':
             self.set_config("monitor_tray_icon", "True")
         else:
             self.set_config("monitor_tray_icon", "False")
         msg = user_interface.Message(
             resources.get_message('configureTrayIconOK'))
         msg.next_step(self.step_menu_main)
         return msg
     except:
         return user_interface.ErrorDialog(
             resources.get_message('configureErrorConnection'))
示例#7
0
 def step_menu_agent_disable_procede(self, ui):
     if ui.get_variable().get() == 'yes':
         try:
             self.set_config("enabled", "False")
             msg = user_interface.Message(
                 resources.get_message('configureAgentDisabled'))
             msg.next_step(self.step_menu_main)
             return msg
         except:
             return user_interface.ErrorDialog(
                 resources.get_message('configureErrorConnection'))
     else:
         return self.step_menu_agent(ui)
示例#8
0
 def step_configure_proxy_set(self, ui):
     ar = ui.get_key().split('_')
     ui.set_key(ar[0])
     if len(ar) == 2 and ar[1] == 'tryAgain':
         if ui.get_variable() is not None and ui.get_variable().get(
         ) == 'configureLater':
             if ui.get_key() == "menuProxy":
                 return self.step_menu_main(ui)
             elif ui.get_key() == "installCode":
                 return self.step_menu_agent_install_key_selected(ui)
     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 user_interface.ErrorDialog(
                     resources.get_message("validInteger").format(
                         resources.get_message('proxyPort')))
         sret = self.invoke_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 = user_interface.Chooser()
         chs.set_key(ui.get_key() + "_tryAgain")
         chs.set_message(resources.get_message('errorConnectionConfig'))
         chs.add("noTryAgain", resources.get_message('noTryAgain'))
         chs.add("configureLater", resources.get_message('configureLater'))
         chs.set_variable(user_interface.VarString("noTryAgain"))
         if ui.get_key() == "menuProxy":
             chs.prev_step(self.step_menu_main)
         elif ui.get_key() == "installCode":
             chs.prev_step(self.step_menu_agent_install_key_selected)
         chs.next_step(self.step_configure_proxy_set)
         return chs
     if ui.get_key() == "menuProxy":
         msg = user_interface.Message(
             resources.get_message('configureProxyEnd'))
         msg.next_step(self.step_menu_main)
         return msg
     elif ui.get_key() == "installCode":
         return self.step_check_install_code(ui)
示例#9
0
 def step_menu_main(self, ui):
     try:
         self.read_proxy_info()
     except:
         return user_interface.ErrorDialog(
             resources.get_message('configureErrorConnection'))
     chs = user_interface.Chooser()
     chs.set_message(resources.get_message('configureChooseOperation'))
     chs.add("configureAgent", resources.get_message('configureAgent'))
     chs.add("configureProxy", resources.get_message('configureProxy'))
     #chs.add("configureMonitor", resources.get_message('configureMonitor'))
     chs.add("configurePassword",
             resources.get_message('configurePassword'))
     chs.add("configureExit", resources.get_message('configureExit'))
     chs.set_variable(self._main_menu_sel)
     chs.next_step(self.step_menu_main_selected)
     return chs
示例#10
0
 def step_menu_monitor_selected(self, ui):
     try:
         chs = user_interface.Chooser()
         chs.set_message(
             resources.get_message(
                 'configureChooseMonitorTrayIconVisibility'))
         chs.add("yes", resources.get_message('yes'))
         chs.add("no", resources.get_message('no'))
         if self.get_config("monitor_tray_icon") == "True":
             chs.set_variable(user_interface.VarString("yes"))
         else:
             chs.set_variable(user_interface.VarString("no"))
         chs.prev_step(self.step_menu_monitor)
         chs.next_step(self.step_menu_monitor_procede)
         return chs
     except:
         return user_interface.ErrorDialog(
             resources.get_message('configureErrorConnection'))