Ejemplo n.º 1
0
        def background_process():
            """Change workspace. This function runs on a separated thread
            created by the parent function. DO NOT call any Gtk methods
            withing its scope, except by emiting signals to the window
            """
            GObject.idle_add(loading_workspace, 'show')
            try:
                ws = self.openWorkspace(workspace_name)
                GObject.idle_add(CONF.setLastWorkspace, ws.name)
                GObject.idle_add(CONF.saveConfig)
            except Exception as e:
                GObject.idle_add(self.handle_no_active_workspace)
                get_logger("GTK").error(e)

            GObject.idle_add(loading_workspace, 'destroy')
            return True
Ejemplo n.º 2
0
        def wrapper(*args, **kwargs):
            try:
                res = func(*args, **kwargs)
            except ServerRequestException as e:
                res = response_in_emergency
                get_logger("Server-GTK IO").warning(e)
            except (requests.exceptions.MissingSchema,
                    requests.exceptions.InvalidSchema):
                res = response_in_emergency
                get_logger("Server-GTK IO").error(
                    "It looks like the Faraday Server "
                    "URL is not correctly formated. Please change it and "
                    "remember to set it with a valid protocol, like http.\n"
                    "For example: http://faradayserver:port/")
            except Exception as ex:
                get_logger().exception(ex)
                res = response_in_emergency
                get_logger("Server-GTK IO").error(
                    "It looks like the Faraday Server is not running\n")

            return res
Ejemplo n.º 3
0
 def run(self, args):
     workspace = args.workspace
     try:
         ws = super(GuiApp, self).openWorkspace(workspace)
     except Exception as e:
         get_logger(self).error(
             ("Your last workspace %s is not accessible, "
              "check configuration.") % workspace)
         get_logger(self).error(
                 "You may try and go to ~/.faraday/config/user.xml "
                 "to set a valid api_uri and last_workspace")
         get_logger(self).error(str(e))
         valid = False
         for i in range(4):
             workspace = click.prompt("Please write the correct, Workspace)")
             try:
                 ws = super(GuiApp, self).openWorkspace(workspace)
                 valid = True
                 break
             except Exception as err:
                 get_logger(self).error(
                     ("Your last workspace %s is not accessible, "
                      "check configuration.") % workspace)
                 get_logger(self).error(
                         "You may try and go to ~/.faraday/config/user.xml "
                         "to set a valid api_uri and last_workspace")
                 get_logger(self).error(str(err))
         if not valid:
             return -1
     workspace = ws.name
     CONF.setLastWorkspace(workspace)
     CONF.saveConfig()
     get_logger(self).info("Workspace %s loaded" % workspace)
     while True:
         if self._stop:
             return
         time.sleep(0.01)
Ejemplo n.º 4
0
 def update(self, event):
     if event.type() == CHANGEFROMINSTANCE:
         get_logger(self).info(
             "[Update Received] " + event.change.getMessage())
Ejemplo n.º 5
0
 def __init__(self):
     self.logger = get_logger(self)