jbqt 0.1.14__tar.gz → 0.1.15__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of jbqt might be problematic. Click here for more details.
- {jbqt-0.1.14 → jbqt-0.1.15}/PKG-INFO +2 -1
- jbqt-0.1.15/jbqt/models/__init__.py +14 -0
- jbqt-0.1.15/jbqt/models/model_consts.py +9 -0
- jbqt-0.1.15/jbqt/models/model_utils.py +24 -0
- jbqt-0.1.15/jbqt/models/toolbar_button.py +58 -0
- {jbqt-0.1.14 → jbqt-0.1.15}/pyproject.toml +2 -1
- jbqt-0.1.14/jbqt/models/__init__.py +0 -6
- {jbqt-0.1.14 → jbqt-0.1.15}/README.md +0 -0
- {jbqt-0.1.14 → jbqt-0.1.15}/jbqt/__init__.py +0 -0
- {jbqt-0.1.14 → jbqt-0.1.15}/jbqt/common/__init__.py +0 -0
- {jbqt-0.1.14 → jbqt-0.1.15}/jbqt/common/qt_utils.py +0 -0
- {jbqt-0.1.14 → jbqt-0.1.15}/jbqt/consts/__init__.py +0 -0
- {jbqt-0.1.14 → jbqt-0.1.15}/jbqt/dialogs/__init__.py +0 -0
- {jbqt-0.1.14 → jbqt-0.1.15}/jbqt/dialogs/file_dialog.py +0 -0
- {jbqt-0.1.14 → jbqt-0.1.15}/jbqt/dialogs/input_form.py +0 -0
- {jbqt-0.1.14 → jbqt-0.1.15}/jbqt/dialogs/text_preview.py +0 -0
- {jbqt-0.1.14 → jbqt-0.1.15}/jbqt/models/chip_button.py +0 -0
- {jbqt-0.1.14 → jbqt-0.1.15}/jbqt/models/chips.py +0 -0
- {jbqt-0.1.14 → jbqt-0.1.15}/jbqt/types/__init__.py +0 -0
- {jbqt-0.1.14 → jbqt-0.1.15}/jbqt/view_icons.py +0 -0
- {jbqt-0.1.14 → jbqt-0.1.15}/jbqt/widgets/__init__.py +0 -0
- {jbqt-0.1.14 → jbqt-0.1.15}/jbqt/widgets/chip_button.py +0 -0
- {jbqt-0.1.14 → jbqt-0.1.15}/jbqt/widgets/chips.py +0 -0
- {jbqt-0.1.14 → jbqt-0.1.15}/jbqt/widgets/multiselect.py +0 -0
- {jbqt-0.1.14 → jbqt-0.1.15}/jbqt/widgets/simple.py +0 -0
- {jbqt-0.1.14 → jbqt-0.1.15}/jbqt/widgets/toast.py +0 -0
- {jbqt-0.1.14 → jbqt-0.1.15}/jbqt/widgets/widget_utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: jbqt
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.15
|
|
4
4
|
Summary:
|
|
5
5
|
Author: Joseph Bochinski
|
|
6
6
|
Author-email: stirgejr@gmail.com
|
|
@@ -12,6 +12,7 @@ Requires-Dist: jbconsts (>=0.1.1,<0.2.0)
|
|
|
12
12
|
Requires-Dist: jbutils (>=0.1.23,<0.2.0)
|
|
13
13
|
Requires-Dist: pyqt6 (>=6.9.0,<7.0.0)
|
|
14
14
|
Requires-Dist: python-levenshtein (>=0.27.1,<0.28.0)
|
|
15
|
+
Requires-Dist: rich (>=14.0.0,<15.0.0)
|
|
15
16
|
Description-Content-Type: text/markdown
|
|
16
17
|
|
|
17
18
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"""Model exports"""
|
|
2
|
+
|
|
3
|
+
from jbqt.models.chips import IChipsWidget
|
|
4
|
+
from jbqt.models.chip_button import IChipButton
|
|
5
|
+
from jbqt.models.model_consts import RegisteredFunctions
|
|
6
|
+
from jbqt.models.model_utils import get_fct, register_fct
|
|
7
|
+
|
|
8
|
+
__all__ = [
|
|
9
|
+
"get_fct",
|
|
10
|
+
"IChipButton",
|
|
11
|
+
"IChipsWidget",
|
|
12
|
+
"register_fct",
|
|
13
|
+
"RegisteredFunctions",
|
|
14
|
+
]
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"""Collection of utility functions local to the models package"""
|
|
2
|
+
|
|
3
|
+
from jbutils.types import Function
|
|
4
|
+
from rich import print
|
|
5
|
+
|
|
6
|
+
from jbqt.models.model_consts import RegisteredFunctions
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def register_fct(name: str, fct: Function, override: bool = False) -> None:
|
|
10
|
+
if name not in RegisteredFunctions:
|
|
11
|
+
RegisteredFunctions[name] = fct
|
|
12
|
+
if override and name in RegisteredFunctions:
|
|
13
|
+
# TODO improve logging
|
|
14
|
+
print(
|
|
15
|
+
f"[yellow][Warning][/yellow]: Function '{name}' already defined and was overwritten"
|
|
16
|
+
)
|
|
17
|
+
print(f"[yellow][Warning][/yellow]: Function '{name}' already defined")
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def get_fct(name: str, fallback: Function | None = None) -> Function | None:
|
|
21
|
+
return RegisteredFunctions.get(name, fallback)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
__all__ = ["register_fct", "get_fct"]
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"""Collection of models for PyQt6"""
|
|
2
|
+
|
|
3
|
+
from collections.abc import Callable
|
|
4
|
+
from dataclasses import dataclass
|
|
5
|
+
|
|
6
|
+
from PyQt6.QtCore import QSize, QObject
|
|
7
|
+
from PyQt6.QtGui import QIcon, QColor, QAction
|
|
8
|
+
|
|
9
|
+
from jbconsts import COLORS
|
|
10
|
+
from jbqt.consts import ICONS, QtIconSizes
|
|
11
|
+
from jbqt.models import model_utils
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@dataclass
|
|
15
|
+
class ToolbarButton:
|
|
16
|
+
name: str = ""
|
|
17
|
+
icon: QIcon | str = ""
|
|
18
|
+
color: QColor | str = COLORS.BLUE_GRAY
|
|
19
|
+
checkable: bool = False
|
|
20
|
+
checked: bool = False
|
|
21
|
+
status_tip: str = ""
|
|
22
|
+
size: QSize | str = QtIconSizes.ICON_MD
|
|
23
|
+
function: Callable[..., None] | str | None = None
|
|
24
|
+
text: str = ""
|
|
25
|
+
|
|
26
|
+
def __post_init__(self) -> None:
|
|
27
|
+
if isinstance(self.function, str):
|
|
28
|
+
fct = model_utils.get_fct(self.function)
|
|
29
|
+
print("fct:", fct)
|
|
30
|
+
self.function = fct if fct else None
|
|
31
|
+
|
|
32
|
+
def to_action(self, parent: QObject | None = None) -> QAction:
|
|
33
|
+
color: QColor | str = self.color
|
|
34
|
+
if isinstance(color, str):
|
|
35
|
+
color = COLORS.get(color, color)
|
|
36
|
+
|
|
37
|
+
size = self.size
|
|
38
|
+
if isinstance(size, str):
|
|
39
|
+
size = QtIconSizes.get(size)
|
|
40
|
+
|
|
41
|
+
icon = self.icon
|
|
42
|
+
if isinstance(icon, str):
|
|
43
|
+
icon_getter = ICONS.get(icon)
|
|
44
|
+
if callable(icon_getter):
|
|
45
|
+
icon = icon_getter(color, size)
|
|
46
|
+
|
|
47
|
+
icon = QIcon() if isinstance(icon, str) else icon
|
|
48
|
+
|
|
49
|
+
action = QAction(icon=icon, text=self.text, parent=parent)
|
|
50
|
+
if self.checkable:
|
|
51
|
+
action.setCheckable(True)
|
|
52
|
+
action.setChecked(self.checkable)
|
|
53
|
+
if self.status_tip:
|
|
54
|
+
action.setStatusTip(self.status_tip)
|
|
55
|
+
if self.function:
|
|
56
|
+
action.triggered.connect(self.function)
|
|
57
|
+
|
|
58
|
+
return action
|
|
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
|
|
|
4
4
|
|
|
5
5
|
[tool.poetry]
|
|
6
6
|
name = "jbqt"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.15"
|
|
8
8
|
description = ""
|
|
9
9
|
authors = [ "Joseph Bochinski <stirgejr@gmail.com>",]
|
|
10
10
|
readme = "README.md"
|
|
@@ -16,3 +16,4 @@ fuzzywuzzy = "^0.18.0"
|
|
|
16
16
|
python-levenshtein = "^0.27.1"
|
|
17
17
|
jbconsts = "^0.1.1"
|
|
18
18
|
jbutils = "^0.1.23"
|
|
19
|
+
rich = "^14.0.0"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|