diff --git a/slic/gui/daqpanels/run.py b/slic/gui/daqpanels/run.py index 92d12887d..39521e9d5 100644 --- a/slic/gui/daqpanels/run.py +++ b/slic/gui/daqpanels/run.py @@ -1,5 +1,6 @@ import wx +from slic.utils import typename from slic.utils.reprate import get_pvname_reprate from ..widgets import STRETCH, TwoButtons, LabeledMathEntry, LabeledFilenameEntry, make_filled_vbox, post_event @@ -73,9 +74,11 @@ class RunPanel(wx.Panel): self.task = self.acquisition.acquire(filename, n_pulses=n_pulses, continuous=continuous, wait=False) def wait(): - print("start", self.task) - self.task.wait() - print("done", self.task) + try: + self.task.wait() + except Exception as e: + tn = typename(e) + print(f"{tn}: {e}") self.task = None post_event(wx.EVT_BUTTON, self.btn_go.btn2) diff --git a/slic/gui/daqpanels/scan.py b/slic/gui/daqpanels/scan.py index b04e34221..78a43551c 100644 --- a/slic/gui/daqpanels/scan.py +++ b/slic/gui/daqpanels/scan.py @@ -1,6 +1,6 @@ import wx -from slic.utils import nice_arange +from slic.utils import nice_arange, typename from slic.utils.reprate import get_pvname_reprate from ..widgets import STRETCH, TwoButtons, LabeledEntry, LabeledMathEntry, LabeledFilenameEntry, make_filled_vbox, make_filled_hbox, post_event @@ -124,7 +124,11 @@ class ScanPanel(wx.Panel): self.scan = self.scanner.scan1D(adjustable, start_pos, end_pos, step_size, n_pulses, filename, relative=relative, return_to_initial_values=return_to_initial_values, repeat=n_repeat, start_immediately=False) def wait(): - self.scan.run() + try: + self.scan.run() + except Exception as e: + tn = typename(e) + print(f"{tn}: {e}") self.scan = None # self.on_change_adj(None) # cannot change widget from thread, post event instead: post_event(wx.EVT_COMBOBOX, self.cb_adjs) diff --git a/slic/gui/daqpanels/special.py b/slic/gui/daqpanels/special.py index b52fed81a..e5ab1ba76 100644 --- a/slic/gui/daqpanels/special.py +++ b/slic/gui/daqpanels/special.py @@ -1,6 +1,7 @@ import numpy as np import wx +from slic.utils import typename from slic.utils.reprate import get_pvname_reprate from ..widgets import LabeledMathEntry, LabeledEntry, LabeledFilenameEntry, TwoButtons, make_filled_hbox, make_filled_vbox, STRETCH, EXPANDING @@ -150,7 +151,11 @@ class SpecialScanPanel(wx.Panel): self.scan = self.scanner.ascan_list(adjustable, steps, n_pulses, filename, return_to_initial_values=return_to_initial_values, repeat=n_repeat, start_immediately=False) def wait(): - self.scan.run() + try: + self.scan.run() + except Exception as e: + tn = typename(e) + print(f"{tn}: {e}") self.scan = None # self.on_change_adj(None) # cannot change widget from thread, post event instead: post_event(wx.EVT_COMBOBOX, self.cb_adjs) diff --git a/slic/gui/daqpanels/static.py b/slic/gui/daqpanels/static.py index f5bb1c6ef..5abfb0c25 100644 --- a/slic/gui/daqpanels/static.py +++ b/slic/gui/daqpanels/static.py @@ -1,5 +1,6 @@ import wx +from slic.utils import typename from slic.utils.reprate import get_pvname_reprate from ..widgets import STRETCH, TwoButtons, LabeledMathEntry, LabeledFilenameEntry, make_filled_vbox, post_event @@ -51,9 +52,11 @@ class StaticPanel(wx.Panel): self.task = self.acquisition.acquire(filename, n_pulses=n_pulses, wait=False) def wait(): - print("start", self.task) - self.task.wait() - print("done", self.task) + try: + self.task.wait() + except Exception as e: + tn = typename(e) + print(f"{tn}: {e}") self.task = None post_event(wx.EVT_BUTTON, self.btn_go.btn2) diff --git a/slic/gui/daqpanels/tweak.py b/slic/gui/daqpanels/tweak.py index 4413ef684..92768d183 100644 --- a/slic/gui/daqpanels/tweak.py +++ b/slic/gui/daqpanels/tweak.py @@ -2,6 +2,8 @@ from collections import defaultdict from datetime import datetime import wx +from slic.utils import typename + from ..widgets import EXPANDING, TwoButtons, LabeledTweakEntry, LabeledMathEntry, make_filled_vbox, post_event, AutoWidthListCtrl, copy_to_clipboard from ..widgets.plotting import PlotDialog from .tools import AdjustableComboBox, run @@ -102,9 +104,11 @@ class TweakPanel(wx.Panel): self.task = adjustable.set_target_value(target) def wait(): - print("start", self.task) - self.task.wait() - print("done", self.task) + try: + self.task.wait() + except Exception as e: + tn = typename(e) + print(f"{tn}: {e}") self.task = None # self.on_change_adj(None) # cannot change widget from thread, post event instead: post_event(wx.EVT_COMBOBOX, self.cb_adjs)