diff options
| author | Kaalleen <36401965+kaalleen@users.noreply.github.com> | 2021-03-04 18:40:53 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-03-04 18:40:53 +0100 |
| commit | e84a86d4ac0caf29d6074728376ff0a594243fec (patch) | |
| tree | 888c79ed0094ba2916a1d329861a85515959913c /lib/gui | |
| parent | b39575a50191307b3b56eab6455626398eec6397 (diff) | |
Update for Inkscape 1.0 (#880)
* update for inkscape 1.0
* add about extension
* Build improvements for the inkscape1.0 branch (#985)
* zip: export real svg not stitch plan
* #411 and #726
* Tools for Font Creators (#1018)
* ignore very small holes in fills
* remove embroider (#1026)
* auto_fill: ignore shrink_or_grow if result is empty (#589)
* break apart: do not ignore small fills
Co-authored-by: Hagen Fritsch <rumpeltux-github@irgendwo.org>
Co-authored-by: Lex Neva <github.com@lexneva.name>
Diffstat (limited to 'lib/gui')
| -rw-r--r-- | lib/gui/electron.py | 4 | ||||
| -rw-r--r-- | lib/gui/presets.py | 4 | ||||
| -rw-r--r-- | lib/gui/simulator.py | 26 |
3 files changed, 12 insertions, 22 deletions
diff --git a/lib/gui/electron.py b/lib/gui/electron.py index 83486f78..ef215fb5 100644 --- a/lib/gui/electron.py +++ b/lib/gui/electron.py @@ -27,5 +27,5 @@ def open_url(url): cwd = get_bundled_dir("electron") # Any output on stdout will crash inkscape. - null = open(os.devnull, 'w') - return subprocess.Popen(command, cwd=cwd, stdout=null) + with open(os.devnull, 'w') as null: + return subprocess.Popen(command, cwd=cwd, stdout=null) diff --git a/lib/gui/presets.py b/lib/gui/presets.py index b3312f0e..2c0d0481 100644 --- a/lib/gui/presets.py +++ b/lib/gui/presets.py @@ -64,7 +64,7 @@ class PresetsPanel(wx.Panel): presets_sizer = wx.StaticBoxSizer(self.presets_box, wx.HORIZONTAL) self.preset_chooser.SetMinSize((200, -1)) - presets_sizer.Add(self.preset_chooser, 1, wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.BOTTOM | wx.EXPAND, 10) + presets_sizer.Add(self.preset_chooser, 1, wx.LEFT | wx.BOTTOM | wx.EXPAND, 10) presets_sizer.Add(self.load_preset_button, 0, wx.ALIGN_CENTER_VERTICAL | wx.BOTTOM | wx.LEFT, 10) presets_sizer.Add(self.add_preset_button, 0, wx.ALIGN_CENTER_VERTICAL | wx.BOTTOM | wx.LEFT, 10) presets_sizer.Add(self.overwrite_preset_button, 0, wx.ALIGN_CENTER_VERTICAL | wx.BOTTOM | wx.LEFT, 10) @@ -106,7 +106,7 @@ class PresetsPanel(wx.Panel): json.dump(presets, presets_file) def update_preset_list(self): - preset_names = self._load_presets().keys() + preset_names = list(self._load_presets().keys()) preset_names = [preset for preset in preset_names if not self.is_hidden(preset)] self.preset_chooser.SetItems(sorted(preset_names)) diff --git a/lib/gui/simulator.py b/lib/gui/simulator.py index 48709cb8..996bc8f9 100644 --- a/lib/gui/simulator.py +++ b/lib/gui/simulator.py @@ -1,21 +1,16 @@ -from itertools import izip import sys -from threading import Thread, Event import time import traceback +from threading import Event, Thread import wx from wx.lib.intctrl import IntCtrl from ..i18n import _ -from ..stitch_plan import stitch_plan_from_file, patches_to_stitch_plan - +from ..stitch_plan import patches_to_stitch_plan, stitch_plan_from_file from ..svg import PIXELS_PER_MM - - from .dialogs import info_dialog - # L10N command label at bottom of simulator window COMMAND_NAMES = [_("STITCH"), _("JUMP"), _("TRIM"), _("STOP"), _("COLOR CHANGE")] @@ -132,7 +127,7 @@ class ControlPanel(wx.Panel): self.accel_entries = [] for shortcut_key in shortcut_keys: - eventId = wx.NewId() + eventId = wx.NewIdRef() self.accel_entries.append((shortcut_key[0], shortcut_key[1], eventId)) self.Bind(wx.EVT_MENU, shortcut_key[2], id=eventId) @@ -378,7 +373,7 @@ class DrawingPanel(wx.Panel): last_stitch = None start = time.time() - for pen, stitches in izip(self.pens, self.stitch_blocks): + for pen, stitches in zip(self.pens, self.stitch_blocks): canvas.SetPen(pen) if stitch + len(stitches) < self.current_stitch: stitch += len(stitches) @@ -423,7 +418,7 @@ class DrawingPanel(wx.Panel): while scale_width < 50: scale_width += one_mm - scale_width_mm = scale_width / self.zoom / PIXELS_PER_MM + scale_width_mm = int(scale_width / self.zoom / PIXELS_PER_MM) # The scale bar looks like this: # @@ -431,7 +426,7 @@ class DrawingPanel(wx.Panel): # |_____|_____| scale_lower_left_x = 20 - scale_lower_left_y = canvas_height - 20 + scale_lower_left_y = canvas_height - 30 canvas.DrawLines(((scale_lower_left_x, scale_lower_left_y - 6), (scale_lower_left_x, scale_lower_left_y), @@ -504,7 +499,7 @@ class DrawingPanel(wx.Panel): # We draw the thread with a thickness of 0.1mm. Real thread has a # thickness of ~0.4mm, but if we did that, we wouldn't be able to # see the individual stitches. - return wx.Pen(color.visible_on_white.rgb, width=int(0.1 * PIXELS_PER_MM * self.PIXEL_DENSITY)) + return wx.Pen(list(map(int, color.visible_on_white.rgb)), int(0.1 * PIXELS_PER_MM * self.PIXEL_DENSITY)) def parse_stitch_plan(self, stitch_plan): self.pens = [] @@ -698,12 +693,7 @@ class EmbroiderySimulator(wx.Frame): stitches_per_second=stitches_per_second) sizer.Add(self.simulator_panel, 1, wx.EXPAND) - # self.SetSizerAndFit() sets the minimum size so that the buttons don't - # get squished. But it then also shrinks the window down to that size. - self.SetSizerAndFit(sizer) - - # Therefore we have to reapply the size that the caller asked for. - self.SetSize(size) + self.SetSizeHints(sizer.CalcMin()) self.Bind(wx.EVT_CLOSE, self.on_close) |
