diff --git a/.idea/fswidgets.iml b/.idea/fswidgets.iml index 26da5f8..07bce9b 100644 --- a/.idea/fswidgets.iml +++ b/.idea/fswidgets.iml @@ -6,7 +6,7 @@ - + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml index e442936..0873408 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -3,5 +3,5 @@ - + \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 6225c69..145c5a9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "PySide6WidgetCollection" -version = "1.0.0.0" +version = "1.0.1" authors = [ { name="Christoph Schmidt", email="cschmidt.fs@gmail.com" }, ] diff --git a/src/dialogs/AboutDialog.py b/src/dialogs/AboutDialog.py new file mode 100644 index 0000000..d9ca41b --- /dev/null +++ b/src/dialogs/AboutDialog.py @@ -0,0 +1,116 @@ +import webbrowser + +from PySide6.QtWidgets import QApplication, QDialog, QVBoxLayout, QLabel, QPushButton, QHBoxLayout, QFrame +from PySide6.QtGui import QPixmap, QFont +from PySide6.QtCore import Qt + +class AboutDialog(QDialog): + def __init__(self, + app_name: str, + app_description: str, + app_version: str, + app_developer: str, + app_git_url: str, + licence: str, + pixmap: QPixmap, + parent=None): + super(AboutDialog, self).__init__(parent) + self.setWindowTitle("About") + + # Main layout + layout = QVBoxLayout() + + # Application image + app_image = QLabel(self) + pixmap = pixmap.scaled(64, 64, Qt.KeepAspectRatio, Qt.SmoothTransformation) + app_image.setPixmap(pixmap) + app_image.setAlignment(Qt.AlignCenter) + layout.addWidget(app_image) + + + # Application name header + app_name_label = QLabel(f"{app_name}", self) # Replace with your application name + app_name_font = QFont() + app_name_font.setBold(True) + app_name_font.setPointSize(16) + app_name_label.setFont(app_name_font) + app_name_label.setAlignment(Qt.AlignCenter) + layout.addWidget(app_name_label) + + # App Description + app_desc = QLabel(f"{app_description}", self) + app_desc_font = QFont() + app_desc_font.setPointSize(8) + app_desc.setFont(app_desc_font) + app_desc.setAlignment(Qt.AlignCenter) + layout.addWidget(app_desc) + + # Version number + version_label = QLabel(f"Version: {app_version}", self) + version_label.setAlignment(Qt.AlignCenter) + layout.addWidget(version_label) + + # Developer + developer_label = QLabel(f"(c) {app_developer}", self) + developer_label_font = QFont() + developer_label_font.setPointSize(8) + developer_label.setFont(developer_label_font) + developer_label.setAlignment(Qt.AlignCenter) + layout.addWidget(developer_label) + + # Add a horizontal line + line = QFrame() + line.setFrameShape(QFrame.HLine) + line.setFrameShadow(QFrame.Sunken) + layout.addWidget(line) + + + # Developer + licence_label = QLabel(f"{licence}", self) + licence_label.setAlignment(Qt.AlignCenter) + layout.addWidget(licence_label) + + + # Git URL + self.git_label = QLabel(f'Visit {app_git_url} for more information
' + f'or to report a bug or to suggest new features.', self) + self.git_label.setOpenExternalLinks(True) + self.git_label.setAlignment(Qt.AlignCenter) + self.git_label.linkActivated.connect(self.open_url) + layout.addWidget(self.git_label) + + line = QFrame() + line.setFrameShape(QFrame.HLine) + line.setFrameShadow(QFrame.Sunken) + layout.addWidget(line) + + + + # Close button + close_button = QPushButton("Close", self) + close_button.clicked.connect(self.close) + button_layout = QHBoxLayout() + button_layout.addStretch() + button_layout.addWidget(close_button) + button_layout.addStretch() + layout.addLayout(button_layout) + + self.setLayout(layout) + + def open_url(self, url): + print(url) + webbrowser.open(url) + +if __name__ == "__main__": + import sys + app = QApplication(sys.argv) + dialog = AboutDialog("TestApplication", + "This is a test application", + "1.0", + "2024 John Doe", + "github.com", + "This project is open source and
contributions are highly welcome." + "
The project is licensed under {licence}.", + QPixmap("adscopecontrol_icon.png")) + dialog.exec() + sys.exit(app.exec()) diff --git a/src/dialogs/__init__.py b/src/dialogs/__init__.py new file mode 100644 index 0000000..1f97fd3 --- /dev/null +++ b/src/dialogs/__init__.py @@ -0,0 +1 @@ +from .AboutDialog import AboutDialog \ No newline at end of file diff --git a/src/dialogs/adscopecontrol_icon.png b/src/dialogs/adscopecontrol_icon.png new file mode 100644 index 0000000..37794bf Binary files /dev/null and b/src/dialogs/adscopecontrol_icon.png differ diff --git a/src/fswidgets/LEDIndicatorWidget.py b/src/widgets/LEDIndicatorWidget.py similarity index 100% rename from src/fswidgets/LEDIndicatorWidget.py rename to src/widgets/LEDIndicatorWidget.py diff --git a/src/fswidgets/PlayPushButton.py b/src/widgets/PlayPushButton.py similarity index 100% rename from src/fswidgets/PlayPushButton.py rename to src/widgets/PlayPushButton.py diff --git a/src/fswidgets/QProgressBarWindow.py b/src/widgets/QProgressBarWindow.py similarity index 100% rename from src/fswidgets/QProgressBarWindow.py rename to src/widgets/QProgressBarWindow.py diff --git a/src/fswidgets/__init__.py b/src/widgets/__init__.py similarity index 100% rename from src/fswidgets/__init__.py rename to src/widgets/__init__.py