screen: RESPOND echo will now show a message on the screen.

This commit is contained in:
Jordan 2021-11-21 20:19:45 -05:00
parent 0a6ac42069
commit c8420c260b
7 changed files with 39 additions and 17 deletions

View File

@ -345,12 +345,18 @@ class KlipperScreen(Gtk.Window):
self._cur_panels.append(panel_name)
logging.debug("Current panel hierarchy: %s", str(self._cur_panels))
def show_popup_message(self, message):
def show_popup_message(self, message, level=2):
if self.popup_message is not None:
self.close_popup_message()
box = Gtk.Box()
box.get_style_context().add_class("message_popup")
if level == 1:
box.get_style_context().add_class("message_popup_echo")
else:
box.get_style_context().add_class("message_popup_error")
box.set_size_request(self.width, self.gtk.get_header_size())
label = Gtk.Label()
if "must home axis first" in message.lower():
@ -730,9 +736,11 @@ class KlipperScreen(Gtk.Window):
if not (data.startswith("B:") and
re.search(r'B:[0-9\.]+\s/[0-9\.]+\sT[0-9]+:[0-9\.]+', data)):
if data.startswith("echo: "):
self.show_popup_message(data[6:], 1)
if data.startswith("!! "):
self.show_popup_message(data[3:])
# logging.debug(json.dumps([action, data], indent=2))
self.show_popup_message(data[3:], 2)
logging.debug(json.dumps([action, data], indent=2))
self.base_panel.process_update(action, data)
if self._cur_panels[-1] in self.subscriptions:

View File

@ -237,14 +237,17 @@ trough {
}
.message_popup {
background-color: #367554;
border-bottom: .1em solid white;
}
.message_popup button {
.message_popup_echo, .message_popup_echo button {
background-color: #367554;
}
.message_popup_error, .message_popup_error button {
background-color: #9e2f3a;
}
.numpad_tleft {
border: .15em solid white;
border-bottom: 0;

View File

@ -180,7 +180,6 @@ textview .time {
}
.message_popup {
background-color: #dc322f; /*solarazed-red*/
border-bottom-color: #fdf6e3; /*base3*/
}
@ -188,6 +187,14 @@ textview .time {
background-color: #dc322f; /*solarazed-red*/
}
.message_popup_echo, .message_popup_echo button {
background-color: #859900; /*solarized-green*/
}
.message_popup_error, .message_popup_error button {
background-color: #dc322f; /*solarazed-red*/
}
.numpad_tleft, .numpad_top, .numpad_tright, .numpad_left, .numpad_button, .numpad_right, .numpad_bleft, .numpad_bottom, .numpad_bright {
border-color: #002b36; /*base03*/
background-color: #073642; /*base02*/

View File

@ -182,11 +182,14 @@ textview .time {
}
.message_popup {
background-color: #B71C1C;
border-bottom-color: #e2e2e2;
}
.message_popup button {
.message_popup_echo, .message_popup_echo button {
background-color: #006412;
}
.message_popup_error, .message_popup_error button {
background-color: #B71C1C;
}

View File

@ -144,11 +144,14 @@ textview .time {
}
.message_popup {
background-color: #B71C1C;
border-bottom-color: #e2e2e2;
}
.message_popup button {
.message_popup_echo, .message_popup_echo button {
background-color: #006412;
}
.message_popup_error, .message_popup_error button {
background-color: #B71C1C;
}

View File

@ -206,11 +206,14 @@ textview .time {
}
.message_popup {
background-color: #EF9A9A;
border-bottom-color: #e2e2e2;
}
.message_popup button {
.message_popup_echo, .message_popup_echo button {
background-color: #a1ef9a;
}
.message_popup_error, .message_popup_error button {
background-color: #EF9A9A;
}

View File

@ -156,14 +156,9 @@ textview .time {
}
.message_popup {
background-color: #367554;
border-bottom-color: white;
}
.message_popup button {
background-color: #367554;
}
.numpad_tleft, .numpad_top, .numpad_tright, .numpad_left, .numpad_button, .numpad_right, .numpad_bleft, .numpad_bottom, .numpad_bright {
border-color: white;
}