diff --git a/slic/gui/persist.py b/slic/gui/persist.py index c02aa1f4..5ab64d2d 100644 --- a/slic/gui/persist.py +++ b/slic/gui/persist.py @@ -3,13 +3,6 @@ from slic.gui import widgets as ws from slic.gui.special import ValueEntry -PERSISTABLE_WIDGETS = ( - ws.MathEntry, - ws.FilenameEntry, - ValueEntry -) - - def store(*args): p = Persistence(*args) p.store() @@ -55,7 +48,7 @@ class Persistence: def get_good_children(self): - return list(c for c in recurse(self.managed) if isinstance(c, PERSISTABLE_WIDGETS)) + return list(c for c in recurse(self.managed) if isinstance(c, ws.PersistableWidget)) diff --git a/slic/gui/special.py b/slic/gui/special.py index 3faf1581..43d59dde 100644 --- a/slic/gui/special.py +++ b/slic/gui/special.py @@ -2,13 +2,13 @@ import numpy as np import wx from .daqpanels import AdjustableComboBox, ETADisplay, correct_n_pulses, run, post_event -from .widgets import LabeledMathEntry, LabeledEntry, LabeledFilenameEntry, TwoButtons, make_filled_hbox, make_filled_vbox, STRETCH, EXPANDING +from .widgets import LabeledMathEntry, LabeledEntry, LabeledFilenameEntry, TwoButtons, make_filled_hbox, make_filled_vbox, STRETCH, EXPANDING, PersistableWidget from slic.utils import nice_arange, readable_seconds from slic.utils.reprate import get_pvname_reprate -class ValueEntry(wx.TextCtrl): +class ValueEntry(wx.TextCtrl, PersistableWidget): pass diff --git a/slic/gui/widgets.py b/slic/gui/widgets.py index 15d415da..d8708cb6 100644 --- a/slic/gui/widgets.py +++ b/slic/gui/widgets.py @@ -7,6 +7,12 @@ from .fname import increase, decrease from .helper import exception_to_warning + +class PersistableWidget: + pass + + + WX_DEFAULT_RESIZABLE_DIALOG_STYLE = wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER|wx.MINIMIZE_BOX|wx.MAXIMIZE_BOX @@ -288,7 +294,7 @@ class LabeledMathEntry(wx.BoxSizer): #TODO: largely copy of LabeledEntry -class MathEntry(wx.TextCtrl): +class MathEntry(wx.TextCtrl, PersistableWidget): def __init__(self, *args, **kwargs): if "style" in kwargs: @@ -375,7 +381,7 @@ class LabeledFilenameEntry(wx.BoxSizer): #TODO: largely copy of LabeledEntry -class FilenameEntry(wx.TextCtrl): +class FilenameEntry(wx.TextCtrl, PersistableWidget): def __init__(self, *args, **kwargs): if "style" in kwargs: