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()
|
||||
elif self.action == 'SYNC' or self.action == 'SYNC_TOR':
|
||||
self.sync()
|
||||
elif self.action == 'GET_CONNECTION':
|
||||
self.get_connection()
|
||||
elif self.action == 'SET_CONNECTION':
|
||||
self.set_connection()
|
||||
elif self.action == 'DESTROY_PROFILE':
|
||||
self.destroy_profile()
|
||||
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"))
|
||||
|
||||
|
||||
|
||||
def check_for_update(self):
|
||||
self.text_output.emit("Checking for updates...")
|
||||
ClientController.sync(client_observer=client_observer, connection_observer=connection_observer)
|
||||
|
@ -299,6 +294,7 @@ class WorkerThread(QThread):
|
|||
class CustomWindow(QMainWindow):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
sys.excepthook = self._handle_exception
|
||||
self.setWindowFlags(
|
||||
Qt.WindowType.Window
|
||||
)
|
||||
|
@ -326,8 +322,9 @@ class CustomWindow(QMainWindow):
|
|||
self.current_profile_id = None
|
||||
self.connection_manager = ConnectionManager()
|
||||
|
||||
current_connection = 'system' #For Default toggle behavior
|
||||
current_connection = None
|
||||
self.is_tor_mode = current_connection == 'tor'
|
||||
|
||||
self.is_animating = False
|
||||
self.animation_step = 0
|
||||
self.page_history = []
|
||||
|
@ -410,13 +407,33 @@ class CustomWindow(QMainWindow):
|
|||
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()
|
||||
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()
|
||||
|
||||
|
||||
def setup_popup(self):
|
||||
connection_dialog = QDialog(self)
|
||||
connection_dialog.setWindowTitle("Connection Type")
|
||||
|
@ -844,14 +861,6 @@ class CustomWindow(QMainWindow):
|
|||
self.disable_marquee()
|
||||
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:
|
||||
self.status_label.setText('')
|
||||
|
@ -4978,6 +4987,7 @@ class PaymentPage(Page):
|
|||
self.on_request_invoice()
|
||||
|
||||
def on_request_invoice(self):
|
||||
raise UnknownConnectionTypeError('The connection type is unknown')
|
||||
total_hours = self.fetch_invoice_duration()
|
||||
selected_currency = self.get_selected_currency()
|
||||
if selected_currency is None:
|
||||
|
|
Loading…
Reference in a new issue