Skip to content

Commit

Permalink
Implement code in update.py in gui.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahsoka committed Jul 31, 2021
1 parent d171a6b commit ea4070c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions beskar/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from .utils import apply_voltage, get_file, get_number_of_devices
from .pages import ApplyVoltagePage, DarkCurrentPage, ScanPage
from PyQt6 import QtCore, QtWidgets, QtGui
from .update import UpdateChecker
from . import __version__

import logging
Expand Down Expand Up @@ -53,6 +54,13 @@ def __init__(self):
QtCore.QMetaObject.connectSlotsByName(self)

def show(self) -> None:
from .handle_errors import handle_exception

self.update_thread = UpdateChecker()
self.update_thread.raise_exception.connect(lambda tup: handle_exception(*tup))
self.update_thread.close_all_windows.connect(QtWidgets.QApplication.closeAllWindows)
self.update_thread.start()

system, num_of_devices = get_number_of_devices()
self.enter_volts_popup = EnterVoltsPopup(self)
if num_of_devices > 1:
Expand All @@ -68,6 +76,7 @@ def show(self) -> None:
apply_voltage(self.device_name)
self.enter_volts_popup.open()
logger.info('Opened EnterVoltsPopup from BeskarWindow.')

super().show()

def create_options_menu(self):
Expand Down

0 comments on commit ea4070c

Please sign in to comment.