-
-
Notifications
You must be signed in to change notification settings - Fork 415
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
use app-model for view menu #4826
Conversation
for more information, see https://pre-commit.ci
…into use-app-model
@lucyleeow @DragaDoncila Is this ready to merge? Do we need to get another review from someone? |
@nclack would be great if we could get someone's eyes (yours maybe... 👀) on how we ended up setting up the
If all of this sounds sane and reasonable to you, then I think this is ready for merge? @lucyleeow can confirm as she's been doing all the heavy lifting here. |
This sounds in line with what the group discussed before, I think we should start the 24 hour clock for merging |
Thank you for the notes @DragaDoncila ! I was half way through typing some but didn't finish. Have added minor notes to the docstring of mock app fixture to add one of the things you mentioned. I agree that this deserves another pair of eyes due to the changes made - so ready for review and merge. The only thing I would note, for our future reference, is that we mock patched the |
One of the CI's is still failing: https://github.com/napari/napari/actions/runs/3254935776/jobs/5343726097 It seems maybe unrelated? It was during test collection
|
Okay seems unrelated and can probably be ignored - see #5217 |
Both failures here are unrelated, and I'm happy with the state of the PR atm. I've pulled it down and checked the menu behaves as expected, including the toggle functionality, so I'm going to merge this now. @lucyleeow @potating-potato I think next focus should be on #4977 and #4922 as they don't include any dynamic menu generation. |
Thank you @DragaDoncila !! I will update #4977 which should fix the current CI failures! |
* feat: use app-model WIP * partially fixed circ imports * bring back some menus with lazy import * wip * incorporate changes from app-model and ino * remove old code * remove more * add app-model dep * remove module from typecheck * small changes * remove not gc.collect assertion * reduce test code * add comments about context objects * add in-n-out to deps * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix test * bump in-n-out min ver * wip * refactor: add constants module, add test for menu building * add __all__ to constants * add some tests * add more comments * bump app-model * add internal documentation * add motivations and vision * wip * wip * wip * working replacement for view_menu * add parent to menu, fix test * remove comment * bump version, raise synchronous errors * add back napari namespace * sort import * comment navigation global * use navigation global * lenient test * Update docs/guides/app_model.md Co-authored-by: alisterburt <alisterburt@gmail.com> * Update napari/_app/actions/_layer_actions.py Co-authored-by: alisterburt <alisterburt@gmail.com> * Update napari/_qt/widgets/_tests/test_qt_extension2reader.py Co-authored-by: Grzegorz Bokota <bokota+github@gmail.com> * rename module * use get_app getter * bump appmodel * fix comment * add comment * move layer actions constants * clarify expression * fix merge * update docs * add tests * fix test * reorg actions * add comment * fix import * update docs * add comment to layer actions * add comment to named tuple * more comments for nathan * add comment * remove in-n-out, pin app-model * Update docs/guides/app_model.md Co-authored-by: Kira Evans <contact@kne42.me> * Update docs/guides/app_model.md Co-authored-by: Kira Evans <contact@kne42.me> * Update napari/_qt/_qapp_model/_menus.py Co-authored-by: Grzegorz Bokota <bokota+github@gmail.com> * toggle action * change viewer toggle action * add viewer toggle action subclass * simplify toggle action with app-model v0.0.8 * fix test * undo last change * fix test * fix type * global import * module docstring * quote type hint * add simple test, move action * relative import * add viewer toggle test * fix activity dock toggle * bump app-model, fix final actions * remove dual param to _QtMainWindow * remove print * remove comment * more comments * add shorcut * amend injection to pass window in init * nits * black * add comment in _QtMainWindow * fix toggles * try ci * test CI, no activity dock toggle * check provider in CI * CI - test just qapp_model_menus * fix app mock in conftest * revert tox ini * fix app tests * cruft * update docstring fixture Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: alisterburt <alisterburt@gmail.com> Co-authored-by: Grzegorz Bokota <bokota+github@gmail.com> Co-authored-by: Kira Evans <contact@kne42.me> Co-authored-by: Ziyang Liu <zliu@chanzuckerberg.com> Co-authored-by: lucy liu <jliu176@gmail.com> Co-authored-by: Nathan Clack <nclack@gmail.com>
* feat: use app-model WIP * partially fixed circ imports * bring back some menus with lazy import * wip * incorporate changes from app-model and ino * remove old code * remove more * add app-model dep * remove module from typecheck * small changes * remove not gc.collect assertion * reduce test code * add comments about context objects * add in-n-out to deps * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix test * bump in-n-out min ver * wip * refactor: add constants module, add test for menu building * add __all__ to constants * add some tests * add more comments * bump app-model * add internal documentation * add motivations and vision * wip * wip * wip * working replacement for view_menu * add parent to menu, fix test * remove comment * bump version, raise synchronous errors * add back napari namespace * sort import * comment navigation global * use navigation global * lenient test * Update docs/guides/app_model.md Co-authored-by: alisterburt <alisterburt@gmail.com> * Update napari/_app/actions/_layer_actions.py Co-authored-by: alisterburt <alisterburt@gmail.com> * Update napari/_qt/widgets/_tests/test_qt_extension2reader.py Co-authored-by: Grzegorz Bokota <bokota+github@gmail.com> * rename module * use get_app getter * bump appmodel * fix comment * add comment * move layer actions constants * clarify expression * fix merge * update docs * add tests * fix test * reorg actions * add comment * fix import * update docs * add comment to layer actions * add comment to named tuple * more comments for nathan * add comment * remove in-n-out, pin app-model * Update docs/guides/app_model.md Co-authored-by: Kira Evans <contact@kne42.me> * Update docs/guides/app_model.md Co-authored-by: Kira Evans <contact@kne42.me> * Update napari/_qt/_qapp_model/_menus.py Co-authored-by: Grzegorz Bokota <bokota+github@gmail.com> * toggle action * change viewer toggle action * add viewer toggle action subclass * simplify toggle action with app-model v0.0.8 * fix test * undo last change * fix test * fix type * global import * module docstring * quote type hint * add simple test, move action * relative import * add viewer toggle test * fix activity dock toggle * bump app-model, fix final actions * remove dual param to _QtMainWindow * remove print * remove comment * more comments * add shorcut * amend injection to pass window in init * nits * black * add comment in _QtMainWindow * fix toggles * try ci * test CI, no activity dock toggle * check provider in CI * CI - test just qapp_model_menus * fix app mock in conftest * revert tox ini * fix app tests * cruft * update docstring fixture Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: alisterburt <alisterburt@gmail.com> Co-authored-by: Grzegorz Bokota <bokota+github@gmail.com> Co-authored-by: Kira Evans <contact@kne42.me> Co-authored-by: Ziyang Liu <zliu@chanzuckerberg.com> Co-authored-by: lucy liu <jliu176@gmail.com> Co-authored-by: Nathan Clack <nclack@gmail.com>
* feat: use app-model WIP * partially fixed circ imports * bring back some menus with lazy import * wip * incorporate changes from app-model and ino * remove old code * remove more * add app-model dep * remove module from typecheck * small changes * remove not gc.collect assertion * reduce test code * add comments about context objects * add in-n-out to deps * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix test * bump in-n-out min ver * wip * refactor: add constants module, add test for menu building * add __all__ to constants * add some tests * add more comments * bump app-model * add internal documentation * add motivations and vision * wip * wip * wip * working replacement for view_menu * add parent to menu, fix test * remove comment * bump version, raise synchronous errors * add back napari namespace * sort import * comment navigation global * use navigation global * lenient test * Update docs/guides/app_model.md Co-authored-by: alisterburt <alisterburt@gmail.com> * Update napari/_app/actions/_layer_actions.py Co-authored-by: alisterburt <alisterburt@gmail.com> * Update napari/_qt/widgets/_tests/test_qt_extension2reader.py Co-authored-by: Grzegorz Bokota <bokota+github@gmail.com> * rename module * use get_app getter * bump appmodel * fix comment * add comment * move layer actions constants * clarify expression * fix merge * update docs * add tests * fix test * reorg actions * add comment * fix import * update docs * add comment to layer actions * add comment to named tuple * more comments for nathan * add comment * remove in-n-out, pin app-model * Update docs/guides/app_model.md Co-authored-by: Kira Evans <contact@kne42.me> * Update docs/guides/app_model.md Co-authored-by: Kira Evans <contact@kne42.me> * Update napari/_qt/_qapp_model/_menus.py Co-authored-by: Grzegorz Bokota <bokota+github@gmail.com> * toggle action * change viewer toggle action * add viewer toggle action subclass * simplify toggle action with app-model v0.0.8 * fix test * undo last change * fix test * fix type * global import * module docstring * quote type hint * add simple test, move action * relative import * add viewer toggle test * fix activity dock toggle * bump app-model, fix final actions * remove dual param to _QtMainWindow * remove print * remove comment * more comments * add shorcut * amend injection to pass window in init * nits * black * add comment in _QtMainWindow * fix toggles * try ci * test CI, no activity dock toggle * check provider in CI * CI - test just qapp_model_menus * fix app mock in conftest * revert tox ini * fix app tests * cruft * update docstring fixture Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: alisterburt <alisterburt@gmail.com> Co-authored-by: Grzegorz Bokota <bokota+github@gmail.com> Co-authored-by: Kira Evans <contact@kne42.me> Co-authored-by: Ziyang Liu <zliu@chanzuckerberg.com> Co-authored-by: lucy liu <jliu176@gmail.com> Co-authored-by: Nathan Clack <nclack@gmail.com>
* feat: use app-model WIP * partially fixed circ imports * bring back some menus with lazy import * wip * incorporate changes from app-model and ino * remove old code * remove more * add app-model dep * remove module from typecheck * small changes * remove not gc.collect assertion * reduce test code * add comments about context objects * add in-n-out to deps * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix test * bump in-n-out min ver * wip * refactor: add constants module, add test for menu building * add __all__ to constants * add some tests * add more comments * bump app-model * add internal documentation * add motivations and vision * wip * wip * wip * working replacement for view_menu * add parent to menu, fix test * remove comment * bump version, raise synchronous errors * add back napari namespace * sort import * comment navigation global * use navigation global * lenient test * Update docs/guides/app_model.md Co-authored-by: alisterburt <alisterburt@gmail.com> * Update napari/_app/actions/_layer_actions.py Co-authored-by: alisterburt <alisterburt@gmail.com> * Update napari/_qt/widgets/_tests/test_qt_extension2reader.py Co-authored-by: Grzegorz Bokota <bokota+github@gmail.com> * rename module * use get_app getter * bump appmodel * fix comment * add comment * move layer actions constants * clarify expression * fix merge * update docs * add tests * fix test * reorg actions * add comment * fix import * update docs * add comment to layer actions * add comment to named tuple * more comments for nathan * add comment * remove in-n-out, pin app-model * Update docs/guides/app_model.md Co-authored-by: Kira Evans <contact@kne42.me> * Update docs/guides/app_model.md Co-authored-by: Kira Evans <contact@kne42.me> * Update napari/_qt/_qapp_model/_menus.py Co-authored-by: Grzegorz Bokota <bokota+github@gmail.com> * toggle action * change viewer toggle action * add viewer toggle action subclass * simplify toggle action with app-model v0.0.8 * fix test * undo last change * fix test * fix type * global import * module docstring * quote type hint * add simple test, move action * relative import * add viewer toggle test * fix activity dock toggle * bump app-model, fix final actions * remove dual param to _QtMainWindow * remove print * remove comment * more comments * add shorcut * amend injection to pass window in init * nits * black * add comment in _QtMainWindow * fix toggles * try ci * test CI, no activity dock toggle * check provider in CI * CI - test just qapp_model_menus * fix app mock in conftest * revert tox ini * fix app tests * cruft * update docstring fixture Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: alisterburt <alisterburt@gmail.com> Co-authored-by: Grzegorz Bokota <bokota+github@gmail.com> Co-authored-by: Kira Evans <contact@kne42.me> Co-authored-by: Ziyang Liu <zliu@chanzuckerberg.com> Co-authored-by: lucy liu <jliu176@gmail.com> Co-authored-by: Nathan Clack <nclack@gmail.com>
* feat: use app-model WIP * partially fixed circ imports * bring back some menus with lazy import * wip * incorporate changes from app-model and ino * remove old code * remove more * add app-model dep * remove module from typecheck * small changes * remove not gc.collect assertion * reduce test code * add comments about context objects * add in-n-out to deps * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix test * bump in-n-out min ver * wip * refactor: add constants module, add test for menu building * add __all__ to constants * add some tests * add more comments * bump app-model * add internal documentation * add motivations and vision * wip * wip * wip * working replacement for view_menu * add parent to menu, fix test * remove comment * bump version, raise synchronous errors * add back napari namespace * sort import * comment navigation global * use navigation global * lenient test * Update docs/guides/app_model.md Co-authored-by: alisterburt <alisterburt@gmail.com> * Update napari/_app/actions/_layer_actions.py Co-authored-by: alisterburt <alisterburt@gmail.com> * Update napari/_qt/widgets/_tests/test_qt_extension2reader.py Co-authored-by: Grzegorz Bokota <bokota+github@gmail.com> * rename module * use get_app getter * bump appmodel * fix comment * add comment * move layer actions constants * clarify expression * fix merge * update docs * add tests * fix test * reorg actions * add comment * fix import * update docs * add comment to layer actions * add comment to named tuple * more comments for nathan * add comment * remove in-n-out, pin app-model * Update docs/guides/app_model.md Co-authored-by: Kira Evans <contact@kne42.me> * Update docs/guides/app_model.md Co-authored-by: Kira Evans <contact@kne42.me> * Update napari/_qt/_qapp_model/_menus.py Co-authored-by: Grzegorz Bokota <bokota+github@gmail.com> * toggle action * change viewer toggle action * add viewer toggle action subclass * simplify toggle action with app-model v0.0.8 * fix test * undo last change * fix test * fix type * global import * module docstring * quote type hint * add simple test, move action * relative import * add viewer toggle test * fix activity dock toggle * bump app-model, fix final actions * remove dual param to _QtMainWindow * remove print * remove comment * more comments * add shorcut * amend injection to pass window in init * nits * black * add comment in _QtMainWindow * fix toggles * try ci * test CI, no activity dock toggle * check provider in CI * CI - test just qapp_model_menus * fix app mock in conftest * revert tox ini * fix app tests * cruft * update docstring fixture Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: alisterburt <alisterburt@gmail.com> Co-authored-by: Grzegorz Bokota <bokota+github@gmail.com> Co-authored-by: Kira Evans <contact@kne42.me> Co-authored-by: Ziyang Liu <zliu@chanzuckerberg.com> Co-authored-by: lucy liu <jliu176@gmail.com> Co-authored-by: Nathan Clack <nclack@gmail.com>
* feat: use app-model WIP * partially fixed circ imports * bring back some menus with lazy import * wip * incorporate changes from app-model and ino * remove old code * remove more * add app-model dep * remove module from typecheck * small changes * remove not gc.collect assertion * reduce test code * add comments about context objects * add in-n-out to deps * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix test * bump in-n-out min ver * wip * refactor: add constants module, add test for menu building * add __all__ to constants * add some tests * add more comments * bump app-model * add internal documentation * add motivations and vision * wip * wip * wip * working replacement for view_menu * add parent to menu, fix test * remove comment * bump version, raise synchronous errors * add back napari namespace * sort import * comment navigation global * use navigation global * lenient test * Update docs/guides/app_model.md Co-authored-by: alisterburt <alisterburt@gmail.com> * Update napari/_app/actions/_layer_actions.py Co-authored-by: alisterburt <alisterburt@gmail.com> * Update napari/_qt/widgets/_tests/test_qt_extension2reader.py Co-authored-by: Grzegorz Bokota <bokota+github@gmail.com> * rename module * use get_app getter * bump appmodel * fix comment * add comment * move layer actions constants * clarify expression * fix merge * update docs * add tests * fix test * reorg actions * add comment * fix import * update docs * add comment to layer actions * add comment to named tuple * more comments for nathan * add comment * remove in-n-out, pin app-model * Update docs/guides/app_model.md Co-authored-by: Kira Evans <contact@kne42.me> * Update docs/guides/app_model.md Co-authored-by: Kira Evans <contact@kne42.me> * Update napari/_qt/_qapp_model/_menus.py Co-authored-by: Grzegorz Bokota <bokota+github@gmail.com> * toggle action * change viewer toggle action * add viewer toggle action subclass * simplify toggle action with app-model v0.0.8 * fix test * undo last change * fix test * fix type * global import * module docstring * quote type hint * add simple test, move action * relative import * add viewer toggle test * fix activity dock toggle * bump app-model, fix final actions * remove dual param to _QtMainWindow * remove print * remove comment * more comments * add shorcut * amend injection to pass window in init * nits * black * add comment in _QtMainWindow * fix toggles * try ci * test CI, no activity dock toggle * check provider in CI * CI - test just qapp_model_menus * fix app mock in conftest * revert tox ini * fix app tests * cruft * update docstring fixture Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: alisterburt <alisterburt@gmail.com> Co-authored-by: Grzegorz Bokota <bokota+github@gmail.com> Co-authored-by: Kira Evans <contact@kne42.me> Co-authored-by: Ziyang Liu <zliu@chanzuckerberg.com> Co-authored-by: lucy liu <jliu176@gmail.com> Co-authored-by: Nathan Clack <nclack@gmail.com>
* feat: use app-model WIP * partially fixed circ imports * bring back some menus with lazy import * wip * incorporate changes from app-model and ino * remove old code * remove more * add app-model dep * remove module from typecheck * small changes * remove not gc.collect assertion * reduce test code * add comments about context objects * add in-n-out to deps * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix test * bump in-n-out min ver * wip * refactor: add constants module, add test for menu building * add __all__ to constants * add some tests * add more comments * bump app-model * add internal documentation * add motivations and vision * wip * wip * wip * working replacement for view_menu * add parent to menu, fix test * remove comment * bump version, raise synchronous errors * add back napari namespace * sort import * comment navigation global * use navigation global * lenient test * Update docs/guides/app_model.md Co-authored-by: alisterburt <alisterburt@gmail.com> * Update napari/_app/actions/_layer_actions.py Co-authored-by: alisterburt <alisterburt@gmail.com> * Update napari/_qt/widgets/_tests/test_qt_extension2reader.py Co-authored-by: Grzegorz Bokota <bokota+github@gmail.com> * rename module * use get_app getter * bump appmodel * fix comment * add comment * move layer actions constants * clarify expression * fix merge * update docs * add tests * fix test * reorg actions * add comment * fix import * update docs * add comment to layer actions * add comment to named tuple * more comments for nathan * add comment * remove in-n-out, pin app-model * Update docs/guides/app_model.md Co-authored-by: Kira Evans <contact@kne42.me> * Update docs/guides/app_model.md Co-authored-by: Kira Evans <contact@kne42.me> * Update napari/_qt/_qapp_model/_menus.py Co-authored-by: Grzegorz Bokota <bokota+github@gmail.com> * toggle action * change viewer toggle action * add viewer toggle action subclass * simplify toggle action with app-model v0.0.8 * fix test * undo last change * fix test * fix type * global import * module docstring * quote type hint * add simple test, move action * relative import * add viewer toggle test * fix activity dock toggle * bump app-model, fix final actions * remove dual param to _QtMainWindow * remove print * remove comment * more comments * add shorcut * amend injection to pass window in init * nits * black * add comment in _QtMainWindow * fix toggles * try ci * test CI, no activity dock toggle * check provider in CI * CI - test just qapp_model_menus * fix app mock in conftest * revert tox ini * fix app tests * cruft * update docstring fixture Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: alisterburt <alisterburt@gmail.com> Co-authored-by: Grzegorz Bokota <bokota+github@gmail.com> Co-authored-by: Kira Evans <contact@kne42.me> Co-authored-by: Ziyang Liu <zliu@chanzuckerberg.com> Co-authored-by: lucy liu <jliu176@gmail.com> Co-authored-by: Nathan Clack <nclack@gmail.com>
# Fixes/Closes Ref: #4826 (comment) # Description Adds toggle status to view menu items: `Toggle Play`, `Toggle Fullscreen` and `Toggle Menubar` . These were not added as part of view menu app model migration PR as they did not exist in main and thus decided to be out of scope of that PR.
Description
Partially to keep moving forward, but also to keep testing the app-model pattern, I'm playing with some branches that use #4784 to start removing old code. This refactors the menu bar view menu with the new pattern.
@Czaki, particularly interested to get your thoughts on this. While I'm mostly very happy with the pattern of declaring commands that require dependencies to be injected (rather than always using methods bound to specific instances), I do recognize that some of it feels a little different as I go. Your Qt expertise and critical eye is very much appreciated here.
diff relative to #4784: tlambert03/napari@use-app-model...tlambert03:napari:appmodel-view-menu