Skip to content

Commit 2924c02

Browse files
authored
refactor: create backend folder (#17)
1 parent 4210572 commit 2924c02

File tree

8 files changed

+23
-7
lines changed

8 files changed

+23
-7
lines changed

src/app_model/backends/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
"""Adapters for using the app_model with various backends."""
2+
3+
# TODO: make a `use_app()` like adapter to easily switch?
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
"""Qt objects for app_model."""
2+
from ._qaction import QCommandAction, QCommandRuleAction, QMenuItemAction
3+
from ._qkeymap import QKeyBindingSequence
4+
from ._qmenu import QModelMenu, QModelSubmenu
5+
from ._util import to_qicon
6+
7+
__all__ = [
8+
"QCommandAction",
9+
"QCommandRuleAction",
10+
"QKeyBindingSequence",
11+
"QMenuItemAction",
12+
"QModelMenu",
13+
"QModelSubmenu",
14+
"to_qicon",
15+
]
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
from qtpy.QtCore import Qt
77
from qtpy.QtGui import QKeySequence
88

9-
from ..types._constants import OperatingSystem
10-
from ..types._keys import KeyBinding, KeyCode, KeyMod, SimpleKeyBinding
9+
from ...types._constants import OperatingSystem
10+
from ...types._keys import KeyBinding, KeyCode, KeyMod, SimpleKeyBinding
1111

1212
QMETA = Qt.KeyboardModifier.MetaModifier
1313
QCTRL = Qt.KeyboardModifier.ControlModifier
@@ -164,6 +164,8 @@ def __init__(self, kb: KeyBinding) -> None:
164164
KeyMod.WinCtrl: Qt.KeyboardModifier.MetaModifier,
165165
}
166166

167+
168+
# unused/untested
167169
KEY_FROM_QT = {
168170
v.toCombined() if hasattr(v, "toCombined") else int(v): k
169171
for k, v in KEY_TO_QT.items()

src/app_model/qt/__init__.py

Lines changed: 0 additions & 4 deletions
This file was deleted.

tests/test_qt/test_qmenu.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from qtpy.QtCore import Qt
66
from qtpy.QtWidgets import QAction, QMainWindow
77

8-
from app_model.qt import QModelMenu
8+
from app_model.backends.qt import QModelMenu
99

1010
if TYPE_CHECKING:
1111
from pytestqt.plugin import QtBot

0 commit comments

Comments
 (0)