Revert "feat: Menu active status (#1482)"

This reverts commit 4172d59dbe.

due to a bug that needs to be investigated

closes #1519
This commit is contained in:
Alfredo Monclus committed 2024-12-06 18:16:45 -03:00
1 parent 7431ad82b8
commit d0faec9c93
10 files changed
+3 -69

No files matched your search

-7
View File
@@ -7,35 +7,30 @@ name: {{ gettext('Home X') }}
icon: home-x
method: printer.gcode.script
params: {"script":"G28 X"}
active: {{ 'x' in printer.homed_axes }}
[menu move homing homey]
name: {{ gettext('Home Y') }}
icon: home-y
method: printer.gcode.script
params: {"script":"G28 Y"}
active: {{ 'y' in printer.homed_axes }}
[menu move homing homez]
name: {{ gettext('Home Z') }}
icon: home-z
method: printer.gcode.script
params: {"script":"G28 Z"}
active: {{ 'z' in printer.homed_axes }}
[menu move homing homeall]
name: {{ gettext('Home All') }}
icon: home
method: printer.gcode.script
params: {"script":"G28"}
active: {{ 'xyz' in printer.homed_axes }}
[menu move homing homexy]
name: {{ gettext('Home XY') }}
icon: home
method: printer.gcode.script
params: {"script":"G28 X Y"}
active: {{ 'xy' in printer.homed_axes }}
[menu move homing quad_gantry_level]
name: {{ gettext('Quad Gantry Level') }}
@@ -43,7 +38,6 @@ icon: home-z
method: printer.gcode.script
params: {"script":"QUAD_GANTRY_LEVEL"}
enable: {{ 'QUAD_GANTRY_LEVEL' in printer.available_commands }}
active: {{ printer.quad_gantry_level.applied }}
[menu move homing Z-Tilt]
name: {{ gettext('Z Tilt') }}
@@ -51,4 +45,3 @@ icon: z-tilt
method: printer.gcode.script
params: {"script":"Z_TILT_ADJUST"}
enable: {{ 'Z_TILT_ADJUST' in printer.available_commands }}
active: {{ printer.z_tilt.applied }}
+2 -3
View File
@@ -190,7 +190,7 @@ class KlipperScreenConfig:
strs = ('gcode', '')
numbers = [f'{option}' for option in config[section] if option != 'gcode']
elif section.startswith('menu '):
strs = ('name', 'icon', 'panel', 'method', 'params', 'enable', 'confirm', 'style', 'active')
strs = ('name', 'icon', 'panel', 'method', 'params', 'enable', 'confirm', 'style')
elif section.startswith('graph')\
or section.startswith('displayed_macros')\
or section.startswith('spoolman'):
@@ -617,8 +617,7 @@ class KlipperScreenConfig:
"confirm": cfg.get("confirm", None),
"enable": cfg.get("enable", "True"),
"params": cfg.get("params", "{}"),
"style": cfg.get("style", None),
"active": cfg.get("active", None)
"style": cfg.get("style", None)
}
return {name[(len(menu) + 6):]: item}
-3
View File
@@ -258,9 +258,6 @@ class Printer:
"gcode_macros": {"count": len(self.get_gcode_macros()), "list": self.get_gcode_macros()},
"leds": {"count": self.ledcount},
"config_sections": list(self.config.keys()),
"homed_axes": self.get_stat("toolhead", "homed_axes"),
"quad_gantry_level": self.get_stat("quad_gantry_level"),
"z_tilt": self.get_stat("z_tilt"),
"available_commands": self.available_commands,
}
}
+1 -17
View File
@@ -84,31 +84,15 @@ class Panel(ScreenPanel):
b.connect("clicked", self._screen._send_action, item['method'], params)
else:
b.connect("clicked", self._screen._go_to_submenu, key)
b.set_name(key)
self.labels[key] = b
def evaluate_enable(self, enable):
if enable is None:
return False
if enable == "{{ moonraker_connected }}":
logging.info(f"moonraker connected {self._screen._ws.connected}")
return self._screen._ws.connected
try:
j2_temp = Template(enable, autoescape=True)
return j2_temp.render(self._printer.get_printer_status_data()) == 'True'
return j2_temp.render(self.j2_data) == 'True'
except Exception as e:
logging.debug(f"Error evaluating enable statement: {enable}\n{e}")
return False
def process_update(self, action, data):
if action != "notify_status_update":
return
for item in self.autogrid:
key = item.get_name()
for item_dict in self.items:
if key in item_dict and 'active' in item_dict[key]:
if self.evaluate_enable(item_dict[key]['active']):
item.get_style_context().add_class("menu_active")
else:
item.get_style_context().remove_class("menu_active")
break
-7
View File
@@ -80,13 +80,6 @@ button.active {
background-color: @active;
}
button.menu_active {
border-width: 0.25em;
border-style: dashed;
border-color: @active;
}
button:disabled,
button.color1:disabled,
button.color2:disabled,
-6
View File
@@ -110,12 +110,6 @@ popover button {
border-color: @solarized-base03;
}
button.menu_active {
border-width: 0.25em;
border-style: dashed;
border-color: @solarized-green;
}
switch {
background-color: @solarized-base02;
}
-6
View File
@@ -94,12 +94,6 @@ combobox menuitem {
border-color: @bg;
}
button.menu_active {
border-width: 0.25em;
border-style: dashed;
border-color: @echo;
}
treeview.view check,
switch {
background-color: @active-dark;
-6
View File
@@ -92,12 +92,6 @@ combobox menuitem {
border-color: #121212;
}
button.menu_active {
border-width: 0.25em;
border-style: solid;
border-color: #006412;
}
treeview.view check,
switch {
background-color: #1c1c1c;
-9
View File
@@ -149,15 +149,6 @@ menu {
border-color: @border;
}
button.menu_active {
border-color: @border;
border-style: solid;
border-width: .25em;
background-color: @bg;
box-shadow: .1em .1em @border;
border-radius: 1em;
}
menuitem {
background-color: @bg;
border-color: @border;
-5
View File
@@ -101,11 +101,6 @@ menu {
border-color: @lines;
}
button.menu_active {
border-width: 0;
background-color: @active;
}
menuitem {
background-color: @bg;
border-color: @lines;