From 3878dba2889d9333b9bcf4f3b87fbaf4863697a8 Mon Sep 17 00:00:00 2001 From: Blue Fox Date: Sat, 8 Jul 2023 19:13:05 +0200 Subject: [PATCH] Added basic Qt MainWindow (with all boilerplate code) --- .gitignore | 2 ++ Scorganizr.pyproject | 3 ++ form.ui | 84 ++++++++++++++++++++++++++++++++++++++++++++ main.py | 19 ++++++++++ ui_form.py | 70 ++++++++++++++++++++++++++++++++++++ 5 files changed, 178 insertions(+) create mode 100644 Scorganizr.pyproject create mode 100644 form.ui create mode 100644 main.py create mode 100644 ui_form.py diff --git a/.gitignore b/.gitignore index e69de29..3f3c6fb 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1,2 @@ +Scorganizr.pyproject.user +__pycache__/ diff --git a/Scorganizr.pyproject b/Scorganizr.pyproject new file mode 100644 index 0000000..51ec4a5 --- /dev/null +++ b/Scorganizr.pyproject @@ -0,0 +1,3 @@ +{ + "files": ["main.py", "form.ui"] +} diff --git a/form.ui b/form.ui new file mode 100644 index 0000000..47be1e7 --- /dev/null +++ b/form.ui @@ -0,0 +1,84 @@ + + + MainWindow + + + + 0 + 0 + 718 + 408 + + + + Scorganizr + + + + .. + + + true + + + false + + + QTabWidget::Rounded + + + + + + 0 + 0 + 718 + 20 + + + + + false + + + File + + + false + + + false + + + + + + + + Quit + + + Ctrl+Q + + + + + + + actionQuit + triggered() + MainWindow + close() + + + -1 + -1 + + + 358 + 203 + + + + + diff --git a/main.py b/main.py new file mode 100644 index 0000000..08ce629 --- /dev/null +++ b/main.py @@ -0,0 +1,19 @@ +# This Python file uses the following encoding: utf-8 +import sys + +from PySide6.QtWidgets import QApplication, QMainWindow +from ui_form import Ui_MainWindow + + +class MainWindow(QMainWindow): + def __init__(self, parent=None): + super().__init__(parent) + self.ui = Ui_MainWindow() + self.ui.setupUi(self) + + +if __name__ == "__main__": + app = QApplication(sys.argv) + widget = MainWindow() + widget.show() + sys.exit(app.exec()) diff --git a/ui_form.py b/ui_form.py new file mode 100644 index 0000000..fde8c7d --- /dev/null +++ b/ui_form.py @@ -0,0 +1,70 @@ +# -*- coding: utf-8 -*- + +################################################################################ +## Form generated from reading UI file 'form.ui' +## +## Created by: Qt User Interface Compiler version 6.5.1 +## +## WARNING! All changes made in this file will be lost when recompiling UI file! +################################################################################ + +from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale, + QMetaObject, QObject, QPoint, QRect, + QSize, QTime, QUrl, Qt) +from PySide6.QtGui import (QAction, QBrush, QColor, QConicalGradient, + QCursor, QFont, QFontDatabase, QGradient, + QIcon, QImage, QKeySequence, QLinearGradient, + QPainter, QPalette, QPixmap, QRadialGradient, + QTransform) +from PySide6.QtWidgets import (QApplication, QMainWindow, QMenu, QMenuBar, + QSizePolicy, QTabWidget, QWidget) + +class Ui_MainWindow(object): + def setupUi(self, MainWindow): + if not MainWindow.objectName(): + MainWindow.setObjectName(u"MainWindow") + MainWindow.resize(718, 408) + icon = QIcon() + iconThemeName = u"insert-image" + if QIcon.hasThemeIcon(iconThemeName): + icon = QIcon.fromTheme(iconThemeName) + else: + icon.addFile(u".", QSize(), QIcon.Normal, QIcon.Off) + + MainWindow.setWindowIcon(icon) + MainWindow.setAnimated(True) + MainWindow.setDocumentMode(False) + MainWindow.setTabShape(QTabWidget.Rounded) + self.actionQuit = QAction(MainWindow) + self.actionQuit.setObjectName(u"actionQuit") + self.centralwidget = QWidget(MainWindow) + self.centralwidget.setObjectName(u"centralwidget") + MainWindow.setCentralWidget(self.centralwidget) + self.menubar = QMenuBar(MainWindow) + self.menubar.setObjectName(u"menubar") + self.menubar.setGeometry(QRect(0, 0, 718, 20)) + self.menuFile = QMenu(self.menubar) + self.menuFile.setObjectName(u"menuFile") + self.menuFile.setTearOffEnabled(False) + self.menuFile.setSeparatorsCollapsible(False) + self.menuFile.setToolTipsVisible(False) + MainWindow.setMenuBar(self.menubar) + + self.menubar.addAction(self.menuFile.menuAction()) + self.menuFile.addAction(self.actionQuit) + + self.retranslateUi(MainWindow) + self.actionQuit.triggered.connect(MainWindow.close) + + QMetaObject.connectSlotsByName(MainWindow) + # setupUi + + def retranslateUi(self, MainWindow): + MainWindow.setWindowTitle(QCoreApplication.translate("MainWindow", u"Scorganizr", None)) + self.actionQuit.setText(QCoreApplication.translate("MainWindow", u"Quit", None)) +#if QT_CONFIG(shortcut) + self.actionQuit.setShortcut(QCoreApplication.translate("MainWindow", u"Ctrl+Q", None)) +#endif // QT_CONFIG(shortcut) + self.menuFile.setTitle(QCoreApplication.translate("MainWindow", u"File", None)) + # retranslateUi +