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-koziol 2022-11-08 21:32:54 +01:00 committed by GitHub
parent ca7143f776
commit 1dc3433e02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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, "+")