monkeyqt 0.2.3__tar.gz → 0.2.4__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.
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/PKG-INFO +1 -1
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/__init__.py +1 -1
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/components/basic/button.py +21 -4
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt.egg-info/PKG-INFO +1 -1
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/LICENSE +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/README.md +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/common/enums.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/components/basic/__init__.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/components/basic/checkbox.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/components/basic/select_card.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/components/data/__init__.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/components/data/avatar.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/components/data/console.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/components/data/data_table.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/components/data/image_compare.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/components/data/image_split.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/components/data/preview_dialogs.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/components/data/pro_table.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/components/data/table.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/components/feedback/__init__.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/components/feedback/alert.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/components/feedback/card.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/components/feedback/progress_bar.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/components/feedback/progress_ring.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/components/feedback/tooltip.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/components/form/auth.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/components/form/captcha.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/components/form/combobox.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/components/form/date_picker.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/components/form/form.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/components/form/input.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/components/form/multicombobox.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/components/form/slider.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/components/form/switch.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/components/form/upload.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/components/layout/__init__.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/components/layout/box.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/components/layout/page.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/components/layout/scroll_area.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/components/layout/widget.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/components/layout/window.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/components/layout/window_shell.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/components/navigation/__init__.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/components/navigation/avatar_menu.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/components/navigation/breadcrumb.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/components/navigation/dropdown.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/components/navigation/history.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/components/navigation/pagination.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/components/navigation/segmented.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/components/navigation/sidebar.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/components/navigation/tabs.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/components/navigation/topbar.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/core/icons.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/core/theme.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/core/theme_data.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/designer/plugins.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/icons.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/themes/__init__.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/themes/__main__.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/themes/adapter.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/themes/components/__init__.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/themes/components/theme_selector.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/themes/engine.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/themes/gallery.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/themes/manager.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/themes/names.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/themes/palette_theme.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/themes/style_utils.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/themes/tokens.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt/themes/unified_qss.py +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt.egg-info/SOURCES.txt +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt.egg-info/dependency_links.txt +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt.egg-info/requires.txt +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/monkeyqt.egg-info/top_level.txt +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/pyproject.toml +0 -0
- {monkeyqt-0.2.3 → monkeyqt-0.2.4}/setup.cfg +0 -0
|
@@ -214,10 +214,23 @@ class MkButton(QPushButton):
|
|
|
214
214
|
qss += f"\nQPushButton {{ {size_qss} }}"
|
|
215
215
|
_MkThemeEngine.apply_style_sheet(self, qss)
|
|
216
216
|
|
|
217
|
+
def sizeHint(self):
|
|
218
|
+
hint = super().sizeHint()
|
|
219
|
+
fm = self.fontMetrics()
|
|
220
|
+
text_w = fm.horizontalAdvance(self.text()) if self.text() else 0
|
|
221
|
+
icon_w = self.iconSize().width() if not self.icon().isNull() else 0
|
|
222
|
+
spacing = 8 if (icon_w and text_w) else 0
|
|
223
|
+
padding_h = 28 if text_w else 0
|
|
224
|
+
w = max(hint.width(), icon_w + text_w + spacing + padding_h)
|
|
225
|
+
h = max(hint.height(), 36)
|
|
226
|
+
from PySide6.QtCore import QSize
|
|
227
|
+
return QSize(w, h)
|
|
228
|
+
|
|
217
229
|
def paintEvent(self, event):
|
|
218
230
|
t = ThemeEngine
|
|
219
231
|
painter = QPainter(self)
|
|
220
232
|
painter.setRenderHint(QPainter.RenderHint.Antialiasing)
|
|
233
|
+
painter.setRenderHint(QPainter.RenderHint.SmoothPixmapTransform)
|
|
221
234
|
rect = self.rect()
|
|
222
235
|
primary = t.get("--primary", "#409EFF")
|
|
223
236
|
bg = t.get("--bg", "#FFFFFF")
|
|
@@ -411,7 +424,7 @@ class MkButton(QPushButton):
|
|
|
411
424
|
icon_sz = self.iconSize()
|
|
412
425
|
icon_w = icon_sz.width()
|
|
413
426
|
icon_h = icon_sz.height()
|
|
414
|
-
spacing =
|
|
427
|
+
spacing = 8 if text else 0
|
|
415
428
|
fm = painter.fontMetrics()
|
|
416
429
|
text_w = fm.horizontalAdvance(text) if text else 0
|
|
417
430
|
total_w = icon_w + spacing + text_w
|
|
@@ -419,8 +432,7 @@ class MkButton(QPushButton):
|
|
|
419
432
|
start_x = rect.left() + (rect.width() - total_w) // 2
|
|
420
433
|
icon_y = rect.top() + (rect.height() - icon_h) // 2
|
|
421
434
|
|
|
422
|
-
|
|
423
|
-
painter.drawPixmap(start_x, icon_y, pixmap)
|
|
435
|
+
icon.paint(painter, QRect(start_x, icon_y, icon_w, icon_h))
|
|
424
436
|
|
|
425
437
|
if text:
|
|
426
438
|
text_rect = QRect(start_x + icon_w + spacing, rect.top(), text_w + 10, rect.height())
|
|
@@ -482,7 +494,7 @@ class MkButton(QPushButton):
|
|
|
482
494
|
def setIcon(self, icon):
|
|
483
495
|
if isinstance(icon, str):
|
|
484
496
|
try:
|
|
485
|
-
from
|
|
497
|
+
from monkeyqt_icons import Ph
|
|
486
498
|
pm = Ph.pixmap(icon, size=16, color=self._get_button_text_color())
|
|
487
499
|
if pm and not pm.isNull():
|
|
488
500
|
icon = QIcon(pm)
|
|
@@ -491,11 +503,15 @@ class MkButton(QPushButton):
|
|
|
491
503
|
elif hasattr(icon, "_ph_spec"):
|
|
492
504
|
self._ph_icon_spec = getattr(icon, "_ph_spec", None)
|
|
493
505
|
try:
|
|
506
|
+
from monkeyqt_icons import Ph
|
|
494
507
|
spec = dict(self._ph_icon_spec)
|
|
495
508
|
orig_color = spec.get("color")
|
|
496
509
|
if orig_color in (None, "auto", "default", "fg", "foreground", "currentcolor"):
|
|
497
510
|
spec["color"] = self._get_button_text_color()
|
|
498
511
|
icon = Ph.icon(**spec)
|
|
512
|
+
if "size" in spec and isinstance(spec["size"], int):
|
|
513
|
+
from PySide6.QtCore import QSize
|
|
514
|
+
self.setIconSize(QSize(spec["size"], spec["size"]))
|
|
499
515
|
except Exception:
|
|
500
516
|
pass
|
|
501
517
|
super().setIcon(icon)
|
|
@@ -504,6 +520,7 @@ class MkButton(QPushButton):
|
|
|
504
520
|
self._update_style()
|
|
505
521
|
if getattr(self, "_ph_icon_spec", None):
|
|
506
522
|
try:
|
|
523
|
+
from monkeyqt_icons import Ph
|
|
507
524
|
spec = dict(self._ph_icon_spec)
|
|
508
525
|
orig_color = spec.get("color")
|
|
509
526
|
if orig_color in (None, "auto", "default", "fg", "foreground", "currentcolor"):
|
|
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
|
|
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
|
|
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
|
|
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
|