diff --git a/pym/consolegui/application/Box.py b/pym/consolegui/application/Box.py index 9d92f00..1c715b7 100644 --- a/pym/consolegui/application/Box.py +++ b/pym/consolegui/application/Box.py @@ -164,7 +164,7 @@ class MainWgt(qt.QMainWindow): self.resize(self.cur_size) def back(self): - self.control_button.del_button() + # self.control_button.del_button() if len(self.ClientObj.back_step_list) < 2: self.delete_MainFrameWgt() @@ -345,17 +345,20 @@ class MainWgt(qt.QMainWindow): self.left_frame.hide() - try: - self.MainFrameWgt.get_entire_frame(pid) - except (RuntimeError, ValueError): - pass + #DEBUG + + #check why are they here? + # try: + self.MainFrameWgt.get_entire_frame(pid) + # except (RuntimeError, ValueError): + # pass def delete_MainFrameWgt(self): self.main_frame.takeWidget() - try: - self.MainFrameWgt.close() - except (RuntimeError, AttributeError): - pass + # try: + self.MainFrameWgt.close() + # except (RuntimeError, AttributeError): + # pass def setScrollBarVal(self): self.main_frame.verticalScrollBar().setSliderPosition \ diff --git a/pym/consolegui/application/ControlButton.py b/pym/consolegui/application/ControlButton.py index 2edfea3..03313f7 100644 --- a/pym/consolegui/application/ControlButton.py +++ b/pym/consolegui/application/ControlButton.py @@ -106,7 +106,8 @@ class MethodNameWgt(qt.QWidget): class ControlButtonWgt(qt.QWidget): def __init__(self, parent, ClientObj): - qt.QWidget.__init__(self, parent) + super().__init__(parent) + # qt.QWidget.__init__(self, parent) self._parent = parent self.ClientObj = ClientObj @@ -114,8 +115,10 @@ class ControlButtonWgt(qt.QWidget): self.setAttribute(qt.Qt.WA_StyledBackground) self.setObjectName('ControlButton') self.setStyleSheet("QWidget#ControlButton " - "{background-color: %s;}"% - get_system_rgb(self, ParameterWindow)) + "{background-color: rgb(255,0,0);}") + # self.setStyleSheet("QWidget#ControlButton " + # "{background-color: %s;}"% + # get_system_rgb(self, ParameterWindow)) self.main_layout = qt.QVBoxLayout(self) self.main_layout.setContentsMargins(28, 8, 0, 28) @@ -182,7 +185,7 @@ class ControlButtonWgt(qt.QWidget): def add_custom_button(self, Group, x, y, brief=False, next_button_text=""): - self.del_button() + # self.del_button() buttons = self._parent.MainFrameWgt.buttons self.button_widget = qt.QWidget(self) end_layout = qt.QHBoxLayout(self.button_widget) @@ -220,7 +223,7 @@ class ControlButtonWgt(qt.QWidget): def add_standart_button(self, Group, x, y, brief=False, \ next_button_text=""): - self.del_button() + # self.del_button() main_frame = self._parent.MainFrameWgt # add 1 (or 2) button ok (next) [and previous] self.button_widget = qt.QWidget(self) @@ -354,7 +357,7 @@ class ControlButtonWgt(qt.QWidget): # self.default_button = None def pre_add_button(self): - self.del_button() + # self.del_button() # add 1 (or 2) button ok (next) [and previous] self.button_widget = qt.QWidget(self) end_layout = qt.QHBoxLayout(self.button_widget) @@ -381,7 +384,7 @@ class ControlButtonWgt(qt.QWidget): self.hlayout.addWidget(self.button_widget) def clear_pid_cache(self): - self.button_disabled() + # self.button_disabled() self.clear_proc_cache_button.setDisabled(True) sid = int(self.ClientObj.sid) res = self.ClientObj.client.service.clear_pid_cache(sid, self.pid) @@ -398,7 +401,7 @@ class ControlButtonWgt(qt.QWidget): if type(self.window()) == SelectedMethodWgt: self.window().close() else: - self.del_button() + # self.del_button() self.hide() self._parent.back() @@ -422,22 +425,22 @@ class ControlButtonWgt(qt.QWidget): if type(self.window()) == SelectedMethodWgt: self.window().close() else: - self.del_button() + # self.del_button() self.hide() self._parent.back() def button_disabled(self): - if self.next_button: - self.next_button.setDisabled(True) - if self.prev_button: - self.prev_button.setDisabled(True) - if self.cancel_button: - self.cancel_button.setDisabled(True) - if self.clear_proc_cache_button: - self.clear_proc_cache_button.setDisabled(True) - if self.customs: - for but in self.customs: - but.setDisabled(True) + # if self.next_button: + # self.next_button.setDisabled(True) + # if self.prev_button: + # self.prev_button.setDisabled(True) + # if self.cancel_button: + # self.cancel_button.setDisabled(True) + # if self.clear_proc_cache_button: + # self.clear_proc_cache_button.setDisabled(True) + # if self.customs: + # for but in self.customs: + # but.setDisabled(True) self.ClientObj.app.processEvents() def button_enabled(self): diff --git a/pym/consolegui/application/DisplayMethod.py b/pym/consolegui/application/DisplayMethod.py index 5e453bb..4a26a58 100644 --- a/pym/consolegui/application/DisplayMethod.py +++ b/pym/consolegui/application/DisplayMethod.py @@ -238,6 +238,7 @@ class DisplayMethod(qt.QWidget): def onActivated(self): + print("DEBUG onActivated") # Call server method if hasattr (self, 'onActivated_thread'): if self.onActivated_thread.isRunning(): @@ -262,6 +263,7 @@ class DisplayMethod(qt.QWidget): str(method_name + '_view'), step = step, expert = expert, brief = brief) + print(f"view_params: \n {view_params}") self.onActivated_thread = ClientServiceThread(self.ClientObj, \ str(method_name + '_view'), int(self.ClientObj.sid), \ view_params, return_except = True) @@ -271,8 +273,12 @@ class DisplayMethod(qt.QWidget): def onActivated_after(self, view): self.setDisabled(False) #self.con_lost_lbl.hide() + if type(view) == Exception: - if hasattr (view.message, 'message'): + print("DEBUG excpt") + print(view) + print(dir(view)) + if hasattr (view, 'message'): view = view.message if type(view.message) == tuple: @@ -346,7 +352,7 @@ class DisplayMethod(qt.QWidget): class StartWidget(qt.QWidget): def __init__(self, parent): - super(StartWidget, self).__init__(parent) + super().__init__(parent) self.setAttribute(qt.Qt.WA_DeleteOnClose) class ConnectLostLabel (qt.QWidget): diff --git a/pym/consolegui/application/LeftMenu.py b/pym/consolegui/application/LeftMenu.py index 326676c..40a559b 100644 --- a/pym/consolegui/application/LeftMenu.py +++ b/pym/consolegui/application/LeftMenu.py @@ -181,8 +181,7 @@ class LeftMenu(qt.QScrollArea): def groupActivated(self, groups, sub_group, title, ClientObj, back = False): ClientObj.MainWidget.delete_MainFrameWgt() - ClientObj.MainWidget.MainFrameWgt = qt.QWidget \ - (ClientObj.MainWidget) + ClientObj.MainWidget.MainFrameWgt = qt.QWidget(ClientObj.MainWidget) hlayout = qt.QHBoxLayout() hlayout.addItem(qt.QSpacerItem( 0, 0, \ diff --git a/pym/consolegui/application/MainClass.py b/pym/consolegui/application/MainClass.py index 1d36d79..487a9bd 100644 --- a/pym/consolegui/application/MainClass.py +++ b/pym/consolegui/application/MainClass.py @@ -26,7 +26,7 @@ import gettext _ = gettext.gettext class ApiClient(qt.QWidget): def __init__(self, app, tabs): - super(ApiClient, self).__init__() + super().__init__() self.app = app self._parent = tabs diff --git a/pym/consolegui/application/MainFrameResult.py b/pym/consolegui/application/MainFrameResult.py index 4051c99..71bcdc0 100644 --- a/pym/consolegui/application/MainFrameResult.py +++ b/pym/consolegui/application/MainFrameResult.py @@ -25,8 +25,8 @@ def debug(level, *args): for s in args: print(s, end=' ') print() -import urllib.request as urllib2 import calculate.contrib +from urllib.error import URLError from suds import MethodNotFound import re @@ -115,7 +115,8 @@ class MainFrameRes(qt.QWidget): self._parent.methodname_wgt.show() self._parent.control_button.show() - self._parent.control_button.del_button() + #DEBUG + # self._parent.control_button.del_button() if self.method_name in self.ClientObj.method_names: self._parent.methodname_wgt.setMethodName \ (self.ClientObj.method_names[self.method_name]) @@ -718,7 +719,6 @@ class MainFrameRes(qt.QWidget): """ Exception container with URLError """ - from urllib2 import URLError from socket import error as socket_error try: if (exception.args and type(exception.args[0]) == URLError and @@ -785,12 +785,11 @@ class MainFrameRes(qt.QWidget): def get_entire_frame(self, pid = None): """ get entire frame, from beginning (if client disconnected) """ self.ClientObj.app.processEvents() - sid = get_sid(self.ClientObj.client) if not pid: try: list_pid = self.ClientObj.client.service.list_pid(sid = sid) - except urllib2.URLError as e: + except URLError as e: _print ('get_entire_frame in MainFrameResult Exception') show_msg (e, _("Not connected!")) return 1 @@ -953,7 +952,7 @@ class MainFrameRes(qt.QWidget): def get_Table(self, sid, pid, item): try: table = self.ClientObj.client.service.get_table(sid, pid, item.id) - except urllib2.URLError: + except URLError: self.show_error('Error get table from server') return 1 diff --git a/pym/consolegui/application/client_class.py b/pym/consolegui/application/client_class.py index 6153389..fc8ffba 100644 --- a/pym/consolegui/application/client_class.py +++ b/pym/consolegui/application/client_class.py @@ -680,12 +680,6 @@ class HTTPSClientCertTransport(HttpTransport): proxy_handler = None if ca_certs or (client_keyfile and client_certfile) \ or (client_keyobj and client_certobj): - print("from if in transport") - print(ca_certs) - print(client_keyfile) - print(client_certfile) - print(client_keyobj) - print(client_certobj) https_handler = CheckingClientHTTPSHandler(parent, cert_path=path_to_cert, ca_certs=ca_certs, diff --git a/pym/consolegui/application/mainframe.py b/pym/consolegui/application/mainframe.py index 345dc8f..cdb0ebd 100644 --- a/pym/consolegui/application/mainframe.py +++ b/pym/consolegui/application/mainframe.py @@ -558,7 +558,7 @@ class MainFrame(qt.QWidget): self.ClientObj.param_objects[self.method_name]['error']) self.highlight_errors() else: - debug(10, "METHOD has not errors", self.method_name) + debug(10, "METHOD has no errors", self.method_name) self.error_output = True # create steps diff --git a/pym/consolegui/application/more.py b/pym/consolegui/application/more.py index 96da6e9..9a7508b 100644 --- a/pym/consolegui/application/more.py +++ b/pym/consolegui/application/more.py @@ -2607,6 +2607,8 @@ class ClientServiceThread(qt.QThread): _print ('TypeError Exception in class ClientServiceThread') try: + print(f"method name : {self.method_name}") + # print(client.service[0]) result = client.service[0][self.method_name](*self.args) except Exception as e: if self.return_except: