summaryrefslogtreecommitdiff
path: root/lib/gui/simulator/drawing_panel.py
diff options
context:
space:
mode:
authorKaalleen <36401965+kaalleen@users.noreply.github.com>2024-06-25 23:46:50 +0200
committerGitHub <noreply@github.com>2024-06-25 23:46:50 +0200
commit850958b5bc6017da66fad041dabc6ddd7b8d9f69 (patch)
tree5ba42bcd4153631d58e9fb3d48ba25411f4adf74 /lib/gui/simulator/drawing_panel.py
parent75a9ea2e1dc16bfc8b41d9a747fdb29b5d3d0b14 (diff)
Simulator: make colors visible on background (#3010)
* simulator: color visible on background * add design dimension info to simulator statusbar * update preview when apply font size filter * add info box * preferences: check if stitch_plan is loaded
Diffstat (limited to 'lib/gui/simulator/drawing_panel.py')
-rw-r--r--lib/gui/simulator/drawing_panel.py20
1 files changed, 18 insertions, 2 deletions
diff --git a/lib/gui/simulator/drawing_panel.py b/lib/gui/simulator/drawing_panel.py
index 0da58393..aced1587 100644
--- a/lib/gui/simulator/drawing_panel.py
+++ b/lib/gui/simulator/drawing_panel.py
@@ -230,12 +230,27 @@ class DrawingPanel(wx.Panel):
self.minx, self.miny, self.maxx, self.maxy = stitch_plan.bounding_box
self.width = self.maxx - self.minx
self.height = self.maxy - self.miny
+ self.dimensions_mm = stitch_plan.dimensions_mm
self.num_stitches = stitch_plan.num_stitches
+ self.num_trims = stitch_plan.num_trims
+ self.num_color_changes = stitch_plan.num_color_blocks - 1
+ self.num_stops = stitch_plan.num_stops
+ self.num_jumps = stitch_plan.num_jumps - 1
self.parse_stitch_plan(stitch_plan)
self.choose_zoom_and_pan()
self.set_current_stitch(0)
+ statusbar = self.GetTopLevelParent().statusbar
+ statusbar.SetStatusText(
+ _("Dimensions: {:.2f} x {:.2f}").format(
+ stitch_plan.dimensions_mm[0],
+ stitch_plan.dimensions_mm[1]
+ ),
+ 1
+ )
self.loaded = True
self.go()
+ if hasattr(self.view_panel, 'info_panel'):
+ self.view_panel.info_panel.update()
def choose_zoom_and_pan(self, event=None):
# ignore if EVT_SIZE fired before we load the stitch plan
@@ -268,7 +283,8 @@ class DrawingPanel(wx.Panel):
def color_to_pen(self, color):
line_width = global_settings['simulator_line_width'] * PIXELS_PER_MM * self.PIXEL_DENSITY
- return wx.Pen(list(map(int, color.visible_on_white.rgb)), int(line_width))
+ background_color = self.GetBackgroundColour().GetAsString()
+ return wx.Pen(list(map(int, color.visible_on_background(background_color).rgb)), int(line_width))
def update_pen_size(self):
line_width = global_settings['simulator_line_width'] * PIXELS_PER_MM * self.PIXEL_DENSITY
@@ -339,7 +355,7 @@ class DrawingPanel(wx.Panel):
command = self.commands[self.current_stitch]
self.control_panel.on_current_stitch(self.current_stitch, command)
statusbar = self.GetTopLevelParent().statusbar
- statusbar.SetStatusText(_("Command: %s") % COMMAND_NAMES[command], 1)
+ statusbar.SetStatusText(_("Command: %s") % COMMAND_NAMES[command], 2)
self.stop_if_at_end()
self.Refresh()