Skip to content

feat(BasicFilamentPage): added check gate button - #337

Draft
Robert0Mart wants to merge 3 commits into
devfrom
feat/check-filament-button
Draft

Robert0Mart wants to merge 3 commits into
devfrom
feat/check-filament-button

Conversation

@Robert0Mart

Copy link
Copy Markdown
Collaborator

Description

  • feat

BlocksScreen/lib/panels/widgets/basicFilamentPanel.py

  • made load/unload button into 1 button
  • added check gate button
  • fixed loading mid print filament_type becomes Unknown
  • updated widgets names

@Robert0Mart Robert0Mart self-assigned this Sep 10, 2026
@Robert0Mart Robert0Mart changed the title feat : added check gate button feat(BasicFilamentPage): added check gate button Sep 10, 2026
@Robert0Mart
Robert0Mart marked this pull request as ready for review September 10, 2026 13:23
@gmmcosta15

gmmcosta15 commented Sep 23, 2026 •

Copy link
Copy Markdown
Collaborator

What's good

  • One Load/Unload toggle driven by the filament_state setter replaces two buttons that disabled each other.
  • The filament_page_load_btn disconnect/reconnect dance in on_print_stats_update is gone, and _on_load_unload_clicked puts the print-state branching in one place.
  • The check button stays hidden until the first MMU state arrives, so non-MMU printers never see it.
  • Skipping SAVE_VARIABLE mid-print stops a mid-print load from overwriting filament_type with UNKNOWN.
  • "state" in status instead of .keys(), and it reuses run_gcode with no new plumbing.
  • The renames are safe: no tests, QSS or other modules reference the old attribute or object names.

1. basicFilamentPanel.py:75: MMU_CHECK_GATE unloads the loaded filament
On the Happy Hare version our printer runs (a880ac0a), bare MMU_CHECK_GATE checks the current gate, and when filament_pos != UNLOADED it first runs a full unload + park. Out of a print it reloads afterwards (minutes, with no feedback in this UI). During a print it does not reload. Newer upstream skips a loaded selected gate, but the machine doesn't have that. Only enable the button when it's harmless:

def _refresh_check_btn(self) -> None:
    self.Basic_fp_check_btn.setEnabled(
        self.state not in ("printing", "paused")
        and self.filament_state is not self.FilamentStates.LOADED
    )

Call it from on_print_stats_update and the filament_state setter, and connect a method instead of the lambda.

2. basicFilamentPanel.py:279-284: UNKNOWN state loses Unload
dev enabled both buttons in UNKNOWN. The panel starts in UNKNOWN and only a sensor or the MMU moves it out, so a printer with no sensor and no MMU never sees Unload again. On MMU printers the state is always LOADED/UNLOADED after the first update, so an extra button only shows where it's needed:

# filament_state setter
self.Basic_fp_unload_btn.setVisible(update is self.FilamentStates.UNKNOWN)

3. basicFilamentPanel.py:189/216: the SAVE_VARIABLE skip needs a why, and ("printing", "paused") is repeated 4x

@property
def _in_print(self) -> bool:
    return self.state in ("printing", "paused")

def _save_filament_type(self, name: str) -> None:
    # mid-print load/unload has no type choice, keep the saved one
    if not self._in_print:
        self.run_gcode.emit(f"""SAVE_VARIABLE VARIABLE=filament_type VALUE='"{name}"'""")

Minor

    1. Basic_fp_* is not snake_case (pylint C0103), and fcp needs the comment at L560 to be readable: load_btn, check_gate_btn, filament_choose_page.
    1. L599/L610: objectNames are still load_header_page_title/load_header_back_button, while the attributes were renamed.
    1. _setupUi sets the load icon (L527) and the "Load" text (L719), then __init__ sets filament_state = UNKNOWN, which writes both again. The setter also builds a new QPixmap on every call. Load the two icons once:
loaded = update is self.FilamentStates.LOADED
self.Basic_fp_load_btn.setText("Unload" if loaded else "Load")
self.Basic_fp_load_btn.setProperty("icon_pixmap", self._unload_icon if loaded else self._load_icon)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants