Skip to content

Commit

Permalink
Revert "feat: Menu active status (#1482)"
Browse files Browse the repository at this point in the history
This reverts commit 4172d59.

due to a bug that needs to be investigated

closes #1519
alfrix committed Dec 6, 2024
1 parent 7431ad8 commit d0faec9
Showing 10 changed files with 3 additions and 69 deletions.
7 changes: 0 additions & 7 deletions config/move_menu.conf
Original file line number Diff line number Diff line change
@@ -7,48 +7,41 @@ 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') }}
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') }}
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 }}
5 changes: 2 additions & 3 deletions ks_includes/config.py
Original file line number Diff line number Diff line change
@@ -190,7 +190,7 @@ def validate_config(self, config, string="", remove=False):
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 @@ def _build_menu_item(self, menu, name):
"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 changes: 0 additions & 3 deletions ks_includes/printer.py
Original file line number Diff line number Diff line change
@@ -258,9 +258,6 @@ def get_printer_status_data(self):
"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,
}
}
18 changes: 1 addition & 17 deletions panels/menu.py
Original file line number Diff line number Diff line change
@@ -84,31 +84,15 @@ def create_menu_items(self):
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 changes: 0 additions & 7 deletions styles/base.css
Original file line number Diff line number Diff line change
@@ -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 changes: 0 additions & 6 deletions styles/colorized/style.css
Original file line number Diff line number Diff line change
@@ -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 changes: 0 additions & 6 deletions styles/material-dark/style.css
Original file line number Diff line number Diff line change
@@ -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 changes: 0 additions & 6 deletions styles/material-darker/style.css
Original file line number Diff line number Diff line change
@@ -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 changes: 0 additions & 9 deletions styles/material-light/style.css
Original file line number Diff line number Diff line change
@@ -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 changes: 0 additions & 5 deletions styles/z-bolt/style.css
Original file line number Diff line number Diff line change
@@ -101,11 +101,6 @@ menu {
border-color: @lines;
}

button.menu_active {
border-width: 0;
background-color: @active;
}

menuitem {
background-color: @bg;
border-color: @lines;

0 comments on commit d0faec9

Please sign in to comment.