screen: RESPOND echo will now show a message on the screen.
This commit is contained in:
parent
0a6ac42069
commit
c8420c260b
14
screen.py
14
screen.py
@ -345,12 +345,18 @@ class KlipperScreen(Gtk.Window):
|
|||||||
self._cur_panels.append(panel_name)
|
self._cur_panels.append(panel_name)
|
||||||
logging.debug("Current panel hierarchy: %s", str(self._cur_panels))
|
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:
|
if self.popup_message is not None:
|
||||||
self.close_popup_message()
|
self.close_popup_message()
|
||||||
|
|
||||||
box = Gtk.Box()
|
box = Gtk.Box()
|
||||||
box.get_style_context().add_class("message_popup")
|
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())
|
box.set_size_request(self.width, self.gtk.get_header_size())
|
||||||
label = Gtk.Label()
|
label = Gtk.Label()
|
||||||
if "must home axis first" in message.lower():
|
if "must home axis first" in message.lower():
|
||||||
@ -730,9 +736,11 @@ class KlipperScreen(Gtk.Window):
|
|||||||
|
|
||||||
if not (data.startswith("B:") and
|
if not (data.startswith("B:") and
|
||||||
re.search(r'B:[0-9\.]+\s/[0-9\.]+\sT[0-9]+:[0-9\.]+', data)):
|
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("!! "):
|
if data.startswith("!! "):
|
||||||
self.show_popup_message(data[3:])
|
self.show_popup_message(data[3:], 2)
|
||||||
# logging.debug(json.dumps([action, data], indent=2))
|
logging.debug(json.dumps([action, data], indent=2))
|
||||||
|
|
||||||
self.base_panel.process_update(action, data)
|
self.base_panel.process_update(action, data)
|
||||||
if self._cur_panels[-1] in self.subscriptions:
|
if self._cur_panels[-1] in self.subscriptions:
|
||||||
|
@ -237,14 +237,17 @@ trough {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.message_popup {
|
.message_popup {
|
||||||
background-color: #367554;
|
|
||||||
border-bottom: .1em solid white;
|
border-bottom: .1em solid white;
|
||||||
}
|
}
|
||||||
|
|
||||||
.message_popup button {
|
.message_popup_echo, .message_popup_echo button {
|
||||||
background-color: #367554;
|
background-color: #367554;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.message_popup_error, .message_popup_error button {
|
||||||
|
background-color: #9e2f3a;
|
||||||
|
}
|
||||||
|
|
||||||
.numpad_tleft {
|
.numpad_tleft {
|
||||||
border: .15em solid white;
|
border: .15em solid white;
|
||||||
border-bottom: 0;
|
border-bottom: 0;
|
||||||
|
@ -180,7 +180,6 @@ textview .time {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.message_popup {
|
.message_popup {
|
||||||
background-color: #dc322f; /*solarazed-red*/
|
|
||||||
border-bottom-color: #fdf6e3; /*base3*/
|
border-bottom-color: #fdf6e3; /*base3*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,6 +187,14 @@ textview .time {
|
|||||||
background-color: #dc322f; /*solarazed-red*/
|
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 {
|
.numpad_tleft, .numpad_top, .numpad_tright, .numpad_left, .numpad_button, .numpad_right, .numpad_bleft, .numpad_bottom, .numpad_bright {
|
||||||
border-color: #002b36; /*base03*/
|
border-color: #002b36; /*base03*/
|
||||||
background-color: #073642; /*base02*/
|
background-color: #073642; /*base02*/
|
||||||
|
@ -182,11 +182,14 @@ textview .time {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.message_popup {
|
.message_popup {
|
||||||
background-color: #B71C1C;
|
|
||||||
border-bottom-color: #e2e2e2;
|
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;
|
background-color: #B71C1C;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,11 +144,14 @@ textview .time {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.message_popup {
|
.message_popup {
|
||||||
background-color: #B71C1C;
|
|
||||||
border-bottom-color: #e2e2e2;
|
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;
|
background-color: #B71C1C;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,11 +206,14 @@ textview .time {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.message_popup {
|
.message_popup {
|
||||||
background-color: #EF9A9A;
|
|
||||||
border-bottom-color: #e2e2e2;
|
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;
|
background-color: #EF9A9A;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,14 +156,9 @@ textview .time {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.message_popup {
|
.message_popup {
|
||||||
background-color: #367554;
|
|
||||||
border-bottom-color: white;
|
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 {
|
.numpad_tleft, .numpad_top, .numpad_tright, .numpad_left, .numpad_button, .numpad_right, .numpad_bleft, .numpad_bottom, .numpad_bright {
|
||||||
border-color: white;
|
border-color: white;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user