Skip to content

Commit

Permalink
Use packaging to determine import to get app-model application
Browse files Browse the repository at this point in the history
Co-authored-by: Grzegorz Bokota <bokota+github@gmail.com>
  • Loading branch information
dalthviz and Czaki committed Oct 23, 2024
1 parent a4ed264 commit 4bf7497
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions midi_app_controller/state/state_manager.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
from importlib.metadata import version
from pathlib import Path
from typing import NamedTuple, Optional

import rtmidi
from app_model import Application
from app_model.registries import MenusRegistry
from app_model.types import CommandRule, MenuItem
from packaging.version import parse as parse_version

# TODO: This will be made public in some future napari version
try:
if parse_version(version("napari")) >= parse_version("0.5.4"):
from napari._app_model import get_app_model
except ImportError:
else:
from napari._app_model import get_app as get_app_model

from midi_app_controller.actions.actions_handler import ActionsHandler
Expand Down

0 comments on commit 4bf7497

Please # to comment.