Fix GTK4 Port: Layout, Focus Management, and Arrow Navigation#81
Open
Inuth0603 wants to merge 1 commit intosugarlabs:masterfrom
Open
Fix GTK4 Port: Layout, Focus Management, and Arrow Navigation#81Inuth0603 wants to merge 1 commit intosugarlabs:masterfrom
Inuth0603 wants to merge 1 commit intosugarlabs:masterfrom
Conversation
67ac97e to
d1ad88f
Compare
6f0dd4d to
ce1ad7f
Compare
Draft
ce1ad7f to
35b9332
Compare
This commit fully ports the Calculate activity to GTK4 and Sugar4.
- Port 'shareable_activity.py' with updated DBus and Sugar4 base classes.
- Rework 'layout.py' to use GTK4 box packing ('append', 'set_child') instead of deprecated containers like 'Gtk.Table'.
- Replace legacy per-widget styling ('modify_bg', 'modify_font') with semantic CSS classes ('calc-button', 'calc-numpad-btn', 'calc-operator-btn', 'calc-action-btn') to be painted by sugar-artwork's GTK4 theme.
- Use 'sugar_style.apply_css_to_widget()' for dynamic per-user XoColor styling on equation history and variable text views.
- Replace StackSwitcher with proper Sugar4 ToolbarBox architecture using ToolbarButton with icon resolution (local SVG fallback).
- Add EventControllerKey on text_entry and calculator buttons.
- Refactor 'toolbars.py' to gracefully render GTK4 toolbar items and correctly update text fallbacks when SVG icons are invalid.
- Port 'calculate.py' to use 'Gtk.EventControllerKey' for keystrokes and update clipboard operations to use GTK4 async mechanisms.
- Include 'main.py' standalone bootstrapper for isolated GTK4 testing.
35b9332 to
6ccfee3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR ports the Calculate activity UI from GTK3 to GTK4/Sugar4. The math engine and parser remain unchanged; only the UI layer and event handling were updated.
What changed
Gtk.Tableand deprecated packing APIs withGtk.GridandGtk.Boxmodify_bg,modify_font,modify_base) and switched to semantic CSS classes:calc-button,calc-numpad-btn,calc-operator-btn, andcalc-action-btnsugar_style.apply_css_to_widget()ToolbarBox/ToolbarButtontoolbars.pyto useset_child()for text fallback when SVG icons are missingGtk.EventControllerKeymain.pyfor standalone local testingNotes on standalone testing
A couple of visual issues are expected when running via
main.pyoutside Sugar:sugar-artworkdoes not yet provide the full GTK4 theme stylingThese are standalone-testing limitations and should not affect behavior inside the Sugar desktop.
Testing
Tested on Debian. Layout, toolbar switching, and expression evaluation all work correctly, and syntax errors are still handled properly.
Screen.Recording.2026-03-15.054616.mp4