Exemplo n.º 1
0
 def step_config_password(self, ui):
     if ui.get_variable().get() == 'configureSetPassword':
         self._change_pwd = user_interface.VarString("", True)
         self._change_repwd = user_interface.VarString("", True)
         ipt = user_interface.Inputs()
         ipt.set_key("set_password")
         ipt.set_message(resources.get_message('configurePassword'))
         ipt.add('password', resources.get_message('password'),
                 self._change_pwd, True)
         ipt.add('rePassword', resources.get_message('rePassword'),
                 self._change_repwd, True)
         ipt.prev_step(self.step_menu_password)
         ipt.next_step(self.step_config_password_procede)
         return ipt
     elif ui.get_variable().get() == 'configureRemovePassword':
         chs = user_interface.Chooser()
         chs.set_key("remove_password")
         chs.set_message(
             resources.get_message('configureRemovePasswordQuestion'))
         chs.add("yes", resources.get_message('yes'))
         chs.add("no", resources.get_message('no'))
         chs.set_variable(user_interface.VarString("no"))
         chs.set_accept_key("yes")
         chs.prev_step(self.step_menu_password)
         chs.next_step(self.step_config_password_procede)
         return chs
Exemplo n.º 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)
Exemplo n.º 3
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'))
Exemplo n.º 4
0
 def step_password(self, ui):
     self._ins_pwd = user_interface.VarString("", True)
     ipt = user_interface.Inputs()
     ipt.set_key("insert_password")
     ipt.set_message(resources.get_message('configureInsertPassword'))
     ipt.add('password', resources.get_message('password'), self._ins_pwd,
             True)
     ipt.next_step(self.step_check_password)
     return ipt
Exemplo n.º 5
0
 def step_menu_monitor(self, ui):
     chs = user_interface.Chooser()
     chs.set_message(resources.get_message('configureChooseOperation'))
     chs.add("configureTrayIconVisibility",
             resources.get_message('configureTrayIconVisibility'))
     chs.set_variable(
         user_interface.VarString("configureTrayIconVisibility"))
     chs.prev_step(self.step_menu_main)
     chs.next_step(self.step_menu_monitor_selected)
     return chs
Exemplo n.º 6
0
 def step_menu_agent_disable(self, ui):
     chs = user_interface.Chooser()
     chs.set_message(resources.get_message('configureDisableAgentQuestion'))
     chs.add("yes", resources.get_message('yes'))
     chs.add("no", resources.get_message('no'))
     chs.set_variable(user_interface.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
Exemplo n.º 7
0
 def step_menu_agent_install_key(self, ui):
     chs = user_interface.Chooser()
     chs.set_message(resources.get_message('configureUninstallKeyQuestion'))
     chs.add("yes", resources.get_message('yes'))
     chs.add("no", resources.get_message('no'))
     chs.set_variable(user_interface.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
Exemplo n.º 8
0
 def __init__(self):
     #self._config_port = 7950
     #self._path_config='config.json'
     self._prop = None
     self._install_code = user_interface.VarString()
     self._proxy_type = user_interface.VarString("SYSTEM")
     self._proxy_host = user_interface.VarString("")
     self._proxy_port = user_interface.VarString("")
     self._proxy_user = user_interface.VarString("")
     self._proxy_password = user_interface.VarString("", True)
     self._password = ""
     self._main_menu_sel = user_interface.VarString("configureExit")
     self._agent_menu_sel = user_interface.VarString(
         "configureChangeInstallKey")
     self._password_menu_sel = user_interface.VarString(
         "configureSetPassword")
Exemplo n.º 9
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)