summaryrefslogtreecommitdiff
path: root/lib/gui/simulator/design_info.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gui/simulator/design_info.py')
-rw-r--r--lib/gui/simulator/design_info.py69
1 files changed, 69 insertions, 0 deletions
diff --git a/lib/gui/simulator/design_info.py b/lib/gui/simulator/design_info.py
new file mode 100644
index 00000000..86d4e3d7
--- /dev/null
+++ b/lib/gui/simulator/design_info.py
@@ -0,0 +1,69 @@
+# Authors: see git history
+#
+# Copyright (c) 2024 Authors
+# Licensed under the GNU GPL version 3.0 or later. See the file LICENSE for details.
+
+import wx
+
+from ...i18n import _
+
+
+class DesignInfoDialog(wx.Dialog):
+ """A dialog to show design info
+ """
+
+ def __init__(self, *args, **kwargs):
+ super(DesignInfoDialog, self).__init__(*args, **kwargs)
+ self.SetWindowStyle(wx.FRAME_FLOAT_ON_PARENT | wx.DEFAULT_FRAME_STYLE)
+
+ self.view_panel = self.GetParent()
+ self.drawing_panel = self.view_panel.drawing_panel
+
+ sizer = wx.BoxSizer(wx.VERTICAL)
+ info_sizer = wx.FlexGridSizer(6, 2, 5, 5)
+
+ dimensions_label = wx.StaticText(self, label=_("Design dimensions (mm)"))
+ self.dimensions = wx.StaticText(self)
+
+ num_stitches_label = wx.StaticText(self, label=_('# Stitches'))
+ self.num_stitches = wx.StaticText(self)
+
+ num_color_changes_label = wx.StaticText(self, label=_("# Color Changes"))
+ self.num_color_changes = wx.StaticText(self)
+
+ num_jumps_label = wx.StaticText(self, label=_("# Jumps"))
+ self.num_jumps = wx.StaticText(self)
+
+ num_trims_label = wx.StaticText(self, label=_("# Trims"))
+ self.num_trims = wx.StaticText(self)
+
+ num_stops_label = wx.StaticText(self, label=_("# Stops"))
+ self.num_stops = wx.StaticText(self)
+
+ info_sizer.Add(dimensions_label, 0, wx.ALL, 10)
+ info_sizer.Add(self.dimensions, 0, wx.EXPAND | wx.ALL, 10)
+ info_sizer.Add(num_stitches_label, 0, wx.ALL, 10)
+ info_sizer.Add(self.num_stitches, 0, wx.EXPAND | wx.ALL, 10)
+ info_sizer.Add(num_color_changes_label, 0, wx.ALL, 10)
+ info_sizer.Add(self.num_color_changes, 0, wx.EXPAND | wx.ALL, 10)
+ info_sizer.Add(num_jumps_label, 0, wx.ALL, 10)
+ info_sizer.Add(self.num_jumps, 0, wx.EXPAND | wx.ALL, 10)
+ info_sizer.Add(num_trims_label, 0, wx.ALL, 10)
+ info_sizer.Add(self.num_trims, 0, wx.EXPAND | wx.ALL, 10)
+ info_sizer.Add(num_stops_label, 0, wx.ALL, 10)
+ info_sizer.Add(self.num_stops, 0, wx.EXPAND | wx.ALL, 10)
+
+ sizer.Add(info_sizer, 1, wx.ALL, 10)
+ self.SetSizerAndFit(sizer)
+ self.update()
+
+ def update(self):
+ if not self.drawing_panel.loaded:
+ return
+ self.dimensions.SetLabel("{:.2f} x {:.2f}".format(self.drawing_panel.dimensions_mm[0], self.drawing_panel.dimensions_mm[1]))
+ self.num_stitches.SetLabel(f"{self.drawing_panel.num_stitches}")
+ self.num_color_changes.SetLabel(f"{self.drawing_panel.num_color_changes}")
+ self.num_jumps.SetLabel(f"{self.drawing_panel.num_jumps}")
+ self.num_trims.SetLabel(f"{self.drawing_panel.num_trims}")
+ self.num_stops.SetLabel(f"{self.drawing_panel.num_stops}")
+ self.Fit()