Skip to content

Conversation

@CyanVoxel
Copy link
Member

@CyanVoxel CyanVoxel commented Sep 4, 2025

Summary

This is a large refactor of the Qt UI structure with the following intentions:

  • Separate out erroneously mixed frontend and backend files
  • Organize UI files that were previously in incorrect or misleading folders
  • Remove unnecessarily specific or broad UI folders
  • Delete unused file(s)
  • Prepare un-refactored UI files for upcoming MVC refactors by moving them to a new temporary qt/mixed directory
  • Rename files to be consistent with the project's naming schemes
  • Prepare the layout for a ThumbRenderer refactor split
  • Fix some minor Pyright errors

Old Layout

├── src
│   └── tagstudio
│       ├── core
│       │   ├── library
│       │   │   ├── alchemy
│       │   │   └── json
│       │   ├── query_lang
│       │   └── utils
│       ├── qt
│       │   ├── controller
│       │   │   ├── components
│       │   │   └── widgets
│       │   │       └── preview
│       │   ├── helpers
│       │   │   └── vendored
│       │   │       └── pydub
│       │   ├── modals
│       │   ├── utils
│       │   ├── view
│       │   │   ├── components
│       │   │   └── widgets
│       │   │       └── preview
│       │   └── widgets
│       │       ├── paged_panel
│       │       └── preview

New Layout

├── src
│   └── tagstudio
│       ├── core
│       │   ├── library
│       │   │   ├── alchemy
│       │   │   │   └── registries
│       │   │   └── json
│       │   ├── query_lang
│       │   └── utils
│       ├── qt
│       │   ├── controllers
│       │   ├── helpers
│       │   ├── mixed  # Temporary until MVC refactor is complete
│       │   ├── models
│       │   ├── previews
│       │   │   └── vendored
│       │   │       └── pydub
│       │   ├── utils
│       │   └── views
│       │       ├── layouts
│       │       └── styles

Tasks Completed

  • Platforms Tested:
    • Windows x86
    • Windows ARM
    • macOS x86
    • macOS ARM
    • Linux x86
    • Linux ARM
  • Tested For:
    • Basic functionality
    • PyInstaller executable

@CyanVoxel CyanVoxel added this to the Alpha v9.5.6 milestone Sep 4, 2025
@CyanVoxel CyanVoxel added Type: Refactor Code that needs to be restructured or cleaned up Priority: Low Doesn't require immediate attention labels Sep 4, 2025
Copy link
Collaborator

@Computerdores Computerdores left a comment

Choose a reason for hiding this comment

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

Looks good so far (just getting a review in early so as not to do it all at once)

(the global settings should probably not be part of core either)

@Computerdores Computerdores moved this to 🚧 In progress in TagStudio Development Sep 4, 2025
@CyanVoxel
Copy link
Member Author

Implemented feedback and just pushed some new changes with some more changes/organizing. Feel free to give feedback on any part of it, some folder structures I'm just feeling out to see how well they work in practice.

(Oh man I just saw the number of files this is touching now... at least this seems to be a good time for a refactor like this?)

Copy link
Collaborator

@Computerdores Computerdores left a comment

Choose a reason for hiding this comment

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

looking good so far - though I am curious what do you intend to convey with the widgets/components difference?

@Computerdores
Copy link
Collaborator

(Oh man I just saw the number of files this is touching now... at least this seems to be a good time for a refactor like this?)

As far as the project is concerned probably, though I can't promise anything in terms of reviews since I have my hands full with my thesis

@CyanVoxel
Copy link
Member Author

looking good so far - though I am curious what do you intend to convey with the widgets/components difference?

That one I'm not entirely sure, I believe those folders were pre-existing so I've just been attempting to follow. In my head I've been trying to put parts of widgets that are only ever used for other widgets inside of Components, while widgets that are more "complete" and meant to be used throughout the UI would go in Widgets. Not sure how effective this approach is though, and I'm certainly open to something else.

@CyanVoxel
Copy link
Member Author

As far as the project is concerned probably, though I can't promise anything in terms of reviews since I have my hands full with my thesis

No worries, I appreciate any level of feedback I can get! I'll still leave things open for review for a period if they're not urgent on the off-chance, and I'll try not to make any mega-weird changes (outside of #1067 which does fall under the "mega weird" category I feel...)

Also congrats and good luck with your thesis!

@CyanVoxel
Copy link
Member Author

@Computerdores I'm currently rebasing and removing the components and widgets subfolders along with some new changes (sorry for the incoming force push)

I also wanted to note/ask, I just noticed that the MVC folder names were made to be singular, not plural. I'm most used to seeing them pluralized and the rest of the folder structure uses plural names as well. Would you mind if I changed those? Sorry that I'm only realizing this now...

@CyanVoxel CyanVoxel added Priority: High An important issue requiring attention and removed Priority: Low Doesn't require immediate attention labels Sep 6, 2025
@Computerdores
Copy link
Collaborator

@Computerdores I'm currently rebasing and removing the components and widgets subfolders along with some new changes (sorry for the incoming force push)

*goes to cry in the corner*
(jk I'll just diff against the prior version locally)

I also wanted to note/ask, I just noticed that the MVC folder names were made to be singular, not plural. I'm most used to seeing them pluralized and the rest of the folder structure uses plural names as well. Would you mind if I changed those? Sorry that I'm only realizing this now...

Feel free to rename them; the singular bled over from another project I was working on at the time where we had all the namespaces as singular.

@Computerdores
Copy link
Collaborator

(jk I'll just diff against the prior version locally)

For anyone trying to do the same, you need git fetch TagStudio fb8f5534ecbdd0f711ed94cc00cdf2ea1afb9d75 first in order to pull the commit

Copy link
Collaborator

@Computerdores Computerdores left a comment

Choose a reason for hiding this comment

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

(this is just for my sake so I can review the newest commit on its own)
Edit: Nvm Github is trolling second review in a minute

Copy link
Collaborator

@Computerdores Computerdores left a comment

Choose a reason for hiding this comment

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

What is the idea behing the previews dir?


Having some kind of separation between widgets (anything that can make sense on its own) and components (ones that only make sense as a part of others) might still make sense.

This is because what I envision for the far future (would be interested to know what your thoughts are on that) is basically being able to pick any of the widgets and open an extra window that contains just that or to split an existing window and put different widgets in each pane.

This is how lots of professional software works (Ghidra immediately comes to my mind because I use it somewhat often) and that type of software is what I also associate with the 'Studio' term.

@CyanVoxel
Copy link
Member Author

What is the idea behind the previews dir?

This is where I intend to split out the thumb_renderer.py (now renderer.py) methods into their own files for each preview type. IMO this is a strange area between "core" and "UI" code that doesn't fit into the traditional MVC structure, and giving it its own directory helps separate it while giving it space for all the new files that will populate it. Actually the driving reason that got me to open this PR was because there just wasn't a good place for me to put the renderer files that I planned on splitting out with a thumbnail renderer refactor, and then I ended up doing a larger reorganization/cleanup of the UI layout structure (that's been needed since the beginning and has only gotten worse over time).

Having some kind of separation between widgets (anything that can make sense on its own) and components (ones that only make sense as a part of others) might still make sense.

This is because what I envision for the far future (would be interested to know what your thoughts are on that) is basically being able to pick any of the widgets and open an extra window that contains just that or to split an existing window and put different widgets in each pane.

This is how lots of professional software works (Ghidra immediately comes to my mind because I use it somewhat often) and that type of software is what I also associate with the 'Studio' term.

I'm certainly open to the idea, I think just at this point in time I'm having difficulties intuiting where some of the existing Qt would files go under that structure, and having that extra outer "widgets" file along with the inner ones wasn't helping with that. Maybe in the meantime,there could at least be the "Components" folders to include Qt files that 100% are sure to be only used as parts of other widgets?

@CyanVoxel CyanVoxel marked this pull request as ready for review September 6, 2025 20:30
@Computerdores
Copy link
Collaborator

What is the idea behind the previews dir?

This is where I intend to split out the thumb_renderer.py (now renderer.py) methods into their own files for each preview type. IMO this is a strange area between "core" and "UI" code that doesn't fit into the traditional MVC structure, and giving it its own directory helps separate it while giving it space for all the new files that will populate it. Actually the driving reason that got me to open this PR was because there just wasn't a good place for me to put the renderer files that I planned on splitting out with a thumbnail renderer refactor, and then I ended up doing a larger reorganization/cleanup of the UI layout structure (that's been needed since the beginning and has only gotten worse over time).

Ahh okay, I was mostly confused by the vendored subdirectory (because I was thinking of just image previews), but now it makes sense!

This is because what I envision for the far future (would be interested to know what your thoughts are on that) is basically being able to pick any of the widgets and open an extra window that contains just that or to split an existing window and put different widgets in each pane.
This is how lots of professional software works (Ghidra immediately comes to my mind because I use it somewhat often) and that type of software is what I also associate with the 'Studio' term.

I'm certainly open to the idea, I think just at this point in time I'm having difficulties intuiting where some of the existing Qt would files go under that structure, and having that extra outer "widgets" file along with the inner ones wasn't helping with that. Maybe in the meantime,there could at least be the "Components" folders to include Qt files that 100% are sure to be only used as parts of other widgets?

We can also just have it unseparated (for now?). For finding "widgets" specifically looking for subclasses of PanelWidget should be enough.

@CyanVoxel CyanVoxel removed this from the Alpha v9.5.6 milestone Sep 6, 2025
@CyanVoxel CyanVoxel added this to the Alpha v9.5.5 milestone Sep 6, 2025
@CyanVoxel CyanVoxel merged commit f49cb4f into main Sep 6, 2025
10 checks passed
@github-project-automation github-project-automation bot moved this from 🚧 In progress to ✅ Done in TagStudio Development Sep 6, 2025
@CyanVoxel CyanVoxel deleted the untangle-layout branch September 6, 2025 21:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Priority: High An important issue requiring attention Type: Refactor Code that needs to be restructured or cleaned up

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

3 participants