Use extruder icon without number if there is only 1

This commit is contained in:
alfrix 2022-03-30 22:58:37 -03:00
parent b70524cd28
commit 53c7afd7a5
7 changed files with 73 additions and 21 deletions

View File

@ -149,10 +149,13 @@ class BasePanel(ScreenPanel):
self.labels[device].set_ellipsize(True)
self.labels[device].set_ellipsize(Pango.EllipsizeMode.START)
if device.startswith("extruder"):
if device == "extruder":
ext_img = self._gtk.Image("extruder-0.svg", None, .5, .5)
if self._printer.extrudercount > 1:
if device == "extruder":
ext_img = self._gtk.Image("extruder-0.svg", None, .5, .5)
else:
ext_img = self._gtk.Image("extruder-%s.svg" % device[8:], None, .5, .5)
else:
ext_img = self._gtk.Image("extruder-%s.svg" % device[8:], None, .5, .5)
ext_img = self._gtk.Image("extruder.svg", None, .5, .5)
self.labels[device + '_box'].pack_start(ext_img, True, True, 3)
elif device.startswith("heater_bed"):
bed_img = self._gtk.Image("bed.svg", None, .5, .5)

View File

@ -47,14 +47,18 @@ class ExtrudePanel(ScreenPanel):
extgrid = self._gtk.HomogeneousGrid()
self.current_extruder = self._printer.get_stat("toolhead", "extruder")
for i, extruder in enumerate(self._printer.get_tools()):
self.labels[extruder] = self._gtk.ButtonImage("extruder-%s" % i, _("Tool") + " %s" % str(i))
if self._printer.extrudercount > 1:
self.labels[extruder] = self._gtk.ButtonImage("extruder-%s" % i, _("Tool") + " %s" % str(i))
else:
self.labels[extruder] = self._gtk.ButtonImage("extruder", _("Tool"))
self.labels[extruder].connect("clicked", self.change_extruder, extruder)
if extruder == self.current_extruder:
self.labels[extruder].get_style_context().add_class("button_active")
if i < 5:
extgrid.attach(self.labels[extruder], i, 0, 1, 1)
if i < 3:
extgrid.attach(self.labels['temperature'], i+1, 0, 1, 1)
if i < 3:
extgrid.attach(self.labels['temperature'], i+1, 0, 1, 1)
grid.attach(extgrid, 0, 0, 4, 1)
if self._screen.vertical_mode:

View File

@ -79,7 +79,10 @@ class MainPanel(MenuPanel):
for d in self.devices:
if d.startswith('extruder'):
i += 1
image = "extruder-%s" % i
if self._printer.extrudercount > 1:
image = "extruder-%s" % i
else:
image = "extruder"
class_name = "graph_label_%s" % device
type = "extruder"
elif device == "heater_bed":

View File

@ -285,7 +285,10 @@ class TemperaturePanel(ScreenPanel):
for d in self.devices:
if d.startswith('extruder'):
i += 1
image = "extruder-%s" % i
if self._printer.extrudercount > 1:
image = "extruder-%s" % i
else:
image = "extruder"
class_name = "graph_label_%s" % device
type = "extruder"
elif device == "heater_bed":

View File

@ -5,8 +5,8 @@
height="24"
viewBox="0 0 24 24"
id="svg892"
sodipodi:docname="extruder.svg"
inkscape:version="1.1 (c4e8f9ed74, 2021-05-24)"
sodipodi:docname="extrude.svg"
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04, custom)"
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"
@ -23,8 +23,8 @@
inkscape:pagecheckerboard="1"
showgrid="false"
inkscape:zoom="26"
inkscape:cx="-0.38461538"
inkscape:cy="12.019231"
inkscape:cx="11.346154"
inkscape:cy="13.288462"
inkscape:window-width="1600"
inkscape:window-height="826"
inkscape:window-x="0"
@ -32,7 +32,8 @@
inkscape:window-maximized="1"
inkscape:current-layer="svg892" />
<path
d="M7,2H17V8H19V13H16.5L13,17H11L7.5,13H5V8H7V2M10,22H2V20H10A1,1 0 0,0 11,19V18H13V19A3,3 0 0,1 10,22Z"
d="m 7,4.5 h 10 v 6 h 2 v 5 h -2.5 l -3.5,4 h -2 l -3.5,-4 H 5 v -5 h 2 v -6"
id="path890"
style="fill:#e2e2e2" />
style="fill:#e2e2e2"
sodipodi:nodetypes="ccccccccccccc" />
</svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -5,8 +5,8 @@
height="24"
viewBox="0 0 24 24"
id="svg892"
sodipodi:docname="extruder.svg"
inkscape:version="1.1 (c4e8f9ed74, 2021-05-24)"
sodipodi:docname="extrude.svg"
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04, custom)"
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"
@ -23,8 +23,8 @@
inkscape:pagecheckerboard="1"
showgrid="false"
inkscape:zoom="26"
inkscape:cx="-0.38461538"
inkscape:cy="12.019231"
inkscape:cx="11.346154"
inkscape:cy="13.288462"
inkscape:window-width="1600"
inkscape:window-height="826"
inkscape:window-x="0"
@ -32,7 +32,8 @@
inkscape:window-maximized="1"
inkscape:current-layer="svg892" />
<path
d="M7,2H17V8H19V13H16.5L13,17H11L7.5,13H5V8H7V2M10,22H2V20H10A1,1 0 0,0 11,19V18H13V19A3,3 0 0,1 10,22Z"
d="m 7,4.5 h 10 v 6 h 2 v 5 h -2.5 l -3.5,4 h -2 l -3.5,-4 H 5 v -5 h 2 v -6"
id="path890"
style="fill:#e2e2e2" />
style="fill:#e2e2e2"
sodipodi:nodetypes="ccccccccccccc" />
</svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -1 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M7,2H17V8H19V13H16.5L13,17H11L7.5,13H5V8H7V2M10,22H2V20H10A1,1 0 0,0 11,19V18H13V19A3,3 0 0,1 10,22Z" /></svg>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
version="1.1"
width="24"
height="24"
viewBox="0 0 24 24"
id="svg4"
sodipodi:docname="extrude.svg"
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04, custom)"
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">
<defs
id="defs8" />
<sodipodi:namedview
id="namedview6"
pagecolor="#505050"
bordercolor="#ffffff"
borderopacity="1"
inkscape:pageshadow="0"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="1"
showgrid="false"
inkscape:zoom="26"
inkscape:cx="12"
inkscape:cy="12.019231"
inkscape:window-width="1600"
inkscape:window-height="826"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg4" />
<path
d="m 7,4.5 h 10 v 6 h 2 v 5 h -2.5 l -3.5,4 h -2 l -3.5,-4 H 5 v -5 h 2 v -6"
id="path2"
sodipodi:nodetypes="ccccccccccccc" />
</svg>

Before

Width:  |  Height:  |  Size: 395 B

After

Width:  |  Height:  |  Size: 1.1 KiB