Skip to content

Refator: filament tab pages organisation - #302

Merged
gmmcosta15 merged 4 commits into
ref/controlTab-stackedWidgetfrom
ref/filamentTab-stackedWidget
Sep 28, 2026
Merged

gmmcosta15 merged 4 commits into
ref/controlTab-stackedWidgetfrom
ref/filamentTab-stackedWidget

Conversation

@Robert0Mart

@Robert0Mart Robert0Mart commented Aug 13, 2026 •

Copy link
Copy Markdown
Collaborator

Stacked PR — merge order

This PR is stacked on top of:

  1. refactor main window stacked widget #298
  2. refactor: separated control stacked widget into pages #299

Do not merge until #298 and #299 are merged first.

CI won't run here until the base becomes dev (after the parents merge).

Description

  • Refactor

BlocksScreen/lib/panels/filamentTab.py

  • aligned main button to the rest of the tabs
  • updated import

BlocksScreen/lib/panels/widgets/FilamentTab/addFilamentPage.py
BlocksScreen/lib/panels/widgets/FilamentTab/addSpoolPage.py
BlocksScreen/lib/panels/widgets/FilamentTab/amuPage.py
BlocksScreen/lib/panels/widgets/FilamentTab/amuWidgets.py
BlocksScreen/lib/panels/widgets/FilamentTab/basicFilamentPanel.py
BlocksScreen/lib/panels/widgets/FilamentTab/spoolmanPage.py

  • moved pages to their own folder for better organisation

BlocksScreen/lib/ui/filamentSensorsPage.ui
BlocksScreen/lib/ui/filamentSensorsPage_ui.py
BlocksScreen/lib/ui/filamentStackedWidget.ui
BlocksScreen/lib/ui/filamentStackedWidget_ui.py

  • deleted unused ui files

@Robert0Mart Robert0Mart changed the title Ref/filament tab stacked widget Refator: filament tab pages organisation Aug 13, 2026
@Robert0Mart
Robert0Mart marked this pull request as ready for review August 13, 2026 16:47
@Robert0Mart Robert0Mart added the Refactor Enhancing code's readability, maintainability, and extensibility while addressing technical debt. label Aug 14, 2026
@gmmcosta15
gmmcosta15 self-requested a review September 23, 2026 10:06

@gmmcosta15 gmmcosta15 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's good

  • Pure moves (100%/99% similarity), and the imports plus test_basic_filament_panel.py are updated in the same PR, so nothing is left pointing at the old paths
  • Drops ~2.5k lines of dead generated UI (filamentStackedWidget*, filamentSensorsPage* had no importers)
  • Replaces the 87.5 "dont ask how i got this value" row hack with explicit 80 px rows and a fixed-height content widget, so the Filament and Control grids now have the same geometry
  • self.ui is gone with no leftover references
  • Header now matches ControlTab from #299 (same font weight, side blanks)
  • _setupUi -> _setup_ui with docstrings, which helps docstrcov

1. filamentTab.py:884-983: the page is built as a local widget and only named at the end; resize does nothing
L888 widget = QtWidgets.QWidget() becomes self.filament_control_page only at L982. L886 self.resize(710, 410) does nothing on a stacked widget inside a layout.

self.filament_control_page = QtWidgets.QWidget()
self.filament_control_page.setFixedSize(710, 410)
self.verticalLayout = QtWidgets.QVBoxLayout(self.filament_control_page)
...
self.addWidget(self.filament_control_page)
# delete self.resize(710, 410)

2. filamentTab.py:979: grid height repeats the magic 80, and #299 sizes the same grid a different way
80 * 3 + spacing() * 2 repeats setRowMinimumHeight(..., 80). controlTab.py (#299) uses sizeHint().height() for the same 3-row grid. Share one helper:

# lib/utils/menu_grid.py
MENU_ROW_H = 80

def fixed_menu_grid(parent: QtWidgets.QWidget, grid: QtWidgets.QGridLayout, rows: int = 3) -> QtWidgets.QWidget:
    """Wrap a menu grid in a fixed-height widget so rows never shift."""
    for r in range(rows):
        grid.setRowMinimumHeight(r, MENU_ROW_H)
    grid.setContentsMargins(0, 0, 0, 0)
    w = QtWidgets.QWidget(parent)
    w.setLayout(grid)
    w.setFixedHeight(MENU_ROW_H * rows + grid.verticalSpacing() * (rows - 1))
    return w

3. filamentTab.py:897/919: two identical 60x55 blanks, while ControlTab's Hblank is 60x60
They're never toggled, so a spacer is enough. Or use a factory with the same size as ControlTab:

def _hblank() -> QtWidgets.QWidget:
    w = QtWidgets.QWidget()
    w.setFixedSize(60, 60)
    return w

self.fp_header_layout.addWidget(_hblank())

4. widgets/FilamentTab/ has no __init__.py, but lib/panels/widgets/ does
That makes it an implicit namespace package inside a regular package (same for ControlTab/ in #299).

touch BlocksScreen/lib/panels/widgets/FilamentTab/__init__.py

5. FilamentTab/basicFilamentPanel.py:351-352: leftovers in the method this PR renamed
setObjectName("self") and a resize(710, 411) that does nothing.

self.setObjectName("basic_filament_panel")
# delete self.resize(710, 411)

@RobeMartins
RobeMartins force-pushed the ref/filamentTab-stackedWidget branch from c61a3be to f055cb1 Compare September 28, 2026 10:04
@gmmcosta15
gmmcosta15 merged commit 523a17a into ref/controlTab-stackedWidget Sep 28, 2026
3 checks passed
gmmcosta15 pushed a commit that referenced this pull request Sep 28, 2026
## Description 

- [x] fix

### Changes
 address reviews on other pr of this stacked PR
#298 
#299 
#302 
#303
#315 
#332

---------

Co-authored-by: Robert0Mart <robertomicael.martins@gmail.com>
RobeMartins pushed a commit that referenced this pull request Sep 28, 2026
## Stacked PR — merge order

This PR is stacked on top of:
1. #298
2. #299

**Do not merge until #298 and #299 are merged first.**

CI won't run here until the base becomes `dev` (after the parents
merge).

## Description 

- [x] Refactor

**BlocksScreen/lib/panels/filamentTab.py**
- aligned main button to the rest of the tabs 
- updated import 

**BlocksScreen/lib/panels/widgets/FilamentTab/addFilamentPage.py**
**BlocksScreen/lib/panels/widgets/FilamentTab/addSpoolPage.py**
**BlocksScreen/lib/panels/widgets/FilamentTab/amuPage.py**
**BlocksScreen/lib/panels/widgets/FilamentTab/amuWidgets.py**
**BlocksScreen/lib/panels/widgets/FilamentTab/basicFilamentPanel.py**
**BlocksScreen/lib/panels/widgets/FilamentTab/spoolmanPage.py**
- moved pages to their own folder for better organisation 

**BlocksScreen/lib/ui/filamentSensorsPage.ui**
**BlocksScreen/lib/ui/filamentSensorsPage_ui.py**
**BlocksScreen/lib/ui/filamentStackedWidget.ui**
**BlocksScreen/lib/ui/filamentStackedWidget_ui.py**
-  deleted unused ui files
RobeMartins added a commit that referenced this pull request Sep 28, 2026
## Description 

- [x] fix

### Changes
 address reviews on other pr of this stacked PR
#298 
#299 
#302 
#303
#315 
#332

---------

Co-authored-by: Robert0Mart <robertomicael.martins@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Refactor Enhancing code's readability, maintainability, and extensibility while addressing technical debt.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants