diff options
| author | Kaalleen <36401965+kaalleen@users.noreply.github.com> | 2023-11-09 17:28:55 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-09 17:28:55 +0100 |
| commit | 8d9930a52d62c6c55b6199fe531ad99dba55e974 (patch) | |
| tree | 9957f37a3b983a8f60a2de9e81cbde05c91744fe | |
| parent | 2a78e51fff7c83dddc283608a95d779a6b89dceb (diff) | |
Save some space (simulator) (#2571)
* combine and untoggle direction buttons
* do not switch bitmap play/pause buttons
| -rw-r--r-- | icons/direction.png | bin | 0 -> 3655 bytes | |||
| -rw-r--r-- | icons/direction.svg (renamed from icons/forward.svg) | 54 | ||||
| -rw-r--r-- | icons/forward.png | bin | 5145 -> 0 bytes | |||
| -rw-r--r-- | icons/pause.png | bin | 2447 -> 0 bytes | |||
| -rw-r--r-- | icons/pause.svg | 56 | ||||
| -rw-r--r-- | icons/reverse.png | bin | 5047 -> 0 bytes | |||
| -rw-r--r-- | icons/reverse.svg | 104 | ||||
| -rw-r--r-- | lib/gui/simulator.py | 36 |
8 files changed, 49 insertions, 201 deletions
diff --git a/icons/direction.png b/icons/direction.png Binary files differnew file mode 100644 index 00000000..f6b6b717 --- /dev/null +++ b/icons/direction.png diff --git a/icons/forward.svg b/icons/direction.svg index 7e64613d..836e5e59 100644 --- a/icons/forward.svg +++ b/icons/direction.svg @@ -7,8 +7,11 @@ viewBox="0 0 256 256" id="svg8375" version="1.1" - inkscape:version="1.3 (1:1.3+202307231459+0e150ed6c4)" + inkscape:version="1.3 (0e150ed6c4, 2023-07-21)" sodipodi:docname="forward.svg" + inkscape:export-filename="forward.png" + inkscape:export-xdpi="96" + inkscape:export-ydpi="96" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns="http://www.w3.org/2000/svg" @@ -52,6 +55,25 @@ apply_with_radius="true" only_selected="false" hide_knots="false" /> + <marker + style="overflow:visible" + id="Triangle" + refX="0" + refY="0" + orient="auto-start-reverse" + inkscape:stockid="Triangle arrow" + markerWidth="0.5" + markerHeight="0.5" + viewBox="0 0 1 1" + inkscape:isstock="true" + inkscape:collect="always" + preserveAspectRatio="xMidYMid"> + <path + transform="scale(0.5)" + style="fill:context-stroke;fill-rule:evenodd;stroke:context-stroke;stroke-width:1pt" + d="M 5.77,0 -2.88,5 V -5 Z" + id="path135" /> + </marker> </defs> <sodipodi:namedview id="base" @@ -60,17 +82,17 @@ borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" - inkscape:zoom="2.7316573" - inkscape:cx="62.965439" - inkscape:cy="129.95774" + inkscape:zoom="1.8211049" + inkscape:cx="123.27681" + inkscape:cy="130.41533" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="false" units="mm" - inkscape:window-width="1366" - inkscape:window-height="705" - inkscape:window-x="-4" - inkscape:window-y="-4" + inkscape:window-width="1920" + inkscape:window-height="1011" + inkscape:window-x="0" + inkscape:window-y="32" inkscape:window-maximized="1" inkscape:showpageshadow="2" inkscape:pagecheckerboard="0" @@ -91,14 +113,14 @@ inkscape:groupmode="layer" id="layer1"> <path - style="color:#000000;fill:#000000;-inkscape-stroke:none" - d="m 124.09914,21.388579 0.29454,48.241365 c 0.0109,1.791043 0.77803,3.49411 2.1121,4.689188 l 52.30151,46.852478 c 1.98726,1.78022 1.98724,4.89216 -4e-5,6.67236 l -52.27862,46.83093 c -1.34885,1.2083 -2.12444,2.93022 -2.13549,4.74109 l -0.29404,48.21105 c -0.0113,1.84863 2.21625,2.79014 3.53425,1.49382 L 230.4316,128.0139 c 1.95911,-1.92688 1.95911,-5.0853 0,-7.01218 L 127.63335,19.89476 c -1.31799,-1.296305 -3.5455,-0.354794 -3.53421,1.493819 z" - id="path4" - sodipodi:nodetypes="ccccccccccccc" /> + style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:30;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#Triangle)" + d="M 28.654909,91.432761 191.42073,91.63363" + id="path3" + sodipodi:nodetypes="cc" /> <path - style="color:#000000;fill:#000000;-inkscape-stroke:none" - d="m 24.099141,21.388579 0.294544,48.241365 c 0.01093,1.791042 0.778028,3.494109 2.112097,4.689188 l 52.301511,46.852478 c 1.987259,1.78022 1.98724,4.89216 -4e-5,6.67236 L 26.528635,174.6749 c -1.348852,1.2083 -2.124443,2.93022 -2.135489,4.74109 l -0.294039,48.21105 c -0.01128,1.84862 2.216247,2.79013 3.534243,1.49382 L 130.4316,128.0139 c 1.95911,-1.92688 1.95911,-5.0853 0,-7.01218 L 27.63335,19.89476 c -1.317988,-1.296303 -3.545496,-0.354793 -3.534209,1.493819 z" - id="path4-1" - sodipodi:nodetypes="cccccccsccccc" /> + style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:30;stroke-dasharray:none;stroke-opacity:1;marker-end:url(#Triangle)" + d="M 227.34509,164.20927 64.579263,164.41014" + id="path1" + sodipodi:nodetypes="cc" /> </g> </svg> diff --git a/icons/forward.png b/icons/forward.png Binary files differdeleted file mode 100644 index f7a95d11..00000000 --- a/icons/forward.png +++ /dev/null diff --git a/icons/pause.png b/icons/pause.png Binary files differdeleted file mode 100644 index 39b55f3b..00000000 --- a/icons/pause.png +++ /dev/null diff --git a/icons/pause.svg b/icons/pause.svg deleted file mode 100644 index eec61f24..00000000 --- a/icons/pause.svg +++ /dev/null @@ -1,56 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!-- Created with Inkscape (http://www.inkscape.org/) --> - -<svg - width="256" - height="256" - viewBox="0 0 256 256" - id="svg8375" - version="1.1" - inkscape:version="1.3 (0e150ed6c4, 2023-07-21)" - sodipodi:docname="pause.svg" - xml:space="preserve" - inkscape:export-filename="pause.png" - inkscape:export-xdpi="96" - inkscape:export-ydpi="96" - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns="http://www.w3.org/2000/svg" - xmlns:svg="http://www.w3.org/2000/svg" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:cc="http://creativecommons.org/ns#" - xmlns:dc="http://purl.org/dc/elements/1.1/"><defs - id="defs8377" /><sodipodi:namedview - id="base" - pagecolor="#ffffff" - bordercolor="#666666" - borderopacity="1.0" - inkscape:pageopacity="0.0" - inkscape:pageshadow="2" - inkscape:zoom="1.3991985" - inkscape:cx="133.29059" - inkscape:cy="120.42609" - inkscape:document-units="px" - inkscape:current-layer="layer1" - showgrid="false" - units="mm" - inkscape:window-width="1920" - inkscape:window-height="1011" - inkscape:window-x="0" - inkscape:window-y="32" - inkscape:window-maximized="1" - inkscape:showpageshadow="2" - inkscape:pagecheckerboard="0" - inkscape:deskcolor="#d1d1d1" /><metadata - id="metadata8380"><rdf:RDF><cc:Work - rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type - rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><g - inkscape:label="Layer 1" - inkscape:groupmode="layer" - id="layer1"><path - id="path1" - style="opacity:1;fill:#000000;fill-opacity:0.97692001;fill-rule:evenodd;stroke:none;stroke-width:0.377953;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" - d="m 75.675755,39.52655 h 19.06887 c 11.080005,0 20.000005,8.92 20.000005,20 v 139.35948 c 0,11.08 -8.92,20 -20.000005,20 h -19.06887 c -11.08,0 -20,-8.92 -20,-20 V 59.52655 c 0,-11.08 8.92,-20 20,-20 z" /><path - id="path2" - style="opacity:1;fill:#000000;fill-opacity:0.97692001;fill-rule:evenodd;stroke:none;stroke-width:0.377953;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1" - d="m 165.10513,39.52655 h 19.06888 c 11.08,0 20,8.92 20,20 v 139.35948 c 0,11.08 -8.92,20 -20,20 h -19.06888 c -11.08,0 -20,-8.92 -20,-20 V 59.52655 c 0,-11.08 8.92,-20 20,-20 z" /></g></svg> diff --git a/icons/reverse.png b/icons/reverse.png Binary files differdeleted file mode 100644 index 982bf3e5..00000000 --- a/icons/reverse.png +++ /dev/null diff --git a/icons/reverse.svg b/icons/reverse.svg deleted file mode 100644 index 29e3d738..00000000 --- a/icons/reverse.svg +++ /dev/null @@ -1,104 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!-- Created with Inkscape (http://www.inkscape.org/) --> - -<svg - width="256" - height="256" - viewBox="0 0 256 256" - id="svg8375" - version="1.1" - inkscape:version="1.3 (1:1.3+202307231459+0e150ed6c4)" - sodipodi:docname="reverse.svg" - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns="http://www.w3.org/2000/svg" - xmlns:svg="http://www.w3.org/2000/svg" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:cc="http://creativecommons.org/ns#" - xmlns:dc="http://purl.org/dc/elements/1.1/"> - <defs - id="defs8377"> - <inkscape:path-effect - effect="fillet_chamfer" - id="path-effect4" - is_visible="true" - lpeversion="1" - nodesatellites_param="F,0,0,1,0,5,0,1 @ F,0,0,1,0,2.8125752,0,1 @ F,0,0,1,0,5,0,1 @ F,0,0,1,0,2.8437239,0,1 @ F,0,0,1,0,5,0,1 @ F,0,0,1,0,5,0,1" - radius="5" - unit="px" - method="auto" - mode="F" - chamfer_steps="1" - flexible="false" - use_knot_distance="true" - apply_no_radius="true" - apply_with_radius="true" - only_selected="false" - hide_knots="false" /> - <inkscape:path-effect - effect="fillet_chamfer" - id="path-effect4-0" - is_visible="true" - lpeversion="1" - nodesatellites_param="F,0,0,1,0,5,0,1 @ F,0,0,1,0,5,0,1 @ F,0,0,1,0,5,0,1 @ F,0,0,1,0,5,0,1 @ F,0,0,1,0,5,0,1 @ F,0,0,1,0,5,0,1" - radius="5" - unit="px" - method="auto" - mode="F" - chamfer_steps="1" - flexible="false" - use_knot_distance="true" - apply_no_radius="true" - apply_with_radius="true" - only_selected="false" - hide_knots="false" /> - </defs> - <sodipodi:namedview - id="base" - pagecolor="#ffffff" - bordercolor="#666666" - borderopacity="1.0" - inkscape:pageopacity="0.0" - inkscape:pageshadow="2" - inkscape:zoom="2.7316573" - inkscape:cx="62.965439" - inkscape:cy="129.95774" - inkscape:document-units="px" - inkscape:current-layer="layer1" - showgrid="false" - units="mm" - inkscape:window-width="1366" - inkscape:window-height="705" - inkscape:window-x="-4" - inkscape:window-y="-4" - inkscape:window-maximized="1" - inkscape:showpageshadow="2" - inkscape:pagecheckerboard="0" - inkscape:deskcolor="#d1d1d1" /> - <metadata - id="metadata8380"> - <rdf:RDF> - <cc:Work - rdf:about=""> - <dc:format>image/svg+xml</dc:format> - <dc:type - rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> - </cc:Work> - </rdf:RDF> - </metadata> - <g - inkscape:label="Layer 1" - inkscape:groupmode="layer" - id="layer1"> - <path - style="color:#000000;fill:#000000;-inkscape-stroke:none" - d="m 131.90086,21.388579 -0.29454,48.241365 c -0.0109,1.791043 -0.77803,3.49411 -2.1121,4.689188 L 77.192707,121.17161 c -1.98726,1.78022 -1.98724,4.89216 4e-5,6.67236 l 52.278623,46.83093 c 1.34885,1.2083 2.12444,2.93022 2.13549,4.74109 l 0.29404,48.21105 c 0.0113,1.84863 -2.21625,2.79014 -3.53425,1.49382 L 25.568397,128.0139 c -1.95911,-1.92688 -1.95911,-5.0853 0,-7.01218 L 128.36665,19.89476 c 1.31799,-1.296305 3.5455,-0.354794 3.53421,1.493819 z" - id="path4" - sodipodi:nodetypes="ccccccccccccc" /> - <path - style="color:#000000;fill:#000000;-inkscape-stroke:none" - d="m 231.90086,21.388579 -0.29455,48.241365 c -0.0109,1.791042 -0.77803,3.494109 -2.1121,4.689188 L 177.1927,121.17161 c -1.98726,1.78022 -1.98724,4.89216 4e-5,6.67236 l 52.27862,46.83093 c 1.34885,1.2083 2.12444,2.93022 2.13549,4.74109 l 0.29404,48.21105 c 0.0113,1.84862 -2.21625,2.79013 -3.53424,1.49382 L 125.5684,128.0139 c -1.95911,-1.92688 -1.95911,-5.0853 0,-7.01218 L 228.36665,19.89476 c 1.31798,-1.296303 3.54549,-0.354793 3.53421,1.493819 z" - id="path4-1" - sodipodi:nodetypes="cccccccsccccc" /> - </g> -</svg> diff --git a/lib/gui/simulator.py b/lib/gui/simulator.py index 863800bd..423802f8 100644 --- a/lib/gui/simulator.py +++ b/lib/gui/simulator.py @@ -78,15 +78,10 @@ class ControlPanel(wx.Panel): self.btnForwardCommand.Bind(wx.EVT_BUTTON, self.animation_one_command_forward) self.btnForwardCommand.SetBitmap(self.load_icon('forward_command')) self.btnForwardCommand.SetToolTip(_('Go forward one command (page-up)')) - self.btnForward = wx.BitmapToggleButton(self, -1, style=self.button_style) - self.btnForward.SetValue(True) - self.btnForward.Bind(wx.EVT_TOGGLEBUTTON, self.on_forward_button) - self.btnForward.SetBitmap(self.load_icon('forward')) - self.btnForward.SetToolTip(_('Animate forward (arrow right)')) - self.btnReverse = wx.BitmapToggleButton(self, -1, style=self.button_style) - self.btnReverse.Bind(wx.EVT_TOGGLEBUTTON, self.on_reverse_button) - self.btnReverse.SetBitmap(self.load_icon('reverse')) - self.btnReverse.SetToolTip(_('Animate in reverse (arrow left)')) + self.btnDirection = wx.Button(self, -1, style=self.button_style) + self.btnDirection.Bind(wx.EVT_BUTTON, self.on_direction_button) + self.btnDirection.SetBitmap(self.load_icon('direction')) + self.btnDirection.SetToolTip(_('Switch animation direction (arrow left, arrow right)')) self.btnPlay = wx.BitmapToggleButton(self, -1, style=self.button_style) self.btnPlay.Bind(wx.EVT_TOGGLEBUTTON, self.on_play_button) self.btnPlay.SetBitmap(self.load_icon('play')) @@ -143,8 +138,7 @@ class ControlPanel(wx.Panel): self.controls_inner_sizer.Add(self.btnBackwardStitch, 0, wx.EXPAND | wx.ALL, 2) self.controls_inner_sizer.Add(self.btnForwardStitch, 0, wx.EXPAND | wx.ALL, 2) self.controls_inner_sizer.Add(self.btnForwardCommand, 0, wx.EXPAND | wx.ALL, 2) - self.controls_inner_sizer.Add(self.btnReverse, 0, wx.EXPAND | wx.ALL, 2) - self.controls_inner_sizer.Add(self.btnForward, 0, wx.EXPAND | wx.ALL, 2) + self.controls_inner_sizer.Add(self.btnDirection, 0, wx.EXPAND | wx.ALL, 2) self.controls_inner_sizer.Add(self.btnPlay, 0, wx.EXPAND | wx.ALL, 2) self.controls_inner_sizer.Add(self.btnRestart, 0, wx.EXPAND | wx.ALL, 2) self.controls_sizer.Add((1, 1), 1) @@ -173,7 +167,7 @@ class ControlPanel(wx.Panel): self.speed_buttons_sizer.Add((1, 1), 1) self.speed_sizer.Add(self.speed_buttons_sizer, 0, wx.EXPAND | wx.ALL) self.speed_text = wx.StaticText(self, wx.ID_ANY, label="", style=wx.ALIGN_CENTRE_HORIZONTAL | wx.ST_NO_AUTORESIZE) - self.speed_text.SetFont(wx.Font(wx.FontInfo(15).Bold())) + self.speed_text.SetFont(wx.Font(wx.FontInfo(10).Bold())) extent = self.speed_text.GetTextExtent(self.format_speed_text(100000)) self.speed_text.SetMinSize(extent) self.speed_sizer.Add(self.speed_text, 0, wx.EXPAND | wx.ALL, 5) @@ -294,24 +288,20 @@ class ControlPanel(wx.Panel): self.set_speed(self.target_stitches_per_second) def animation_forward(self, event=None): - self.btnForward.SetValue(True) - self.btnReverse.SetValue(False) self.drawing_panel.forward() self.direction = 1 self.update_speed_text() def animation_reverse(self, event=None): - self.btnForward.SetValue(False) - self.btnReverse.SetValue(True) self.drawing_panel.reverse() self.direction = -1 self.update_speed_text() - def on_forward_button(self, event): - self.animation_forward() - - def on_reverse_button(self, event): - self.animation_reverse() + def on_direction_button(self, event): + if self.direction == -1: + self.animation_forward() + else: + self.animation_reverse() def set_speed(self, speed): self.speed = int(max(speed, 1)) @@ -376,19 +366,15 @@ class ControlPanel(wx.Panel): def animation_pause(self, event=None): self.drawing_panel.stop() - self.btnPlay.SetBitmap(self.load_icon('play')) def animation_start(self, event=None): self.drawing_panel.go() - self.btnPlay.SetBitmap(self.load_icon('pause')) def on_start(self): self.btnPlay.SetValue(True) - self.btnPlay.SetBitmap(self.load_icon('pause')) def on_stop(self): self.btnPlay.SetValue(False) - self.btnPlay.SetBitmap(self.load_icon('play')) def on_play_button(self, event): play = self.btnPlay.GetValue() |
