From c8420c260bec7474637f79a77649b9a414d5a171 Mon Sep 17 00:00:00 2001 From: Jordan Date: Sun, 21 Nov 2021 20:19:45 -0500 Subject: [PATCH] screen: RESPOND echo will now show a message on the screen. --- screen.py | 14 +++++++++++--- styles/base.css | 7 +++++-- styles/colorized/style.css | 9 ++++++++- styles/material-dark/style.css | 7 +++++-- styles/material-darker/style.css | 7 +++++-- styles/material-light/style.css | 7 +++++-- styles/z-bolt/style.css | 5 ----- 7 files changed, 39 insertions(+), 17 deletions(-) diff --git a/screen.py b/screen.py index 8209562f..2247a244 100644 --- a/screen.py +++ b/screen.py @@ -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: diff --git a/styles/base.css b/styles/base.css index 2fd9543f..eaca36e2 100644 --- a/styles/base.css +++ b/styles/base.css @@ -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; diff --git a/styles/colorized/style.css b/styles/colorized/style.css index 5e48cc61..476eff38 100644 --- a/styles/colorized/style.css +++ b/styles/colorized/style.css @@ -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*/ diff --git a/styles/material-dark/style.css b/styles/material-dark/style.css index 15594db7..76c42153 100644 --- a/styles/material-dark/style.css +++ b/styles/material-dark/style.css @@ -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; } diff --git a/styles/material-darker/style.css b/styles/material-darker/style.css index c06ad35e..ffa3fe86 100644 --- a/styles/material-darker/style.css +++ b/styles/material-darker/style.css @@ -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; } diff --git a/styles/material-light/style.css b/styles/material-light/style.css index 278c458a..623c6d6c 100644 --- a/styles/material-light/style.css +++ b/styles/material-light/style.css @@ -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; } diff --git a/styles/z-bolt/style.css b/styles/z-bolt/style.css index 71f8df23..0e281120 100644 --- a/styles/z-bolt/style.css +++ b/styles/z-bolt/style.css @@ -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; }