修复耗材检测弹窗异常问题
This commit is contained in:
parent
3bfc1aa714
commit
413bf6fc4a
@ -23,14 +23,14 @@ class Prompt:
|
|||||||
def decode(self, data):
|
def decode(self, data):
|
||||||
logging.info(f'{data}')
|
logging.info(f'{data}')
|
||||||
if data.startswith('prompt_begin'):
|
if data.startswith('prompt_begin'):
|
||||||
self.header = _(data.replace('prompt_begin', '').lstrip())
|
self.header = _(cleaned_data) if (cleaned_data := data.replace("prompt_begin", "").strip()) else ""
|
||||||
if self.header:
|
if self.header:
|
||||||
self.window_title = self.header
|
self.window_title = self.header
|
||||||
self.text = ""
|
self.text = ""
|
||||||
self.buttons = []
|
self.buttons = []
|
||||||
return
|
return
|
||||||
elif data.startswith('prompt_text'):
|
elif data.startswith('prompt_text'):
|
||||||
self.text = _(data.replace('prompt_text ', '').lstrip())
|
self.text = _(cleaned_data) if (cleaned_data := data.replace("prompt_text", "").strip()) else ""
|
||||||
return
|
return
|
||||||
elif data.startswith('prompt_button ') or data.startswith('prompt_footer_button'):
|
elif data.startswith('prompt_button ') or data.startswith('prompt_footer_button'):
|
||||||
data = data.replace('prompt_button ', '')
|
data = data.replace('prompt_button ', '')
|
||||||
|
@ -876,7 +876,7 @@ class KlipperScreen(Gtk.Window):
|
|||||||
elif action == "notify_update_response":
|
elif action == "notify_update_response":
|
||||||
if 'message' in data and 'Error' in data['message']:
|
if 'message' in data and 'Error' in data['message']:
|
||||||
logging.error(f"{action}:{data['message']}")
|
logging.error(f"{action}:{data['message']}")
|
||||||
self.show_popup_message(_(data['message'].lstrip()), 3, from_ws=True)
|
self.show_popup_message(_(cleaned_data) if (cleaned_data := data['message'].strip()) else "", 3, from_ws=True)
|
||||||
if "KlipperScreen" in data['message']:
|
if "KlipperScreen" in data['message']:
|
||||||
self.restart_ks()
|
self.restart_ks()
|
||||||
elif action == "notify_power_changed":
|
elif action == "notify_power_changed":
|
||||||
@ -895,9 +895,9 @@ class KlipperScreen(Gtk.Window):
|
|||||||
return
|
return
|
||||||
self.prompt.decode(action)
|
self.prompt.decode(action)
|
||||||
elif data.startswith("echo: "):
|
elif data.startswith("echo: "):
|
||||||
self.show_popup_message(_(data[6:].lstrip()), 1, from_ws=True)
|
self.show_popup_message(_(cleaned_data) if (cleaned_data := data[6:].strip()) else "", 1, from_ws=True)
|
||||||
elif data.startswith("!! "):
|
elif data.startswith("!! "):
|
||||||
self.show_popup_message(_(data[3:].lstrip()), 3, from_ws=True)
|
self.show_popup_message(_(cleaned_data) if (cleaned_data := data[3:].strip()) else "", 3, from_ws=True)
|
||||||
elif "unknown" in data.lower() and \
|
elif "unknown" in data.lower() and \
|
||||||
not ("TESTZ" in data or "MEASURE_AXES_NOISE" in data or "ACCELEROMETER_QUERY" in data):
|
not ("TESTZ" in data or "MEASURE_AXES_NOISE" in data or "ACCELEROMETER_QUERY" in data):
|
||||||
self.show_popup_message(data, from_ws=True)
|
self.show_popup_message(data, from_ws=True)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user