Example #1
0
    def check_step(self, method_name, set_step=None):
        #        def wrapper():
        # Call server method
        if hasattr(self, "check_step_thread"):
            if self.check_step_thread.isRunning():
                _print("check_step_thread is running")
                self.setEnabled(True)
                return 1

        self.step = set_step if set_step else 0

        self._parent.ClientObj.method_name = method_name
        self._parent.ClientObj.sid = get_sid(self._parent.ClientObj.client)

        expert = None
        if self._parent.ClientObj.MainWidget.MainFrameWgt.isBrief(self.step):
            num = None
            brief = True
            expert = True
        else:
            brief = False
            num = self.step

        view_params = get_view_params(
            self._parent.ClientObj.client, str(method_name + "_view"), step=num, expert=expert, brief=brief
        )
        self.check_step_thread = ClientServiceThread(
            self._parent.ClientObj, str(method_name + "_view"), int(self._parent.ClientObj.sid), view_params
        )
        self.check_step_thread.signal.connect(self.check_step_after)
        self.check_step_thread.start()
Example #2
0
    def onActivated(self):
        method_name = self.sender().objectName()

        # set new Title
        new_title = self.sender().text()
        try:
            new_title = new_title.decode("utf-8")
        except (UnicodeDecodeError, UnicodeEncodeError):
            pass
        self._parent.ClientObj._parent.setWindowTitle(new_title + " - " + self.old_title)

        step = 0
        self._parent.ClientObj.method_name = method_name

        self._parent.ClientObj.sid = get_sid(self._parent.ClientObj.client)
        # switch to the desired step
        if self._parent.ClientObj.param_objects.has_key(method_name):
            self._parent.ClientObj.param_objects[method_name]["step"] = step

        # Call server method
        if hasattr(self, "onActivated_thread"):
            if self.onActivated_thread.isRunning():
                return 1
        view_params = get_view_params(self._parent.ClientObj.client, str(method_name + "_view"), step=step)
        self.onActivated_thread = ClientServiceThread(
            self._parent.ClientObj,
            str(method_name + "_view"),
            int(self._parent.ClientObj.sid),
            view_params,
            return_except=True,
        )
        self.onActivated_thread.signal.connect(self.onActivated_after)
        self.onActivated_thread.start()
 def connect(self):
     self.MethodWidget.connect_to_localhost(self.args.host, self.args.port)
     if not self.ClientObj.client:
         return 1
     self.ClientObj.sid = get_sid(self.ClientObj.client)
     try:
         view_params = get_view_params(self.ClientObj.client, self.args.method + "_view", step=0)
         view = self.ClientObj.client.service[0][self.args.method + "_view"](int(self.ClientObj.sid), view_params)
     except sudsds.MethodNotFound:
         _print("Method not found: ", self.args.method + "_view")
         self.close()
         sys.exit(1)
     if self.ClientObj.method_names.has_key(self.args.method):
         view_method = self.ClientObj.method_names[self.args.method]
     else:
         view_method = self.args.method
     self.setWindowTitle(view_method + " - " + self.ClientObj._parent.windowTitle())
     self.MethodWidget.main_frame_view(view, self.args.method)
     return 0
    def onActivated(self):
        # Call server method
        if hasattr (self, 'onActivated_thread'):
            if self.onActivated_thread.isRunning():
                return 1
        self.setDisabled(True)
        method_name = self.sender().objectName()
#        view_method_name = self.sender().text()
        step = 0
        brief = False
        self.ClientObj.method_name = method_name

        self.ClientObj.sid = get_sid(self.ClientObj.client)
        if self.ClientObj.param_objects.has_key(method_name):
            self.ClientObj.param_objects[method_name]['step'] = 0

        view_params = get_view_params(self.ClientObj.client, \
                       str(method_name + '_view'), step = step, brief = brief)
        self.onActivated_thread = ClientServiceThread(self.ClientObj, \
                        str(method_name + '_view'), int(self.ClientObj.sid), \
                        view_params, return_except = True)
        self.onActivated_thread.signal.connect(self.onActivated_after)
        self.onActivated_thread.start()