Skip to content

Commit

Permalink
Abstracted window initialize code.
Browse files Browse the repository at this point in the history
  • Loading branch information
earik87 committed Jul 14, 2024
1 parent 0e88e33 commit 531e2d9
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions app/light.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,16 @@

class LightUIWindow(QMainWindow):
def __init__(self):
super(LightUIWindow, self).__init__()
loadUi('app/MainWindow.ui', self)
self.setWindowTitle('THz Scan GUI')

self.initialize_window()
self.initialize_instruments()
self.initialize_ui_components()
self.initialize_scan_data()

def initialize_window(self):
super(LightUIWindow, self).__init__()
loadUi('app/MainWindow.ui', self)
self.setWindowTitle('THz Scan GUI')

def initialize_instruments(self):
if DEMO_MODE:
self.nidaq = NIDAQDemo()
Expand All @@ -41,7 +43,6 @@ def initialize_instruments(self):
self.lia = SR830Demo("com3", 19200)
self.lia.openConnection()
time.sleep(0.25)

self.stage.openConnection()
self.stage.home()

Expand All @@ -55,7 +56,6 @@ def initialize_ui_components(self):
def set_ui_buttons_to_default_values(self):
self.ddSens.setCurrentIndex(18)
self.ddTc.setCurrentIndex(7)

self.StopRunFlag = False
self.IsHomedFlag = False
self.SaveAllFlag = False
Expand All @@ -74,7 +74,6 @@ def initialize_figure(self):
self.toolbar = NavigationToolbar(self.canvas, self)
if os.name == 'posix':
matplotlib.rcParams.update({'font.size': 5})

self.verticalLayout.insertWidget(0, self.toolbar)
self.verticalLayout.replaceWidget(self.wplot, self.canvas)

Expand All @@ -87,6 +86,7 @@ def initialize_buttons(self):
self.cbSaveall.stateChanged.connect(self.update_savestate)


#TODO: Refactor this method.
def btnStart_clicked(self):
try:
self.lia.demo_measure_reset() # should be removed when out of dev
Expand Down

0 comments on commit 531e2d9

Please sign in to comment.