fixed connection type exception
This commit is contained in:
parent
6e7751db01
commit
0f21b25fa4
1 changed files with 28 additions and 18 deletions
|
@ -79,10 +79,6 @@ class WorkerThread(QThread):
|
||||||
self.disable_profile()
|
self.disable_profile()
|
||||||
elif self.action == 'SYNC' or self.action == 'SYNC_TOR':
|
elif self.action == 'SYNC' or self.action == 'SYNC_TOR':
|
||||||
self.sync()
|
self.sync()
|
||||||
elif self.action == 'GET_CONNECTION':
|
|
||||||
self.get_connection()
|
|
||||||
elif self.action == 'SET_CONNECTION':
|
|
||||||
self.set_connection()
|
|
||||||
elif self.action == 'DESTROY_PROFILE':
|
elif self.action == 'DESTROY_PROFILE':
|
||||||
self.destroy_profile()
|
self.destroy_profile()
|
||||||
elif self.action == 'DISABLE_ALL_PROFILES':
|
elif self.action == 'DISABLE_ALL_PROFILES':
|
||||||
|
@ -119,7 +115,6 @@ class WorkerThread(QThread):
|
||||||
client_observer.subscribe('updated', lambda event: self.text_output.emit("Update process completed"))
|
client_observer.subscribe('updated', lambda event: self.text_output.emit("Update process completed"))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def check_for_update(self):
|
def check_for_update(self):
|
||||||
self.text_output.emit("Checking for updates...")
|
self.text_output.emit("Checking for updates...")
|
||||||
ClientController.sync(client_observer=client_observer, connection_observer=connection_observer)
|
ClientController.sync(client_observer=client_observer, connection_observer=connection_observer)
|
||||||
|
@ -299,6 +294,7 @@ class WorkerThread(QThread):
|
||||||
class CustomWindow(QMainWindow):
|
class CustomWindow(QMainWindow):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
sys.excepthook = self._handle_exception
|
||||||
self.setWindowFlags(
|
self.setWindowFlags(
|
||||||
Qt.WindowType.Window
|
Qt.WindowType.Window
|
||||||
)
|
)
|
||||||
|
@ -326,8 +322,9 @@ class CustomWindow(QMainWindow):
|
||||||
self.current_profile_id = None
|
self.current_profile_id = None
|
||||||
self.connection_manager = ConnectionManager()
|
self.connection_manager = ConnectionManager()
|
||||||
|
|
||||||
current_connection = 'system' #For Default toggle behavior
|
current_connection = None
|
||||||
self.is_tor_mode = current_connection == 'tor'
|
self.is_tor_mode = current_connection == 'tor'
|
||||||
|
|
||||||
self.is_animating = False
|
self.is_animating = False
|
||||||
self.animation_step = 0
|
self.animation_step = 0
|
||||||
self.page_history = []
|
self.page_history = []
|
||||||
|
@ -410,13 +407,33 @@ class CustomWindow(QMainWindow):
|
||||||
self.set_toggle_state(self.is_tor_mode)
|
self.set_toggle_state(self.is_tor_mode)
|
||||||
|
|
||||||
|
|
||||||
def get_current_connection(self):
|
|
||||||
try:
|
|
||||||
return ConfigurationController.get_connection()
|
|
||||||
except UnknownConnectionTypeError:
|
def _handle_exception(self, identifier, message, trace):
|
||||||
|
if issubclass(identifier, UnknownConnectionTypeError):
|
||||||
self.setup_popup()
|
self.setup_popup()
|
||||||
|
os.execv(sys.executable, [sys.executable] + sys.argv)
|
||||||
|
|
||||||
|
else:
|
||||||
|
|
||||||
|
config = self._load_gui_config()
|
||||||
|
|
||||||
|
if config and config["logging"]["gui_logging_enabled"] == True:
|
||||||
|
|
||||||
|
logging.error(
|
||||||
|
f"Uncaught exception:\n"
|
||||||
|
f"Type: {identifier.__name__}\n"
|
||||||
|
f"Value: {str(message)}\n"
|
||||||
|
f"Traceback:\n{''.join(traceback.format_tb(trace))}"
|
||||||
|
)
|
||||||
|
|
||||||
|
sys.__excepthook__(identifier, message, trace)
|
||||||
|
|
||||||
|
def get_current_connection(self):
|
||||||
return ConfigurationController.get_connection()
|
return ConfigurationController.get_connection()
|
||||||
|
|
||||||
|
|
||||||
def setup_popup(self):
|
def setup_popup(self):
|
||||||
connection_dialog = QDialog(self)
|
connection_dialog = QDialog(self)
|
||||||
connection_dialog.setWindowTitle("Connection Type")
|
connection_dialog.setWindowTitle("Connection Type")
|
||||||
|
@ -844,14 +861,6 @@ class CustomWindow(QMainWindow):
|
||||||
self.disable_marquee()
|
self.disable_marquee()
|
||||||
return
|
return
|
||||||
|
|
||||||
if is_downloading and not self.is_downloading:
|
|
||||||
self.is_downloading = True
|
|
||||||
|
|
||||||
if self.is_downloading and 'Downloading' not in text:
|
|
||||||
return
|
|
||||||
|
|
||||||
if 'Downloaded' in text:
|
|
||||||
self.is_downloading = False
|
|
||||||
|
|
||||||
if clear:
|
if clear:
|
||||||
self.status_label.setText('')
|
self.status_label.setText('')
|
||||||
|
@ -4978,6 +4987,7 @@ class PaymentPage(Page):
|
||||||
self.on_request_invoice()
|
self.on_request_invoice()
|
||||||
|
|
||||||
def on_request_invoice(self):
|
def on_request_invoice(self):
|
||||||
|
raise UnknownConnectionTypeError('The connection type is unknown')
|
||||||
total_hours = self.fetch_invoice_duration()
|
total_hours = self.fetch_invoice_duration()
|
||||||
selected_currency = self.get_selected_currency()
|
selected_currency = self.get_selected_currency()
|
||||||
if selected_currency is None:
|
if selected_currency is None:
|
||||||
|
|
Loading…
Reference in a new issue