system and menu: fix not loading when no printer is online but moonraker is connected
This commit is contained in:
parent
7e9fc97b4b
commit
244f964126
@ -20,6 +20,10 @@ class Printer:
|
|||||||
"shutdown": None
|
"shutdown": None
|
||||||
}
|
}
|
||||||
tools = []
|
tools = []
|
||||||
|
toolcount = 0
|
||||||
|
extrudercount = 0
|
||||||
|
tempdevcount = 0
|
||||||
|
fancount = 0
|
||||||
|
|
||||||
def __init__(self, printer_info, data, state_execute_cb):
|
def __init__(self, printer_info, data, state_execute_cb):
|
||||||
self.state = "disconnected"
|
self.state = "disconnected"
|
||||||
@ -176,9 +180,6 @@ class Printer:
|
|||||||
}
|
}
|
||||||
logging.debug("Power devices: %s" % self.power_devices)
|
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=""):
|
def get_config_section_list(self, search=""):
|
||||||
if not hasattr(self, "config"):
|
if not hasattr(self, "config"):
|
||||||
return []
|
return []
|
||||||
@ -232,7 +233,7 @@ class Printer:
|
|||||||
"fans": {
|
"fans": {
|
||||||
"count": self.fancount
|
"count": self.fancount
|
||||||
},
|
},
|
||||||
"bltouch": self.section_exists("bltouch"),
|
"bltouch": self.config_section_exists("bltouch"),
|
||||||
"gcode_macros": {
|
"gcode_macros": {
|
||||||
"count": len(self.get_gcode_macros())
|
"count": len(self.get_gcode_macros())
|
||||||
},
|
},
|
||||||
@ -241,7 +242,7 @@ class Printer:
|
|||||||
"power_devices": {
|
"power_devices": {
|
||||||
"count": len(self.get_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"]
|
self.tempstore[dev]["temperatures"] = result[dev]["temperatures"]
|
||||||
logging.info("Temp store: %s" % list(self.tempstore))
|
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():
|
if section in self.get_config_section_list():
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
@ -38,24 +38,6 @@ class SystemPanel(ScreenPanel):
|
|||||||
_("Are you sure you wish to shutdown the system?"), "machine.shutdown")
|
_("Are you sure you wish to shutdown the system?"), "machine.shutdown")
|
||||||
shutdown.set_vexpand(False)
|
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 = Gtk.ScrolledWindow()
|
||||||
scroll.set_property("overlay-scrolling", False)
|
scroll.set_property("overlay-scrolling", False)
|
||||||
scroll.set_vexpand(True)
|
scroll.set_vexpand(True)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user