PEP8, typos and warnings fixes

This commit is contained in:
alfrix authored and Alfredo Monclus committed 2022-05-31 11:14:42 -03:00
1 parent fd2a717ece
commit 5a36729b76
40 files changed
+335 -296

No files matched your search

+8 -9
View File
@@ -51,6 +51,7 @@ PRINTER_BASE_STATUS_OBJECTS = [
klipperscreendir = pathlib.Path(__file__).parent.resolve()
class KlipperScreen(Gtk.Window):
""" Class for creating a screen for Klipper via HDMI """
_cur_panels = []
@@ -440,7 +441,6 @@ class KlipperScreen(Gtk.Window):
widget.destroy()
def init_style(self):
style_provider = Gtk.CssProvider()
css = open(os.path.join(klipperscreendir, "styles", "base.css"))
css_data = css.read()
css.close()
@@ -475,17 +475,17 @@ class KlipperScreen(Gtk.Window):
)
for i in range(len(style_options['graph_colors']['bed']['colors'])):
css_data += "\n.graph_label_heater_bed%s {border-left-color: #%s}" % (
"" if i+1 == 1 else i+1,
"" if i + 1 == 1 else i + 1,
style_options['graph_colors']['bed']['colors'][i]
)
for i in range(len(style_options['graph_colors']['fan']['colors'])):
css_data += "\n.graph_label_fan_%s {border-left-color: #%s}" % (
i+1,
i + 1,
style_options['graph_colors']['fan']['colors'][i]
)
for i in range(len(style_options['graph_colors']['sensor']['colors'])):
css_data += "\n.graph_label_sensor_%s {border-left-color: #%s}" % (
i+1,
i + 1,
style_options['graph_colors']['sensor']['colors'][i]
)
@@ -943,7 +943,7 @@ class KlipperScreen(Gtk.Window):
if state['result']['klippy_connected'] is False:
self.panels['splash_screen'].update_text(
_("Moonraker: connected") +
("\n\nKlipper: %s\n\n") % state['result']['klippy_state'] +
"\n\nKlipper: %s\n\n" % state['result']['klippy_state'] +
_("Retry #%s") % self.reinit_count)
return False
@@ -979,7 +979,7 @@ class KlipperScreen(Gtk.Window):
)
data = self.apiclient.send_request("printer/objects/query?" + "&".join(PRINTER_BASE_STATUS_OBJECTS +
extra_items))
extra_items))
if data is False:
msg = "Error getting printer object data with extra items"
logging.info(msg)
@@ -1002,7 +1002,7 @@ class KlipperScreen(Gtk.Window):
def printer_ready(self):
_ = self.lang.gettext
self.close_popup_message()
# Force update to printer webhooks state in case the update is missed due to websocket subscribe not yet sent
# Force an update to printer webhooks state in case the update is missed due to websocket subscribe not yet sent
self.printer.process_update({"webhooks": {"state": "ready", "state_message": "Printer is ready"}})
self.show_panel('main_panel', "main_menu", _("Home"), 2,
items=self._config.get_menu_items("__main"), extrudercount=self.printer.get_extruder_count())
@@ -1073,8 +1073,8 @@ class KlipperScreen(Gtk.Window):
os.system("xsetroot -cursor ks_includes/emptyCursor.xbm ks_includes/emptyCursor.xbm")
return
def main():
def main():
version = functions.get_software_version()
parser = argparse.ArgumentParser(description="KlipperScreen - A GUI for Klipper")
parser.add_argument(
@@ -1096,7 +1096,6 @@ def main():
logging.info("KlipperScreen version: %s" % version)
win = KlipperScreen(args, version)
win.connect("destroy", Gtk.main_quit)
win.show_all()