Compare commits
20 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 29f63ccb75 | |||
| 71702f5f7a | |||
| fb623ee4fc | |||
| 44a113d85d | |||
| d0bc302915 | |||
| 4cf494982e | |||
| bba3ecf4c1 | |||
| 0d763f267c | |||
| e785db369f | |||
| 4783ec5a32 | |||
| 73b187b5a8 | |||
| 532e81f165 | |||
| 4babb18676 | |||
| e7118162d4 | |||
| 425c8125d2 | |||
| aeb7e2907f | |||
| b17b3200fc | |||
| aa31b65750 | |||
| 886f7e0972 | |||
| 5fb1d9fe5b |
339
base.py
339
base.py
@@ -5,7 +5,6 @@ from collections import OrderedDict
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import getpass
|
import getpass
|
||||||
import h5py
|
import h5py
|
||||||
import inspect
|
|
||||||
import logging
|
import logging
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import platform
|
import platform
|
||||||
@@ -58,6 +57,7 @@ CENTRAL_WIDGET_MINIMUM_WIDTH = 1240
|
|||||||
SLS_CENTRAL_WIDGET_MINIMUM_HEIGHT = 840
|
SLS_CENTRAL_WIDGET_MINIMUM_HEIGHT = 840
|
||||||
SLS_CENTRAL_WIDGET_MINIMUM_WIDTH = 940
|
SLS_CENTRAL_WIDGET_MINIMUM_WIDTH = 940
|
||||||
|
|
||||||
|
|
||||||
class BaseWindow(QMainWindow):
|
class BaseWindow(QMainWindow):
|
||||||
""" BaseWindow
|
""" BaseWindow
|
||||||
"""
|
"""
|
||||||
@@ -75,14 +75,15 @@ class BaseWindow(QMainWindow):
|
|||||||
QThread.__init__(self)
|
QThread.__init__(self)
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
self.settings = self.parent.settings
|
self.settings = self.parent.settings
|
||||||
|
|
||||||
self.folder_name = folder_name
|
self.folder_name = folder_name
|
||||||
self.time_in_seconds = time_in_seconds
|
self.time_in_seconds = time_in_seconds
|
||||||
self.reanalysis_time = reanalysis_time
|
self.reanalysis_time = reanalysis_time
|
||||||
self.all_data = self.parent.all_data
|
self.all_data = self.parent.all_data
|
||||||
self.all_data_2 = self.parent.all_data_2
|
self.all_data_2 = self.parent.all_data_2
|
||||||
|
|
||||||
#Causes QThread::wait: Thread tried to wait on itself
|
# Causes QThread::wait: Thread tried to wait on itself
|
||||||
#def __del__(self):
|
# def __del__(self):
|
||||||
# self.wait()
|
# self.wait()
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
@@ -94,7 +95,7 @@ class BaseWindow(QMainWindow):
|
|||||||
reanalysis_time_in_seconds=self.reanalysis_time)
|
reanalysis_time_in_seconds=self.reanalysis_time)
|
||||||
|
|
||||||
def extract_and_attach(i, nfig, name, all_fig_data):
|
def extract_and_attach(i, nfig, name, all_fig_data):
|
||||||
canvas = 'Canvas {0}'.format(i+1)
|
canvas = 'Canvas {0}'.format(i + 1)
|
||||||
name_base = name.replace(' ', '_').lower()
|
name_base = name.replace(' ', '_').lower()
|
||||||
write_message_fired = False
|
write_message_fired = False
|
||||||
|
|
||||||
@@ -109,17 +110,28 @@ class BaseWindow(QMainWindow):
|
|||||||
|
|
||||||
name = name_base + "_{0}".format(
|
name = name_base + "_{0}".format(
|
||||||
idx) if idx > 0 else name_base
|
idx) if idx > 0 else name_base
|
||||||
|
|
||||||
save_dest = (folder_name + date_str + '_' + name +
|
save_dest = (folder_name + date_str + '_' + name +
|
||||||
'.png')
|
'.png')
|
||||||
|
|
||||||
|
|
||||||
if not os.path.exists(save_dest):
|
|
||||||
if all_fig_data[canvas][idx] is not None:
|
|
||||||
_dirname = os.path.dirname(save_dest)
|
_dirname = os.path.dirname(save_dest)
|
||||||
|
|
||||||
|
#print("DIRECTORY NAME IS ", _dirname)
|
||||||
|
# print("exists?", os.path.exists(_dirname),
|
||||||
|
# os.path.exists(save_dest))
|
||||||
|
|
||||||
|
if not os.path.isfile(save_dest):
|
||||||
|
if all_fig_data[canvas][idx] is not None:
|
||||||
|
|
||||||
|
if not os.path.exists(_dirname):
|
||||||
|
|
||||||
|
os.makedirs(_dirname)
|
||||||
|
|
||||||
if os.access(_dirname, os.W_OK):
|
if os.access(_dirname, os.W_OK):
|
||||||
|
|
||||||
all_fig_data[canvas][idx].savefig(save_dest)
|
all_fig_data[canvas][idx].savefig(
|
||||||
|
save_dest)
|
||||||
|
|
||||||
elif not write_message_fired:
|
elif not write_message_fired:
|
||||||
|
|
||||||
_mess = ("Do not have write permission " +
|
_mess = ("Do not have write permission " +
|
||||||
@@ -133,46 +145,41 @@ class BaseWindow(QMainWindow):
|
|||||||
_line(), _mess, {})
|
_line(), _mess, {})
|
||||||
write_message_fired = True
|
write_message_fired = True
|
||||||
|
|
||||||
|
|
||||||
if not write_message_fired:
|
if not write_message_fired:
|
||||||
attach_files.append(save_dest)
|
attach_files.append(save_dest)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
resultsSeq = self.settings.data["GUI"]["resultsSeq"]
|
resultsSeq = self.settings.data["GUI"]["resultsSeq"]
|
||||||
titleSeq = self.settings.data["GUI"]["subResultsTabTitle"]
|
titleSeq = self.settings.data["GUI"]["subResultsTabTitle"]
|
||||||
if self.all_data:
|
if self.all_data:
|
||||||
fig_data = self.all_data['Figure data']
|
fig_data = self.all_data['Figure data']
|
||||||
for i, (nfig, name) in enumerate(zip(resultsSeq, titleSeq)):
|
for i, (nfig, name) in enumerate(
|
||||||
|
zip(resultsSeq, titleSeq)):
|
||||||
print(i, nfig, name, flush=True)
|
print(i, nfig, name, flush=True)
|
||||||
print(fig_data, flush=True)
|
print(fig_data, flush=True)
|
||||||
extract_and_attach(i, nfig, name, fig_data)
|
extract_and_attach(i, nfig, name, fig_data)
|
||||||
except KeyError as ex:
|
except KeyError as ex:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
resultsSeq = self.settings.data["GUI2"]["resultsSeq"]
|
resultsSeq = self.settings.data["GUI2"]["resultsSeq"]
|
||||||
titleSeq = self.settings.data["GUI2"]["subResultsTabTitle"]
|
titleSeq = self.settings.data["GUI2"]["subResultsTabTitle"]
|
||||||
if self.all_data_2:
|
if self.all_data_2:
|
||||||
fig_data = self.all_data_2['Figure data']
|
fig_data = self.all_data_2['Figure data']
|
||||||
for i, (nfig, name) in enumerate(zip(resultsSeq, titleSeq)):
|
for i, (nfig, name) in enumerate(
|
||||||
|
zip(resultsSeq, titleSeq)):
|
||||||
extract_and_attach(i, nfig, name, fig_data)
|
extract_and_attach(i, nfig, name, fig_data)
|
||||||
except KeyError as ex:
|
except KeyError as ex:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
# Not so nice.. send a signal instead?
|
||||||
|
|
||||||
#Not so nice.. send a signal instead?
|
|
||||||
if attach_files:
|
if attach_files:
|
||||||
self.parent.attach_files = attach_files
|
self.parent.attach_files = attach_files
|
||||||
print(attach_files, flush=True)
|
print(attach_files, flush=True)
|
||||||
print("All files attached", flush=True)
|
print("All files attached", flush=True)
|
||||||
else:
|
else:
|
||||||
print("No files to attach", flush=True)
|
print("No files to attach", flush=True)
|
||||||
time.sleep(0.1) #avoid race condition
|
time.sleep(0.1) # avoid race condition
|
||||||
|
|
||||||
class HDFSave(QThread):
|
class HDFSave(QThread):
|
||||||
"""Thread for hdf analysis
|
"""Thread for hdf analysis
|
||||||
@@ -181,11 +188,11 @@ class BaseWindow(QMainWindow):
|
|||||||
def __init__(self, parent, from_dialog):
|
def __init__(self, parent, from_dialog):
|
||||||
QThread.__init__(self)
|
QThread.__init__(self)
|
||||||
self.parent = parent
|
self.parent = parent
|
||||||
self.from_dialog=from_dialog
|
self.from_dialog = from_dialog
|
||||||
|
|
||||||
#Only a precaution, not experienced
|
# Only a precaution, not experienced
|
||||||
#Causes QThread::wait: Thread tried to wait on itself
|
# Causes QThread::wait: Thread tried to wait on itself
|
||||||
#def __del__(self):
|
# def __del__(self):
|
||||||
# self.wait()
|
# self.wait()
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
@@ -194,7 +201,7 @@ class BaseWindow(QMainWindow):
|
|||||||
QApplication.processEvents(QEventLoop.ExcludeUserInputEvents, 5000)
|
QApplication.processEvents(QEventLoop.ExcludeUserInputEvents, 5000)
|
||||||
|
|
||||||
self.all_data = self.parent.all_data
|
self.all_data = self.parent.all_data
|
||||||
#Reanalysis data
|
# Reanalysis data
|
||||||
|
|
||||||
if self.all_data is not None:
|
if self.all_data is not None:
|
||||||
try:
|
try:
|
||||||
@@ -218,7 +225,7 @@ class BaseWindow(QMainWindow):
|
|||||||
now_in_seconds = self.all_data['Processed data'][
|
now_in_seconds = self.all_data['Processed data'][
|
||||||
'Reanalysis time in seconds']
|
'Reanalysis time in seconds']
|
||||||
|
|
||||||
#Double check
|
# Double check
|
||||||
if not from_hdf:
|
if not from_hdf:
|
||||||
if 'from_hdf' in self.all_data['Processed data']:
|
if 'from_hdf' in self.all_data['Processed data']:
|
||||||
from_hdf = bool(self.all_data['Processed data'][
|
from_hdf = bool(self.all_data['Processed data'][
|
||||||
@@ -229,8 +236,8 @@ class BaseWindow(QMainWindow):
|
|||||||
|
|
||||||
self.parent.from_hdf = from_hdf
|
self.parent.from_hdf = from_hdf
|
||||||
|
|
||||||
print("t=========================>", ts_in_seconds, " // ", now_in_seconds)
|
print("t", ts_in_seconds, now_in_seconds)
|
||||||
print("from hdf5=========================>", from_hdf)
|
print("from hdf5, dialog=====>", from_hdf, self.from_dialog)
|
||||||
|
|
||||||
if self.parent.hdf_filename is None or not self.from_dialog:
|
if self.parent.hdf_filename is None or not self.from_dialog:
|
||||||
self.parent.set_new_hdf_filename(ts_in_seconds,
|
self.parent.set_new_hdf_filename(ts_in_seconds,
|
||||||
@@ -239,19 +246,19 @@ class BaseWindow(QMainWindow):
|
|||||||
print("FILENAME ==", self.parent.hdf_filename, flush=True)
|
print("FILENAME ==", self.parent.hdf_filename, flush=True)
|
||||||
with h5py.File(self.parent.hdf_filename, 'w') as dataH5:
|
with h5py.File(self.parent.hdf_filename, 'w') as dataH5:
|
||||||
|
|
||||||
#experiment
|
# experiment
|
||||||
if not from_hdf:
|
if not from_hdf:
|
||||||
self.parent.add_pvs_to_hdf(
|
self.parent.add_pvs_to_hdf(
|
||||||
dataH5, pv_list=self.parent.pv_machine_list,
|
dataH5, pv_list=self.parent.pv_machine_list,
|
||||||
from_hdf=from_hdf)
|
from_hdf=from_hdf)
|
||||||
|
|
||||||
#general
|
# general
|
||||||
#if not from_hdf:
|
# if not from_hdf:
|
||||||
self.parent.add_general_to_hdf(dataH5)
|
self.parent.add_general_to_hdf(dataH5)
|
||||||
self.parent.add_to_hdf(dataH5, proc=True, raw=True)
|
self.parent.add_to_hdf(dataH5, proc=True, raw=True)
|
||||||
self.parent.hdf_save_completed = True
|
self.parent.hdf_save_completed = True
|
||||||
|
|
||||||
_mess = "Processed data saved to {}".format(
|
_mess = "Data saved to {}".format(
|
||||||
self.parent.hdf_filename)
|
self.parent.hdf_filename)
|
||||||
self.parent.trigger_log_message.emit(
|
self.parent.trigger_log_message.emit(
|
||||||
MsgSeverity.INFO.name, _pymodule, _line(), _mess,
|
MsgSeverity.INFO.name, _pymodule, _line(), _mess,
|
||||||
@@ -263,7 +270,6 @@ class BaseWindow(QMainWindow):
|
|||||||
MsgSeverity.ERROR.name, _pymodule, _line(), _mess, {})
|
MsgSeverity.ERROR.name, _pymodule, _line(), _mess, {})
|
||||||
self.parent.hdf_save_completed = False
|
self.parent.hdf_save_completed = False
|
||||||
|
|
||||||
|
|
||||||
class HDFThread(QThread):
|
class HDFThread(QThread):
|
||||||
"""Thread for hdf analysis
|
"""Thread for hdf analysis
|
||||||
"""
|
"""
|
||||||
@@ -276,9 +282,9 @@ class BaseWindow(QMainWindow):
|
|||||||
self.all_data = all_data
|
self.all_data = all_data
|
||||||
self.hdf_filename_loaded = self.parent.hdf_filename_loaded
|
self.hdf_filename_loaded = self.parent.hdf_filename_loaded
|
||||||
|
|
||||||
#Only a precaution, not experienced
|
# Only a precaution, not experienced
|
||||||
#Causes QThread::wait: Thread tried to wait on itself
|
# Causes QThread::wait: Thread tried to wait on itself
|
||||||
#def __del__(self):
|
# def __del__(self):
|
||||||
# self.wait()
|
# self.wait()
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
@@ -289,7 +295,7 @@ class BaseWindow(QMainWindow):
|
|||||||
mess = ("Analysis not configured for HDF analysis! " +
|
mess = ("Analysis not configured for HDF analysis! " +
|
||||||
"Missing method: load_hdf_file")
|
"Missing method: load_hdf_file")
|
||||||
self.parent.trigger_log_message.emit(
|
self.parent.trigger_log_message.emit(
|
||||||
MsgSeverity.ERROR.name,_pymodule, _line(), mess, {})
|
MsgSeverity.ERROR.name, _pymodule, _line(), mess, {})
|
||||||
self.parent.trigger_progressbar.emit(PROGRESS_THREAD_END)
|
self.parent.trigger_progressbar.emit(PROGRESS_THREAD_END)
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -313,7 +319,7 @@ class BaseWindow(QMainWindow):
|
|||||||
expt_dict = None
|
expt_dict = None
|
||||||
pass
|
pass
|
||||||
|
|
||||||
#Open hdf5file here and
|
# Open hdf5file here and
|
||||||
mess = "HDF file {} analysis proceeding...".format(
|
mess = "HDF file {} analysis proceeding...".format(
|
||||||
self.hdf_filename_loaded)
|
self.hdf_filename_loaded)
|
||||||
self.parent.trigger_log_message.emit(MsgSeverity.INFO.name,
|
self.parent.trigger_log_message.emit(MsgSeverity.INFO.name,
|
||||||
@@ -339,14 +345,13 @@ class BaseWindow(QMainWindow):
|
|||||||
self.parent.trigger_log_message.emit(
|
self.parent.trigger_log_message.emit(
|
||||||
MsgSeverity.ERROR.name, _pymodule, _line(), mess, {})
|
MsgSeverity.ERROR.name, _pymodule, _line(), mess, {})
|
||||||
|
|
||||||
|
|
||||||
class AnalysisThread(QThread):
|
class AnalysisThread(QThread):
|
||||||
"""Analysis thread
|
"""Analysis thread
|
||||||
"""
|
"""
|
||||||
trigger_thread_event = Signal(dict)
|
trigger_thread_event = Signal(dict)
|
||||||
|
|
||||||
def __init__(self, parent, analysis_procedure, input_parameters,
|
def __init__(self, parent, analysis_procedure, input_parameters,
|
||||||
messages: dict={
|
messages: dict = {
|
||||||
"success": "Analysis completed", "fail":
|
"success": "Analysis completed", "fail":
|
||||||
"No data returned from analysis procedure"}):
|
"No data returned from analysis procedure"}):
|
||||||
|
|
||||||
@@ -367,13 +372,16 @@ class BaseWindow(QMainWindow):
|
|||||||
def run(self):
|
def run(self):
|
||||||
"""Run thread
|
"""Run thread
|
||||||
"""
|
"""
|
||||||
print("RUN IN BASE CLASS", flush=True)
|
print("RUN ANLYSIS THREAD FROM WITHIN IN BASE CLASS", flush=True)
|
||||||
|
|
||||||
|
# Reset all_data fro parent
|
||||||
|
self.parent.all_data = None
|
||||||
|
|
||||||
all_dict = self.analysis_procedure.measure_and_analyze(
|
all_dict = self.analysis_procedure.measure_and_analyze(
|
||||||
self.input_parameters)
|
self.input_parameters)
|
||||||
|
|
||||||
# Emit results
|
# Emit results
|
||||||
if all_dict:
|
if all_dict is not None:
|
||||||
self.trigger_thread_event.emit(all_dict)
|
self.trigger_thread_event.emit(all_dict)
|
||||||
mess = self.messages['success']
|
mess = self.messages['success']
|
||||||
self.parent.trigger_log_message.emit(
|
self.parent.trigger_log_message.emit(
|
||||||
@@ -383,7 +391,6 @@ class BaseWindow(QMainWindow):
|
|||||||
self.parent.trigger_log_message.emit(
|
self.parent.trigger_log_message.emit(
|
||||||
MsgSeverity.WARN.name, _pymodule, _line(), mess, {})
|
MsgSeverity.WARN.name, _pymodule, _line(), mess, {})
|
||||||
|
|
||||||
|
|
||||||
def __init__(self, parent=None, pymodule=None, appversion=None, title="",
|
def __init__(self, parent=None, pymodule=None, appversion=None, title="",
|
||||||
user_mode=UserMode.OPERATION, facility=Facility.SwissFEL,
|
user_mode=UserMode.OPERATION, facility=Facility.SwissFEL,
|
||||||
extended=True, has_optics=True, has_procedure=True):
|
extended=True, has_optics=True, has_procedure=True):
|
||||||
@@ -395,13 +402,11 @@ class BaseWindow(QMainWindow):
|
|||||||
self.appversion = appversion if appversion else _appversion
|
self.appversion = appversion if appversion else _appversion
|
||||||
self.source_file = None
|
self.source_file = None
|
||||||
self.author = _author
|
self.author = _author
|
||||||
self.appversion = _appversion
|
|
||||||
self.title = title
|
self.title = title
|
||||||
self.facility = facility
|
self.facility = facility
|
||||||
self.user_mode = user_mode
|
self.user_mode = user_mode
|
||||||
self.appname, self.appext = self.pymodule.split(".")
|
self.appname, self.appext = self.pymodule.split(".")
|
||||||
|
|
||||||
|
|
||||||
print("=============================================")
|
print("=============================================")
|
||||||
print("Starting {0} at: {1}".format(self.appname, datetime.now()))
|
print("Starting {0} at: {1}".format(self.appname, datetime.now()))
|
||||||
print("User: {0} Host: {1}".format(os.getlogin(), os.uname()[1]))
|
print("User: {0} Host: {1}".format(os.getlogin(), os.uname()[1]))
|
||||||
@@ -409,7 +414,7 @@ class BaseWindow(QMainWindow):
|
|||||||
|
|
||||||
self.settings = ReadJSON(self.appname)
|
self.settings = ReadJSON(self.appname)
|
||||||
|
|
||||||
#Read out current_logbook
|
# Read out current_logbook
|
||||||
|
|
||||||
self.cafe = PyCafe.CyCafe()
|
self.cafe = PyCafe.CyCafe()
|
||||||
self.cyca = PyCafe.CyCa()
|
self.cyca = PyCafe.CyCa()
|
||||||
@@ -425,8 +430,9 @@ class BaseWindow(QMainWindow):
|
|||||||
self.screenshot_items = []
|
self.screenshot_items = []
|
||||||
|
|
||||||
self.filename = None
|
self.filename = None
|
||||||
self.hdf_filename_loaded = "NONE" #For loading into hdf dockwidget
|
self.hdf_filename_loaded = "NONE" # For loading into hdf dockwidget
|
||||||
self.hdf_filename = None #For saving
|
self.hdf_filename = None # For saving
|
||||||
|
self.hdf_user_dict = {}
|
||||||
self.hdf_dialog = None
|
self.hdf_dialog = None
|
||||||
self.from_hdf = False
|
self.from_hdf = False
|
||||||
|
|
||||||
@@ -441,9 +447,13 @@ class BaseWindow(QMainWindow):
|
|||||||
|
|
||||||
self.menu = self.menuBar()
|
self.menu = self.menuBar()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
self.elog_dest = self.settings.data["Elog"]["destination"]
|
self.elog_dest = self.settings.data["Elog"]["destination"]
|
||||||
|
|
||||||
|
try:
|
||||||
|
self.elog_add_date_to_dir = self.settings.data["Elog"]["addDateToDir"]
|
||||||
|
except KeyError:
|
||||||
|
self.elog_add_date_to_dir = True
|
||||||
|
|
||||||
self.screenshot_dest = self.settings.data["screenshot"]["destination"]
|
self.screenshot_dest = self.settings.data["screenshot"]["destination"]
|
||||||
self.stdlog_dest = (self.settings.data["stdlog"]["destination"] +
|
self.stdlog_dest = (self.settings.data["stdlog"]["destination"] +
|
||||||
self.appname + "-" + os.getlogin() + ".log")
|
self.appname + "-" + os.getlogin() + ".log")
|
||||||
@@ -482,16 +492,15 @@ class BaseWindow(QMainWindow):
|
|||||||
|
|
||||||
self.hdf_save_completed = False if self.autopost_hdf else True
|
self.hdf_save_completed = False if self.autopost_hdf else True
|
||||||
|
|
||||||
|
self.all_input_parameters = {} # gui
|
||||||
|
self.all_input_labels = {} # gui
|
||||||
|
self.all_expert_parameters = {} # gui
|
||||||
|
self.all_expert_labels = {} # gui
|
||||||
|
|
||||||
self.all_input_parameters = {} #gui
|
self.input_parameters = {} # analysis thread
|
||||||
self.all_input_labels = {} #gui
|
|
||||||
self.all_expert_parameters = {} #gui
|
|
||||||
self.all_expert_labels = {} #gui
|
|
||||||
|
|
||||||
self.input_parameters = {} #analysis thread
|
|
||||||
self.input_labels = {}
|
self.input_labels = {}
|
||||||
#self.input_value_dict = {}
|
#self.input_value_dict = {}
|
||||||
self.expert_parameters = {} #added to input_parameters
|
self.expert_parameters = {} # added to input_parameters
|
||||||
self.expert_labels = {}
|
self.expert_labels = {}
|
||||||
|
|
||||||
self.read_input_parameters()
|
self.read_input_parameters()
|
||||||
@@ -510,8 +519,8 @@ class BaseWindow(QMainWindow):
|
|||||||
print(("Base class without user supplied AnalysisProcedure class."
|
print(("Base class without user supplied AnalysisProcedure class."
|
||||||
+ " import Error:"), e, flush=True)
|
+ " import Error:"), e, flush=True)
|
||||||
|
|
||||||
##self.trigger_elog_entry.connect(self.receive_elog_notification)
|
# self.trigger_elog_entry.connect(self.receive_elog_notification)
|
||||||
##self.trigger_hdf_save.connect(self.save_to_hdf)
|
# self.trigger_hdf_save.connect(self.save_to_hdf)
|
||||||
|
|
||||||
self.msg_severity_qcolor = {
|
self.msg_severity_qcolor = {
|
||||||
MsgSeverity.FATAL: QColor(
|
MsgSeverity.FATAL: QColor(
|
||||||
@@ -540,7 +549,7 @@ class BaseWindow(QMainWindow):
|
|||||||
self.settings.data["MsgSeverity"]["debug"])
|
self.settings.data["MsgSeverity"]["debug"])
|
||||||
}
|
}
|
||||||
|
|
||||||
#QSetttings
|
# QSetttings
|
||||||
self.restore_application_settings()
|
self.restore_application_settings()
|
||||||
|
|
||||||
self.init_toolbar()
|
self.init_toolbar()
|
||||||
@@ -599,7 +608,6 @@ class BaseWindow(QMainWindow):
|
|||||||
self.show_log_message(MsgSeverity.INFO.name, _pymodule, _line(),
|
self.show_log_message(MsgSeverity.INFO.name, _pymodule, _line(),
|
||||||
"Application configured")
|
"Application configured")
|
||||||
|
|
||||||
|
|
||||||
def read_input_parameters(self):
|
def read_input_parameters(self):
|
||||||
|
|
||||||
for key, dictval in self.settings.data["Parameters"].items():
|
for key, dictval in self.settings.data["Parameters"].items():
|
||||||
@@ -643,7 +651,6 @@ class BaseWindow(QMainWindow):
|
|||||||
self.all_input_labels[key] = dictval["data"]["text"]
|
self.all_input_labels[key] = dictval["data"]["text"]
|
||||||
#print(key, self.settings.data["Parameters"][key]["flag"])
|
#print(key, self.settings.data["Parameters"][key]["flag"])
|
||||||
|
|
||||||
|
|
||||||
if "Expert" not in self.settings.data:
|
if "Expert" not in self.settings.data:
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -688,7 +695,6 @@ class BaseWindow(QMainWindow):
|
|||||||
self.expert_labels[key] = dictval["data"]["text"]
|
self.expert_labels[key] = dictval["data"]["text"]
|
||||||
self.all_expert_labels[key] = dictval["data"]["text"]
|
self.all_expert_labels[key] = dictval["data"]["text"]
|
||||||
|
|
||||||
|
|
||||||
def init_toolbar(self):
|
def init_toolbar(self):
|
||||||
""" Prepare toolbar
|
""" Prepare toolbar
|
||||||
"""
|
"""
|
||||||
@@ -716,7 +722,7 @@ class BaseWindow(QMainWindow):
|
|||||||
#menu_daq = self.menu.addMenu("&DAQ")
|
#menu_daq = self.menu.addMenu("&DAQ")
|
||||||
#menu_daq_actions = []
|
#menu_daq_actions = []
|
||||||
#daq_toolbar = self.addToolBar("DAQ")
|
#daq_toolbar = self.addToolBar("DAQ")
|
||||||
#daq_toolbar.setObjectName("ViewToolBar")
|
# daq_toolbar.setObjectName("ViewToolBar")
|
||||||
|
|
||||||
help_toolbar = self.addToolBar("Help")
|
help_toolbar = self.addToolBar("Help")
|
||||||
help_toolbar.setObjectName("HelpToolBar")
|
help_toolbar.setObjectName("HelpToolBar")
|
||||||
@@ -786,7 +792,7 @@ class BaseWindow(QMainWindow):
|
|||||||
"Save&ALL", slot=self.write_to_destinations,
|
"Save&ALL", slot=self.write_to_destinations,
|
||||||
shortcut="Ctrl+Z", icon="save_all", tip="Save All")
|
shortcut="Ctrl+Z", icon="save_all", tip="Save All")
|
||||||
|
|
||||||
#toolbar
|
# toolbar
|
||||||
# Place ExitWidget on the far right
|
# Place ExitWidget on the far right
|
||||||
exit_toolbar = self.addToolBar("EXIT")
|
exit_toolbar = self.addToolBar("EXIT")
|
||||||
exit_toolbar.setObjectName("ExitToolBar")
|
exit_toolbar.setObjectName("ExitToolBar")
|
||||||
@@ -796,20 +802,21 @@ class BaseWindow(QMainWindow):
|
|||||||
exit_toolbar.addWidget(spacer_wgt)
|
exit_toolbar.addWidget(spacer_wgt)
|
||||||
#_qsize = exit_toolbar.iconSize()
|
#_qsize = exit_toolbar.iconSize()
|
||||||
#print("qsize", _qsize)
|
#print("qsize", _qsize)
|
||||||
true_list = [self.autopost_epics, self.autopost_hdf, self.autopost_elog]
|
true_list = [
|
||||||
|
self.autopost_epics,
|
||||||
|
self.autopost_hdf,
|
||||||
|
self.autopost_elog]
|
||||||
|
|
||||||
if true_list.count(True) > 1:
|
if true_list.count(True) > 1:
|
||||||
exit_toolbar.setIconSize(QSize(true_list.count(True)*30+10, 24))
|
exit_toolbar.setIconSize(
|
||||||
#exit_toolbar.setIconSize(_qsize)
|
QSize(true_list.count(True) * 30 + 10, 24))
|
||||||
|
# exit_toolbar.setIconSize(_qsize)
|
||||||
self.add_actions(exit_toolbar, (
|
self.add_actions(exit_toolbar, (
|
||||||
save_all_action, "Space", None, "Space", quit_action))
|
save_all_action, "Space", None, "Space", quit_action))
|
||||||
else:
|
else:
|
||||||
self.add_actions(exit_toolbar, (quit_action,))
|
self.add_actions(exit_toolbar, (quit_action,))
|
||||||
|
|
||||||
|
def combine_save_icons(self): # epics=False, hdf=False, elog=False):
|
||||||
|
|
||||||
|
|
||||||
def combine_save_icons(self): #epics=False, hdf=False, elog=False):
|
|
||||||
|
|
||||||
epics = self.autopost_epics
|
epics = self.autopost_epics
|
||||||
hdf = self.autopost_hdf
|
hdf = self.autopost_hdf
|
||||||
@@ -835,9 +842,9 @@ class BaseWindow(QMainWindow):
|
|||||||
elif hdf:
|
elif hdf:
|
||||||
startx2 = 20
|
startx2 = 20
|
||||||
startx3 = 150
|
startx3 = 150
|
||||||
comboPixmap = QPixmap(130*true_list.count(True), 100) #420, 100
|
comboPixmap = QPixmap(130 * true_list.count(True), 100) # 420, 100
|
||||||
#comboPixmap.fill(Qt.transparent)
|
# comboPixmap.fill(Qt.transparent)
|
||||||
comboPixmap.fill(QColor("#dcdcdc")) #"#bcc6cc"
|
comboPixmap.fill(QColor("#dcdcdc")) # "#bcc6cc"
|
||||||
epicsImage = QPixmap(":/epics.png")
|
epicsImage = QPixmap(":/epics.png")
|
||||||
hdfImage = QPixmap(":/hdfS.png")
|
hdfImage = QPixmap(":/hdfS.png")
|
||||||
elogImage = QPixmap(":/elog.png")
|
elogImage = QPixmap(":/elog.png")
|
||||||
@@ -852,8 +859,8 @@ class BaseWindow(QMainWindow):
|
|||||||
painter.end()
|
painter.end()
|
||||||
return combinedIcon
|
return combinedIcon
|
||||||
|
|
||||||
|
# Actions
|
||||||
|
|
||||||
################# Actions
|
|
||||||
def add_actions(self, target, actions):
|
def add_actions(self, target, actions):
|
||||||
""" Add to toolbar
|
""" Add to toolbar
|
||||||
"""
|
"""
|
||||||
@@ -868,7 +875,7 @@ class BaseWindow(QMainWindow):
|
|||||||
target.addAction(action)
|
target.addAction(action)
|
||||||
|
|
||||||
def create_action(self, text, slot=None, shortcut=None, icon=None, tip=None,
|
def create_action(self, text, slot=None, shortcut=None, icon=None, tip=None,
|
||||||
checkable=False):# signal="triggered()"):
|
checkable=False): # signal="triggered()"):
|
||||||
""" Helper fn
|
""" Helper fn
|
||||||
"""
|
"""
|
||||||
action = QAction(text, self)
|
action = QAction(text, self)
|
||||||
@@ -888,8 +895,6 @@ class BaseWindow(QMainWindow):
|
|||||||
action.setCheckable(True)
|
action.setCheckable(True)
|
||||||
return action
|
return action
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def verify_close_event(self):
|
def verify_close_event(self):
|
||||||
""" Overrides QMainWindow method
|
""" Overrides QMainWindow method
|
||||||
"""
|
"""
|
||||||
@@ -930,13 +935,13 @@ class BaseWindow(QMainWindow):
|
|||||||
def closeEvent(self, event):
|
def closeEvent(self, event):
|
||||||
""" Overrides QMainWindow method
|
""" Overrides QMainWindow method
|
||||||
"""
|
"""
|
||||||
#Close all dock widgets
|
# Close all dock widgets
|
||||||
#self.removeDockWidget(self.hdf_dock_widget)
|
# self.removeDockWidget(self.hdf_dock_widget)
|
||||||
self.logger.info("Closing Application")
|
self.logger.info("Closing Application")
|
||||||
print("Closing Application", flush=True)
|
print("Closing Application", flush=True)
|
||||||
self.save_application_settings()
|
self.save_application_settings()
|
||||||
QApplication.processEvents()
|
QApplication.processEvents()
|
||||||
#print( ("Stopping Monitors. This may on occasion lead to " +
|
# print( ("Stopping Monitors. This may on occasion lead to " +
|
||||||
# "NO CYTHON CALLBACK MATCH FOUND notices"), flush=True)
|
# "NO CYTHON CALLBACK MATCH FOUND notices"), flush=True)
|
||||||
self.cafe.monitorStopAll()
|
self.cafe.monitorStopAll()
|
||||||
time.sleep(0.05)
|
time.sleep(0.05)
|
||||||
@@ -1015,16 +1020,15 @@ class BaseWindow(QMainWindow):
|
|||||||
qdialog.setLayout(layout)
|
qdialog.setLayout(layout)
|
||||||
qdialog.show()
|
qdialog.show()
|
||||||
|
|
||||||
|
# def save_to_hdf_started(self):
|
||||||
#def save_to_hdf_started(self):
|
|
||||||
# QApplication.processEvents()
|
# QApplication.processEvents()
|
||||||
#def save_to_hdf_finished(self):
|
# def save_to_hdf_finished(self):
|
||||||
# QApplication.processEvents()
|
# QApplication.processEvents()
|
||||||
|
|
||||||
@Slot()
|
@Slot()
|
||||||
def write_to_destinations(self):
|
def write_to_destinations(self):
|
||||||
#disable signal
|
# disable signal
|
||||||
#self.gui_frame.autopost_save.blockSignals(True)
|
# self.gui_frame.autopost_save.blockSignals(True)
|
||||||
QApplication.processEvents()
|
QApplication.processEvents()
|
||||||
if self.autopost_epics:
|
if self.autopost_epics:
|
||||||
self.save_to_epics()
|
self.save_to_epics()
|
||||||
@@ -1037,9 +1041,8 @@ class BaseWindow(QMainWindow):
|
|||||||
if self.autopost_elog:
|
if self.autopost_elog:
|
||||||
self.send_to_elog()
|
self.send_to_elog()
|
||||||
QApplication.processEvents()
|
QApplication.processEvents()
|
||||||
#enable signal
|
# enable signal
|
||||||
#self.gui_frame.autopost_save.blockSignals(False)
|
# self.gui_frame.autopost_save.blockSignals(False)
|
||||||
|
|
||||||
|
|
||||||
def set_new_hdf_filename(self, time_in_seconds=None,
|
def set_new_hdf_filename(self, time_in_seconds=None,
|
||||||
reanalysis_time_in_seconds=None):
|
reanalysis_time_in_seconds=None):
|
||||||
@@ -1047,7 +1050,6 @@ class BaseWindow(QMainWindow):
|
|||||||
self.hdf_filename = (self.hdf_dest + self.add_date_to_path(
|
self.hdf_filename = (self.hdf_dest + self.add_date_to_path(
|
||||||
time_in_seconds, reanalysis_time_in_seconds) + ".h5")
|
time_in_seconds, reanalysis_time_in_seconds) + ".h5")
|
||||||
|
|
||||||
|
|
||||||
def add_date_to_path(self, time_in_seconds=None,
|
def add_date_to_path(self, time_in_seconds=None,
|
||||||
reanalysis_time_in_seconds=None):
|
reanalysis_time_in_seconds=None):
|
||||||
|
|
||||||
@@ -1069,9 +1071,11 @@ class BaseWindow(QMainWindow):
|
|||||||
_month = when.strftime("%m")
|
_month = when.strftime("%m")
|
||||||
_day = when.strftime("%d")
|
_day = when.strftime("%d")
|
||||||
|
|
||||||
|
if self.elog_add_date_to_dir:
|
||||||
return str(_year + "/" + _month + "/" + _day + "/" + self.appname +
|
return str(_year + "/" + _month + "/" + _day + "/" + self.appname +
|
||||||
"_" + _date_label)
|
"_" + _date_label)
|
||||||
|
else:
|
||||||
|
return str(self.appname + "_" + _date_label)
|
||||||
|
|
||||||
def verify_save_to_hdf(self):
|
def verify_save_to_hdf(self):
|
||||||
""" To be called by user from save_to_hdf
|
""" To be called by user from save_to_hdf
|
||||||
@@ -1103,7 +1107,6 @@ class BaseWindow(QMainWindow):
|
|||||||
QApplication.processEvents()
|
QApplication.processEvents()
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
if self.hdf_save_completed:
|
if self.hdf_save_completed:
|
||||||
_mess = "Data previously saved to hdf:\n{0}".format(
|
_mess = "Data previously saved to hdf:\n{0}".format(
|
||||||
self.hdf_filename)
|
self.hdf_filename)
|
||||||
@@ -1114,7 +1117,6 @@ class BaseWindow(QMainWindow):
|
|||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def add_to_hdf(self, dataH5=None, proc=True, raw=False):
|
def add_to_hdf(self, dataH5=None, proc=True, raw=False):
|
||||||
""" Abstract method to be overwritten by user. Optional.
|
""" Abstract method to be overwritten by user. Optional.
|
||||||
"""
|
"""
|
||||||
@@ -1144,7 +1146,6 @@ class BaseWindow(QMainWindow):
|
|||||||
)
|
)
|
||||||
QM.exec()
|
QM.exec()
|
||||||
|
|
||||||
|
|
||||||
def add_pvs_to_hdf(self, dataH5, top_group="experiment", pv_list=None,
|
def add_pvs_to_hdf(self, dataH5, top_group="experiment", pv_list=None,
|
||||||
from_hdf=False):
|
from_hdf=False):
|
||||||
|
|
||||||
@@ -1172,7 +1173,6 @@ class BaseWindow(QMainWindow):
|
|||||||
{})
|
{})
|
||||||
return isOK
|
return isOK
|
||||||
|
|
||||||
|
|
||||||
if from_hdf:
|
if from_hdf:
|
||||||
return isOK
|
return isOK
|
||||||
|
|
||||||
@@ -1198,20 +1198,23 @@ class BaseWindow(QMainWindow):
|
|||||||
MsgSeverity.WARN.name, _pymodule, _line(), _mess, {})
|
MsgSeverity.WARN.name, _pymodule, _line(), _mess, {})
|
||||||
return isOK
|
return isOK
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def add_general_to_hdf(self, dataH5):
|
def add_general_to_hdf(self, dataH5):
|
||||||
isOK = True
|
isOK = True
|
||||||
user_dict = {}
|
user_dict = {}
|
||||||
|
|
||||||
user_dict['Comment'] = self.hdf_dialog.user_dict[
|
#user_dict['Comment'] is prefilled in get_data in savehdf.py
|
||||||
'Comment'] if self.hdf_dialog is not None else str(
|
# user_dict['Comment'] = self.hdf_dialog.user_dict[
|
||||||
"HDF file generated via Save All button")
|
# 'Comment'] if self.hdf_dialog is not None else str(
|
||||||
|
# "HDF file generated via Save All button")
|
||||||
|
#user_dict['Comment'] = self.hdf_dialog.comment.document().toPlainText()
|
||||||
|
if self.hdf_user_dict:
|
||||||
|
user_dict['Comment'] = self.hdf_user_dict['Comment']
|
||||||
|
else:
|
||||||
|
user_dict['Comment'] = "HDF file generated via Save All button"
|
||||||
user_dict['Author'] = self.author
|
user_dict['Author'] = self.author
|
||||||
user_dict['Application'] = self.pymodule
|
user_dict['Application'] = self.pymodule
|
||||||
user_dict['Version'] = self.appversion
|
user_dict['Version'] = self.appversion
|
||||||
#user_dict['Comment'] = comment if comment is not None else str(
|
# user_dict['Comment'] = comment if comment is not None else str(
|
||||||
# "HDF file generated via Save All button")
|
# "HDF file generated via Save All button")
|
||||||
user_dict['Filepath'] = self.source_file
|
user_dict['Filepath'] = self.source_file
|
||||||
#user_dict['Process'] = os.getpid()
|
#user_dict['Process'] = os.getpid()
|
||||||
@@ -1245,13 +1248,12 @@ class BaseWindow(QMainWindow):
|
|||||||
MsgSeverity.WARN.name, _pymodule, _line(), _mess, {})
|
MsgSeverity.WARN.name, _pymodule, _line(), _mess, {})
|
||||||
return isOK
|
return isOK
|
||||||
|
|
||||||
|
|
||||||
@Slot()
|
@Slot()
|
||||||
def save_to_hdf_dialog(self):
|
def save_to_hdf_dialog(self):
|
||||||
""" This uses the widget interface to allow the user to enter
|
""" This uses the widget interface to allow the user to enter
|
||||||
additional meta-data
|
additional meta-data
|
||||||
"""
|
"""
|
||||||
|
print("save_to_hdf_dialog==>", flush=True)
|
||||||
if not self.verify_save_to_hdf():
|
if not self.verify_save_to_hdf():
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@@ -1274,7 +1276,6 @@ class BaseWindow(QMainWindow):
|
|||||||
self.hdf_dialog = QSaveHDF(self, input_options=input_options,
|
self.hdf_dialog = QSaveHDF(self, input_options=input_options,
|
||||||
from_dialog=True)
|
from_dialog=True)
|
||||||
|
|
||||||
|
|
||||||
def verify_send_to_elog(self):
|
def verify_send_to_elog(self):
|
||||||
|
|
||||||
if self.analysis_thread is not None:
|
if self.analysis_thread is not None:
|
||||||
@@ -1324,20 +1325,18 @@ class BaseWindow(QMainWindow):
|
|||||||
|
|
||||||
#_elog_sf = ElogSwissFEL()
|
#_elog_sf = ElogSwissFEL()
|
||||||
_logbook = None
|
_logbook = None
|
||||||
_category_idx = 0 #_elog_sf.category.MEASUREMENT=1
|
_category_idx = 0 # _elog_sf.category.MEASUREMENT=1
|
||||||
_domain_idx = 0 #_elog_sf.system.NONE
|
_domain_idx = 0 # _elog_sf.system.NONE
|
||||||
_section_idx = 0 #_elog_sf.system.BEAMDYNAMICS=1
|
_section_idx = 0 # _elog_sf.system.BEAMDYNAMICS=1
|
||||||
_attach_files = []
|
_attach_files = []
|
||||||
_message = ""
|
_message = ""
|
||||||
|
|
||||||
|
|
||||||
QSendToELOG(self, logbook=_logbook, categoryIdx=_category_idx,
|
QSendToELOG(self, logbook=_logbook, categoryIdx=_category_idx,
|
||||||
domainIdx=_domain_idx, sectionIdx=_section_idx,
|
domainIdx=_domain_idx, sectionIdx=_section_idx,
|
||||||
title=self.title, message=_message,
|
title=self.title, message=_message,
|
||||||
attachFile=_attach_files)
|
attachFile=_attach_files)
|
||||||
QApplication.processEvents()
|
QApplication.processEvents()
|
||||||
|
|
||||||
|
|
||||||
def initiate_cycling(self, pv_list=[]):
|
def initiate_cycling(self, pv_list=[]):
|
||||||
if not pv_list:
|
if not pv_list:
|
||||||
return False
|
return False
|
||||||
@@ -1395,7 +1394,7 @@ class BaseWindow(QMainWindow):
|
|||||||
while self.is_cycling(pv_cycle_quads):
|
while self.is_cycling(pv_cycle_quads):
|
||||||
time.sleep(0.005)
|
time.sleep(0.005)
|
||||||
QApplication.processEvents()
|
QApplication.processEvents()
|
||||||
if time.time()-start > timeout:
|
if time.time() - start > timeout:
|
||||||
_mess = ("Timeout ({0}s) reached for Cycling. " +
|
_mess = ("Timeout ({0}s) reached for Cycling. " +
|
||||||
"\nPlease check set points for " +
|
"\nPlease check set points for " +
|
||||||
"\nDeflector: {1} " +
|
"\nDeflector: {1} " +
|
||||||
@@ -1406,7 +1405,6 @@ class BaseWindow(QMainWindow):
|
|||||||
qm.warning(self, "Set Optics", _mess, QMessageBox.Ok)
|
qm.warning(self, "Set Optics", _mess, QMessageBox.Ok)
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
||||||
@Slot()
|
@Slot()
|
||||||
def set_optics(self):
|
def set_optics(self):
|
||||||
""" Abstract method to be overwritten by user
|
""" Abstract method to be overwritten by user
|
||||||
@@ -1429,12 +1427,11 @@ class BaseWindow(QMainWindow):
|
|||||||
)
|
)
|
||||||
QM.exec()
|
QM.exec()
|
||||||
|
|
||||||
|
|
||||||
def verify_save_to_epics(self):
|
def verify_save_to_epics(self):
|
||||||
""" To be called by user from save_to_epics
|
""" To be called by user from save_to_epics
|
||||||
"""
|
"""
|
||||||
if self.all_data:
|
if self.all_data:
|
||||||
#Data from hdf analysis - do not save to epics
|
# Data from hdf analysis - do not save to epics
|
||||||
if 'Reanalysis time' in self.all_data['Processed data']:
|
if 'Reanalysis time' in self.all_data['Processed data']:
|
||||||
if self.all_data['Processed data']['Reanalysis time']:
|
if self.all_data['Processed data']['Reanalysis time']:
|
||||||
print("HDF RUN - data not written to epics")
|
print("HDF RUN - data not written to epics")
|
||||||
@@ -1484,7 +1481,6 @@ class BaseWindow(QMainWindow):
|
|||||||
)
|
)
|
||||||
QM.exec()
|
QM.exec()
|
||||||
|
|
||||||
|
|
||||||
def send_to_log_window(self, pv_list: list = [], status: int = 1,
|
def send_to_log_window(self, pv_list: list = [], status: int = 1,
|
||||||
status_list: list = [], operation: str = 'set/get',
|
status_list: list = [], operation: str = 'set/get',
|
||||||
pymodule=_pymodule, line: int = _line()):
|
pymodule=_pymodule, line: int = _line()):
|
||||||
@@ -1504,11 +1500,9 @@ class BaseWindow(QMainWindow):
|
|||||||
"See Log window").format(ibad, len(status_list))
|
"See Log window").format(ibad, len(status_list))
|
||||||
self.statusbar.showMessage(_mess)
|
self.statusbar.showMessage(_mess)
|
||||||
|
|
||||||
|
|
||||||
def send_to_epics(self, pv_dict: dict = None, pv_names: list = None,
|
def send_to_epics(self, pv_dict: dict = None, pv_names: list = None,
|
||||||
pv_values: list = None) -> (int, list):
|
pv_values: list = None) -> (int, list):
|
||||||
|
|
||||||
|
|
||||||
if pv_dict is not None:
|
if pv_dict is not None:
|
||||||
pv_values = []
|
pv_values = []
|
||||||
pv_names = list(pv_dict.keys())
|
pv_names = list(pv_dict.keys())
|
||||||
@@ -1538,15 +1532,15 @@ class BaseWindow(QMainWindow):
|
|||||||
status = self.cyca.ICAFE_NORMAL
|
status = self.cyca.ICAFE_NORMAL
|
||||||
status_list = []
|
status_list = []
|
||||||
try:
|
try:
|
||||||
status, status_list = self.cafe.setCompoundList(pv_names, pv_values)
|
status, status_list = self.cafe.setCompoundList(
|
||||||
except:
|
pv_names, pv_values)
|
||||||
|
except BaseException:
|
||||||
print("Exception raised in cafe.setCompoundList", flush=True)
|
print("Exception raised in cafe.setCompoundList", flush=True)
|
||||||
status = self.cyca.ECAFE_BADTYPE
|
status = self.cyca.ECAFE_BADTYPE
|
||||||
for pv, val in zip(pv_names, pv_values):
|
for pv, val in zip(pv_names, pv_values):
|
||||||
print("pv/val", pv, val, flush=True)
|
print("pv/val", pv, val, flush=True)
|
||||||
status_list.append(self.ECAFE_BADTYPE)
|
status_list.append(self.ECAFE_BADTYPE)
|
||||||
|
|
||||||
|
|
||||||
if status != self.cyca.ICAFE_NORMAL:
|
if status != self.cyca.ICAFE_NORMAL:
|
||||||
ibad = 0
|
ibad = 0
|
||||||
for _status, _pv in zip(status_list, pv_names):
|
for _status, _pv in zip(status_list, pv_names):
|
||||||
@@ -1589,7 +1583,7 @@ class BaseWindow(QMainWindow):
|
|||||||
self.printer.paperRect().y() +
|
self.printer.paperRect().y() +
|
||||||
self.printer.pageRect().height() / 2)
|
self.printer.pageRect().height() / 2)
|
||||||
painter.scale(scale, scale)
|
painter.scale(scale, scale)
|
||||||
painter.translate(-w.width()/2, -w.height()/2)
|
painter.translate(-w.width() / 2, -w.height() / 2)
|
||||||
w.render(painter)
|
w.render(painter)
|
||||||
|
|
||||||
@Slot()
|
@Slot()
|
||||||
@@ -1648,7 +1642,7 @@ class BaseWindow(QMainWindow):
|
|||||||
self.screenshot_titles.clear()
|
self.screenshot_titles.clear()
|
||||||
self.screenshot_items.clear()
|
self.screenshot_items.clear()
|
||||||
|
|
||||||
############################### Init
|
# Init
|
||||||
def init_statusbar_wgt(self):
|
def init_statusbar_wgt(self):
|
||||||
""" Configure statusbar
|
""" Configure statusbar
|
||||||
"""
|
"""
|
||||||
@@ -1675,7 +1669,7 @@ class BaseWindow(QMainWindow):
|
|||||||
layout="Hor")
|
layout="Hor")
|
||||||
self.hdf_dock_widget.setObjectName("hdfDockWidget")
|
self.hdf_dock_widget.setObjectName("hdfDockWidget")
|
||||||
self.hdf_dock_widget.setVisible(False)
|
self.hdf_dock_widget.setVisible(False)
|
||||||
#hdfDockWidget.setFloating(True)
|
# hdfDockWidget.setFloating(True)
|
||||||
self.hdf_dock_widget.setContentsMargins(9, 9, 9, 9)
|
self.hdf_dock_widget.setContentsMargins(9, 9, 9, 9)
|
||||||
self.h5_groupbox.analyze_h5_widget.clicked.connect(
|
self.h5_groupbox.analyze_h5_widget.clicked.connect(
|
||||||
self.start_hdf_thread)
|
self.start_hdf_thread)
|
||||||
@@ -1707,7 +1701,7 @@ class BaseWindow(QMainWindow):
|
|||||||
settings.setValue("BaseWindow/Geometry", (self.saveGeometry()))
|
settings.setValue("BaseWindow/Geometry", (self.saveGeometry()))
|
||||||
settings.setValue("BaseWindow/State", (self.saveState()))
|
settings.setValue("BaseWindow/State", (self.saveState()))
|
||||||
|
|
||||||
#To be overloaded by user
|
# To be overloaded by user
|
||||||
def load_hdf_file(self):
|
def load_hdf_file(self):
|
||||||
""" load_hdf5 file into analysis dictionary
|
""" load_hdf5 file into analysis dictionary
|
||||||
"""
|
"""
|
||||||
@@ -1737,31 +1731,31 @@ class BaseWindow(QMainWindow):
|
|||||||
_mess, QMessageBox.Ok)
|
_mess, QMessageBox.Ok)
|
||||||
return
|
return
|
||||||
|
|
||||||
#self.hdf_thread_started()
|
# self.hdf_thread_started()
|
||||||
self.statusbar.showMessage("Loading {0}".format(
|
self.statusbar.showMessage("Loading {0}".format(
|
||||||
self.hdf_filename_loaded))
|
self.hdf_filename_loaded))
|
||||||
self.trigger_progressbar_str.emit(
|
self.trigger_progressbar_str.emit(
|
||||||
5, "Loading HDF file for analysis")
|
5, "Loading HDF file for analysis")
|
||||||
#Fill all data from HDF file
|
# Fill all data from HDF file
|
||||||
###hdf_all_data = self.load_hdf_file()
|
###hdf_all_data = self.load_hdf_file()
|
||||||
|
|
||||||
###if not hdf_all_data:
|
# if not hdf_all_data:
|
||||||
### self.hdf_thread_finished()
|
# self.hdf_thread_finished()
|
||||||
### return
|
# return
|
||||||
|
|
||||||
self.hdf_thread = self.HDFThread(
|
self.hdf_thread = self.HDFThread(
|
||||||
self, self.analysis_procedure, all_data=None) #=hdf_all_data
|
self, self.analysis_procedure, all_data=None) # =hdf_all_data
|
||||||
self.hdf_thread.trigger_thread_event.connect(
|
self.hdf_thread.trigger_thread_event.connect(
|
||||||
self.receive_analysis_results)
|
self.receive_analysis_results)
|
||||||
#procedure moved above
|
# procedure moved above
|
||||||
self.hdf_thread.started.connect(self.hdf_thread_started)
|
self.hdf_thread.started.connect(self.hdf_thread_started)
|
||||||
self.hdf_thread.finished.connect(self.hdf_thread_finished)
|
self.hdf_thread.finished.connect(self.hdf_thread_finished)
|
||||||
|
|
||||||
self.hdf_thread.start()
|
self.hdf_thread.start()
|
||||||
QApplication.processEvents()
|
QApplication.processEvents()
|
||||||
|
|
||||||
|
# To be overloaded by user
|
||||||
|
|
||||||
#To be overloaded by user
|
|
||||||
def verify_analysis_preconditions(self):
|
def verify_analysis_preconditions(self):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@@ -1792,7 +1786,6 @@ class BaseWindow(QMainWindow):
|
|||||||
if not self.verify_analysis_preconditions():
|
if not self.verify_analysis_preconditions():
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
self.analysis_thread = self.AnalysisThread(
|
self.analysis_thread = self.AnalysisThread(
|
||||||
self, self.analysis_procedure, self.input_parameters)
|
self, self.analysis_procedure, self.input_parameters)
|
||||||
|
|
||||||
@@ -1802,11 +1795,9 @@ class BaseWindow(QMainWindow):
|
|||||||
self.analysis_thread.started.connect(self.analysis_thread_started)
|
self.analysis_thread.started.connect(self.analysis_thread_started)
|
||||||
self.analysis_thread.finished.connect(self.analysis_thread_finished)
|
self.analysis_thread.finished.connect(self.analysis_thread_finished)
|
||||||
|
|
||||||
|
|
||||||
self.analysis_thread.start()
|
self.analysis_thread.start()
|
||||||
QApplication.processEvents()
|
QApplication.processEvents()
|
||||||
|
|
||||||
|
|
||||||
@Slot()
|
@Slot()
|
||||||
def analysis_thread_started(self):
|
def analysis_thread_started(self):
|
||||||
""" Change state of widgets when measuring
|
""" Change state of widgets when measuring
|
||||||
@@ -1830,7 +1821,6 @@ class BaseWindow(QMainWindow):
|
|||||||
self.gui_frame.in_hdf_measurement_procedure()
|
self.gui_frame.in_hdf_measurement_procedure()
|
||||||
QApplication.processEvents()
|
QApplication.processEvents()
|
||||||
|
|
||||||
|
|
||||||
@Slot()
|
@Slot()
|
||||||
def hdf_thread_finished(self):
|
def hdf_thread_finished(self):
|
||||||
""" Reset widgets to intial pre-measurement state
|
""" Reset widgets to intial pre-measurement state
|
||||||
@@ -1839,7 +1829,6 @@ class BaseWindow(QMainWindow):
|
|||||||
QApplication.processEvents()
|
QApplication.processEvents()
|
||||||
#print("Thread Finished")
|
#print("Thread Finished")
|
||||||
|
|
||||||
|
|
||||||
@Slot(dict)
|
@Slot(dict)
|
||||||
def receive_analysis_results(self, all_dict):
|
def receive_analysis_results(self, all_dict):
|
||||||
self.all_data = all_dict
|
self.all_data = all_dict
|
||||||
@@ -1854,21 +1843,25 @@ class BaseWindow(QMainWindow):
|
|||||||
try:
|
try:
|
||||||
results_data = all_dict['Processed data']['Results']
|
results_data = all_dict['Processed data']['Results']
|
||||||
self.gui_frame.send_to_results_output_wgt(results_data)
|
self.gui_frame.send_to_results_output_wgt(results_data)
|
||||||
except:
|
except BaseException:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
#print("IDX+++", self.gui_frame.central_tab_widget.indexOf('Emittance'), flush=True)
|
#print("IDX+++", self.gui_frame.central_tab_widget.indexOf('Emittance'), flush=True)
|
||||||
#print("IDX+++", self.gui_frame.level2_tab_wgt[0].indexOf('Plots'))
|
#print("IDX+++", self.gui_frame.level2_tab_wgt[0].indexOf('Plots'))
|
||||||
#self.gui_frame.central_tab_widget.setCurrentIndex(1)
|
# self.gui_frame.central_tab_widget.setCurrentIndex(1)
|
||||||
|
|
||||||
self.gui_frame.results_tab_wgt.setCurrentIndex(0)
|
self.gui_frame.results_tab_wgt.setCurrentIndex(0)
|
||||||
|
|
||||||
if "GUITree" in self.settings.data:
|
if "GUITree" in self.settings.data:
|
||||||
|
|
||||||
#for j in range(len(self.gui_frame.level1_tab_wgt)):
|
# for j in range(len(self.gui_frame.level1_tab_wgt)):
|
||||||
j = self.gui_frame.central_tab_widget.currentIndex()
|
j = self.gui_frame.central_tab_widget.currentIndex()
|
||||||
for i in range(self.gui_frame.level1_tab_wgt[j].count()):
|
for i in range(self.gui_frame.level1_tab_wgt[j].count()):
|
||||||
print(j, i, self.gui_frame.level1_tab_wgt[j].tabText(i), flush=True)
|
print(
|
||||||
|
j,
|
||||||
|
i,
|
||||||
|
self.gui_frame.level1_tab_wgt[j].tabText(i),
|
||||||
|
flush=True)
|
||||||
if self.gui_frame.level1_tab_wgt[j].tabText(i) == "Plots":
|
if self.gui_frame.level1_tab_wgt[j].tabText(i) == "Plots":
|
||||||
self.gui_frame.level1_tab_wgt[j].setCurrentIndex(i)
|
self.gui_frame.level1_tab_wgt[j].setCurrentIndex(i)
|
||||||
else:
|
else:
|
||||||
@@ -1876,14 +1869,20 @@ class BaseWindow(QMainWindow):
|
|||||||
else:
|
else:
|
||||||
|
|
||||||
for i in range(self.gui_frame.central_tab_widget.count()):
|
for i in range(self.gui_frame.central_tab_widget.count()):
|
||||||
print(i, self.gui_frame.central_tab_widget.tabText(i), flush=True)
|
print(
|
||||||
|
i,
|
||||||
|
self.gui_frame.central_tab_widget.tabText(i),
|
||||||
|
flush=True)
|
||||||
if self.gui_frame.central_tab_widget.tabText(i) == "Plots":
|
if self.gui_frame.central_tab_widget.tabText(i) == "Plots":
|
||||||
self.gui_frame.central_tab_widget.setCurrentIndex(i)
|
self.gui_frame.central_tab_widget.setCurrentIndex(i)
|
||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
for i in range(self.gui_frame.measurement_tab_wgt.count()):
|
for i in range(self.gui_frame.measurement_tab_wgt.count()):
|
||||||
print(i, self.gui_frame.measurement_tab_wgt.tabText(i), flush=True)
|
print(
|
||||||
|
i,
|
||||||
|
self.gui_frame.measurement_tab_wgt.tabText(i),
|
||||||
|
flush=True)
|
||||||
if self.gui_frame.measurement_tab_wgt.tabText(i) == "Plots":
|
if self.gui_frame.measurement_tab_wgt.tabText(i) == "Plots":
|
||||||
self.gui_frame.measurement_tab_wgt.setCurrentIndex(i)
|
self.gui_frame.measurement_tab_wgt.setCurrentIndex(i)
|
||||||
else:
|
else:
|
||||||
@@ -1907,10 +1906,9 @@ class BaseWindow(QMainWindow):
|
|||||||
self.gui_frame.in_abort_procedure()
|
self.gui_frame.in_abort_procedure()
|
||||||
# Trigger abort signal to the analysis thread
|
# Trigger abort signal to the analysis thread
|
||||||
self.analysis_procedure.trigger_abort.emit()
|
self.analysis_procedure.trigger_abort.emit()
|
||||||
#self.trigger_progressbar.emit(PROGRESS_THREAD_ABORTING)
|
# self.trigger_progressbar.emit(PROGRESS_THREAD_ABORTING)
|
||||||
QApplication.processEvents()
|
QApplication.processEvents()
|
||||||
|
|
||||||
|
|
||||||
@Slot(str, str, int, str, dict)
|
@Slot(str, str, int, str, dict)
|
||||||
def receive_log_message(self, severity, module, line, message, options={}):
|
def receive_log_message(self, severity, module, line, message, options={}):
|
||||||
'''Receive message from thread for routing to log window'''
|
'''Receive message from thread for routing to log window'''
|
||||||
@@ -1925,7 +1923,7 @@ class BaseWindow(QMainWindow):
|
|||||||
'''Receives update of message'''
|
'''Receives update of message'''
|
||||||
self.progressbar.setVisible(True)
|
self.progressbar.setVisible(True)
|
||||||
try:
|
try:
|
||||||
if self.input_parameters["simulation"] :
|
if self.input_parameters["simulation"]:
|
||||||
self.progressbar_color = self.progressbar_simulation
|
self.progressbar_color = self.progressbar_simulation
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
@@ -1954,7 +1952,7 @@ class BaseWindow(QMainWindow):
|
|||||||
mess = "Aborting measurement procedure"
|
mess = "Aborting measurement procedure"
|
||||||
self.show_log_message(
|
self.show_log_message(
|
||||||
MsgSeverity.WARN.name, _pymodule, _line(), mess)
|
MsgSeverity.WARN.name, _pymodule, _line(), mess)
|
||||||
#self.statusbar.showMessage(mess)
|
# self.statusbar.showMessage(mess)
|
||||||
elif value == PROGRESS_THREAD_ABORTED:
|
elif value == PROGRESS_THREAD_ABORTED:
|
||||||
self.progressbar.setFormat("Procedure aborted")
|
self.progressbar.setFormat("Procedure aborted")
|
||||||
self.progressbar.setObjectName(self.progressbar_abort)
|
self.progressbar.setObjectName(self.progressbar_abort)
|
||||||
@@ -1989,7 +1987,6 @@ class BaseWindow(QMainWindow):
|
|||||||
QApplication.processEvents()
|
QApplication.processEvents()
|
||||||
time.sleep(0.0001)
|
time.sleep(0.0001)
|
||||||
|
|
||||||
|
|
||||||
def initialize_application(self, appname=_appname, delay=None,
|
def initialize_application(self, appname=_appname, delay=None,
|
||||||
facility=Facility.SwissFEL):
|
facility=Facility.SwissFEL):
|
||||||
"""
|
"""
|
||||||
@@ -2033,10 +2030,10 @@ class BaseWindow(QMainWindow):
|
|||||||
parser.add_argument("-f", "--facility")
|
parser.add_argument("-f", "--facility")
|
||||||
parser.add_argument("-u", "--user")
|
parser.add_argument("-u", "--user")
|
||||||
#result, unknown = parser.parse_known_args(["--qss", ":/sfop.qss"])
|
#result, unknown = parser.parse_known_args(["--qss", ":/sfop.qss"])
|
||||||
#result, unknown = parser.parse_known_args(["--qss", ":/sfop.qss",
|
# result, unknown = parser.parse_known_args(["--qss", ":/sfop.qss",
|
||||||
#"-c", "--facility", "--user"])
|
# "-c", "--facility", "--user"])
|
||||||
#print(result)
|
# print(result)
|
||||||
#print(unknown)
|
# print(unknown)
|
||||||
result = parser.parse_args()
|
result = parser.parse_args()
|
||||||
if result.qss:
|
if result.qss:
|
||||||
print("qss file {0} supplied by user".format(result.qss))
|
print("qss file {0} supplied by user".format(result.qss))
|
||||||
@@ -2068,21 +2065,20 @@ class BaseWindow(QMainWindow):
|
|||||||
<p style='color:black; font-weight:bold;
|
<p style='color:black; font-weight:bold;
|
||||||
font-size:20px; margin-right:22px;'>
|
font-size:20px; margin-right:22px;'>
|
||||||
This message will self-destruct in {1} seconds<br></p>
|
This message will self-destruct in {1} seconds<br></p>
|
||||||
""".format(appname, round(delay)), Qt.AlignCenter | Qt.AlignTop)
|
""".format(appname, round(delay)),
|
||||||
width = 860 + (len(appname)-10)*15
|
Qt.AlignmentFlag(Qt.AlignCenter | Qt.AlignTop))
|
||||||
|
width = 860 + (len(appname) - 10) * 15
|
||||||
height = 220
|
height = 220
|
||||||
self.splash_screen.resize(width, height)
|
self.splash_screen.resize(width, height)
|
||||||
|
|
||||||
#Maybe useful at some point
|
# Maybe useful at some point
|
||||||
#pSplashNotice = QCheckBox(self.splash_screen);
|
#pSplashNotice = QCheckBox(self.splash_screen);
|
||||||
#pSplashNotice.setChecked(Qt.Checked)
|
# pSplashNotice.setChecked(Qt.Checked)
|
||||||
|
|
||||||
|
|
||||||
self.splash_progressbar = QProgressBar(self.splash_screen)
|
self.splash_progressbar = QProgressBar(self.splash_screen)
|
||||||
self.splash_timer = QTimer()
|
self.splash_timer = QTimer()
|
||||||
self.splash_screen.show()
|
self.splash_screen.show()
|
||||||
|
|
||||||
|
|
||||||
# Custom progress bar stylesheet
|
# Custom progress bar stylesheet
|
||||||
progressbar_stylesheet = """
|
progressbar_stylesheet = """
|
||||||
QProgressBar:horizontal {
|
QProgressBar:horizontal {
|
||||||
@@ -2104,9 +2100,9 @@ class BaseWindow(QMainWindow):
|
|||||||
|
|
||||||
def show_time():
|
def show_time():
|
||||||
now = time.time()
|
now = time.time()
|
||||||
val = (now-start1)*100/delay
|
val = (now - start1) * 100 / delay
|
||||||
val = 5 * round(val/5)
|
val = 5 * round(val / 5)
|
||||||
int_seconds_remaining = int(delay - (now-start1))
|
int_seconds_remaining = int(delay - (now - start1))
|
||||||
seconds_remaining = '{:2d}'.format(int_seconds_remaining)
|
seconds_remaining = '{:2d}'.format(int_seconds_remaining)
|
||||||
self.splash_progressbar.setValue(val)
|
self.splash_progressbar.setValue(val)
|
||||||
self.processEvents()
|
self.processEvents()
|
||||||
@@ -2122,21 +2118,21 @@ class BaseWindow(QMainWindow):
|
|||||||
{1:>2} second{2} remaining<br></p>
|
{1:>2} second{2} remaining<br></p>
|
||||||
""".format(self.splash_appname, seconds_remaining, sec_str)
|
""".format(self.splash_appname, seconds_remaining, sec_str)
|
||||||
|
|
||||||
self.splash_screen.showMessage(mess, Qt.AlignCenter|Qt.AlignTop)
|
self.splash_screen.showMessage(
|
||||||
|
mess, Qt.AlignmentFlag(Qt.AlignCenter | Qt.AlignTop))
|
||||||
self.processEvents()
|
self.processEvents()
|
||||||
#print(val, seconds_remaining)
|
#print(val, seconds_remaining)
|
||||||
|
|
||||||
self.splash_timer.timeout.connect(show_time)
|
self.splash_timer.timeout.connect(show_time)
|
||||||
self.splash_timer.start(200) #ms with 10 samples per sec.
|
self.splash_timer.start(200) # ms with 10 samples per sec.
|
||||||
|
|
||||||
return self.splash_screen
|
return self.splash_screen
|
||||||
|
|
||||||
|
|
||||||
def initialize_finished(self, myapp):
|
def initialize_finished(self, myapp):
|
||||||
self.splash_timer.stop()
|
self.splash_timer.stop()
|
||||||
self.splash_progressbar.setValue(100)
|
self.splash_progressbar.setValue(100)
|
||||||
time.sleep(1.5)
|
time.sleep(0.4)
|
||||||
#app.processEvents()
|
# app.processEvents()
|
||||||
self.splash_screen.showMessage(
|
self.splash_screen.showMessage(
|
||||||
"""
|
"""
|
||||||
<br><p style='color:black; font-weight:bold;
|
<br><p style='color:black; font-weight:bold;
|
||||||
@@ -2148,11 +2144,10 @@ class BaseWindow(QMainWindow):
|
|||||||
Ready....
|
Ready....
|
||||||
|
|
||||||
<br></p>
|
<br></p>
|
||||||
""".format(self.splash_appname), Qt.AlignCenter | Qt.AlignTop)
|
""".format(self.splash_appname),
|
||||||
|
Qt.AlignmentFlag(Qt.AlignCenter | Qt.AlignTop))
|
||||||
self.splash_screen.finish(myapp)
|
self.splash_screen.finish(myapp)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def check_status_list(self, pymodule: str = _pymodule,
|
def check_status_list(self, pymodule: str = _pymodule,
|
||||||
operation: str = "channel access",
|
operation: str = "channel access",
|
||||||
pv_list: list = None, status_list: list = None,
|
pv_list: list = None, status_list: list = None,
|
||||||
@@ -2171,7 +2166,6 @@ class BaseWindow(QMainWindow):
|
|||||||
if stat is None:
|
if stat is None:
|
||||||
status_list[i] = self.cafe.getStatus(pv)
|
status_list[i] = self.cafe.getStatus(pv)
|
||||||
|
|
||||||
|
|
||||||
brk = ("------------------------------------------------------" +
|
brk = ("------------------------------------------------------" +
|
||||||
"------------------------------------------------------")
|
"------------------------------------------------------")
|
||||||
self.trigger_log_message.emit(
|
self.trigger_log_message.emit(
|
||||||
@@ -2201,15 +2195,14 @@ class BaseWindow(QMainWindow):
|
|||||||
|
|
||||||
return status_list
|
return status_list
|
||||||
|
|
||||||
|
|
||||||
def check_status(self, pymodule: str = _pymodule,
|
def check_status(self, pymodule: str = _pymodule,
|
||||||
operation: str = "channel access",
|
operation: str = "channel access",
|
||||||
pv: str = None, stat: int = None,
|
pv: str = None, stat: int = None,
|
||||||
line: int =_line()):
|
line: int = _line()):
|
||||||
|
|
||||||
if not pv:
|
if not pv:
|
||||||
return
|
return
|
||||||
if stat == None:
|
if stat is None:
|
||||||
stat = self.cafe.getStatus(pv)
|
stat = self.cafe.getStatus(pv)
|
||||||
|
|
||||||
if stat != self.cyca.ICAFE_NORMAL:
|
if stat != self.cyca.ICAFE_NORMAL:
|
||||||
|
|||||||
1105
guiframe.py
1105
guiframe.py
File diff suppressed because it is too large
Load Diff
@@ -38,7 +38,6 @@ class QSaveHDF(QDialog):
|
|||||||
self.user_dict = {}
|
self.user_dict = {}
|
||||||
self.user_dict['Comment'] = None
|
self.user_dict['Comment'] = None
|
||||||
#self.file_name = None
|
#self.file_name = None
|
||||||
|
|
||||||
#self.excluded_input = ['Year', 'Month', 'Date']
|
#self.excluded_input = ['Year', 'Month', 'Date']
|
||||||
|
|
||||||
if 'Time in seconds' in input_options.keys():
|
if 'Time in seconds' in input_options.keys():
|
||||||
@@ -244,6 +243,7 @@ class QSaveHDF(QDialog):
|
|||||||
|
|
||||||
def save(self):
|
def save(self):
|
||||||
self.get_data()
|
self.get_data()
|
||||||
|
self.parent.hdf_user_dict = self.user_dict
|
||||||
self.parent.hdf_filename = self.user_dict['Destination']
|
self.parent.hdf_filename = self.user_dict['Destination']
|
||||||
self.parent.save_to_hdf(from_dialog=self.from_dialog)
|
self.parent.save_to_hdf(from_dialog=self.from_dialog)
|
||||||
self.close()
|
self.close()
|
||||||
|
|||||||
13
sendelog.py
13
sendelog.py
@@ -9,22 +9,13 @@ from qtpy.QtWidgets import (QComboBox, QDialog, QFileDialog, QHBoxLayout,
|
|||||||
QVBoxLayout)
|
QVBoxLayout)
|
||||||
|
|
||||||
import elog # https://github.com/paulscherrerinstitute/py_elog
|
import elog # https://github.com/paulscherrerinstitute/py_elog
|
||||||
from pyqtacc.bdbase.enumkind import MsgSeverity
|
from apps4ops.bdbase.enumkind import MsgSeverity
|
||||||
|
from apps4ops.bdbase.utils import _line
|
||||||
|
|
||||||
_version = "1.0.0"
|
_version = "1.0.0"
|
||||||
_pymodule = os.path.basename(__file__)
|
_pymodule = os.path.basename(__file__)
|
||||||
_appname, _appext = _pymodule.split(".")
|
_appname, _appext = _pymodule.split(".")
|
||||||
|
|
||||||
def _line():
|
|
||||||
"""Macro to return the current line number.
|
|
||||||
|
|
||||||
The current line number within the file is used when
|
|
||||||
reporting messages to the message logging window.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
int: Current line number.
|
|
||||||
"""
|
|
||||||
return inspect.currentframe().f_back.f_lineno
|
|
||||||
|
|
||||||
class QSendToELOG(QDialog):
|
class QSendToELOG(QDialog):
|
||||||
""" Graphical interface to elog
|
""" Graphical interface to elog
|
||||||
|
|||||||
@@ -9,22 +9,14 @@ from qtpy.QtWidgets import (
|
|||||||
QLineEdit, QPushButton, QTextEdit, QVBoxLayout)
|
QLineEdit, QPushButton, QTextEdit, QVBoxLayout)
|
||||||
|
|
||||||
import elog # https://github.com/paulscherrerinstitute/py_elog
|
import elog # https://github.com/paulscherrerinstitute/py_elog
|
||||||
from pyqtacc.bdbase.enumkind import MsgSeverity
|
|
||||||
|
from apps4ops.bdbase.enumkind import MsgSeverity
|
||||||
|
from apps4ops.bdbase.utils import _line
|
||||||
|
|
||||||
_version = "1.0.0"
|
_version = "1.0.0"
|
||||||
_pymodule = os.path.basename(__file__)
|
_pymodule = os.path.basename(__file__)
|
||||||
_appname, _appext = _pymodule.split(".")
|
_appname, _appext = _pymodule.split(".")
|
||||||
|
|
||||||
def _line():
|
|
||||||
"""Macro to return the current line number.
|
|
||||||
|
|
||||||
The current line number within the file is used when
|
|
||||||
reporting messages to the message logging window.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
int: Current line number.
|
|
||||||
"""
|
|
||||||
return inspect.currentframe().f_back.f_lineno
|
|
||||||
|
|
||||||
class QSendToELOGFrame(QDialog):
|
class QSendToELOGFrame(QDialog):
|
||||||
""" Graphical interface to elog
|
""" Graphical interface to elog
|
||||||
|
|||||||
Reference in New Issue
Block a user