diff options
| author | Lex Neva <lexelby@users.noreply.github.com> | 2018-06-15 21:42:52 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-06-15 21:42:52 -0400 |
| commit | 28e8efebf2a721239fa996865f9ef228e3521121 (patch) | |
| tree | 89526b299ab2e55bb69225d26cea781f90bc9bd1 /lib/extensions/params.py | |
| parent | 4a2162e25892da7ce49b944532ebc8f2a9786a28 (diff) | |
| parent | 350c292f8d0415fefefa83ce5ce84c2b5c17bd75 (diff) | |
v1.9.1: bug fixes
Lots of bug fixes:
* properly handle case where stroke width is not set (defaults to 1 per SVG spec)
* properly handle case where <svg> width and height not set (defaults to viewbox)
* properly handle case where fill is not set (defaults to "black" rather than "none")
* show error message (rather than crashing) if satin column set for a path with only one subpath
* don't leave the simulate window around after "use last settings"
* show a useful error message in Params if the user hasn't selected anything embroiderable
Diffstat (limited to 'lib/extensions/params.py')
| -rw-r--r-- | lib/extensions/params.py | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/lib/extensions/params.py b/lib/extensions/params.py index 03a6f3cc..9d8de41b 100644 --- a/lib/extensions/params.py +++ b/lib/extensions/params.py @@ -354,6 +354,9 @@ class SettingsFrame(wx.Frame): self.simulate_thread = None self.simulate_refresh_needed = Event() + # used when closing to avoid having the window reopen at the last second + self.disable_simulate_window = False + wx.CallLater(1000, self.update_simulator) self.presets_box = wx.StaticBox(self, wx.ID_ANY, label=_("Presets")) @@ -392,6 +395,9 @@ class SettingsFrame(wx.Frame): self.simulate_window.stop() self.simulate_window.clear() + if self.disable_simulate_window: + return + if not self.simulate_thread or not self.simulate_thread.is_alive(): self.simulate_thread = Thread(target=self.simulate_worker) self.simulate_thread.daemon = True @@ -586,6 +592,7 @@ class SettingsFrame(wx.Frame): self.close() def use_last(self, event): + self.disable_simulate_window = True self._load_preset("__LAST__") self.apply(event) @@ -632,6 +639,9 @@ class SettingsFrame(wx.Frame): self.Layout() # end wxGlade +class NoValidObjects(Exception): + pass + class Params(InkstitchExtension): def __init__(self, *args, **kwargs): self.cancelled = False @@ -689,6 +699,11 @@ class Params(InkstitchExtension): def create_tabs(self, parent): tabs = [] + nodes_by_class = self.get_nodes_by_class() + + if not nodes_by_class: + raise NoValidObjects() + for cls, nodes in self.get_nodes_by_class(): params = cls.get_params() @@ -745,12 +760,15 @@ class Params(InkstitchExtension): self.cancelled = True def effect(self): - app = wx.App() - frame = SettingsFrame(tabs_factory=self.create_tabs, on_cancel=self.cancel) - frame.Show() - app.MainLoop() - - if self.cancelled: - # This prevents the superclass from outputting the SVG, because we - # may have modified the DOM. - sys.exit(0) + try: + app = wx.App() + frame = SettingsFrame(tabs_factory=self.create_tabs, on_cancel=self.cancel) + frame.Show() + app.MainLoop() + + if self.cancelled: + # This prevents the superclass from outputting the SVG, because we + # may have modified the DOM. + sys.exit(0) + except NoValidObjects: + self.no_elements_error() |
