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

Package reorganization #1229

Merged

Conversation

mrvisscher
Copy link
Collaborator

@mrvisscher mrvisscher commented Feb 8, 2024

Quite a large reorganization of imports in the activity-browser, and controllers packages. This change allows us to import certain important objects like the application, main window, signals, controllers and logger in a simplified manner. For example the logger can now be accessed by simply putting:

from activity_browser import log after which you can use log.debug or log.info as usual.

Quick summary of changes

  • Enables from activity_browser import application, log, signals, ab_settings, project_settings, version and any of the controllers
  • Enables access to the main window through application.main_window, which make it easier to create widgets that inherit the main_window directly.
  • Controllers are now stand-alone, which gives us access to their methods and (future) properties
  • Controllers have been put into separate files
  • Logging workflows have been updated throughout the AB

Considerations regarding stand-alone controllers

For future reference: at this moment I chose to make the controllers global instead of singletons or instanceless for the following reasons:

Why not instanceless and access through static methods?

Tried it out, but properties don't work for objects that have no instance. And as the plan is to add properties like databases or projects to the controllers later, this won't work.

Why not singletons?

Although implementing a singleton structure using the __new__ dundermethod seemed easy at first, __init__ is called every time a class is called for. Because we have a lot of signal connections in the init-phase of the controllers right now I decided it was not worth the stability risk.

Checklist

  • Keep pull requests small so they can be easily reviewed. - Yeah this failed 😢
  • Update the documentation, please follow the numpy style guide.
  • Update tests.
  • Categorize the PR by setting a good title and adding one of the labels:
    bug, feature, ui, change, documentation, breaking, ci
    as they show up in the changelog.
  • Link this PR to related issues by using closing keywords.
  • Add a milestone to the PR for the intended release.
  • Request a review from another developer.

@mrvisscher mrvisscher added the change PRs related to minor changes to AB label Feb 8, 2024
@mrvisscher mrvisscher added this to the 2.10 milestone Feb 8, 2024
@mrvisscher mrvisscher requested a review from marc-vdm February 8, 2024 09:45
@mrvisscher mrvisscher marked this pull request as draft February 8, 2024 09:46
@coveralls
Copy link

coveralls commented Feb 8, 2024

Coverage Status

coverage: 50.117% (-0.6%) from 50.688%
when pulling b038d32 on mrvisscher:package-reorganization
into 0955df9 on LCA-ActivityBrowser:master.

@mrvisscher mrvisscher marked this pull request as ready for review February 8, 2024 10:23
@marc-vdm marc-vdm changed the base branch from master to v2.10.0 February 9, 2024 14:07
@mrvisscher mrvisscher changed the base branch from v2.10.0 to minor February 19, 2024 11:23
@mrvisscher mrvisscher merged commit 21f38b2 into LCA-ActivityBrowser:minor Feb 19, 2024
15 checks passed
@mrvisscher mrvisscher deleted the package-reorganization branch November 22, 2024 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
change PRs related to minor changes to AB
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants