Set distance and speed variables after config is loaded (#782)

Co-authored-by: Marcin Kozioł <marcin.koziol@outi.pl>
This commit is contained in:
marcin-koziolandMarcin Kozioł authored and GitHub committed 2022-11-08 17:32:54 -03:00
1 parent ca7143f776
commit 1dc3433e02
1 file changed
+3 -2
+3 -2
View File
@@ -24,9 +24,7 @@ class ExtrudePanel(ScreenPanel):
self.unload_filament = any("UNLOAD_FILAMENT" in macro.upper() for macro in macros)
self.speeds = ['1', '2', '5', '25']
self.speed = int(self.speeds[1])
self.distances = ['5', '10', '15', '25']
self.distance = int(self.distances[1])
print_cfg = self._config.get_printer_config(self._screen.connected_printer)
if print_cfg is not None:
dis = print_cfg.get("extrude_distances", '5, 10, 15, 25')
@@ -40,6 +38,9 @@ class ExtrudePanel(ScreenPanel):
if 1 < len(vel) < 5:
self.speeds = vel
self.distance = int(self.distances[1])
self.speed = int(self.speeds[1])
def initialize(self, panel_name):
self.labels['extrude'] = self._gtk.ButtonImage("extrude", _("Extrude"), "color4")
self.labels['extrude'].connect("clicked", self.extrude, "+")