Skip to content

Commit dd9dae3

Browse files
committed
Merge branch 'main' into add-ann
2 parents 6bdcbc3 + 617752c commit dd9dae3

File tree

4 files changed

+21
-9
lines changed

4 files changed

+21
-9
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ jobs:
5858

5959
- name: 🧪 Run Tests
6060
run: uv run coverage run -p -m pytest -v
61+
env:
62+
PYTEST_ADDOPTS: ${{ matrix.resolution == 'lowest-direct' && '-W ignore' || '' }}
6163

6264
- name: Upload coverage
6365
uses: actions/upload-artifact@v4
@@ -82,6 +84,8 @@ jobs:
8284
exclude:
8385
- platform: "macos-latest"
8486
extra: "pyside2"
87+
- python-version: "3.12"
88+
extra: "pyside2"
8589

8690
steps:
8791
- uses: actions/checkout@v4
@@ -94,7 +98,7 @@ jobs:
9498
python-version: ${{ matrix.python-version }}
9599
enable-cache: true
96100
cache-dependency-glob: "**/pyproject.toml"
97-
101+
98102
- uses: pyvista/setup-headless-display-action@v4
99103
with:
100104
qt: true
@@ -104,6 +108,8 @@ jobs:
104108

105109
- name: 🧪 Run Tests
106110
run: uv run coverage run -p -m pytest -v
111+
env:
112+
PYTEST_ADDOPTS: ${{ matrix.resolution == 'lowest-direct' && '-W ignore' || '' }}
107113

108114
# If something goes wrong with --pre tests, we can open an issue in the repo
109115
- name: 📝 Report --pre Failures
@@ -175,4 +181,4 @@ jobs:
175181
- uses: softprops/action-gh-release@v2
176182
with:
177183
generate_release_notes: true
178-
files: './dist/*'
184+
files: "./dist/*"

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,4 @@ ENV/
107107
app_model/_version.py
108108
src/app_model/_version.py
109109

110-
uv.lock
110+
uv.lock

pyproject.toml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ classifiers = [
3737
]
3838
dynamic = ["version"]
3939
dependencies = [
40-
"psygnal>=0.3.4",
40+
"psygnal>=0.10",
4141
"pydantic>=1.10.18",
4242
"pydantic-compat>=0.1.1",
4343
"in-n-out>=0.1.5",
@@ -57,8 +57,8 @@ pyqt5 = [
5757
"pyqt5-qt5>=5.15.4; sys_platform != 'win32'",
5858
]
5959
pyqt6 = ["app-model[qt]", "PyQt6>=6.4.0"]
60-
pyside2 = ["app-model[qt]", "PySide2>=5.15.2"]
61-
pyside6 = ["app-model[qt]", "PySide6>=6.4.0"]
60+
pyside2 = ["app-model[qt]", "PySide2>=5.15.2.1"]
61+
pyside6 = ["app-model[qt]", "PySide6>=6.6.0"]
6262

6363
# https://peps.python.org/pep-0735/
6464
# setup with `uv sync` or `pip install -e . --group dev`
@@ -152,7 +152,6 @@ filterwarnings = [
152152
"error",
153153
"ignore:Enum value:DeprecationWarning:superqt",
154154
"ignore:Failed to disconnect::pytestqt",
155-
"ignore:ast.Str is deprecated:DeprecationWarning",
156155
"ignore:Failing to pass a value to the 'type_params' parameter::pydantic",
157156
"ignore:`__get_validators__` is deprecated and will be removed",
158157
]
@@ -193,6 +192,9 @@ exclude_lines = [
193192
[tool.coverage.run]
194193
source = ["app_model"]
195194

195+
[tool.coverage.paths]
196+
source = ["src/", "*/app-model/app-model/src", "*/site-packages/"]
197+
196198
[tool.check-manifest]
197199
ignore = [
198200
".github_changelog_generator",

src/app_model/backends/qt/_qmenu.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from collections.abc import Collection, Iterable, Mapping, Sequence
55
from typing import TYPE_CHECKING, cast
66

7-
from qtpy.QtWidgets import QMenu, QMenuBar, QToolBar
7+
from qtpy.QtWidgets import QApplication, QMenu, QMenuBar, QToolBar
88

99
from app_model import Application
1010
from app_model.types import SubmenuItem
@@ -300,14 +300,18 @@ def _rebuild(
300300

301301
groups = list(app.menus.iter_menu_groups(menu_id))
302302
n_groups = len(groups)
303+
qapp = QApplication.instance()
303304
for n, group in enumerate(groups):
304305
for item in group:
305306
if isinstance(item, SubmenuItem):
306307
if include_submenus:
307308
submenu = QModelSubmenu(item, app, parent=menu)
308309
cast("QMenu", menu).addMenu(submenu)
309310
elif item.command.id not in _exclude:
310-
action = QMenuItemAction.create(item, app=app, parent=menu)
311+
# use QApplication instance as parent for actions
312+
# because we use action singleton, and actions
313+
# are not related to any window.
314+
action = QMenuItemAction.create(item, app=app, parent=qapp)
311315
menu.addAction(action)
312316
if n < n_groups - 1:
313317
menu.addSeparator()

0 commit comments

Comments
 (0)