jbqt 0.1.3__py3-none-any.whl → 0.1.4__py3-none-any.whl
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/common/consts.py
CHANGED
jbqt/dialogs/file_dialog.py
CHANGED
|
@@ -3,15 +3,36 @@ from PyQt6.QtWidgets import QWidget, QPushButton, QVBoxLayout, QFileDialog
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
class JbFileDialog(QWidget):
|
|
6
|
+
"""A simple widget that opens a file dialog in either 'open' or 'save' mode.
|
|
7
|
+
|
|
8
|
+
Emits:
|
|
9
|
+
selectedFile (str): Emitted when a file path is chosen.
|
|
10
|
+
|
|
11
|
+
Args:
|
|
12
|
+
title (str): The dialog window title.
|
|
13
|
+
directory (str): The starting directory.
|
|
14
|
+
mode (str): 'open' to open an existing file, 'save' to choose a save location.
|
|
15
|
+
"""
|
|
16
|
+
|
|
6
17
|
selectedFile = pyqtSignal(str)
|
|
7
18
|
|
|
8
|
-
def __init__(
|
|
9
|
-
|
|
19
|
+
def __init__(
|
|
20
|
+
self, title: str = "File Dialog", directory: str = "", mode: str = "open"
|
|
21
|
+
) -> None:
|
|
10
22
|
super().__init__()
|
|
11
|
-
|
|
23
|
+
|
|
24
|
+
self.title = title
|
|
12
25
|
self.directory = directory
|
|
26
|
+
self.mode = mode.lower()
|
|
27
|
+
|
|
28
|
+
if self.mode not in {"open", "save"}:
|
|
29
|
+
raise ValueError("mode must be either 'open' or 'save'")
|
|
13
30
|
|
|
14
|
-
self.
|
|
31
|
+
self.setWindowTitle(title)
|
|
32
|
+
|
|
33
|
+
self.button = QPushButton(
|
|
34
|
+
"Open File" if self.mode == "open" else "Save File", self
|
|
35
|
+
)
|
|
15
36
|
self.button.clicked.connect(self.open_file_dialog)
|
|
16
37
|
|
|
17
38
|
layout = QVBoxLayout()
|
|
@@ -19,9 +40,21 @@ class JbFileDialog(QWidget):
|
|
|
19
40
|
self.setLayout(layout)
|
|
20
41
|
|
|
21
42
|
def open_file_dialog(self) -> None:
|
|
22
|
-
"""Open a file dialog
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
43
|
+
"""Open a file dialog based on the selected mode."""
|
|
44
|
+
if self.mode == "open":
|
|
45
|
+
file_name, _ = QFileDialog.getOpenFileName(
|
|
46
|
+
self,
|
|
47
|
+
self.title,
|
|
48
|
+
self.directory,
|
|
49
|
+
"All Files (*);;Text Files (*.txt)",
|
|
50
|
+
)
|
|
51
|
+
else:
|
|
52
|
+
file_name, _ = QFileDialog.getSaveFileName(
|
|
53
|
+
self,
|
|
54
|
+
self.title,
|
|
55
|
+
self.directory,
|
|
56
|
+
"All Files (*);;Text Files (*.txt)",
|
|
57
|
+
)
|
|
58
|
+
|
|
26
59
|
if file_name:
|
|
27
60
|
self.selectedFile.emit(file_name)
|
jbqt/widgets/__init__.py
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"""Collection of widget exports"""
|
|
2
2
|
|
|
3
|
+
|
|
3
4
|
from jbqt.widgets.chip_button import ChipButton
|
|
4
5
|
from jbqt.widgets.chips import ChipsWidget
|
|
5
6
|
from jbqt.widgets.multiselect import MultiSelectComboBox
|
|
6
7
|
from jbqt.widgets.simple import ClickableLabel, LongIntSpinBox
|
|
7
8
|
from jbqt.widgets.toast import Toast
|
|
8
9
|
|
|
10
|
+
WIDGET_LIST = [ChipButton, ChipsWidget, MultiSelectComboBox, ClickableLabel, LongIntSpinBox, Toast]
|
|
11
|
+
|
|
12
|
+
|
|
9
13
|
__all__ = [
|
|
10
14
|
"ChipButton",
|
|
11
15
|
"ChipsWidget",
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
jbqt/__init__.py,sha256=JThPqSDraggKWluruHIXeE1-Kzgu6zJin-IXxX1GnLg,243
|
|
2
2
|
jbqt/common/__init__.py,sha256=WkP7IRKAuScLZpGP3AgARlegLke714OlrgihUVHMHMs,317
|
|
3
|
-
jbqt/common/consts.py,sha256=
|
|
3
|
+
jbqt/common/consts.py,sha256=L3c7sP2V-KuDXVc52SVUp3DTDHmIWF2GXLyYUqQsQHI,5610
|
|
4
4
|
jbqt/common/qt_utils.py,sha256=d81MXUIs7JTpXOaPIoGHTLZYwhry7xhCWRy9BxitlzA,2297
|
|
5
5
|
jbqt/dialogs/__init__.py,sha256=DZi-qwW75JKfTLk33bowjt9Nhn1mpOO6kmP7mSMGz0o,245
|
|
6
|
-
jbqt/dialogs/file_dialog.py,sha256=
|
|
6
|
+
jbqt/dialogs/file_dialog.py,sha256=QMUxgSNt1IGLqgPgKqrEwlPjKIQ7D5qrY2cJCXmW654,1830
|
|
7
7
|
jbqt/dialogs/input_form.py,sha256=h4lzr4gv0PJTn0I77hdm_UIGeTng-buIuwzBSuswGxs,2451
|
|
8
8
|
jbqt/dialogs/text_preview.py,sha256=5rZjMvvMPq0jenPQkxKTFsGzuebdH_EnjKsdgNzv93o,1244
|
|
9
9
|
jbqt/models/__init__.py,sha256=aQUYSr2bL9uRVdmEh_3s5pHbzM0MyKXEiO2Bqe16I8A,155
|
|
10
10
|
jbqt/models/chip_button.py,sha256=nV5hVaYKStTOTGEa0WnVi1FolxrjnLQ1E3cSCQx-YkA,283
|
|
11
11
|
jbqt/models/chips.py,sha256=ou9RJxDSm6MI10CDnWrNi1DTRMKfqIIEowLVbyoFJZg,652
|
|
12
12
|
jbqt/view_icons.py,sha256=dwAAtDbqs3mwtmUxsjlFYdTsD2mi5m9BRmBQm6HpU9E,6389
|
|
13
|
-
jbqt/widgets/__init__.py,sha256=
|
|
13
|
+
jbqt/widgets/__init__.py,sha256=WxDWM5MDnB9NkvaYxE4AiT7tFjGB9fBirEx2iZUujeU,523
|
|
14
14
|
jbqt/widgets/chip_button.py,sha256=w_slazW-a4qmQDmdqSwtuPXLqA8rntjgHK3Tvgu3fDg,6222
|
|
15
15
|
jbqt/widgets/chips.py,sha256=DxZln3JdseEJRzmWWhrcR560ZOHCchmZqnjjUnEUZ_M,7743
|
|
16
16
|
jbqt/widgets/multiselect.py,sha256=84DYA12FBZvBBsPqlxiWMjY8lsQN0MkpJwqYN3nyz8Y,6981
|
|
17
17
|
jbqt/widgets/simple.py,sha256=-JVvNYiL05Ip7qSkt9rRFbdb-Jff6AbnuXPXOXdXoUw,1750
|
|
18
18
|
jbqt/widgets/toast.py,sha256=S85PgcydbmICnjSY5VR6KUG_UZv4UERjvE_mP_zE9GA,1179
|
|
19
19
|
jbqt/widgets/widget_utils.py,sha256=W8HkKJvTjGOB6wRR2D1sFzd673yEpPHNn-njjkM-1HE,2225
|
|
20
|
-
jbqt-0.1.
|
|
21
|
-
jbqt-0.1.
|
|
22
|
-
jbqt-0.1.
|
|
20
|
+
jbqt-0.1.4.dist-info/METADATA,sha256=ZNGL18QrLQkxqgisC66kCitZ5G_n9pX6F6TocL8qGjc,462
|
|
21
|
+
jbqt-0.1.4.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
22
|
+
jbqt-0.1.4.dist-info/RECORD,,
|
|
File without changes
|