diff --git a/panels/mmu_filaments.py b/panels/mmu_filaments.py index eab521fd9..67f402379 100644 --- a/panels/mmu_filaments.py +++ b/panels/mmu_filaments.py @@ -230,7 +230,6 @@ def __init__(self, screen, title): layers.insert_page(edit_grid, None, 1) self.content.add(layers) - self.gate_tool_map = self.build_gate_tool_map() def post_attach(self): # Gtk Notebook will only change layer after show_all() hence this extra callback to fix state @@ -264,6 +263,7 @@ def query_spoolman(self): def refresh(self): self.use_spoolman = self._printer.spoolman and self._config.get_main_config().getboolean("mmu_use_spoolman", False) + self.gate_tool_map = self.build_gate_tool_map() mmu = self._printer.get_stat("mmu") gate_status = mmu['gate_status'] @@ -320,7 +320,7 @@ def get_tool_details(self, tools): tool_str = '' if len(tools) > 0: tool_str = 'T' + ', '.join(map(str, tools[:2])) - tool_str += ', ...' if len(tools) > 2 else '' + tool_str += '...' if len(tools) > 2 else '' return tool_str def get_color_details(self, gate_color): diff --git a/panels/mmu_spoolman.py b/panels/mmu_spoolman.py index aae083ec0..b513b1f54 100644 --- a/panels/mmu_spoolman.py +++ b/panels/mmu_spoolman.py @@ -115,7 +115,6 @@ def __init__(self, screen, title): layers.insert_page(scroll, None, 0) self.content.add(layers) - self.gate_tool_map = self.build_gate_tool_map() def async_spools_refresh(self): while self.is_running: @@ -148,6 +147,7 @@ def activate(self): self.refresh() def refresh(self): + self.gate_tool_map = self.build_gate_tool_map() mmu = self._printer.get_stat("mmu") gate_status = mmu['gate_status'] gate_material = mmu['gate_material'] @@ -253,8 +253,8 @@ def get_status_details(self, gate_status): def get_tool_details(self, tools): tool_str = '' if len(tools) > 0: - tool_str = 'T' + ', '.join(map(str, tools[:2])) - tool_str += ', ...' if len(tools) > 2 else '' + tool_str = 'T' + ', '.join(map(str, tools[:1])) + tool_str += '..' if len(tools) > 1 else '' return tool_str def get_color_details(self, gate_color): diff --git a/panels/mmu_toolmap.py b/panels/mmu_toolmap.py index e1d88292d..192d7a213 100644 --- a/panels/mmu_toolmap.py +++ b/panels/mmu_toolmap.py @@ -77,6 +77,8 @@ def __init__(self, screen, title): self.labels['reset'].set_halign(Gtk.Align.CENTER) self.labels['reset'].set_valign(Gtk.Align.START) self.labels['reset'].set_vexpand(False) + self.labels['reset'].get_style_context().add_class("mmu_es_gate") + self.labels['reset'].get_style_context().add_class("mmu_es_gate_selected") self.labels['es_group'].set_xalign(0) self.labels['es_group'].get_style_context().add_class("mmu_endless_spool_toggle") self.labels['endless_spool'].get_style_context().add_class("mmu_endless_spool_toggle") @@ -151,13 +153,13 @@ def __init__(self, screen, title): scroll.add(grid) self.content.add(scroll) + def activate(self): mmu = self._printer.get_stat("mmu") self.ui_ttg_map = mmu['ttg_map'] self.ui_endless_spool_groups = self.map_unique_groups(mmu['endless_spool_groups']) self.ui_sel_es_group = self.ui_endless_spool_groups[self.ui_ttg_map[self.ui_sel_tool]] self.ui_es_enabled = mmu['endless_spool'] - def activate(self): self.labels['endless_spool'].set_active(self.ui_es_enabled == 1) self.update_map() self.update_es_group() @@ -242,7 +244,7 @@ def update_map(self): else: msg += ' ' if cnt == 0 else '┃' self.labels[f'toolmap{y}'].set_text(msg) - self.labels[f'es_gate{gate}'].get_style_context().add_class("distbutton_active") + self.labels[f'es_gate{gate}'].get_style_context().add_class("mmu_es_gate_selected") self.labels['tool'].set_label(f"T{tool}") self.labels['gate'].set_label(f"Gate #{gate}") @@ -250,9 +252,9 @@ def update_es_group(self): gates_in_group = self.build_es_spool_gate_group(self.ui_sel_es_group) for g in range(len(self.ui_ttg_map)): if g in gates_in_group: - self.labels[f"es_gate{g}"].get_style_context().add_class("distbutton_active") + self.labels[f"es_gate{g}"].get_style_context().add_class("mmu_es_gate_selected") else: - self.labels[f"es_gate{g}"].get_style_context().remove_class("distbutton_active") + self.labels[f"es_gate{g}"].get_style_context().remove_class("mmu_es_gate_selected") self.labels[f"es_gate{g}"].set_sensitive(self.ui_es_enabled == 1) grp = self.convert_number_to_letter(self.ui_sel_es_group) self.labels['es_group'].set_markup(f"ES Group: {grp}") diff --git a/styles/base.css b/styles/base.css index 2dab769b9..0edf004e2 100644 --- a/styles/base.css +++ b/styles/base.css @@ -719,6 +719,15 @@ trough progress { min-height: 2em; } +.mmu_es_gate_selected { + background: @active; +} + +.mmu_es_gate_reset { + padding-top: 1em; + background: @active; +} + .mmu_endless_spool_toggle { padding-bottom: .6em; }