Skip to content

Commit

Permalink
Added version number to all windows and output data, switching over t…
Browse files Browse the repository at this point in the history
…o using One Directory mode.
  • Loading branch information
mitbailey committed May 11, 2023
1 parent 9510654 commit 070c5f3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
12 changes: 7 additions & 5 deletions mmc.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
import middleware as mw
from middleware import MotionController#, list_all_devices
from middleware import Detector
import version

# Fonts
digital_7_italic_22 = None
Expand Down Expand Up @@ -289,7 +290,7 @@ def show_window_device_manager(self):
self.dmw = QDialog(self) # pass parent window
uic.loadUi(ui_file, self.dmw)

self.dmw.setWindowTitle('Device Manager')
self.dmw.setWindowTitle('Device Manager (MMCv%s)'%(version.__MMC_VERSION__))
self.dmw_list = ''


Expand Down Expand Up @@ -518,9 +519,9 @@ def _show_main_gui(self, dummy: bool):
self.UIE_mcw_steps_per_nm_qdsb: QDoubleSpinBox = None

if dummy:
self.setWindowTitle("McPherson Monochromator Control (Debug Mode) v0.6")
self.setWindowTitle("McPherson Monochromator Control (Debug Mode) (MMCv%s)"%(version.__MMC_VERSION__))
else:
self.setWindowTitle("McPherson Monochromator Control (Hardware Mode) v0.6")
self.setWindowTitle("McPherson Monochromator Control (Hardware Mode) (MMCv%s)"%(version.__MMC_VERSION__))

self.is_conv_set = False # Use this flag to set conversion

Expand Down Expand Up @@ -1201,6 +1202,7 @@ def save_data_cb(self):
except Exception:
print('Could not open file %s'%(fileInfo.fileName()))
return
ofile.write('# DATA RECORDED IN SOFTWARE VERSION: MMCv%s\n'%(version.__MMC_VERSION__))
ofile.write('# %s\n'%(tstamp.strftime('%Y-%m-%d %H:%M:%S')))
try:
ofile.write('# Steps/mm: %f\n'%(metadata['steps_per_value']))
Expand Down Expand Up @@ -1555,7 +1557,7 @@ def show_window_machine_config(self):
self.machine_conf_win = QDialog(self) # pass parent window
uic.loadUi(ui_file, self.machine_conf_win)

self.machine_conf_win.setWindowTitle('Monochromator Configuration')
self.machine_conf_win.setWindowTitle('Monochromator Configuration (MMCv%s)'%(version.__MMC_VERSION__))

self.UIE_mcw_model_qcb: QComboBox = self.machine_conf_win.findChild(QComboBox, 'models')
self.UIE_mcw_model_qcb.addItems(McPherson.MONO_MODELS)
Expand Down Expand Up @@ -1956,7 +1958,7 @@ def exception_hook(exctype, value, traceback):

except Exception as e:
print('A GLOBAL EXCEPTION HAS BEEN DETECTED:')
print(e.what())
print(e)

print('Exiting program...')

Expand Down
6 changes: 6 additions & 0 deletions utilities_qt/scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
import matplotlib
matplotlib.use('Qt5Agg')

import version

class Scan(QThread):
SIGNAL_status_update = pyqtSignal(str)
SIGNAL_progress = pyqtSignal(int)
Expand Down Expand Up @@ -166,6 +168,7 @@ def run(self):
print(sav_files)
if len(sav_files) > 0 and sav_files[i] is not None:
if idx == 0:
sav_files[i].write('# DATA RECORDED IN SOFTWARE VERSION: MMCv%s\n'%(version.__MMC_VERSION__))
sav_files[i].write('# %s\n'%(tnow.strftime('%Y-%m-%d %H:%M:%S')))
sav_files[i].write('# Steps/mm: %f\n'%(self.other.motion_controllers.main_drive_axis.get_steps_per_value()))
sav_files[i].write('# mm/nm: %e; lambda_0 (nm): %e\n'%(0, self.other.zero_ofst))
Expand Down Expand Up @@ -333,6 +336,7 @@ def run(self):

if len(sav_files) > 0 and sav_files[i] is not None:
if idx == 0:
sav_files[i].write('# DATA RECORDED IN SOFTWARE VERSION: MMCv%s\n'%(version.__MMC_VERSION__))
sav_files[i].write('# %s\n'%(tnow.strftime('%Y-%m-%d %H:%M:%S')))
sav_files[i].write('# Steps/deg: %f\n'%(self.other.motion_controllers.sample_rotation_axis.get_steps_per_value()))
sav_files[i].write('# mm/nm: 0; lambda_0 (nm): 0\n')
Expand Down Expand Up @@ -421,6 +425,7 @@ def run(self):

if len(sav_files) > 0 and sav_files[i] is not None:
if idx == 0:
sav_files[i].write('# DATA RECORDED IN SOFTWARE VERSION: MMCv%s\n'%(version.__MMC_VERSION__))
sav_files[i].write('# %s\n'%(tnow.strftime('%Y-%m-%d %H:%M:%S')))
sav_files[i].write('# Steps/deg: %f\n'%(self.other.motion_controllers.sample_rotation_axis.get_steps_per_value()))
sav_files[i].write('# mm/nm: 0; lambda_0 (nm): 0\n')
Expand Down Expand Up @@ -591,6 +596,7 @@ def run(self):

if len(sav_files) > 0 and sav_files[i] is not None:
if idx == 0:
sav_files[i].write('# DATA RECORDED IN SOFTWARE VERSION: MMCv%s\n'%(version.__MMC_VERSION__))
sav_files[i].write('# %s\n'%(tnow.strftime('%Y-%m-%d %H:%M:%S')))
sav_files[i].write('# Steps/deg: %f\n'%(self.other.motion_controllers.detector_rotation_axis.get_steps_per_value()))
sav_files[i].write('# mm/nm: 0; lambda_0 (nm): 0\n')
Expand Down
1 change: 1 addition & 0 deletions version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__MMC_VERSION__ = '0.7.1'

0 comments on commit 070c5f3

Please sign in to comment.