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

Moving GUI out of the controllers #1241

Merged
merged 36 commits into from
Mar 28, 2024

Conversation

mrvisscher
Copy link
Collaborator

@mrvisscher mrvisscher commented Feb 21, 2024

Big refactor that moves GUI interaction out of the controllers and into specialized ABAction's. This introduces a new design philosophy in which widgets are only responsible for their own state, controllers are only responsible for Brightway's state, and actions are responsible for the logic for moving between states. This:

  • Separates the UI from the controllers, making them initializable before UI init, preventing circular imports
  • Moves specialized user interaction from widgets, clearing up where user interaction happens
  • Makes user interactions easily testable by unit-testing ABActions (>90% coverage right now)
  • ABActions inherit QActions, so they can easily be added to buttons, or (context)menus.

ABAction flowchart

ABAction flowchart

Checklist

  • 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.
  • 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 21, 2024
@mrvisscher mrvisscher added this to the 2.10 milestone Feb 21, 2024
@mrvisscher mrvisscher requested a review from marc-vdm March 6, 2024 13:30
@mrvisscher mrvisscher marked this pull request as ready for review March 6, 2024 13:30
Copy link
Member

@marc-vdm marc-vdm left a comment

Choose a reason for hiding this comment

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

Also some documentation TODO:

  • Make contributing.md a smaller file with references the below:
  • Add files explaining important items (file for actions, controllers, signals etc)
    • Why do they exist?
    • When (not) to use them?
    • Relationships between other things
  • File on how to update tests

activity_browser/actions/base.py Outdated Show resolved Hide resolved
activity_browser/actions/base.py Show resolved Hide resolved
activity_browser/bwutils/importers.py Outdated Show resolved Hide resolved
activity_browser/bwutils/superstructure/file_imports.py Outdated Show resolved Hide resolved
activity_browser/layouts/tabs/project_manager.py Outdated Show resolved Hide resolved
activity_browser/ui/tables/views.py Outdated Show resolved Hide resolved
@@ -95,6 +95,6 @@ def focusOutEvent(self, event):
super(SignalledComboEdit, self).focusOutEvent(event)

# def showPopup(self):
Copy link
Member

Choose a reason for hiding this comment

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

remove?

tests/legacy/test_settings.py Outdated Show resolved Hide resolved

#
#
# def test_open_db_wizard_button(qtbot, ab_app, monkeypatch):
Copy link
Member

Choose a reason for hiding this comment

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

remove?

activity_browser/settings.py Outdated Show resolved Hide resolved
@mrvisscher mrvisscher merged commit 360c9e3 into LCA-ActivityBrowser:minor Mar 28, 2024
15 checks passed
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.

Changing characterization factors not working CF table: possible to add same biosphere flow twice
2 participants