Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Big refactoring number 2 #34

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Big refactoring number 2 #34

wants to merge 2 commits into from

Conversation

kannes
Copy link
Contributor

@kannes kannes commented Nov 2, 2024

I had some non-work time and got into a nice puzzle game with this plugin. Sorry for dumping it as one huge commit but this really was chain-of-thought refactoring and the result is way better. It's pretty much all the stuff that I wanted to finish in my older refactoring, e.g.:

  • Clean separation between GUI, core functions and manager in-between
  • Data source discovery rules in dataclasses with proper regexes
  • Transfer of data sources via stored data
  • Remove unnecessary path twiddling based on OS
  • Use pathlib everywhere possible
  • Less classes more functions #42
  • Lots of renamings for clarity
  • Qt6 compatible enums
  • ...

There are still some TODOs in the code, known bugs, outdated or missing docstrings, etc. But it is again "better than before" and definitely more maintainable.

I ripped away most of the annoying deep convolution for the import/removal logic. There are now three "layers":

  • Core functionality is in functions that might raise exceptions.
  • The dialog handles GUI and message communication.
  • The main ProfileManager class sits between them, takes selections from the GUI and calls the functions with them, then catches possible errors and provides success or error messages back to the GUI.

  • How to name the datasources directory? It is where for all the importable/removable things there is a file with the functions inside. I am really struggling to find a meaningful name for the directory.
  • Lots of new strings to translate or update, IMO nothing that's too important right now.

Johannes Kröger and others added 2 commits November 2, 2024 22:50
- Clean separation between GUI, core functions and manager in-between
- Data source discovery rules in dataclasses with proper regexes
- Transfer of data sources via stored data
- Remove unnecessary path twiddling based on OS
- Use pathlib everywhere possible
- Less classes more functions #42
- Lots of renamings for clarity
- Qt6 compatible enums
- ...
@github-actions github-actions bot added the UI User interface: forms, widgets... label Nov 2, 2024
@kannes
Copy link
Contributor Author

kannes commented Nov 2, 2024

I would propose that this becomes the first "new" release, possibly with some more smaller fixes if necessary.

@Guts
Copy link
Collaborator

Guts commented Nov 4, 2024

Hi @kannes,

Not sure if I'm supposed to review here or not. Your PR is really huge and hard to dive into. Is it only refactoring or also feature/enhancement?

@Guts
Copy link
Collaborator

Guts commented Nov 4, 2024

Since the new CI/CD allow to easily publish/release a new plugin's version, maybe we can take our time to review here and merge it after 0.5.0-beta2 - 2024-11-02 is released?

@kannes
Copy link
Contributor Author

kannes commented Nov 4, 2024

Oh yeah, sorry, definitely not something to actually review as I touched pretty much everything. It was more meant as a "I did something we could merge at some point, check it out" ;)

I'd be fine with either doing 0.5.0 with the existing state and this as 0.6.0 or merging it first and doing 0.5.0 with this. (Or any other version numbers really...) What works best for you!

@Guts
Copy link
Collaborator

Guts commented Nov 5, 2024

I'd be fine with either doing 0.5.0 with the existing state and this as 0.6.0

+1 for this strategy.

Copy link
Collaborator

@Guts Guts left a comment

Choose a reason for hiding this comment

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

Well it's really too heavy to review for me. So except a remark regarding bookmark management, I did not really read carefully the code.

But I've successfully tested this branch locally and it works like a charm.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I wonder if it isn't possible and preferable to use the PyQGIS API to manipulate bookmarks?

https://qgis.org/pyqgis/3.38/core/QgsBookmarkManager.html

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Definitely! I'd consider that a possible improvement for later though. Other functions could and should probably also be treated by native QGIS functions instead the brittle self-written code we got :)

@kannes
Copy link
Contributor Author

kannes commented Nov 29, 2024

Cheers! Yeah, definitely too much and too overwhelming for reviewing. A review of this would be pretty much a review of the whole project. I'll see if I can get a colleague to give that a go in December. Otherwise I'll probably merge it some time in early January for a new year's release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
UI User interface: forms, widgets...
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants