Skip to content

feat: widgets Qol features - #288

Merged
gmmcosta15 merged 8 commits into
devfrom
feat/widgets-QOL
Sep 24, 2026
Merged

gmmcosta15 merged 8 commits into
devfrom
feat/widgets-QOL

Conversation

@Robert0Mart

@Robert0Mart Robert0Mart commented Jul 21, 2026 •

Copy link
Copy Markdown
Collaborator

Description

  • feature

BlocksScreen/lib/panels/widgets/keyboardPage.py

  • added first time like numpad

BlocksScreen/lib/utils/blocks_linedit.py

  • added disabled state (grayout and ignores clicks)

BlocksScreen/lib/panels/widgets/numpadPage.py

  • added toggle for min and max (on by default)

@Robert0Mart
Robert0Mart requested a review from gmmcosta15 July 21, 2026 15:19
@Robert0Mart Robert0Mart self-assigned this Jul 21, 2026
@Robert0Mart
Robert0Mart marked this pull request as ready for review July 27, 2026 11:32
@Robert0Mart
Robert0Mart marked this pull request as draft July 29, 2026 12:52
@Robert0Mart Robert0Mart changed the title add: added QoL features feat: widgets Qol features Aug 3, 2026
@Robert0Mart
Robert0Mart marked this pull request as ready for review August 3, 2026 11:18

@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

  • The first key after set_value() now replaces the prefill instead of appending to it, which is what a touch keyboard should do.
  • in_range is computed once instead of three times, and set_enforce_range defaults to enforcing, so every existing numpad caller keeps its behaviour.
  • A disabled BlocksCustomLinEdit now looks disabled, and _disabled_bg_color is allocated with the other paint colours instead of inside paintEvent.
  • The keyboard select button gets a real yes.svg icon.
  • Dead code gone: the empty mouseReleaseEvent override and the comment banners in colorWheelWidget.
  • The keyboard test is updated to the new replace behaviour.

1. keyboardPage.py:249: the firsttime wipe runs before the enter/clear branches, so the first tap after set_value() destroys the prefill
Open the keyboard on an existing SSID and tap Enter to accept it: an empty string is submitted. Tap Clear: the whole value is wiped instead of one char. networkWindow.py:3767, filamentTab.py:805, addFilamentPage.py:95 and addSpoolPage.py:165 all prefill through set_value(), so all of them are affected. Only a printable key should consume the flag:

def value_inserted(self, value: str) -> None:
    if value == "&&":
        value = "&"

    if self.firsttime and value not in ("enter", "clear"):
        self.current_value = ""
        self.firsttime = False

2. keyboardPage.py:217: firsttime is armed in show(), which Qt bypasses
setVisible(True), showFullScreen() and QStackedWidget.setCurrentWidget() never call the Python show() override, so the flag stays False and the next edit appends to the previous value. numpadPage already uses showEvent, match it:

def showEvent(self, a0: QtGui.QShowEvent | None) -> None:
    self._geometry_calc()
    self.firsttime = True
    return super().showEvent(a0)

3. numpadPage.py:64: in_range is computed before the clear branch changes current_value
clear shortens the value at lines 76-77, but the glow test at line 79 still uses the old snapshot, so the glow is one keystroke behind: deleting a digit back into range leaves it glowing, deleting out of range leaves it clean. Recompute after the change, and keep a separate snapshot for the enter branch if it needs the old value:

    elif "clear" in value:
        ...
    in_range = self.min_value <= int(self.current_value) <= self.max_value
    if not in_range and self.enforce_range:

4. numpadPage.py:44-45: showEvent resets enforce_range, silently undoing set_enforce_range(False)
Any caller that configures the numpad before showing it gets the setting reverted, so the API only works if called after show(), an ordering rule nobody can see. Reset enforce_range wherever min_value/max_value are reset instead:

def showEvent(self, a0: QtGui.QShowEvent | None) -> None:
    self.firsttime = True
    self.min_max_label.setVisible(self.enforce_range)
    return super().showEvent(a0)

5. blocks_linedit.py:107: the disabled state greys the background but not the text
_draw_text always uses self._text_color, so a disabled field paints full-black text on the new grey background and still reads as editable:

painter.setPen(self._text_color if self.isEnabled() else self._disabled_bg_color.darker(160))

6. blocks_linedit.py:85: the isEnabled() guard in mousePressEvent is unreachable
Qt does not deliver mouse events to disabled widgets, they go to the parent. The guard is harmless but dead, the paintEvent change is what carries this feature:

def mousePressEvent(self, event: QtGui.QMouseEvent) -> None:
    """Handle mouse press"""
    self.clicked.emit()
    super().mousePressEvent(event)

7. colorWheelWidget.py:108: deleting the commented-out mousePressEvent leaves the wheel drag-only
_pick is only reachable from mouseMoveEvent, which needs movement. A clean tap on the touchscreen (press + release, no motion) selects nothing. The comment was the reminder that this was missing:

def mousePressEvent(self, event: QtGui.QMouseEvent) -> None:
    self._pick(event.position())

8. numpadPage.py:146-148: the 60x60 QWidget spacer is a real widget in the tree
It only balances the header, a layout spacer does the same:

self.header_layout.addSpacing(60)

@gmmcosta15 gmmcosta15 mentioned this pull request Sep 23, 2026
1 task
@gmmcosta15
gmmcosta15 merged commit ce3274e into dev Sep 24, 2026
6 of 7 checks passed
@gmmcosta15
gmmcosta15 deleted the feat/widgets-QOL branch September 24, 2026 08:54
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.

3 participants