system and menu: fix not loading when no printer is online but moonraker is connected

This commit is contained in:
alfrix 2022-03-01 09:12:13 -03:00
parent 7e9fc97b4b
commit 244f964126
2 changed files with 7 additions and 24 deletions

View File

@ -20,6 +20,10 @@ class Printer:
"shutdown": None
}
tools = []
toolcount = 0
extrudercount = 0
tempdevcount = 0
fancount = 0
def __init__(self, printer_info, data, state_execute_cb):
self.state = "disconnected"
@ -176,9 +180,6 @@ class Printer:
}
logging.debug("Power devices: %s" % self.power_devices)
def config_section_exists(self, section):
return section in list(self.config)
def get_config_section_list(self, search=""):
if not hasattr(self, "config"):
return []
@ -232,7 +233,7 @@ class Printer:
"fans": {
"count": self.fancount
},
"bltouch": self.section_exists("bltouch"),
"bltouch": self.config_section_exists("bltouch"),
"gcode_macros": {
"count": len(self.get_gcode_macros())
},
@ -241,7 +242,7 @@ class Printer:
"power_devices": {
"count": len(self.get_power_devices())
},
"probe": self.section_exists("probe")
"probe": self.config_section_exists("probe")
}
}
@ -340,7 +341,7 @@ class Printer:
self.tempstore[dev]["temperatures"] = result[dev]["temperatures"]
logging.info("Temp store: %s" % list(self.tempstore))
def section_exists(self, section):
def config_section_exists(self, section):
if section in self.get_config_section_list():
return True
return False

View File

@ -38,24 +38,6 @@ class SystemPanel(ScreenPanel):
_("Are you sure you wish to shutdown the system?"), "machine.shutdown")
shutdown.set_vexpand(False)
info = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
info.set_vexpand(True)
info.set_valign(Gtk.Align.CENTER)
self.labels['loadavg'] = Gtk.Label("temp")
self.labels['klipper_version'] = Gtk.Label(
_("Klipper Version") +
(": %s" % self._screen.printer.get_klipper_version()))
self.labels['klipper_version'].set_margin_top(15)
self.labels['ks_version'] = Gtk.Label(_("KlipperScreen Version") + (": %s" % self._screen.version))
self.labels['ks_version'].set_margin_top(15)
info.add(self.labels['loadavg'])
info.add(self.labels['klipper_version'])
info.add(self.labels['ks_version'])
scroll = Gtk.ScrolledWindow()
scroll.set_property("overlay-scrolling", False)
scroll.set_vexpand(True)