gui-utilities 1.3.37__tar.gz → 1.3.40__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.
- {gui_utilities-1.3.37 → gui_utilities-1.3.40}/PKG-INFO +1 -1
- {gui_utilities-1.3.37 → gui_utilities-1.3.40}/gui_utilities/gui_utilities.py +34 -11
- {gui_utilities-1.3.37 → gui_utilities-1.3.40}/gui_utilities.egg-info/PKG-INFO +1 -1
- {gui_utilities-1.3.37 → gui_utilities-1.3.40}/pyproject.toml +1 -1
- {gui_utilities-1.3.37 → gui_utilities-1.3.40}/LICENSE +0 -0
- {gui_utilities-1.3.37 → gui_utilities-1.3.40}/README.md +0 -0
- {gui_utilities-1.3.37 → gui_utilities-1.3.40}/gui_utilities/icons/focused_hide_text_icon.png +0 -0
- {gui_utilities-1.3.37 → gui_utilities-1.3.40}/gui_utilities/icons/focused_show_text_icon.png +0 -0
- {gui_utilities-1.3.37 → gui_utilities-1.3.40}/gui_utilities/icons/hide_text_icon.png +0 -0
- {gui_utilities-1.3.37 → gui_utilities-1.3.40}/gui_utilities/icons/show_text_icon.png +0 -0
- {gui_utilities-1.3.37 → gui_utilities-1.3.40}/gui_utilities/tlds/tlds_list.txt +0 -0
- {gui_utilities-1.3.37 → gui_utilities-1.3.40}/gui_utilities.egg-info/SOURCES.txt +0 -0
- {gui_utilities-1.3.37 → gui_utilities-1.3.40}/gui_utilities.egg-info/dependency_links.txt +0 -0
- {gui_utilities-1.3.37 → gui_utilities-1.3.40}/gui_utilities.egg-info/requires.txt +0 -0
- {gui_utilities-1.3.37 → gui_utilities-1.3.40}/gui_utilities.egg-info/top_level.txt +0 -0
- {gui_utilities-1.3.37 → gui_utilities-1.3.40}/setup.cfg +0 -0
|
@@ -386,18 +386,35 @@ def create_text_box(
|
|
|
386
386
|
font_family = font_family,
|
|
387
387
|
font_size = font_size,
|
|
388
388
|
background_color = "transparent",
|
|
389
|
-
hover_background_color = "transparent",
|
|
390
389
|
disabled_background_color = "transparent",
|
|
391
390
|
parent = text_box
|
|
392
391
|
)
|
|
393
392
|
placeholder_label.setTextFormat(Qt.TextFormat.RichText)
|
|
393
|
+
placeholder_label.setAttribute(Qt.WidgetAttribute.WA_TransparentForMouseEvents, True)
|
|
394
|
+
placeholder_label.move(0, -2)
|
|
394
395
|
placeholder_label.show()
|
|
395
396
|
|
|
396
|
-
|
|
397
|
-
placeholder_label.setVisible(text_box.text() == "")
|
|
397
|
+
class _PlaceholderFocusWatcher(QObject):
|
|
398
398
|
|
|
399
|
-
|
|
400
|
-
|
|
399
|
+
def __init__(self, watched, placeholder_label):
|
|
400
|
+
super().__init__(watched)
|
|
401
|
+
self._watched = watched
|
|
402
|
+
self._placeholder = placeholder_label
|
|
403
|
+
|
|
404
|
+
def eventFilter(self, watched, event):
|
|
405
|
+
if watched is self._watched and event.type() in (QEvent.Type.FocusIn, QEvent.Type.FocusOut):
|
|
406
|
+
self._placeholder.setVisible((self._watched.text() == "") and (not self._watched.hasFocus()))
|
|
407
|
+
return super().eventFilter(watched, event)
|
|
408
|
+
|
|
409
|
+
def _update_placeholder_visibility():
|
|
410
|
+
if placeholder_label is not None:
|
|
411
|
+
placeholder_label.setVisible(text_box.text() == "" and not text_box.hasFocus())
|
|
412
|
+
|
|
413
|
+
text_box.textChanged.connect(_update_placeholder_visibility)
|
|
414
|
+
focus_watcher_placeholder = _PlaceholderFocusWatcher(text_box, placeholder_label)
|
|
415
|
+
text_box.installEventFilter(focus_watcher_placeholder)
|
|
416
|
+
setattr(text_box, "_placeholder_focus_watcher", focus_watcher_placeholder)
|
|
417
|
+
_update_placeholder_visibility()
|
|
401
418
|
if hide_text:
|
|
402
419
|
show_text_icon = QIcon(show_text_icon_url)
|
|
403
420
|
hide_text_icon = QIcon(hide_text_icon_url)
|
|
@@ -411,6 +428,7 @@ def create_text_box(
|
|
|
411
428
|
toggle_text_visibility_button.setIconSize(QSize(25, 25))
|
|
412
429
|
toggle_text_visibility_action = QWidgetAction(text_box)
|
|
413
430
|
toggle_text_visibility_action.setDefaultWidget(toggle_text_visibility_button)
|
|
431
|
+
text_box.addAction(toggle_text_visibility_action, QLineEdit.ActionPosition.TrailingPosition)
|
|
414
432
|
toggle_text_visibility_button.setStyleSheet("""
|
|
415
433
|
QToolButton {
|
|
416
434
|
background-color: transparent;
|
|
@@ -418,7 +436,6 @@ def create_text_box(
|
|
|
418
436
|
margin-right: 10px;
|
|
419
437
|
}
|
|
420
438
|
""")
|
|
421
|
-
text_box.addAction(toggle_text_visibility_action, QLineEdit.ActionPosition.TrailingPosition)
|
|
422
439
|
|
|
423
440
|
def update_icon():
|
|
424
441
|
is_password = text_box.echoMode() == QLineEdit.EchoMode.Password
|
|
@@ -433,15 +450,21 @@ def create_text_box(
|
|
|
433
450
|
|
|
434
451
|
toggle_text_visibility_button.clicked.connect(toggle_visibility)
|
|
435
452
|
|
|
436
|
-
class
|
|
453
|
+
class _IconFocusWatcher(QObject):
|
|
437
454
|
|
|
455
|
+
def __init__(self, watched, on_focus_change):
|
|
456
|
+
super().__init__(watched)
|
|
457
|
+
self._watched = watched
|
|
458
|
+
self._on_focus_change = on_focus_change
|
|
459
|
+
|
|
438
460
|
def eventFilter(self, watched, event):
|
|
439
|
-
if event.type() in (QEvent.Type.FocusIn, QEvent.Type.FocusOut):
|
|
461
|
+
if watched is self._watched and event.type() in (QEvent.Type.FocusIn, QEvent.Type.FocusOut):
|
|
462
|
+
if callable(self._on_focus_change): self._on_focus_change()
|
|
440
463
|
return super().eventFilter(watched, event)
|
|
441
464
|
|
|
442
|
-
|
|
443
|
-
text_box.installEventFilter(
|
|
444
|
-
setattr(text_box, "
|
|
465
|
+
icon_focus_watcher = _IconFocusWatcher(text_box, update_icon)
|
|
466
|
+
text_box.installEventFilter(icon_focus_watcher)
|
|
467
|
+
setattr(text_box, "_icon_focus_watcher", icon_focus_watcher)
|
|
445
468
|
update_icon()
|
|
446
469
|
return text_box
|
|
447
470
|
|
|
File without changes
|
|
File without changes
|
{gui_utilities-1.3.37 → gui_utilities-1.3.40}/gui_utilities/icons/focused_hide_text_icon.png
RENAMED
|
File without changes
|
{gui_utilities-1.3.37 → gui_utilities-1.3.40}/gui_utilities/icons/focused_show_text_icon.png
RENAMED
|
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
|