Skip to content

implement Qt6 views#1446

Open
dxqb wants to merge 7 commits into
Nerogar:pyside_copyfrom
dxqb:pyside
Open

implement Qt6 views#1446
dxqb wants to merge 7 commits into
Nerogar:pyside_copyfrom
dxqb:pyside

Conversation

@dxqb
Copy link
Copy Markdown
Collaborator

@dxqb dxqb commented May 10, 2026

Builds on the controller-view abstraction introduced in the previous PR. That PR made all business logic toolkit-independent and defined UI content in toolkit-neutral base views. This PR adds a PySide6 frontend without touching any of that shared code.

Three pieces are needed to make build_content run under Qt:

pyside6_components — mirrors the ctk_components API with Qt widgets. self.components.label(...), self.components.options(...) etc. resolve to Qt implementations when a PySide6 view passes this namespace at construction.

QtVar / PySide6UIState — Qt equivalent of tkinter variables and UIState. QtVar wraps a value and fires Qt signals on change; PySide6UIState exposes the same interface controllers and base views expect.

PySide6*View classes — inherit from the Qt window/widget base and the shared Base*View. For TrainUI, PySide6TrainUIView(QMainWindow, BaseTrainUIView) reuses TrainUIController and BaseTrainUIView unchanged.

The PySide6 UI is launched via ./run-cmd.sh train_ui_pyside6. The CTK UI is unaffected and is still started using ./start-ui.sh.

  • untested on windows
  • the dataset tools were not ported because it contains lots of outdated ctk-specific code that doesn't use ctk_components.py. If we want to keep those it needs a refactor itself before porting

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@dxqb
Copy link
Copy Markdown
Collaborator Author

dxqb commented May 10, 2026

grafik

Comment thread .gitignore
train.bat
debug_report.log
config_diff.txt
CLAUDE.md
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

FYI, you should definitely push your CLAUDE.md and treat it as a development guide for the project :)

Copy link
Copy Markdown
Collaborator Author

@dxqb dxqb May 10, 2026

Choose a reason for hiding this comment

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

mine is not good enough for general use. I used the first draft claude made because I was still learning to use claude, and then worked with additional PLAN files

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe then a good opportunity would be to describe in CLAUDE.md your programming rules for the repo and the entrypoints of pyside UI that this MR introduce? and then each new MR would build on top of it to describe different branch of the codebase wdyt?

Copy link
Copy Markdown
Collaborator Author

@dxqb dxqb May 10, 2026

Choose a reason for hiding this comment

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

I'm still not experienced enough with Claude Code to do that, but PRs welcome.
I also have second thoughts about encouraging AI PRs. It has obviously become a good tool for a large refactoring like this one, that wouldn't have been possible without AI.

But all code using AI code must be reviewed before submitting it as a PR. That can't become the PR reviewer's job. So you must still already know the codebase to contribute.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Fair point. Wdyt of adding a PR template with a checklist contributors have to tick before opening, something like "I've read and understand all changes in this diff" and "I've tested locally"? It won't stop people from lying, but vibe coded mess is easy to spot anyway.

I can include that in the same PR as the CLAUDE.md if it sounds useful.

Copy link
Copy Markdown
Collaborator Author

@dxqb dxqb May 15, 2026

Choose a reason for hiding this comment

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

no strong opinions on this from me. It would be nice to know what stage the code is, like

  • manually written code
  • AI generated prototype, works but unreviewed
  • human reviewed by submitter but will re-work
  • fully human reviewed, ready for PR review
  • ...

but I'm not sure how to enforce that. if the templates get too much, nobody follows them

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'll have a dab along with the Claude.md/agents.md and potentially some skills useful - thanks for the feedback

return lo


def _alignment(sticky: str) -> Qt.AlignmentFlag:
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

the components API is still very Ctk-centric. the sticky parameter for example is what Ctk expects, and translated here to equivalent Qt.

this could be refactored further, but I think that's for later.

dxqb and others added 2 commits May 11, 2026 20:12
…UIView

Now handled by path_entry in the base class.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@dxqb dxqb requested a review from O-J1 May 11, 2026 21:04
@dxqb dxqb linked an issue May 15, 2026 that may be closed by this pull request
dxqb and others added 4 commits May 15, 2026 12:01
- PySide6TrainUIView: create train_config/ui_state/controller before base
  init so they can be passed as constructor params; replace self.train_config
  with self.controller.train_config throughout
- PySide6CloudTabView: pass controller to BaseCloudTabView.__init__;
  remove now-redundant self.controller assignment
- PySide6ConceptTabView: implement _update_filters() (removed from base);
  pass concept to BaseConceptWidgetView.__init__
- PySide6TrainingTabView: remove callbacks dict; call build() without it;
  implement 6 abstract methods with logic inlined from private helpers;
  remove now-unused private helper methods

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…abView

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
UIState's enum trace looks up var_type[string], so the var must hold the
string repr of the value, not the value itself.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.

[Feat]: Replace CustomTkInter with PyQt6

2 participants