threads __init__, pyside6->pyqt6

This commit is contained in:
WorldTeacher
2024-05-07 15:33:35 +02:00
parent 24eefd9473
commit e999c51863
34 changed files with 972 additions and 985 deletions

View File

@@ -1,12 +1,12 @@
# Form implementation generated from reading ui file 'c:\Users\aky547\GitHub\Semesterapparate\ui\widgets\message_widget.ui'
#
# Created by: PySide6 UI code generator 6.3.1
# Created by: PyQt6 UI code generator 6.3.1
#
# WARNING: Any manual changes made to this file will be lost when pyuic6 is
# run again. Do not edit this file unless you know what you are doing.
from PySide6 import QtCore, QtGui, QtWidgets
from PyQt6 import QtCore, QtGui, QtWidgets
from src.backend.database import Database

View File

@@ -1,12 +1,12 @@
# Form implementation generated from reading ui file 'c:\Users\aky547\GitHub\Semesterapparate\ui\widgets\progress_overview_widget.ui'
#
# Created by: PySide6 UI code generator 6.3.1
# Created by: PyQt6 UI code generator 6.3.1
#
# WARNING: Any manual changes made to this file will be lost when pyuic6 is
# run again. Do not edit this file unless you know what you are doing.
from PySide6 import QtCore, QtGui, QtWidgets
from PyQt6 import QtCore, QtGui, QtWidgets
class Ui_Form(object):
@@ -63,7 +63,7 @@ class Ui_Form(object):
font = QtGui.QFont()
font.setPointSize(10)
font.setBold(True)
font.setItalic(False)
font.setItal#ic(False)
font.setUnderline(False)
font.setWeight(75)
font.setKerning(True)

View File

@@ -1,6 +1,6 @@
# import pysignal pyslot
from PySide6.QtCore import Signal
from PySide6.QtWidgets import (
from PyQt6.QtCore import pyqtSignal as Signal
from PyQt6.QtWidgets import (
QApplication,
QTreeWidget,
QTreeWidgetItem,
@@ -10,7 +10,7 @@ from PySide6.QtWidgets import (
class StatusWidget(QWidget):
person_double_clicked = Signal(str,str, int)
person_double_clicked = Signal(str, str, int)
def __init__(self, data, header_label: str):
super(StatusWidget, self).__init__()
@@ -23,6 +23,7 @@ class StatusWidget(QWidget):
layout.addWidget(self.tree_widget)
self.setLayout(layout)
self.tree_widget.itemDoubleClicked.connect(self.on_item_double_clicked)
def on_item_double_clicked(self, item: QTreeWidgetItem, column: int):
parent_depth = 0
parent = item.parent()
@@ -31,7 +32,7 @@ class StatusWidget(QWidget):
parent = parent.parent()
print(parent_depth)
# Emit the person_double_clicked signal with the name of the person and the parent depth
self.person_double_clicked.emit(self.header,item.text(column), parent_depth)
self.person_double_clicked.emit(self.header, item.text(column), parent_depth)
def populate_tree(self, data):
if data == {}:
@@ -70,7 +71,8 @@ if __name__ == "__main__":
widget = StatusWidget(data, "test")
widget.show()
#detect emit signal
# detect emit signal
widget.person_double_clicked.connect(lambda x: print(x))
sys.exit(app.exec())

View File

@@ -1,29 +1,32 @@
from PySide6.QtWidgets import QFileDialog, QApplication
from PySide6.QtCore import QSettings
import sys
from PyQt6.QtCore import QSettings
from PyQt6.QtWidgets import QApplication, QFileDialog
class FilePicker:
def __init__(self):
self.settings = QSettings("PH-Freiburg", "SAP")
self.last_path = self.settings.value("last_path", "/")
self.multi_select = True
def pick_files(self):
filepicker = QFileDialog()
filepicker.setFileMode(QFileDialog.FileMode.ExistingFiles)
filepicker.setDirectory(self.last_path)
filepicker.setOption(QFileDialog.Option.DontUseNativeDialog, True)
#enable multi select
# enable multi select
filepicker.setOption(QFileDialog.Option.DontUseCustomDirectoryIcons, True)
files, _ = filepicker.getOpenFileNames(caption='Open file', directory=self.last_path)
files, _ = filepicker.getOpenFileNames(caption="Open file", dir=self.last_path)
if files:
self.last_path = files[0]
self.settings.setValue("last_path", self.last_path)
return files
if __name__ == '__main__':
if __name__ == "__main__":
app = QApplication(sys.argv)
picker = FilePicker()
files = picker.pick_files()
print(files)
print(files)

View File

@@ -5,7 +5,7 @@ matplotlib.use("QtAgg")
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolbar
from matplotlib.figure import Figure
from PySide6 import QtCore, QtWidgets
from PyQt6 import QtCore, QtWidgets
class graph(FigureCanvas):
@@ -25,7 +25,7 @@ class GraphWidget(QtWidgets.QWidget):
self.toolbar = NavigationToolbar(self.graph, self)
# set legend
self.graph.axes.legend(legend_labels, loc="upper left")
#set x-axis text to be slanted
# set x-axis text to be slanted
self.graph.axes.set_xticklabels(data["x"], rotation=45, ha="right")
# set the layout
layout = QtWidgets.QVBoxLayout()
@@ -49,3 +49,4 @@ if __name__ == "__main__":
widget = GraphWidget(data=data, legend_labels=["+", "-"])
widget.show()
sys.exit(app.exec())

View File

@@ -1,4 +1,4 @@
from PySide6 import QtCore, QtGui, QtWidgets
from PyQt6 import QtCore, QtGui, QtWidgets
from Ui_progress_overview_widget import Ui_Form