log: cleanup logs for files, system and bed_mesh
functions: log if DPMS fails to load screen: log send_action
This commit is contained in:
parent
300eed4d29
commit
1e6a9ec8ae
@ -47,8 +47,8 @@ try:
|
||||
return state
|
||||
|
||||
dpms_loaded = True
|
||||
except Exception:
|
||||
pass
|
||||
except Exception as msg:
|
||||
logging.error(f"Couldn't load DPMS: {msg}")
|
||||
|
||||
|
||||
def get_network_interfaces():
|
||||
|
@ -85,7 +85,8 @@ class BedMeshPanel(ScreenPanel):
|
||||
if profile not in self.profiles:
|
||||
self.add_profile(profile)
|
||||
|
||||
logging.info(f"Active {self.active_mesh} changing to {profile}")
|
||||
if self.active_mesh != profile:
|
||||
logging.info(f"Active {self.active_mesh} changing to {profile}")
|
||||
self.profiles[profile]['name'].set_sensitive(False)
|
||||
self.profiles[profile]['name'].get_style_context().add_class("button_active")
|
||||
self.active_mesh = profile
|
||||
@ -176,7 +177,6 @@ class BedMeshPanel(ScreenPanel):
|
||||
|
||||
def load_meshes(self):
|
||||
bm_profiles = self._printer.get_stat("bed_mesh", "profiles")
|
||||
logging.info(f"Bed profiles: {bm_profiles}")
|
||||
for prof in bm_profiles:
|
||||
if prof not in self.profiles:
|
||||
self.add_profile(prof)
|
||||
@ -187,7 +187,6 @@ class BedMeshPanel(ScreenPanel):
|
||||
def process_update(self, action, data):
|
||||
if action == "notify_status_update":
|
||||
with contextlib.suppress(KeyError):
|
||||
logging.info(data['bed_mesh'])
|
||||
self.activate_mesh(data['bed_mesh']['profile_name'])
|
||||
|
||||
def remove_create(self):
|
||||
|
@ -83,7 +83,6 @@ class SystemPanel(ScreenPanel):
|
||||
infogrid.attach(self.labels[f"{prog}_restart"], 0, i, 1, 1)
|
||||
|
||||
infogrid.attach(self.labels[f"{prog}_status"], 2, i, 1, 1)
|
||||
logging.info(f"Updating program: {prog} ")
|
||||
self.update_program_info(prog)
|
||||
|
||||
infogrid.attach(self.labels[prog], 1, i, 1, 1)
|
||||
@ -338,12 +337,11 @@ class SystemPanel(ScreenPanel):
|
||||
|
||||
def update_program_info(self, p):
|
||||
|
||||
logging.info(f"Updating program: {p} ")
|
||||
if 'version_info' not in self.update_status or p not in self.update_status['version_info']:
|
||||
logging.info(f"Unknown version: {p}")
|
||||
return
|
||||
|
||||
info = self.update_status['version_info'][p]
|
||||
logging.info(f"{p}: {info}")
|
||||
|
||||
if p == "system":
|
||||
self.labels[p].set_markup("<b>System</b>")
|
||||
@ -352,7 +350,7 @@ class SystemPanel(ScreenPanel):
|
||||
self.labels[f"{p}_status"].get_style_context().remove_class('update')
|
||||
self.labels[f"{p}_status"].set_sensitive(False)
|
||||
else:
|
||||
self._needs_update(p)
|
||||
self._needs_update(p, local="", remote=info['package_count'])
|
||||
|
||||
elif 'configured_type' in info and info['configured_type'] == 'git_repo':
|
||||
if info['is_valid'] and not info['is_dirty']:
|
||||
@ -361,7 +359,7 @@ class SystemPanel(ScreenPanel):
|
||||
self.labels[f"{p}_status"].get_style_context().remove_class('invalid')
|
||||
else:
|
||||
self.labels[p].set_markup(f"<b>{p}</b>\n{info['version']} -> {info['remote_version']}")
|
||||
self._needs_update(p)
|
||||
self._needs_update(p, info['version'], info['remote_version'])
|
||||
else:
|
||||
self.labels[p].set_markup(f"<b>{p}</b>\n{info['version']}")
|
||||
self.labels[f"{p}_status"].set_label(_("Invalid"))
|
||||
@ -371,15 +369,17 @@ class SystemPanel(ScreenPanel):
|
||||
self._already_updated(p, info)
|
||||
else:
|
||||
self.labels[p].set_markup(f"<b>{p}</b>\n{info['version']} -> {info['remote_version']}")
|
||||
self._needs_update(p)
|
||||
self._needs_update(p, info['version'], info['remote_version'])
|
||||
|
||||
def _already_updated(self, p, info):
|
||||
logging.info(f"{p} {info['version']}")
|
||||
self.labels[p].set_markup(f"<b>{p}</b>\n{info['version']}")
|
||||
self.labels[f"{p}_status"].set_label(_("Up To Date"))
|
||||
self.labels[f"{p}_status"].get_style_context().remove_class('update')
|
||||
self.labels[f"{p}_status"].set_sensitive(False)
|
||||
|
||||
def _needs_update(self, p):
|
||||
def _needs_update(self, p, local="", remote=""):
|
||||
logging.info(f"{p} {local} -> {remote}")
|
||||
self.labels[f"{p}_status"].set_label(_("Update"))
|
||||
self.labels[f"{p}_status"].get_style_context().add_class('update')
|
||||
self.labels[f"{p}_status"].set_sensitive(True)
|
||||
|
@ -856,7 +856,6 @@ class KlipperScreen(Gtk.Window):
|
||||
elif action == "notify_status_update" and self.printer.get_state() != "shutdown":
|
||||
self.printer.process_update(data)
|
||||
elif action == "notify_filelist_changed":
|
||||
logging.debug("Filelist changed: %s", json.dumps(data, indent=2))
|
||||
if self.files is not None:
|
||||
self.files.process_update(data)
|
||||
elif action == "notify_metadata_update":
|
||||
@ -923,6 +922,7 @@ class KlipperScreen(Gtk.Window):
|
||||
widget.destroy()
|
||||
|
||||
def _send_action(self, widget, method, params):
|
||||
logging.info(f"{method}: {params}")
|
||||
self._ws.send_method(method, params)
|
||||
|
||||
def printer_initializing(self, text=None, disconnect=False):
|
||||
|
Loading…
x
Reference in New Issue
Block a user