Example #1
0
    def _guimode_start(self):
        self._app = gdi.Window(gdi.WINDOW_TYPE_NORMAL_NOT_RESIZABLE)
        self._app.set_title(U"DWAgent")
        self._app.set_size(_WIDTH, _HEIGHT)
        self._app.set_show_position(gdi.WINDOW_POSITION_CENTER_SCREEN)
        self._app.set_action(self._guimode_action)

        pnl_left = gdi.Panel()
        pnl_left.set_position(0, 0)
        pnl_left.set_size(_WIDTH_LEFT, _HEIGHT)
        pnl_left.set_background_gradient("83e5ff", "FFFFFF",
                                         gdi.GRADIENT_DIRECTION_LEFTRIGHT)
        self._app.add_component(pnl_left)

        pnl_bottom = gdi.Panel()
        pnl_bottom.set_position(0, _CONTENT_HEIGHT)
        pnl_bottom.set_size(_WIDTH, _HEIGHT_BOTTOM)
        self._app.add_component(pnl_bottom)

        wbtn = 140
        hbtn = 36

        self._btback = gdi.Button()
        self._btback.set_position(10, 10)
        self._btback.set_size(wbtn, hbtn)
        self._btback.set_text(resources.get_message('back'))
        self._btback.set_enable(False)
        self._btback.set_action(self._guimode_back)
        pnl_bottom.add_component(self._btback)

        self._btnext = gdi.Button()
        self._btnext.set_position(10 + wbtn + 5, 10)
        self._btnext.set_size(wbtn, hbtn)
        self._btnext.set_text(resources.get_message('next'))
        self._btnext.set_enable(False)
        self._btnext.set_action(self._guimode_next)
        pnl_bottom.add_component(self._btnext)

        self._btclose = gdi.Button()
        self._btclose.set_position(_WIDTH - wbtn - 10, 10)
        self._btclose.set_size(wbtn, hbtn)
        self._btclose.set_text(resources.get_message('close'))
        self._btclose.set_enable(False)
        self._btclose.set_action(self._guimode_close)
        pnl_bottom.add_component(self._btclose)

        self._pnlmain = None
        self._cur_step_ui = None
        self._step_init_run = False

        gdi.add_scheduler(0.1, self._guimode_step_init_start)

        #self._queue = Queue()
        #gdi.add_scheduler(0.1, self._guimode_update)

        gdi.loop(self._app, True)
Example #2
0
    def __init__(self, prt):
        self._parent = prt
        self._list = [u"screencapture", u"shell", u"transfers"]
        self._sessions = False
        self._cmps = {}
        self._visible_cmps = {}
        self._screen_w = 0
        self._screen_h = 0
        self._dlg_w = 25
        self._dlg = gdi.Window(gdi.WINDOW_TYPE_POPUP)
        self._dlg.set_background("ffaa33")
        self._pnl = gdi.Panel()
        self._pnl.set_position(1, 1)
        self._pnl.set_size(self._dlg_w, 24)
        self._pnl.set_background("313536")
        self._dlg.add_component(self._pnl)
        implogo = gdi.ImagePanel()
        implogo.set_position(4, 4)
        implogo.set_filename(images.get_image(u"logo16x16.bmp"))
        self._pnl.add_component(implogo)

        for k in self._list:
            self._visible_cmps[k] = False
            self._cmps[k] = gdi.ImagePanel()
            self._cmps[k].set_filename(
                images.get_image(u"activities_" + k + u".bmp"))
            self._dlg.add_component(self._cmps[k])

        self._sessions_last_update = self._sessions
        self._visible_cmps_last_update = self._visible_cmps.copy()
        self._dlg.set_action(self.on_action)
Example #3
0
File: ui.py Project: landv/agent
 def _prepare_main_panel(self):
     if self._gui_enable is True:
         if (self._pnlmain is not None):
             self._pnlmain.remove_all_components()
         else:
             self._pnlmain = gdi.Panel();
             self._pnlmain.set_background("ffffff")
             self._pnlmain.set_position(_WIDTH_LEFT, self._top_height)
             self._pnlmain.set_size(_CONTENT_WIDTH,_CONTENT_HEIGHT)
             self._app.add_component(self._pnlmain)
Example #4
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()
Example #5
0
    def prepare_window(self):
        self._cur_status = "NOSERVICE"
        self._cur_connections = 0
        #msgst=self._get_message('monitorStatusNoService')

        self._app = gdi.Window(gdi.WINDOW_TYPE_NORMAL_NOT_RESIZABLE, None,
                               self._logo)
        self._app.set_title(self._get_message('monitorTitle'))
        self._app.set_size(_WIDTH, _HEIGHT)
        self._app.set_show_position(gdi.WINDOW_POSITION_CENTER_SCREEN)
        self._app.set_action(self._window_action)

        self._img_status_top = gdi.Panel()
        self._img_status_top.set_position(0, 0)
        self._img_status_top.set_size(_CONTENT_WIDTH, _HEIGHT_STATUS)
        self._img_status_top.set_background_gradient(
            "ffffff", "ffffff", gdi.GRADIENT_DIRECTION_TOPBOTTOM)
        self._app.add_component(self._img_status_top)

        self._img_status_bottom = gdi.Panel()
        self._img_status_bottom.set_position(0, _HEIGHT - _HEIGHT_STATUS)
        self._img_status_bottom.set_size(_CONTENT_WIDTH, _HEIGHT_STATUS)
        self._img_status_bottom.set_background_gradient(
            "ffffff", "ffffff", gdi.GRADIENT_DIRECTION_BOTTONTOP)
        self._app.add_component(self._img_status_bottom)

        self._lbl_status = gdi.Label()
        self._lbl_status.set_text_align(gdi.TEXT_ALIGN_CENTERMIDDLE)
        self._lbl_status.set_text(self._get_message('waiting'))
        self._lbl_status.set_position(0, _HEIGHT_STATUS)
        self._lbl_status.set_size(_CONTENT_WIDTH,
                                  _HEIGHT - (2 * _HEIGHT_STATUS))
        self._app.add_component(self._lbl_status)

        self._pnl_bottom = gdi.Panel()
        self._pnl_bottom.set_position(_CONTENT_WIDTH, 0)
        self._pnl_bottom.set_size(_WIDTH_RIGHT, _HEIGHT)
        self._app.add_component(self._pnl_bottom)

        wbtn = _WIDTH_RIGHT - 20
        hbtn = 36
        appy = 10

        self._btends = gdi.Button()
        self._btends.set_position(10, appy)
        self._btends.set_size(wbtn, hbtn)
        self._btends.set_text(self._get_message('monitorDisable'))
        self._btends.set_action(self.enable_disable)
        self._btends.set_enable(False)
        self._pnl_bottom.add_component(self._btends)
        appy += hbtn + 6

        self._btconfig = gdi.Button()
        self._btconfig.set_position(10, appy)
        self._btconfig.set_size(wbtn, hbtn)
        self._btconfig.set_text(self._get_message('monitorConfigure'))
        self._btconfig.set_action(self.configure)
        self._btconfig.set_enable(False)
        self._pnl_bottom.add_component(self._btconfig)
        appy += hbtn + 6

        self._btunistall = gdi.Button()
        self._btunistall.set_position(10, appy)
        self._btunistall.set_size(wbtn, hbtn)
        self._btunistall.set_text(self._get_message('monitorUninstall'))
        self._btunistall.set_action(self.unistall)
        self._pnl_bottom.add_component(self._btunistall)
        appy += hbtn + 6
Example #6
0
    def prepare_window(self):
        self._cur_status = "NOSERVICE"
        self._cur_activities = None
        #msgst=self._get_message('monitorStatusNoService')

        self._app = gdi.Window(gdi.WINDOW_TYPE_NORMAL_NOT_RESIZABLE, None,
                               self._logo)
        self._app.set_title(self._get_message('monitorTitle'))
        self._app.set_size(_WIDTH, _HEIGHT)
        self._app.set_show_position(gdi.WINDOW_POSITION_CENTER_SCREEN)
        self._app.set_action(self._window_action)

        self._img_status_top = gdi.Panel()
        self._img_status_top.set_position(0, 0)
        self._img_status_top.set_size(_CONTENT_WIDTH, _HEIGHT_STATUS_BAR)
        self._img_status_top.set_background_gradient(
            "ffffff", "ffffff", gdi.GRADIENT_DIRECTION_TOPBOTTOM)
        self._app.add_component(self._img_status_top)

        self._lbl_status = gdi.Label()
        self._lbl_status.set_background("ffffff")
        self._lbl_status.set_opaque(True)
        self._lbl_status.set_text_align(gdi.TEXT_ALIGN_CENTERMIDDLE)
        self._lbl_status.set_text(self._get_message('waiting'))
        self._lbl_status.set_position(0, _HEIGHT_STATUS_BAR)
        #self._lbl_status.set_size(_CONTENT_WIDTH,int((_HEIGHT-(2*_HEIGHT_STATUS_BAR))/2.8))
        self._lbl_status.set_size(_CONTENT_WIDTH, _HEIGHT_STATUS)
        self._app.add_component(self._lbl_status)

        self._img_status_bottom = gdi.Panel()
        self._img_status_bottom.set_position(
            0,
            self._lbl_status.get_y() + self._lbl_status.get_height())
        self._img_status_bottom.set_size(_CONTENT_WIDTH, _HEIGHT_STATUS_BAR)
        self._img_status_bottom.set_background_gradient(
            "ffffff", "ffffff", gdi.GRADIENT_DIRECTION_BOTTONTOP)
        self._app.add_component(self._img_status_bottom)

        self._lbl_notificationst = gdi.Label()
        self._lbl_notificationst.set_background("d9d9d9")
        self._lbl_notificationst.set_opaque(True)
        self._lbl_notificationst.set_text_align(gdi.TEXT_ALIGN_CENTERMIDDLE)
        self._lbl_notificationst.set_text(
            self._get_message('monitorCurrentActivities'))
        self._lbl_notificationst.set_position(
            0,
            self._img_status_bottom.get_y() +
            self._img_status_bottom.get_height())
        self._lbl_notificationst.set_size(_CONTENT_WIDTH, 25)
        self._app.add_component(self._lbl_notificationst)

        self._lbl_notificationsl = gdi.Label()
        self._lbl_notificationsl.set_background("ffffff")
        self._lbl_notificationsl.set_opaque(True)
        self._lbl_notificationsl.set_text_align(gdi.TEXT_ALIGN_RIGHTMIDDLE)
        self._lbl_notificationsl.set_position(
            0,
            self._lbl_notificationst.get_y() +
            self._lbl_notificationst.get_height())
        self._lbl_notificationsl.set_size(
            int(_CONTENT_WIDTH / 2),
            _HEIGHT - (self._lbl_notificationst.get_y() +
                       self._lbl_notificationst.get_height()))
        self._app.add_component(self._lbl_notificationsl)

        self._lbl_notificationsr = gdi.Label()
        self._lbl_notificationsr.set_background("ffffff")
        self._lbl_notificationsr.set_opaque(True)
        self._lbl_notificationsr.set_text_align(gdi.TEXT_ALIGN_LEFTMIDDLE)
        self._lbl_notificationsr.set_position(int(_CONTENT_WIDTH / 2),
                                              self._lbl_notificationsl.get_y())
        self._lbl_notificationsr.set_size(
            self._lbl_notificationsl.get_width(),
            self._lbl_notificationsl.get_height())
        self._app.add_component(self._lbl_notificationsr)

        self._lbl_notificationsn = gdi.Label()
        self._lbl_notificationsn.set_background("ffffff")
        self._lbl_notificationsn.set_position(
            0,
            self._lbl_notificationsl.get_y() +
            (int(self._lbl_notificationsl.get_height() / 2) - (26 / 2)))
        self._lbl_notificationsn.set_text(
            self._get_message('monitorNoActivities'))
        self._lbl_notificationsn.set_text_align(gdi.TEXT_ALIGN_CENTERMIDDLE)
        self._lbl_notificationsn.set_size(_CONTENT_WIDTH, 26)
        self._lbl_notificationsn.set_opaque(True)
        self._app.add_component(self._lbl_notificationsn)

        self._pnl_bottom = gdi.Panel()
        self._pnl_bottom.set_position(_CONTENT_WIDTH, 0)
        self._pnl_bottom.set_size(_WIDTH_RIGHT, _HEIGHT)
        self._app.add_component(self._pnl_bottom)

        wbtn = _WIDTH_RIGHT - 20
        hbtn = 36
        appy = 10

        self._btends = gdi.Button()
        self._btends.set_position(10, appy)
        self._btends.set_size(wbtn, hbtn)
        self._btends.set_text(self._get_message('monitorDisable'))
        self._btends.set_action(self.enable_disable)
        self._btends.set_enable(False)
        self._pnl_bottom.add_component(self._btends)
        appy += hbtn + 6

        self._btconfig = gdi.Button()
        self._btconfig.set_position(10, appy)
        self._btconfig.set_size(wbtn, hbtn)
        self._btconfig.set_text(self._get_message('monitorConfigure'))
        self._btconfig.set_action(self.configure)
        self._btconfig.set_enable(False)
        self._pnl_bottom.add_component(self._btconfig)
        appy += hbtn + 6

        self._btunistall = gdi.Button()
        self._btunistall.set_position(10, appy)
        self._btunistall.set_size(wbtn, hbtn)
        self._btunistall.set_text(self._get_message('monitorUninstall'))
        self._btunistall.set_action(self.unistall)
        self._pnl_bottom.add_component(self._btunistall)
        appy += hbtn + 6
Example #7
0
    rr.set_position(250, 210)
    rr.set_selected(True)
    ww.add_component(rr)

    pbr = gdi.ProgressBar()
    pbr.set_position(250, 250)
    pbr.set_percent(0.4)
    ww.add_component(pbr)
    '''
    imp = ImagePanel()
    imp.set_position(250, 280)
    imp.set_filename(u"test.bmp")
    ww.add_component(imp)
    '''

    pl = gdi.Panel()
    pl.set_position(0, 0)
    pl.set_size(90, ww.get_height())
    pl.set_background_gradient("83e5ff", "FFFFFF",
                               gdi.GRADIENT_DIRECTION_LEFTRIGHT)
    ww.add_component(pl)

    pb = gdi.Panel()
    pb.set_position(0, ww.get_height() - 55)
    pb.set_size(ww.get_width(), 55)
    ww.add_component(pb)

    b1 = gdi.Button()
    b1.set_text("Message")
    b1.set_position(10, 10)
    b1.set_action(_test_other_window)
Example #8
0
File: ui.py Project: landv/agent
 def _guimode_start(self):
     
     gdi.gdw_lib() #Se non รจ presente la libreria va in errore quindi in modalita console
             
     self._top_height=0
     if self._topimage is not None:
         self._top_height=gdi.get_image_size(self._topimage)["height"]
     elif self._topinfo is not None:
         self._top_height=(22*len(self._topinfo.split("\n"))) + 10
     
     self._app = gdi.Window(gdi.WINDOW_TYPE_NORMAL_NOT_RESIZABLE, logopath=self._logo)
     #self._app = Window(gdi.WINDOW_TYPE_NORMAL_NOT_RESIZABLE, logopath=self._logo)
     #self._app.setUI(self)
     
     self._app.set_title(self._title)
     self._app.set_size(_WIDTH, _HEIGHT+self._top_height)
     self._app.set_show_position(gdi.WINDOW_POSITION_CENTER_SCREEN)
     self._app.set_action(self._guimode_action)
     
     pnl_left = gdi.Panel();
     pnl_left.set_position(0, self._top_height)
     pnl_left.set_size(_WIDTH_LEFT,_HEIGHT)
     
     if self._leftcolor is not None:
         pnl_left.set_background_gradient(self._leftcolor, "FFFFFF", gdi.GRADIENT_DIRECTION_LEFTRIGHT)
     else:
         pnl_left.set_background_gradient("83e5ff", "FFFFFF", gdi.GRADIENT_DIRECTION_LEFTRIGHT)
     self._app.add_component(pnl_left)
     
     if self._topimage is not None:
         pnl_top = gdi.ImagePanel();
         pnl_top.set_position(0, 0)
         pnl_top.set_filename(self._topimage)
         pnl_top.set_size(_WIDTH,self._top_height)
         self._app.add_component(pnl_top)
     elif self._topinfo is not None:
         pnl_top = gdi.Panel();
         pnl_top.set_position(0, 0)
         pnl_top.set_size(_WIDTH,self._top_height)
         pnl_top.set_background("d9d9d9")
         self._app.add_component(pnl_top)
         
         pnl_top_text = gdi.Label()
         pnl_top_text.set_position(10,0)
         pnl_top_text.set_size(_WIDTH-(2*10),self._top_height)
         pnl_top_text.set_wordwrap(True)
         pnl_top_text.set_foreground("000000")
                     
         pnl_top_text.set_text(self._topinfo)
         pnl_top.add_component(pnl_top_text)
     
     
     pnl_bottom = gdi.Panel();
     pnl_bottom.set_position(0, _CONTENT_HEIGHT+self._top_height)
     pnl_bottom.set_size(_WIDTH,_HEIGHT_BOTTOM)
     self._app.add_component(pnl_bottom)
     
     wbtn=140
     hbtn=36
     
     self._btback = gdi.Button();
     self._btback.set_position(10, 10)
     self._btback.set_size(wbtn, hbtn)
     self._btback.set_text(messages.get_message('back'))
     self._btback.set_enable(False);
     self._btback.set_action(self._guimode_back)
     pnl_bottom.add_component(self._btback)
             
     self._btnext = gdi.Button();
     self._btnext.set_position(10+wbtn+5, 10)
     self._btnext.set_size(wbtn, hbtn)
     self._btnext.set_text(messages.get_message('next'))
     self._btnext.set_enable(False);
     self._btnext.set_action(self._guimode_next)
     pnl_bottom.add_component(self._btnext)
     
     self._btclose = gdi.Button();
     self._btclose.set_position(_WIDTH-wbtn-10, 10)
     self._btclose.set_size(wbtn, hbtn)
     self._btclose.set_text(messages.get_message('close'))
     self._btclose.set_enable(False);
     self._btclose.set_action(self._guimode_close)
     pnl_bottom.add_component(self._btclose)
     
     self._pnlmain=None
     self._cur_step_ui=None
     self._step_init_run=False
     
     self._guimode_step_init_start()
     self._app.show()
     gdi.loop()
Example #9
0
  rr.set_position(250, 170)
  ww.add_component(rr)
  
  rr = gdi.RadioButton()
  rr.set_text("No")
  rr.set_group("GRP1");
  rr.set_position(250, 210)
  rr.set_selected(True)
  ww.add_component(rr)
  
  pbr = gdi.ProgressBar()
  pbr.set_position(250, 250)
  pbr.set_percent(0.4)
  ww.add_component(pbr)
  
  pl = gdi.Panel();
  pl.set_position(0, 0)
  pl.set_size(90,ww.get_height())
  pl.set_background_gradient("83e5ff", "FFFFFF", gdi.GRADIENT_DIRECTION_LEFTRIGHT)
  ww.add_component(pl)
  
  imp = gdi.ImagePanel()
  imp.set_position(200, 280)
  imp.set_filename(images.get_image("logo32x32.bmp"))
  ww.add_component(imp)    
 
  pb = gdi.Panel();
  pb.set_position(0, ww.get_height()-55)
  pb.set_size(ww.get_width(),55)
  ww.add_component(pb)