Fix potential issues with variables

This commit is contained in:
alfrix 2022-06-30 11:37:35 -03:00 committed by Alfredo Monclus
parent b611491997
commit 831db2403d
5 changed files with 11 additions and 7 deletions

View File

@ -54,9 +54,9 @@ class ConsolePanel(ScreenPanel):
options.set_hexpand(True)
options.set_vexpand(False)
options.add(o1_lbl)
options.pack_start(o1_switch, False, 0, 5)
options.pack_start(o1_switch, False, False, 5)
options.add(o2_lbl)
options.pack_start(o2_switch, False, 0, 5)
options.pack_start(o2_switch, False, False, 5)
options.add(o3_button)
sw = Gtk.ScrolledWindow()

View File

@ -47,7 +47,8 @@ class ExtrudePanel(ScreenPanel):
extgrid = self._gtk.HomogeneousGrid()
self.current_extruder = self._printer.get_stat("toolhead", "extruder")
limit = 5
for i, extruder in enumerate(self._printer.get_tools()):
i = 0
for extruder in self._printer.get_tools():
if self._printer.extrudercount > 1:
self.labels[extruder] = self._gtk.ButtonImage("extruder-%s" % i, "")
else:
@ -57,9 +58,9 @@ class ExtrudePanel(ScreenPanel):
self.labels[extruder].get_style_context().add_class("button_active")
if i < limit:
extgrid.attach(self.labels[extruder], i, 0, 1, 1)
i += 1
if i < (limit - 1):
extgrid.attach(self.labels['temperature'], i + 1, 0, 1, 1)
i += 1
distgrid = Gtk.Grid()
j = 0

View File

@ -175,6 +175,8 @@ class FineTunePanel(ScreenPanel):
gcode = "SET_GCODE_OFFSET Z_ADJUST=-%s MOVE=1" % self.bs_delta
elif dir == "reset":
gcode = "SET_GCODE_OFFSET Z=0 MOVE=1"
else:
gcode = ""
self._screen._ws.klippy.gcode_script(gcode)

View File

@ -884,12 +884,12 @@ class JobStatusPanel(ScreenPanel):
i['data'] = ""
self.show_file_thumbnail()
if "object_height" in self.file_metadata:
self.height = self.file_metadata['object_height']
self.height = float(self.file_metadata['object_height'])
self.labels['height'].set_label(str(self.height) + " mm")
if "layer_height" in self.file_metadata:
self.layer_h = self.file_metadata['layer_height']
self.layer_h = float(self.file_metadata['layer_height'])
if "first_layer_height" in self.file_metadata:
self.f_layer_h = self.file_metadata['first_layer_height']
self.f_layer_h = float(self.file_metadata['first_layer_height'])
else:
self.f_layer_h = self.layer_h
self.labels['total_layers'].set_label(str(int((self.height - self.f_layer_h) / self.layer_h) + 1))

View File

@ -227,6 +227,7 @@ class TemperaturePanel(ScreenPanel):
logging.info("Setting %s to %d" % (heater, 0))
self._printer.set_dev_stat(heater, "target", 0)
else:
target = None
for heater in self.active_heaters:
MAX_TEMP = int(float(self._printer.get_config_section(heater)['max_temp']))
if heater.startswith('extruder'):