lint fixes and minor refactorings

This commit is contained in:
alfrix 2022-09-21 11:54:49 -03:00
parent c061378e62
commit 2f427f7b82
2 changed files with 11 additions and 9 deletions

View File

@ -48,11 +48,13 @@ class BedLevelPanel(ScreenPanel):
self._get_offsets("bltouch")
elif "probe" in self._screen.printer.get_config_section_list():
self._get_offsets("probe")
new_screws = []
# bed_screws uses NOZZLE positions
# screws_tilt_adjust uses PROBE positions and to be offseted for the buttons to work equal to bed_screws
for screw in self.screws:
new_screws.append([round(screw[0] + self.x_offset, 1), round(screw[1] + self.y_offset, 1)])
new_screws = [
[round(screw[0] + self.x_offset, 1), round(screw[1] + self.y_offset, 1)]
for screw in self.screws
]
self.screws = new_screws
logging.info(f"screws with offset: {self.screws}")
elif "bed_screws" in self._screen.printer.get_config_section_list():
@ -110,9 +112,9 @@ class BedLevelPanel(ScreenPanel):
for screw in screw_positions:
if screw not in ("bl", "fl", "fr", "br", "bm", "fm", "lm", "rm", ""):
logging.error(f"Unknown screw: {screw}")
self._screen.show_popup_message(_("Unknown screw position") + ": %s" % screw)
self._screen.show_popup_message(_("Unknown screw position") + f": {screw}")
valid_positions = False
if not(3 <= len(screw_positions) <= 8):
if not (3 <= len(screw_positions) <= 8):
valid_positions = False
rotation = printer_cfg.getint("screw_rotation", 0)
logging.info(f"Rotation: {rotation}")
@ -142,7 +144,7 @@ class BedLevelPanel(ScreenPanel):
bedgrid.attach(self.labels['lm'], 1, 1, 1, 1)
if "rm" in screw_positions:
bedgrid.attach(self.labels['rm'], 3, 1, 1, 1)
elif nscrews in (4, 6, 8):
elif nscrews in {4, 6, 8}:
bedgrid.attach(self.labels['bl'], 1, 0, 1, 1)
bedgrid.attach(self.labels['fl'], 1, 2, 1, 1)
bedgrid.attach(self.labels['fr'], 3, 2, 1, 1)

View File

@ -201,9 +201,9 @@ class SystemPanel(ScreenPanel):
if "package_count" in info:
label.set_markup((
f'<b>{info["package_count"]} '
+ ngettext("Package will be updated", "Packages will be updated", info["package_count"])
+ f':</b>\n'
f'<b>{info["package_count"]} '
+ ngettext("Package will be updated", "Packages will be updated", info["package_count"])
+ f':</b>\n'
))
label.set_halign(Gtk.Align.CENTER)
vbox.add(label)