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 😢
[x] 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.
coverage: 50.117% (-0.6%) from 50.688%
when pulling b038d32aa8f8ddccfa65bc77c8113fcfc1d097da on mrvisscher:package-reorganization
into 0955df9ad3644251c9511f73a3998cdefc99df74 on LCA-ActivityBrowser:master.
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 uselog.debug
orlog.info
as usual.Quick summary of changes
from activity_browser import application, log, signals, ab_settings, project_settings, version
and any of the controllersapplication.main_window
, which make it easier to create widgets that inherit the main_window directly.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
orprojects
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
bug
,feature
,ui
,change
,documentation
,breaking
,ci
as they show up in the changelog.