jbqt 0.1.2__tar.gz → 0.1.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.

Potentially problematic release.


This version of jbqt might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: jbqt
3
- Version: 0.1.2
3
+ Version: 0.1.4
4
4
  Summary:
5
5
  Author: Joseph Bochinski
6
6
  Author-email: stirgejr@gmail.com
@@ -0,0 +1,12 @@
1
+ """Common exports for jbqt"""
2
+
3
+ from jbqt.common import consts, qt_utils
4
+ from jbqt.common.consts import GlobalRefs
5
+ from jbqt.common.qt_utils import register_app
6
+
7
+ __all__ = [
8
+ "GlobalRefs",
9
+ "consts",
10
+ "qt_utils",
11
+ "register_app",
12
+ ]
@@ -0,0 +1,16 @@
1
+ """Const exports"""
2
+
3
+ from jbqt.common import consts, qt_utils
4
+ from jbqt.common.consts import COLORS, STYLES, SIZES, GlobalRefs, ICONS
5
+ from jbqt.common.qt_utils import register_app
6
+
7
+ __all__ = [
8
+ "COLORS",
9
+ "consts",
10
+ "GlobalRefs",
11
+ "ICONS",
12
+ "qt_utils",
13
+ "register_app",
14
+ "SIZES",
15
+ "STYLES",
16
+ ]
@@ -165,3 +165,5 @@ class ICONS:
165
165
  return getattr(cls, name)
166
166
  else:
167
167
  return default
168
+
169
+ WIDGET_MAP
@@ -0,0 +1,60 @@
1
+ from PyQt6.QtCore import pyqtSignal
2
+ from PyQt6.QtWidgets import QWidget, QPushButton, QVBoxLayout, QFileDialog
3
+
4
+
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
+
17
+ selectedFile = pyqtSignal(str)
18
+
19
+ def __init__(
20
+ self, title: str = "File Dialog", directory: str = "", mode: str = "open"
21
+ ) -> None:
22
+ super().__init__()
23
+
24
+ self.title = title
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'")
30
+
31
+ self.setWindowTitle(title)
32
+
33
+ self.button = QPushButton(
34
+ "Open File" if self.mode == "open" else "Save File", self
35
+ )
36
+ self.button.clicked.connect(self.open_file_dialog)
37
+
38
+ layout = QVBoxLayout()
39
+ layout.addWidget(self.button)
40
+ self.setLayout(layout)
41
+
42
+ def open_file_dialog(self) -> None:
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
+
59
+ if file_name:
60
+ self.selectedFile.emit(file_name)
@@ -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",
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
4
4
 
5
5
  [tool.poetry]
6
6
  name = "jbqt"
7
- version = "0.1.2"
7
+ version = "0.1.4"
8
8
  description = ""
9
9
  authors = [ "Joseph Bochinski <stirgejr@gmail.com>",]
10
10
  readme = "README.md"
File without changes
@@ -1,6 +0,0 @@
1
- """Const exports"""
2
-
3
- from jbqt.common.consts import COLORS, STYLES, SIZES, GlobalRefs, ICONS
4
- from jbqt.common.qt_utils import register_app
5
-
6
- __all__ = ["COLORS", "STYLES", "SIZES", "GlobalRefs", "ICONS", "register_app"]
@@ -1,27 +0,0 @@
1
- from PyQt6.QtCore import pyqtSignal
2
- from PyQt6.QtWidgets import QWidget, QPushButton, QVBoxLayout, QFileDialog
3
-
4
-
5
- class JbFileDialog(QWidget):
6
- selectedFile = pyqtSignal(str)
7
-
8
- def __init__(self, title: str = "File Dialog", directory: str = "") -> None:
9
- """Initialize the main window with a button to open a file dialog."""
10
- super().__init__()
11
- self.setWindowTitle("QFileDialog Example")
12
- self.directory = directory
13
-
14
- self.button = QPushButton("Open File", self)
15
- self.button.clicked.connect(self.open_file_dialog)
16
-
17
- layout = QVBoxLayout()
18
- layout.addWidget(self.button)
19
- self.setLayout(layout)
20
-
21
- def open_file_dialog(self) -> None:
22
- """Open a file dialog to select a file."""
23
- file_name, _ = QFileDialog.getOpenFileName(
24
- self, "Open File", self.directory, "All Files (*);;Text Files (*.txt)"
25
- )
26
- if file_name:
27
- self.selectedFile.emit(file_name)
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