jbqt 0.1.16__tar.gz → 0.1.17__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.16 → jbqt-0.1.17}/PKG-INFO +2 -2
- jbqt-0.1.17/jbqt/common/__pycache__/__init__.cpython-312.pyc +0 -0
- jbqt-0.1.17/jbqt/common/__pycache__/qt_utils.cpython-312.pyc +0 -0
- jbqt-0.1.17/jbqt/consts/__pycache__/__init__.cpython-312.pyc +0 -0
- jbqt-0.1.17/jbqt/dialogs/__init__.py +8 -0
- jbqt-0.1.17/jbqt/dialogs/__pycache__/__init__.cpython-312.pyc +0 -0
- jbqt-0.1.17/jbqt/dialogs/__pycache__/file_dialog.cpython-312.pyc +0 -0
- jbqt-0.1.17/jbqt/dialogs/__pycache__/input_form.cpython-312.pyc +0 -0
- jbqt-0.1.17/jbqt/dialogs/__pycache__/single_input.cpython-312.pyc +0 -0
- jbqt-0.1.17/jbqt/dialogs/__pycache__/text_preview.cpython-312.pyc +0 -0
- jbqt-0.1.17/jbqt/dialogs/input_form.py +140 -0
- {jbqt-0.1.16 → jbqt-0.1.17}/jbqt/models/__init__.py +2 -0
- jbqt-0.1.17/jbqt/models/__pycache__/__init__.cpython-312.pyc +0 -0
- jbqt-0.1.17/jbqt/models/__pycache__/chip_button.cpython-312.pyc +0 -0
- jbqt-0.1.17/jbqt/models/__pycache__/chips.cpython-312.pyc +0 -0
- jbqt-0.1.17/jbqt/models/__pycache__/dialog_options.cpython-312.pyc +0 -0
- jbqt-0.1.17/jbqt/models/__pycache__/model_consts.cpython-312.pyc +0 -0
- jbqt-0.1.17/jbqt/models/__pycache__/model_utils.cpython-312.pyc +0 -0
- jbqt-0.1.17/jbqt/models/__pycache__/toolbar_button.cpython-312.pyc +0 -0
- jbqt-0.1.17/jbqt/models/dialog_options.py +28 -0
- jbqt-0.1.17/jbqt/types/__pycache__/__init__.cpython-312.pyc +0 -0
- jbqt-0.1.17/jbqt/widgets/__pycache__/__init__.cpython-312.pyc +0 -0
- jbqt-0.1.17/jbqt/widgets/__pycache__/chip_button.cpython-312.pyc +0 -0
- jbqt-0.1.17/jbqt/widgets/__pycache__/simple.cpython-312.pyc +0 -0
- {jbqt-0.1.16 → jbqt-0.1.17}/pyproject.toml +2 -2
- jbqt-0.1.16/jbqt/dialogs/__init__.py +0 -7
- {jbqt-0.1.16 → jbqt-0.1.17}/README.md +0 -0
- {jbqt-0.1.16 → jbqt-0.1.17}/jbqt/__init__.py +0 -0
- {jbqt-0.1.16 → jbqt-0.1.17}/jbqt/common/__init__.py +0 -0
- {jbqt-0.1.16 → jbqt-0.1.17}/jbqt/common/qt_utils.py +0 -0
- {jbqt-0.1.16 → jbqt-0.1.17}/jbqt/consts/__init__.py +0 -0
- {jbqt-0.1.16 → jbqt-0.1.17}/jbqt/dialogs/file_dialog.py +0 -0
- /jbqt-0.1.16/jbqt/dialogs/input_form.py → /jbqt-0.1.17/jbqt/dialogs/single_input.py +0 -0
- {jbqt-0.1.16 → jbqt-0.1.17}/jbqt/dialogs/text_preview.py +0 -0
- {jbqt-0.1.16 → jbqt-0.1.17}/jbqt/models/chip_button.py +0 -0
- {jbqt-0.1.16 → jbqt-0.1.17}/jbqt/models/chips.py +0 -0
- {jbqt-0.1.16 → jbqt-0.1.17}/jbqt/models/model_consts.py +0 -0
- {jbqt-0.1.16 → jbqt-0.1.17}/jbqt/models/model_utils.py +0 -0
- {jbqt-0.1.16 → jbqt-0.1.17}/jbqt/models/toolbar_button.py +0 -0
- {jbqt-0.1.16 → jbqt-0.1.17}/jbqt/types/__init__.py +0 -0
- {jbqt-0.1.16 → jbqt-0.1.17}/jbqt/view_icons.py +0 -0
- {jbqt-0.1.16 → jbqt-0.1.17}/jbqt/widgets/__init__.py +0 -0
- {jbqt-0.1.16 → jbqt-0.1.17}/jbqt/widgets/chip_button.py +0 -0
- {jbqt-0.1.16 → jbqt-0.1.17}/jbqt/widgets/chips.py +0 -0
- {jbqt-0.1.16 → jbqt-0.1.17}/jbqt/widgets/multiselect.py +0 -0
- {jbqt-0.1.16 → jbqt-0.1.17}/jbqt/widgets/simple.py +0 -0
- {jbqt-0.1.16 → jbqt-0.1.17}/jbqt/widgets/toast.py +0 -0
- {jbqt-0.1.16 → jbqt-0.1.17}/jbqt/widgets/widget_utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: jbqt
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.17
|
|
4
4
|
Summary:
|
|
5
5
|
Author: Joseph Bochinski
|
|
6
6
|
Author-email: stirgejr@gmail.com
|
|
@@ -9,7 +9,7 @@ Classifier: Programming Language :: Python :: 3
|
|
|
9
9
|
Classifier: Programming Language :: Python :: 3.12
|
|
10
10
|
Requires-Dist: fuzzywuzzy (>=0.18.0,<0.19.0)
|
|
11
11
|
Requires-Dist: jbconsts (>=0.1.1,<0.2.0)
|
|
12
|
-
Requires-Dist: jbutils (>=0.1.
|
|
12
|
+
Requires-Dist: jbutils (>=0.1.24,<0.2.0)
|
|
13
13
|
Requires-Dist: pyqt6 (>=6.9.0,<7.0.0)
|
|
14
14
|
Requires-Dist: python-levenshtein (>=0.27.1,<0.28.0)
|
|
15
15
|
Requires-Dist: rich (>=14.0.0,<15.0.0)
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"""jbqt Dialog exports"""
|
|
2
|
+
|
|
3
|
+
from jbqt.dialogs.input_form import InputFormDialog
|
|
4
|
+
from jbqt.dialogs.single_input import InputDialog
|
|
5
|
+
from jbqt.dialogs.text_preview import TextPreviewDialog
|
|
6
|
+
from jbqt.dialogs.file_dialog import JbFileDialog
|
|
7
|
+
|
|
8
|
+
__all__ = ["InputDialog", "InputFormDialog", "TextPreviewDialog", "JbFileDialog"]
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
from typing import Any, Callable
|
|
3
|
+
|
|
4
|
+
from PyQt6.QtCore import pyqtSignal
|
|
5
|
+
from PyQt6.QtWidgets import (
|
|
6
|
+
QDialog,
|
|
7
|
+
QDialogButtonBox,
|
|
8
|
+
QDoubleSpinBox,
|
|
9
|
+
QHBoxLayout,
|
|
10
|
+
QLabel,
|
|
11
|
+
QLayout,
|
|
12
|
+
QLineEdit,
|
|
13
|
+
QPushButton,
|
|
14
|
+
QSpinBox,
|
|
15
|
+
QVBoxLayout,
|
|
16
|
+
QWidget,
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
from PyQt6 import QtWidgets
|
|
20
|
+
|
|
21
|
+
from jbqt.models import DialogOptions
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def get_widget(name: str) -> QWidget | None:
|
|
25
|
+
widget: QWidget | None = None
|
|
26
|
+
if hasattr(QtWidgets, name):
|
|
27
|
+
widget = getattr(QtWidgets, name)
|
|
28
|
+
""" elif hasattr(widgets, name):
|
|
29
|
+
widget = getattr(widgets, name) """
|
|
30
|
+
|
|
31
|
+
if widget:
|
|
32
|
+
if not callable(widget):
|
|
33
|
+
return
|
|
34
|
+
|
|
35
|
+
widget = widget()
|
|
36
|
+
if isinstance(widget, QWidget):
|
|
37
|
+
return widget
|
|
38
|
+
return None
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def get_widget_val(widget: QWidget) -> str | int | float | None:
|
|
42
|
+
# Emit the custom signal with data when the dialog is accepted
|
|
43
|
+
value = None
|
|
44
|
+
if isinstance(widget, QLineEdit):
|
|
45
|
+
value = widget.text()
|
|
46
|
+
elif isinstance(widget, QSpinBox):
|
|
47
|
+
value = widget.value()
|
|
48
|
+
elif isinstance(widget, QDoubleSpinBox):
|
|
49
|
+
value = widget.value()
|
|
50
|
+
|
|
51
|
+
return value
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
class InputFormDialog(QDialog):
|
|
55
|
+
"""reference value for external use"""
|
|
56
|
+
|
|
57
|
+
value = pyqtSignal(dict)
|
|
58
|
+
|
|
59
|
+
def __init__(
|
|
60
|
+
self,
|
|
61
|
+
parent=None,
|
|
62
|
+
form_data: list[dict] | None = None,
|
|
63
|
+
opts: DialogOptions | None = None,
|
|
64
|
+
):
|
|
65
|
+
super().__init__(parent)
|
|
66
|
+
|
|
67
|
+
opts = opts or DialogOptions(title="Input")
|
|
68
|
+
opts.apply(self)
|
|
69
|
+
|
|
70
|
+
self.form_data: list[dict] = [obj.copy() for obj in form_data or []]
|
|
71
|
+
self.input_widgets: dict[str, QWidget] = {}
|
|
72
|
+
|
|
73
|
+
self.main_layout = QVBoxLayout()
|
|
74
|
+
self.construct_widgets()
|
|
75
|
+
|
|
76
|
+
button_box = QHBoxLayout()
|
|
77
|
+
submit_btn = QPushButton("Submit", parent=self)
|
|
78
|
+
submit_btn.clicked.connect(self.submit)
|
|
79
|
+
|
|
80
|
+
cancel_btn = QPushButton("Cancel", parent=self)
|
|
81
|
+
cancel_btn.clicked.connect(self.close)
|
|
82
|
+
|
|
83
|
+
button_box.addWidget(submit_btn)
|
|
84
|
+
button_box.addWidget(cancel_btn)
|
|
85
|
+
self.main_layout.addLayout(button_box)
|
|
86
|
+
|
|
87
|
+
self.setLayout(self.main_layout)
|
|
88
|
+
|
|
89
|
+
def construct_widgets(self) -> None:
|
|
90
|
+
for widget_def in self.form_data:
|
|
91
|
+
if not "type" in widget_def:
|
|
92
|
+
continue
|
|
93
|
+
|
|
94
|
+
layout = QHBoxLayout()
|
|
95
|
+
|
|
96
|
+
w_type = widget_def.pop("type")
|
|
97
|
+
label = widget_def.pop("label", "")
|
|
98
|
+
key = widget_def.pop("key", "")
|
|
99
|
+
if not key:
|
|
100
|
+
continue
|
|
101
|
+
|
|
102
|
+
widget = get_widget(w_type)
|
|
103
|
+
if not widget:
|
|
104
|
+
continue
|
|
105
|
+
if label and isinstance(label, str):
|
|
106
|
+
layout.addWidget(QLabel(label))
|
|
107
|
+
|
|
108
|
+
if widget_def:
|
|
109
|
+
self._init_widget(widget, **widget_def)
|
|
110
|
+
layout.addWidget(widget)
|
|
111
|
+
self.main_layout.addLayout(layout)
|
|
112
|
+
self.input_widgets[key] = widget
|
|
113
|
+
|
|
114
|
+
def get_form_data(self) -> dict:
|
|
115
|
+
form_values: dict[str, Any] = {}
|
|
116
|
+
|
|
117
|
+
for key, widget in self.input_widgets.items():
|
|
118
|
+
value = get_widget_val(widget)
|
|
119
|
+
if value:
|
|
120
|
+
form_values[key] = value
|
|
121
|
+
|
|
122
|
+
return form_values
|
|
123
|
+
|
|
124
|
+
def submit(self) -> None:
|
|
125
|
+
form_data = self.get_form_data()
|
|
126
|
+
self.value.emit(form_data)
|
|
127
|
+
self.close()
|
|
128
|
+
|
|
129
|
+
def close(self) -> bool:
|
|
130
|
+
self.deleteLater()
|
|
131
|
+
|
|
132
|
+
return super().close()
|
|
133
|
+
|
|
134
|
+
def _init_widget(self, widget: QWidget, **opts) -> None:
|
|
135
|
+
for key, value in opts.items():
|
|
136
|
+
setter_key = f"set{key[0].upper() + key[1:]}"
|
|
137
|
+
if hasattr(widget, setter_key):
|
|
138
|
+
setter = getattr(widget, setter_key)
|
|
139
|
+
if setter:
|
|
140
|
+
setter(value)
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
from jbqt.models.chips import IChipsWidget
|
|
4
4
|
from jbqt.models.chip_button import IChipButton
|
|
5
|
+
from jbqt.models.dialog_options import DialogOptions
|
|
5
6
|
from jbqt.models.model_consts import RegisteredFunctions
|
|
6
7
|
from jbqt.models.model_utils import get_fct, register_fct
|
|
7
8
|
from jbqt.models.toolbar_button import ToolbarButton
|
|
8
9
|
|
|
9
10
|
__all__ = [
|
|
11
|
+
"DialogOptions",
|
|
10
12
|
"get_fct",
|
|
11
13
|
"IChipButton",
|
|
12
14
|
"IChipsWidget",
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
|
|
3
|
+
from PyQt6.QtCore import QObject
|
|
4
|
+
from PyQt6.QtWidgets import QWidget, QMainWindow, QApplication, QDialog
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@dataclass
|
|
8
|
+
class DialogOptions:
|
|
9
|
+
title: str = ""
|
|
10
|
+
x_pos: int | None = None
|
|
11
|
+
y_pos: int | None = None
|
|
12
|
+
height: int | None = None
|
|
13
|
+
width: int | None = None
|
|
14
|
+
|
|
15
|
+
def apply(self, q_obj: QWidget | QMainWindow | QDialog):
|
|
16
|
+
if self.title:
|
|
17
|
+
q_obj.setWindowTitle(self.title)
|
|
18
|
+
|
|
19
|
+
h, w, x, y = self.height, self.width, self.x_pos, self.y_pos
|
|
20
|
+
if h or w:
|
|
21
|
+
h = h or 400
|
|
22
|
+
w = w or 400
|
|
23
|
+
q_obj.resize(w, h)
|
|
24
|
+
|
|
25
|
+
if x is not None or y is not None:
|
|
26
|
+
x = x or 0
|
|
27
|
+
y = y or 0
|
|
28
|
+
q_obj.move(x, y)
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
|
|
|
4
4
|
|
|
5
5
|
[tool.poetry]
|
|
6
6
|
name = "jbqt"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.17"
|
|
8
8
|
description = ""
|
|
9
9
|
authors = [ "Joseph Bochinski <stirgejr@gmail.com>",]
|
|
10
10
|
readme = "README.md"
|
|
@@ -15,5 +15,5 @@ pyqt6 = "^6.9.0"
|
|
|
15
15
|
fuzzywuzzy = "^0.18.0"
|
|
16
16
|
python-levenshtein = "^0.27.1"
|
|
17
17
|
jbconsts = "^0.1.1"
|
|
18
|
-
jbutils = "^0.1.23"
|
|
19
18
|
rich = "^14.0.0"
|
|
19
|
+
jbutils = "^0.1.24"
|
|
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
|