jbqt 0.1.6__tar.gz → 0.1.8__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.6 → jbqt-0.1.8}/PKG-INFO +1 -1
- {jbqt-0.1.6 → jbqt-0.1.8}/jbqt/common/consts.py +13 -11
- jbqt-0.1.8/jbqt/types/__init__.py +8 -0
- {jbqt-0.1.6 → jbqt-0.1.8}/pyproject.toml +1 -1
- {jbqt-0.1.6 → jbqt-0.1.8}/README.md +0 -0
- {jbqt-0.1.6 → jbqt-0.1.8}/jbqt/__init__.py +0 -0
- {jbqt-0.1.6 → jbqt-0.1.8}/jbqt/common/__init__.py +0 -0
- {jbqt-0.1.6 → jbqt-0.1.8}/jbqt/common/qt_utils.py +0 -0
- {jbqt-0.1.6 → jbqt-0.1.8}/jbqt/dialogs/__init__.py +0 -0
- {jbqt-0.1.6 → jbqt-0.1.8}/jbqt/dialogs/file_dialog.py +0 -0
- {jbqt-0.1.6 → jbqt-0.1.8}/jbqt/dialogs/input_form.py +0 -0
- {jbqt-0.1.6 → jbqt-0.1.8}/jbqt/dialogs/text_preview.py +0 -0
- {jbqt-0.1.6 → jbqt-0.1.8}/jbqt/models/__init__.py +0 -0
- {jbqt-0.1.6 → jbqt-0.1.8}/jbqt/models/chip_button.py +0 -0
- {jbqt-0.1.6 → jbqt-0.1.8}/jbqt/models/chips.py +0 -0
- {jbqt-0.1.6 → jbqt-0.1.8}/jbqt/view_icons.py +0 -0
- {jbqt-0.1.6 → jbqt-0.1.8}/jbqt/widgets/__init__.py +0 -0
- {jbqt-0.1.6 → jbqt-0.1.8}/jbqt/widgets/chip_button.py +0 -0
- {jbqt-0.1.6 → jbqt-0.1.8}/jbqt/widgets/chips.py +0 -0
- {jbqt-0.1.6 → jbqt-0.1.8}/jbqt/widgets/multiselect.py +0 -0
- {jbqt-0.1.6 → jbqt-0.1.8}/jbqt/widgets/simple.py +0 -0
- {jbqt-0.1.6 → jbqt-0.1.8}/jbqt/widgets/toast.py +0 -0
- {jbqt-0.1.6 → jbqt-0.1.8}/jbqt/widgets/widget_utils.py +0 -0
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import os
|
|
2
2
|
import re
|
|
3
3
|
|
|
4
|
+
|
|
4
5
|
import jbutils
|
|
5
6
|
|
|
6
7
|
from PyQt6.QtWidgets import QApplication, QMainWindow, QScrollArea, QWidget
|
|
7
8
|
from PyQt6.QtCore import Qt, QSize
|
|
8
9
|
from PyQt6.QtGui import QIcon, QPixmap, QPainter, QColor
|
|
9
10
|
|
|
11
|
+
from jbqt.types import IconGetter
|
|
12
|
+
|
|
10
13
|
TAG_RE = re.compile(r"^\((.+)\)(\d+\.\d+)$")
|
|
11
14
|
LIST_ITEM_ROLE = Qt.ItemDataRole.UserRole - 1
|
|
12
15
|
|
|
@@ -15,16 +18,16 @@ COLORS = jbutils.COLORS
|
|
|
15
18
|
|
|
16
19
|
|
|
17
20
|
class GlobalRefs:
|
|
18
|
-
app: QApplication = None
|
|
19
|
-
main_window: QMainWindow = None
|
|
20
|
-
scroll_area: QScrollArea = None
|
|
21
|
+
app: QApplication | None = None
|
|
22
|
+
main_window: QMainWindow | None = None
|
|
23
|
+
scroll_area: QScrollArea | None = None
|
|
21
24
|
server_active: bool = False
|
|
22
25
|
debug_set: bool = False
|
|
23
|
-
seed_widget: QWidget = None
|
|
26
|
+
seed_widget: QWidget | None = None
|
|
24
27
|
|
|
25
28
|
|
|
26
29
|
class QtPaths:
|
|
27
|
-
icon_dir: str = None
|
|
30
|
+
icon_dir: str | None = None
|
|
28
31
|
|
|
29
32
|
|
|
30
33
|
THEME_ICONS: dict[str, QIcon] = {
|
|
@@ -91,14 +94,14 @@ def icon_dir(file_name: str) -> str:
|
|
|
91
94
|
|
|
92
95
|
|
|
93
96
|
def recolor_icon(
|
|
94
|
-
image_path: str, color: str | QColor, scale: QSize = None
|
|
97
|
+
image_path: str, color: str | QColor, scale: QSize | None = None
|
|
95
98
|
) -> QIcon:
|
|
96
99
|
if not color:
|
|
97
100
|
color = QColor("black")
|
|
98
101
|
if isinstance(color, str):
|
|
99
102
|
color = QColor(color)
|
|
100
103
|
|
|
101
|
-
if
|
|
104
|
+
if scale is None:
|
|
102
105
|
scale = SIZES.ICON_MD
|
|
103
106
|
pixmap = QPixmap(image_path)
|
|
104
107
|
icon_key = os.path.splitext(os.path.basename(image_path))[0]
|
|
@@ -127,12 +130,11 @@ def recolor_icon(
|
|
|
127
130
|
return QIcon(recolored_pixmap.scaled(scale, Qt.AspectRatioMode.KeepAspectRatio))
|
|
128
131
|
|
|
129
132
|
|
|
130
|
-
def get_icon(file_name: str) ->
|
|
131
|
-
def getter(color: str = "", size: QSize | int = None):
|
|
133
|
+
def get_icon(file_name: str) -> IconGetter:
|
|
134
|
+
def getter(color: str = "", size: QSize | int | None = None) -> QIcon:
|
|
132
135
|
if isinstance(size, int):
|
|
133
136
|
size = QSize(size, size)
|
|
134
137
|
|
|
135
|
-
# return QIcon(QPixmap(_icon_dir(file_name)))
|
|
136
138
|
return recolor_icon(icon_dir(file_name), color, size)
|
|
137
139
|
|
|
138
140
|
return getter
|
|
@@ -160,7 +162,7 @@ class ICONS:
|
|
|
160
162
|
SYNC = get_icon("sync.png")
|
|
161
163
|
|
|
162
164
|
@classmethod
|
|
163
|
-
def get(cls, name: str, default: str = "") -> str:
|
|
165
|
+
def get(cls, name: str, default: str = "") -> IconGetter | str:
|
|
164
166
|
if hasattr(cls, name):
|
|
165
167
|
return getattr(cls, name)
|
|
166
168
|
else:
|
|
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
|