added "marker" class for persistability instead of list of widgets
This commit is contained in:
+1
-8
@@ -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))
|
||||
|
||||
|
||||
|
||||
|
||||
+2
-2
@@ -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
|
||||
|
||||
|
||||
|
||||
+8
-2
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user