Ejemplo n.º 1
0
    def _enable_disable_action_pwd(self, e):
        pwd = ""
        for c in e["window"].get_components():
            if c.get_name() == "txtPassword":
                pwd = c.get_text()

        e["window"].destroy()
        val = "false"
        mess_ok = 'monitorAgentDisabled'
        if self._cur_status == "DISABLE":
            val = "true"
            mess_ok = 'monitorAgentEnabled'
        if self.check_auth(pwd):
            self.set_config(pwd, "enabled", val)
            dlg = gdi.DialogMessage(gdi.DIALOGMESSAGE_ACTIONS_OK,
                                    gdi.DIALOGMESSAGE_LEVEL_INFO, self._app)
            dlg.set_title(self._get_message('monitorTitle'))
            dlg.set_message(self._get_message(mess_ok))
            dlg.show()
        else:
            dlg = gdi.DialogMessage(gdi.DIALOGMESSAGE_ACTIONS_OK,
                                    gdi.DIALOGMESSAGE_LEVEL_ERROR, self._app)
            dlg.set_title(self._get_message('monitorTitle'))
            dlg.set_message(self._get_message('monitorInvalidPassword'))
            dlg.show()
Ejemplo n.º 2
0
 def _enable_disable_action(self, e):
     if e["action"] == "DIALOG_YES":
         try:
             val = "false"
             mess_ok = 'monitorAgentDisabled'
             if self._cur_status == "DISABLE":
                 val = "true"
                 mess_ok = 'monitorAgentEnabled'
             pwd = ""
             if self.check_auth(pwd):
                 self.set_config(pwd, "enabled", val)
                 dlg = gdi.DialogMessage(gdi.DIALOGMESSAGE_ACTIONS_OK,
                                         gdi.DIALOGMESSAGE_LEVEL_INFO,
                                         self._app)
                 dlg.set_title(self._get_message('monitorTitle'))
                 dlg.set_message(self._get_message(mess_ok))
                 dlg.show()
             else:
                 #RICHIEDE PASSWORD
                 dlg = gdi.Window(gdi.WINDOW_TYPE_DIALOG, self._app)
                 dlg.set_title(self._get_message('monitorTitle'))
                 dlg.set_size(220, 140)
                 dlg.set_show_position(gdi.WINDOW_POSITION_CENTER_SCREEN)
                 lbl = gdi.Label()
                 lbl.set_text(self._get_message('monitorEnterPassword'))
                 lbl.set_position(10, 10)
                 lbl.set_width(200)
                 dlg.add_component(lbl)
                 txt = gdi.TextBox()
                 txt.set_name("txtPassword")
                 txt.set_password_mask(True)
                 txt.set_position(10, 10 + lbl.get_height())
                 txt.set_width(200)
                 dlg.add_component(txt)
                 pnlBottomH = 55
                 pnl = gdi.Panel()
                 pnl.set_position(0, dlg.get_height() - pnlBottomH)
                 pnl.set_size(dlg.get_width(), pnlBottomH)
                 dlg.add_component(pnl)
                 bt = gdi.Button()
                 bt.set_position(
                     int((dlg.get_width() / 2) - (bt.get_width() / 2)), 10)
                 bt.set_text(self._get_message('ok'))
                 bt.set_action(self._enable_disable_action_pwd)
                 pnl.add_component(bt)
                 dlg.show()
         except Exception as e:
             dlg = gdi.DialogMessage(gdi.DIALOGMESSAGE_ACTIONS_OK,
                                     gdi.DIALOGMESSAGE_LEVEL_ERROR,
                                     self._app)
             dlg.set_title(self._get_message('monitorTitle'))
             dlg.set_message(str(e))
             dlg.show()
Ejemplo n.º 3
0
 def unistall(self, e):
     if e["action"] == "PERFORMED":
         if is_windows():
             subprocess.call(
                 ["native" + utils.path_sep + "dwaglnc.exe", "uninstall"])
         elif is_linux():
             sucmd = None
             if self._which("gksu"):
                 sucmd = "gksu"
             elif self._which("kdesu"):
                 sucmd = "kdesu"
             if sucmd is not None:
                 osenv = os.environ
                 libenv = {}
                 for k in osenv:
                     if k != "LD_LIBRARY_PATH":
                         libenv[k] = osenv[k]
                 subprocess.Popen([
                     sucmd,
                     utils.path_absname("native" + utils.path_sep +
                                        "uninstall")
                 ],
                                  env=libenv)
             else:
                 dlg = gdi.DialogMessage(gdi.DIALOGMESSAGE_ACTIONS_OK,
                                         gdi.DIALOGMESSAGE_LEVEL_ERROR,
                                         self._app)
                 dlg.set_title(self._get_message('monitorTitle'))
                 dlg.set_message(
                     self._get_message('monitorUninstallNotRun'))
                 dlg.show()
         elif is_mac():
             self._runproc(
                 ["open", "-a",
                  os.path.abspath("native/Uninstall.app")])
Ejemplo n.º 4
0
def _test_other_window(e):
    prnt=None
    if "window" in e:
        prnt=e["window"]
    wwn = gdi.DialogMessage(gdi.DIALOGMESSAGE_ACTIONS_YESNO,gdi.DIALOGMESSAGE_LEVEL_WARN,prnt) 
    wwn.set_title("Title MsgBox")
    wwn.set_message(u"Test Message.\nThis is a test message. How are you?. " + str(e["action"]))
    wwn.show()
Ejemplo n.º 5
0
Archivo: ui.py Proyecto: landv/agent
 def _guimode_close(self, e):
     if self._cur_step_ui is None or (self._cur_step_ui.is_next_enabled() or self._cur_step_ui.is_back_enabled()) :
         dlgerr = gdi.DialogMessage(gdi.DIALOGMESSAGE_ACTIONS_YESNO,gdi.DIALOGMESSAGE_LEVEL_INFO,parentwin=self._app, logopath=self._logo)
         dlgerr.set_title(self._title)
         dlgerr.set_message(messages.get_message('confirmExit'))
         dlgerr.set_action(self._guimode_close_action)
         dlgerr.show();
     else:
         self.close()
Ejemplo n.º 6
0
 def enable_disable(self, e):
     msg=self._get_message('monitorDisableAgentQuestion')
     if self._cur_status=="DISABLE":
         msg=self._get_message('monitorEnableAgentQuestion')
     
     dlg = gdi.DialogMessage(gdi.DIALOGMESSAGE_ACTIONS_YESNO,gdi.DIALOGMESSAGE_LEVEL_INFO,self._app)
     dlg.set_title(self._get_message('monitorTitle'))
     dlg.set_message(msg)
     dlg.set_action(self._enable_disable_action)
     dlg.show();
Ejemplo n.º 7
0
def _test_popup_menu(e):
    if e["action"] == u"PERFORMED":
        prnt = None
        if "window" in e:
            prnt = e["window"]
        wwn = gdi.DialogMessage(gdi.DIALOGMESSAGE_ACTIONS_YESNO,
                                gdi.DIALOGMESSAGE_LEVEL_WARN, prnt)
        wwn.set_title("Title MsgBox")
        wwn.set_message(u"NAME:" + str(e["name"]))
        wwn.show()
Ejemplo n.º 8
0
Archivo: ui.py Proyecto: landv/agent
 def _show_error(self,  msg):
     if self._gui_enable is True:
         dlgerr = gdi.DialogMessage(gdi.DIALOGMESSAGE_ACTIONS_OK,gdi.DIALOGMESSAGE_LEVEL_ERROR,parentwin=self._app, logopath=self._logo)
         dlgerr.set_title(self._title)
         dlgerr.set_message(msg)
         dlgerr.set_action(self._show_error_gui_ok)
         dlgerr.show();
     else:
         self._printcl(u"")
         self._printcl(messages.get_message('error') + u": " + msg)
         if self._raw_input(messages.get_message('pressEnter')) is not None:
             self._prepare_step(self._cur_step_ui)
Ejemplo n.º 9
0
 def _show_error(self, msg):
     if self._gui_enable is True:
         dlgerr = gdi.DialogMessage(gdi.DIALOGMESSAGE_ACTIONS_OK,
                                    gdi.DIALOGMESSAGE_LEVEL_ERROR,
                                    self._app)
         dlgerr.set_title(self._title)
         dlgerr.set_message(msg)
         dlgerr.set_action(self._show_error_gui_ok)
         dlgerr.show()
     else:
         print("")
         print(resources.get_message('error') + ": " + msg)
         try:
             raw_input(resources.get_message('pressEnter'))
             self._prepare_step(self._cur_step_ui)
         except:
             None
Ejemplo n.º 10
0
 def unistall(self, e):
     if is_windows():
         subprocess.call(["native" + utils.path_sep + "dwaglnc.exe" , "uninstall"]) 
     elif is_linux():
         sucmd=None
         if self._which("gksu"):
             sucmd="gksu"
         elif self._which("kdesu"):
             sucmd="kdesu"
         if sucmd is not None:
             subprocess.Popen([sucmd , utils.path_absname("native" + utils.path_sep + "uninstall")])
         else:
             dlg = gdi.DialogMessage(gdi.DIALOGMESSAGE_ACTIONS_OK,gdi.DIALOGMESSAGE_LEVEL_ERROR,self._app)
             dlg.set_title(self._get_message('monitorTitle'))
             dlg.set_message(self._get_message('monitorUninstallNotRun'))
             dlg.show();
     elif is_mac():
         subprocess.Popen(["native/Uninstall.app/Contents/MacOS/Uninstall"])