refactor: completely ignore gcode responses with temps:
i can't think of a reason to show this messages
This commit is contained in:
@@ -22,26 +22,19 @@ class Panel(ScreenPanel):
|
||||
title = title or _("Console")
|
||||
super().__init__(screen, title)
|
||||
self.autoscroll = True
|
||||
self.hidetemps = True
|
||||
|
||||
o1_button = self._gtk.Button("arrow-down", _("Auto-scroll") + " ", None, self.bts, Gtk.PositionType.RIGHT, 1)
|
||||
o1_button.get_style_context().add_class("button_active")
|
||||
o1_button.get_style_context().add_class("buttons_slim")
|
||||
o1_button.connect("clicked", self.set_autoscroll)
|
||||
|
||||
o2_button = self._gtk.Button("heat-up", _("Hide temp.") + " ", None, self.bts, Gtk.PositionType.RIGHT, 1)
|
||||
o2_button.get_style_context().add_class("button_active")
|
||||
o2_button = self._gtk.Button("refresh", _('Clear') + " ", None, self.bts, Gtk.PositionType.RIGHT, 1)
|
||||
o2_button.get_style_context().add_class("buttons_slim")
|
||||
o2_button.connect("clicked", self.hide_temps)
|
||||
|
||||
o3_button = self._gtk.Button("refresh", _('Clear') + " ", None, self.bts, Gtk.PositionType.RIGHT, 1)
|
||||
o3_button.get_style_context().add_class("buttons_slim")
|
||||
o3_button.connect("clicked", self.clear)
|
||||
o2_button.connect("clicked", self.clear)
|
||||
|
||||
options = Gtk.Grid(vexpand=False)
|
||||
options.attach(o1_button, 0, 0, 1, 1)
|
||||
options.attach(o2_button, 1, 0, 1, 1)
|
||||
options.attach(o3_button, 2, 0, 1, 1)
|
||||
|
||||
sw = Gtk.ScrolledWindow(hexpand=True, vexpand=True)
|
||||
|
||||
@@ -94,7 +87,7 @@ class Panel(ScreenPanel):
|
||||
elif message.startswith("//"):
|
||||
color = COLORS['warning']
|
||||
message = message.replace("// ", "")
|
||||
elif self.hidetemps and re.match('^(?:ok\\s+)?(B|C|T\\d*):', message):
|
||||
elif re.match('^(?:ok\\s+)?(B|C|T\\d*):', message):
|
||||
return
|
||||
else:
|
||||
color = COLORS['response']
|
||||
@@ -123,10 +116,6 @@ class Panel(ScreenPanel):
|
||||
if action == "notify_gcode_response":
|
||||
self.add_gcode("response", time.time(), data)
|
||||
|
||||
def hide_temps(self, widget):
|
||||
self.hidetemps ^= True
|
||||
self.toggle_active_class(widget, self.hidetemps)
|
||||
|
||||
def set_autoscroll(self, widget):
|
||||
self.autoscroll ^= True
|
||||
self.toggle_active_class(widget, self.autoscroll)
|
||||
|
52
screen.py
52
screen.py
@@ -9,6 +9,7 @@ import subprocess
|
||||
import pathlib
|
||||
import traceback # noqa
|
||||
import locale
|
||||
import re
|
||||
import sys
|
||||
import gi
|
||||
|
||||
@@ -857,31 +858,32 @@ class KlipperScreen(Gtk.Window):
|
||||
self.printer.process_power_update(data)
|
||||
self.panels['splash_screen'].check_power_status()
|
||||
elif action == "notify_gcode_response" and self.printer.state not in ["error", "shutdown"]:
|
||||
if not (data.startswith("B:") or data.startswith("T:")):
|
||||
if data.startswith("// action:"):
|
||||
action = data[10:]
|
||||
if action.startswith('prompt_begin'):
|
||||
if self.prompt is not None:
|
||||
self.prompt.end()
|
||||
self.prompt = Prompt(self)
|
||||
if self.prompt is None:
|
||||
return
|
||||
self.prompt.decode(action)
|
||||
elif data.startswith("echo: "):
|
||||
self.show_popup_message(data[6:], 1, from_ws=True)
|
||||
elif data.startswith("!! "):
|
||||
self.show_popup_message(data[3:], 3, from_ws=True)
|
||||
elif "unknown" in data.lower() and \
|
||||
not ("TESTZ" in data or "MEASURE_AXES_NOISE" in data or "ACCELEROMETER_QUERY" in data):
|
||||
self.show_popup_message(data, from_ws=True)
|
||||
elif "SAVE_CONFIG" in data and self.printer.state == "ready":
|
||||
script = {"script": "SAVE_CONFIG"}
|
||||
self._confirm_send_action(
|
||||
None,
|
||||
_("Save configuration?") + "\n\n" + _("Klipper will reboot"),
|
||||
"printer.gcode.script",
|
||||
script
|
||||
)
|
||||
if re.match('^(?:ok\\s+)?(B|C|T\\d*):', data):
|
||||
return
|
||||
if data.startswith("// action:"):
|
||||
action = data[10:]
|
||||
if action.startswith('prompt_begin'):
|
||||
if self.prompt is not None:
|
||||
self.prompt.end()
|
||||
self.prompt = Prompt(self)
|
||||
if self.prompt is None:
|
||||
return
|
||||
self.prompt.decode(action)
|
||||
elif data.startswith("echo: "):
|
||||
self.show_popup_message(data[6:], 1, from_ws=True)
|
||||
elif data.startswith("!! "):
|
||||
self.show_popup_message(data[3:], 3, from_ws=True)
|
||||
elif "unknown" in data.lower() and \
|
||||
not ("TESTZ" in data or "MEASURE_AXES_NOISE" in data or "ACCELEROMETER_QUERY" in data):
|
||||
self.show_popup_message(data, from_ws=True)
|
||||
elif "SAVE_CONFIG" in data and self.printer.state == "ready":
|
||||
script = {"script": "SAVE_CONFIG"}
|
||||
self._confirm_send_action(
|
||||
None,
|
||||
_("Save configuration?") + "\n\n" + _("Klipper will reboot"),
|
||||
"printer.gcode.script",
|
||||
script
|
||||
)
|
||||
self.process_update(action, data)
|
||||
|
||||
def process_update(self, *args):
|
||||
|
Reference in New Issue
Block a user