LCA-ActivityBrowser / activity-browser

GUI for brightway2
GNU Lesser General Public License v3.0
134 stars 50 forks source link

Package reorganization #1229

Closed mrvisscher closed 4 months ago

mrvisscher commented 4 months ago

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

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

coveralls commented 4 months ago

Coverage Status

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