From e543e95cbd1fe29ebb5b894d70ce77df00c5c377 Mon Sep 17 00:00:00 2001 From: Sven Augustin Date: Mon, 26 Jul 2021 17:10:25 +0200 Subject: [PATCH] moved PersistableWidget marker class to other persistence code --- slic/gui/daqpanels/special.py | 3 ++- slic/gui/persist.py | 8 ++++++-- slic/gui/widgets/__init__.py | 2 +- slic/gui/widgets/entries.py | 3 ++- slic/gui/widgets/tools.py | 4 ---- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/slic/gui/daqpanels/special.py b/slic/gui/daqpanels/special.py index b613b825c..70931d25b 100644 --- a/slic/gui/daqpanels/special.py +++ b/slic/gui/daqpanels/special.py @@ -3,7 +3,8 @@ import wx from slic.utils.reprate import get_pvname_reprate -from ..widgets import LabeledMathEntry, LabeledEntry, LabeledFilenameEntry, TwoButtons, make_filled_hbox, make_filled_vbox, STRETCH, EXPANDING, PersistableWidget +from ..widgets import LabeledMathEntry, LabeledEntry, LabeledFilenameEntry, TwoButtons, make_filled_hbox, make_filled_vbox, STRETCH, EXPANDING +from ..persist import PersistableWidget from .tools import AdjustableComboBox, ETADisplay, correct_n_pulses, run, post_event diff --git a/slic/gui/persist.py b/slic/gui/persist.py index 2ce4fc7ad..997ec68ee 100644 --- a/slic/gui/persist.py +++ b/slic/gui/persist.py @@ -1,6 +1,5 @@ from pathlib import Path from slic.utils import typename, json_save, json_load -from slic.gui import widgets as ws def skip_on_error(f): @@ -15,6 +14,11 @@ def skip_on_error(f): +class PersistableWidget: + pass + + + class Persistence: def __init__(self, fname, managed): @@ -58,7 +62,7 @@ def set_values(values, obj): def get_good_children(obj): - return [c for c in recurse(obj) if isinstance(c, ws.PersistableWidget)] + return [c for c in recurse(obj) if isinstance(c, PersistableWidget)] def recurse(obj): children = obj.GetChildren() diff --git a/slic/gui/widgets/__init__.py b/slic/gui/widgets/__init__.py index 0fe7b2453..f726f6449 100644 --- a/slic/gui/widgets/__init__.py +++ b/slic/gui/widgets/__init__.py @@ -3,7 +3,7 @@ from .completers import ContainsTextCompleter, FuzzyTextCompleter from .entries import LabeledEntry, LabeledFilenameEntry, LabeledMathEntry, LabeledTweakEntry from .lists import AutoWidthListCtrl, show_list, show_two_lists from .mods import MainPanel, NotebookDX -from .tools import EXPANDING, STRETCH, PersistableWidget, make_filled_vbox, make_filled_hbox, copy_to_clipboard, post_event +from .tools import EXPANDING, STRETCH, make_filled_vbox, make_filled_hbox, copy_to_clipboard, post_event from .twobuttons import TwoButtons diff --git a/slic/gui/widgets/entries.py b/slic/gui/widgets/entries.py index e2e8f94aa..088e19640 100644 --- a/slic/gui/widgets/entries.py +++ b/slic/gui/widgets/entries.py @@ -2,7 +2,8 @@ import wx from slic.utils import arithmetic_eval, typename -from .tools import ADJUSTMENTS, PersistableWidget, make_filled_hbox +from .tools import ADJUSTMENTS, make_filled_hbox +from ..persist import PersistableWidget class LabeledTweakEntry(wx.BoxSizer): diff --git a/slic/gui/widgets/tools.py b/slic/gui/widgets/tools.py index f2726da1b..8a6bc44fe 100644 --- a/slic/gui/widgets/tools.py +++ b/slic/gui/widgets/tools.py @@ -6,10 +6,6 @@ from .fname import increase, decrease WX_DEFAULT_RESIZABLE_DIALOG_STYLE = wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER|wx.MINIMIZE_BOX|wx.MAXIMIZE_BOX -class PersistableWidget: - pass - - class EXPANDING: pass class STRETCH: pass