gui-utilities 1.3.16__tar.gz → 1.3.30__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 gui-utilities might be problematic. Click here for more details.
- {gui_utilities-1.3.16 → gui_utilities-1.3.30}/PKG-INFO +1 -1
- {gui_utilities-1.3.16 → gui_utilities-1.3.30}/gui_utilities/gui_utilities.py +45 -32
- {gui_utilities-1.3.16 → gui_utilities-1.3.30}/gui_utilities.egg-info/PKG-INFO +1 -1
- {gui_utilities-1.3.16 → gui_utilities-1.3.30}/pyproject.toml +1 -1
- {gui_utilities-1.3.16 → gui_utilities-1.3.30}/LICENSE +0 -0
- {gui_utilities-1.3.16 → gui_utilities-1.3.30}/README.md +0 -0
- {gui_utilities-1.3.16 → gui_utilities-1.3.30}/gui_utilities/icons/focused_hide_text_icon.png +0 -0
- {gui_utilities-1.3.16 → gui_utilities-1.3.30}/gui_utilities/icons/focused_show_text_icon.png +0 -0
- {gui_utilities-1.3.16 → gui_utilities-1.3.30}/gui_utilities/icons/hide_text_icon.png +0 -0
- {gui_utilities-1.3.16 → gui_utilities-1.3.30}/gui_utilities/icons/show_text_icon.png +0 -0
- {gui_utilities-1.3.16 → gui_utilities-1.3.30}/gui_utilities/tlds/tlds_list.txt +0 -0
- {gui_utilities-1.3.16 → gui_utilities-1.3.30}/gui_utilities.egg-info/SOURCES.txt +0 -0
- {gui_utilities-1.3.16 → gui_utilities-1.3.30}/gui_utilities.egg-info/dependency_links.txt +0 -0
- {gui_utilities-1.3.16 → gui_utilities-1.3.30}/gui_utilities.egg-info/requires.txt +0 -0
- {gui_utilities-1.3.16 → gui_utilities-1.3.30}/gui_utilities.egg-info/top_level.txt +0 -0
- {gui_utilities-1.3.16 → gui_utilities-1.3.30}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from PyQt6.QtCore import Qt, QObject, QEvent, QSize
|
|
2
2
|
from PyQt6.QtWidgets import QWidget, QVBoxLayout, QHBoxLayout, QLabel, QPushButton, QLineEdit, QComboBox, QDialog, QToolButton, QWidgetAction, QCheckBox, QTableWidget, QHeaderView
|
|
3
|
-
from PyQt6.QtGui import QIcon
|
|
3
|
+
from PyQt6.QtGui import QIcon
|
|
4
4
|
import re
|
|
5
5
|
import requests
|
|
6
6
|
import importlib.resources
|
|
@@ -18,7 +18,7 @@ def create_window(title, background_color = "#1e1e1e"):
|
|
|
18
18
|
window.setLayout(main_layout)
|
|
19
19
|
return window
|
|
20
20
|
|
|
21
|
-
def
|
|
21
|
+
def create_menu(
|
|
22
22
|
ui_instance,
|
|
23
23
|
buttons,
|
|
24
24
|
title,
|
|
@@ -130,7 +130,7 @@ def create_title(
|
|
|
130
130
|
font_family = "Segoe UI",
|
|
131
131
|
font_size = 36,
|
|
132
132
|
font_color = "#ffffff",
|
|
133
|
-
background_color = "
|
|
133
|
+
background_color = "transparent",
|
|
134
134
|
padding = 15,
|
|
135
135
|
padding_left = None,
|
|
136
136
|
padding_top = None,
|
|
@@ -168,7 +168,7 @@ def create_label(
|
|
|
168
168
|
font_size = 14,
|
|
169
169
|
font_color = "#ffffff",
|
|
170
170
|
font_weight = "normal",
|
|
171
|
-
background_color = "
|
|
171
|
+
background_color = "transparent",
|
|
172
172
|
padding = 15,
|
|
173
173
|
padding_left = None,
|
|
174
174
|
padding_top = None,
|
|
@@ -177,14 +177,11 @@ def create_label(
|
|
|
177
177
|
border_width = 0,
|
|
178
178
|
border_color = "#5c5c5c",
|
|
179
179
|
border_radius = 0,
|
|
180
|
-
hover_background_color = "
|
|
180
|
+
hover_background_color = "transparent",
|
|
181
181
|
hover_border_width = 0,
|
|
182
182
|
hover_border_color = "#777777",
|
|
183
|
-
pressed_background_color = "#1e1e1e",
|
|
184
|
-
pressed_border_width = 0,
|
|
185
|
-
pressed_border_color = "#0078d7",
|
|
186
183
|
disabled_font_color = "#888888",
|
|
187
|
-
disabled_background_color = "
|
|
184
|
+
disabled_background_color = "transparent",
|
|
188
185
|
disabled_border_width = 0,
|
|
189
186
|
disabled_border_color = "#4a4a4a"
|
|
190
187
|
):
|
|
@@ -211,10 +208,6 @@ def create_label(
|
|
|
211
208
|
background-color: {hover_background_color};
|
|
212
209
|
border: {hover_border_width}px solid {hover_border_color};
|
|
213
210
|
}}
|
|
214
|
-
QLabel:pressed{{
|
|
215
|
-
background-color: {pressed_background_color};
|
|
216
|
-
border: {pressed_border_width}px solid {pressed_border_color};
|
|
217
|
-
}}
|
|
218
211
|
QLabel:disabled{{
|
|
219
212
|
color: {disabled_font_color};
|
|
220
213
|
background-color: {disabled_background_color};
|
|
@@ -248,40 +241,30 @@ def create_button(
|
|
|
248
241
|
disabled_font_color = "#888888",
|
|
249
242
|
disabled_background_color = "#2d2d2d",
|
|
250
243
|
disabled_border_width = 2,
|
|
251
|
-
disabled_border_color = "#4a4a4a"
|
|
244
|
+
disabled_border_color = "#4a4a4a",
|
|
245
|
+
maximum_width = 360
|
|
252
246
|
):
|
|
253
247
|
button = QPushButton()
|
|
254
|
-
button.setMaximumWidth(
|
|
255
|
-
main_layout = QVBoxLayout(
|
|
248
|
+
button.setMaximumWidth(maximum_width)
|
|
249
|
+
main_layout = QVBoxLayout()
|
|
250
|
+
button.setLayout(main_layout)
|
|
256
251
|
main_layout.setContentsMargins(0, 0, 0, 0)
|
|
257
252
|
label = create_label(
|
|
258
253
|
text = text,
|
|
259
254
|
font_size = font_size,
|
|
260
255
|
font_color = font_color,
|
|
261
256
|
font_weight = "bold",
|
|
262
|
-
background_color = background_color,
|
|
263
257
|
padding = padding,
|
|
264
258
|
padding_left = padding_left,
|
|
265
259
|
padding_top = padding_top,
|
|
266
260
|
padding_right = padding_right,
|
|
267
261
|
padding_bottom = padding_bottom,
|
|
268
|
-
|
|
269
|
-
border_color = border_color,
|
|
270
|
-
border_radius = border_radius,
|
|
271
|
-
hover_background_color = hover_background_color,
|
|
272
|
-
hover_border_width = hover_border_width,
|
|
273
|
-
hover_border_color = hover_border_color,
|
|
274
|
-
pressed_background_color = pressed_background_color,
|
|
275
|
-
pressed_border_width = pressed_border_width,
|
|
276
|
-
pressed_border_color = pressed_border_color,
|
|
277
|
-
disabled_font_color = disabled_font_color,
|
|
278
|
-
disabled_background_color = disabled_background_color,
|
|
279
|
-
disabled_border_width = disabled_border_width,
|
|
280
|
-
disabled_border_color = disabled_border_color
|
|
262
|
+
disabled_border_width = disabled_border_width
|
|
281
263
|
)
|
|
282
264
|
label.setAlignment(Qt.AlignmentFlag.AlignCenter)
|
|
283
265
|
label.setWordWrap(True)
|
|
284
266
|
main_layout.addWidget(label)
|
|
267
|
+
button.setFixedHeight(main_layout.sizeHint().height() + 2 * border_width)
|
|
285
268
|
padding_left_value = padding_left if padding_left is not None else padding
|
|
286
269
|
padding_top_value = padding_top if padding_top is not None else padding
|
|
287
270
|
padding_right_value = padding_right if padding_right is not None else padding
|
|
@@ -346,10 +329,10 @@ def create_text_box(
|
|
|
346
329
|
hide_text_icon_url = str(icons_dir / "hide_text_icon.png"),
|
|
347
330
|
focused_show_text_icon_url = str(icons_dir / "focused_show_text_icon.png"),
|
|
348
331
|
focused_hide_text_icon_url = str(icons_dir / "focused_hide_text_icon.png"),
|
|
349
|
-
hide_text = False
|
|
332
|
+
hide_text = False,
|
|
333
|
+
math_expression = False
|
|
350
334
|
):
|
|
351
335
|
text_box = QLineEdit()
|
|
352
|
-
text_box.setPlaceholderText(placeholder_text)
|
|
353
336
|
padding_left_value = padding_left if padding_left is not None else padding
|
|
354
337
|
padding_top_value = padding_top if padding_top is not None else padding
|
|
355
338
|
padding_right_value = padding_right if padding_right is not None else padding
|
|
@@ -383,6 +366,36 @@ def create_text_box(
|
|
|
383
366
|
}}
|
|
384
367
|
"""
|
|
385
368
|
text_box.setStyleSheet(style_sheet)
|
|
369
|
+
|
|
370
|
+
def latex_to_html(expression):
|
|
371
|
+
html_expression = expression
|
|
372
|
+
html_expression = re.sub(r"\\frac\{(.*?)\}\{(.*?)\}", r"<span style='font-size:90%;'>\1⁄\2</span>", html_expression)
|
|
373
|
+
html_expression = re.sub(r"([a-zA-Z])_(\d+)", r"\1<sub>\2</sub>", html_expression)
|
|
374
|
+
html_expression = re.sub(r"([a-zA-Z0-9])\^(\d+)", r"\1<sup>\2</sup>", html_expression)
|
|
375
|
+
html_expression = html_expression.replace(" ", " ")
|
|
376
|
+
return html_expression
|
|
377
|
+
|
|
378
|
+
if not math_expression: text_box.setPlaceholderText(placeholder_text)
|
|
379
|
+
else:
|
|
380
|
+
html_placeholder = latex_to_html(placeholder_text)
|
|
381
|
+
placeholder_label = create_label(
|
|
382
|
+
text = html_placeholder,
|
|
383
|
+
font_color = font_color,
|
|
384
|
+
font_family = font_family,
|
|
385
|
+
font_size = font_size,
|
|
386
|
+
background_color = background_color,
|
|
387
|
+
hover_background_color = hover_background_color,
|
|
388
|
+
disabled_background_color = disabled_background_color,
|
|
389
|
+
)
|
|
390
|
+
placeholder_label.setTextFormat(Qt.TextFormat.RichText)
|
|
391
|
+
placeholder_label.setAttribute(Qt.WidgetAttribute.WA_TransparentForMouseEvents)
|
|
392
|
+
placeholder_label.show()
|
|
393
|
+
|
|
394
|
+
def update_placeholder_visibility():
|
|
395
|
+
placeholder_label.setVisible(text_box.text() == "")
|
|
396
|
+
|
|
397
|
+
text_box.textChanged.connect(update_placeholder_visibility)
|
|
398
|
+
update_placeholder_visibility()
|
|
386
399
|
if hide_text:
|
|
387
400
|
show_text_icon = QIcon(show_text_icon_url)
|
|
388
401
|
hide_text_icon = QIcon(hide_text_icon_url)
|
|
File without changes
|
|
File without changes
|
{gui_utilities-1.3.16 → gui_utilities-1.3.30}/gui_utilities/icons/focused_hide_text_icon.png
RENAMED
|
File without changes
|
{gui_utilities-1.3.16 → gui_utilities-1.3.30}/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
|