add files

This commit is contained in:
WorldTeacher
2024-01-26 08:28:01 +01:00
parent dd9ee24a8f
commit 0a9818940c
110 changed files with 21563 additions and 0 deletions

View File

@@ -0,0 +1,67 @@
# Form implementation generated from reading ui file 'c:\Users\aky547\GitHub\Semesterapparate\ui\widgets\message_widget.ui'
#
# 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 PyQt6 import QtCore, QtGui, QtWidgets
from src.backend.database import Database
class Ui_Form(object):
def setupUi(self, Form):
Form.setObjectName("Form")
Form.resize(295, 110)
self.label = QtWidgets.QLabel(Form)
self.label.setGeometry(QtCore.QRect(10, 0, 47, 21))
self.label.setObjectName("label")
self.lineEdit = QtWidgets.QLineEdit(Form)
self.lineEdit.setEnabled(True)
self.lineEdit.setGeometry(QtCore.QRect(60, 0, 41, 20))
self.lineEdit.setFocusPolicy(QtCore.Qt.FocusPolicy.NoFocus)
self.lineEdit.setReadOnly(True)
self.lineEdit.setObjectName("lineEdit")
self.label_2 = QtWidgets.QLabel(Form)
self.label_2.setGeometry(QtCore.QRect(10, 20, 51, 21))
self.label_2.setObjectName("label_2")
self.textEdit = QtWidgets.QTextEdit(Form)
self.textEdit.setGeometry(QtCore.QRect(10, 40, 281, 66))
self.textEdit.setFocusPolicy(QtCore.Qt.FocusPolicy.NoFocus)
self.textEdit.setInputMethodHints(QtCore.Qt.InputMethodHint.ImhNone)
self.textEdit.setReadOnly(True)
self.textEdit.setObjectName("textEdit")
self.pushButton = QtWidgets.QPushButton(Form)
self.pushButton.setGeometry(QtCore.QRect(210, 10, 75, 23))
self.pushButton.setFocusPolicy(QtCore.Qt.FocusPolicy.NoFocus)
self.pushButton.setObjectName("pushButton")
self.hidden_id = QtWidgets.QLabel(Form)
self.hidden_id.setGeometry(QtCore.QRect(140, 10, 47, 13))
self.hidden_id.setFocusPolicy(QtCore.Qt.FocusPolicy.NoFocus)
self.hidden_id.setObjectName("hidden_id")
self.hidden_id.hide()
self.delete = False
self.pushButton.clicked.connect(self.delete_message)
self.retranslateUi(Form)
QtCore.QMetaObject.connectSlotsByName(Form)
Form.setTabOrder(self.lineEdit, self.textEdit)
def retranslateUi(self, Form):
_translate = QtCore.QCoreApplication.translate
Form.setWindowTitle(_translate("Form", "Form"))
self.label.setText(_translate("Form", "Apparat:"))
self.label_2.setText(_translate("Form", "Nachricht:"))
self.pushButton.setText(_translate("Form", "Löschen"))
self.hidden_id.setText(_translate("Form", "TextLabel"))
def set_message(self, message: str, apparat: int, app_id: int):
self.textEdit.setText(message)
self.lineEdit.setText(str(apparat) if apparat else "Alle")
self.hidden_id.setText(str(app_id))
def delete_message(self):
db = Database()
print("deleting message")
db.delete_message(self.hidden_id.text())

View File

@@ -0,0 +1,149 @@
# Form implementation generated from reading ui file 'c:\Users\aky547\GitHub\Semesterapparate\ui\widgets\progress_overview_widget.ui'
#
# 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 PyQt6 import QtCore, QtGui, QtWidgets
class Ui_Form(object):
def setupUi(self, Form):
Form.setObjectName("Form")
Form.resize(300, 751)
sizePolicy = QtWidgets.QSizePolicy(
QtWidgets.QSizePolicy.Policy.Fixed, QtWidgets.QSizePolicy.Policy.Fixed
)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(Form.sizePolicy().hasHeightForWidth())
Form.setSizePolicy(sizePolicy)
Form.setMaximumSize(QtCore.QSize(300, 751))
self.group_software = QtWidgets.QGroupBox(Form)
self.group_software.setEnabled(True)
self.group_software.setGeometry(QtCore.QRect(10, 10, 281, 211))
font = QtGui.QFont()
font.setPointSize(10)
font.setBold(True)
font.setWeight(75)
self.group_software.setFont(font)
self.group_software.setStatusTip("")
self.group_software.setFlat(False)
self.group_software.setCheckable(False)
self.group_software.setChecked(False)
self.group_software.setObjectName("group_software")
self.checkBox = QtWidgets.QCheckBox(self.group_software)
self.checkBox.setGeometry(QtCore.QRect(10, 20, 241, 41))
font = QtGui.QFont()
font.setPointSize(8)
font.setBold(False)
font.setWeight(50)
self.checkBox.setFont(font)
self.checkBox.setObjectName("checkBox")
self.checkBox_2 = QtWidgets.QCheckBox(self.group_software)
self.checkBox_2.setGeometry(QtCore.QRect(10, 50, 241, 41))
font = QtGui.QFont()
font.setPointSize(8)
font.setBold(False)
font.setWeight(50)
self.checkBox_2.setFont(font)
self.checkBox_2.setObjectName("checkBox_2")
self.checkBox_3 = QtWidgets.QCheckBox(self.group_software)
self.checkBox_3.setGeometry(QtCore.QRect(10, 130, 241, 41))
font = QtGui.QFont()
font.setPointSize(8)
font.setBold(False)
font.setWeight(50)
self.checkBox_3.setFont(font)
self.checkBox_3.setObjectName("checkBox_3")
self.groupBox_2 = QtWidgets.QGroupBox(Form)
self.groupBox_2.setGeometry(QtCore.QRect(10, 220, 281, 251))
font = QtGui.QFont()
font.setPointSize(10)
font.setBold(True)
font.setItalic(False)
font.setUnderline(False)
font.setWeight(75)
font.setKerning(True)
font.setStyleStrategy(QtGui.QFont.StyleStrategy.PreferDefault)
self.groupBox_2.setFont(font)
self.groupBox_2.setObjectName("groupBox_2")
self.checkBox_4 = QtWidgets.QCheckBox(self.groupBox_2)
self.checkBox_4.setGeometry(QtCore.QRect(10, 20, 241, 41))
font = QtGui.QFont()
font.setPointSize(8)
font.setBold(False)
font.setWeight(50)
self.checkBox_4.setFont(font)
self.checkBox_4.setObjectName("checkBox_4")
self.checkBox_5 = QtWidgets.QCheckBox(self.groupBox_2)
self.checkBox_5.setGeometry(QtCore.QRect(10, 50, 241, 41))
font = QtGui.QFont()
font.setPointSize(8)
font.setBold(False)
font.setWeight(50)
self.checkBox_5.setFont(font)
self.checkBox_5.setObjectName("checkBox_5")
self.checkBox_6 = QtWidgets.QCheckBox(self.groupBox_2)
self.checkBox_6.setGeometry(QtCore.QRect(10, 80, 161, 41))
font = QtGui.QFont()
font.setPointSize(8)
font.setBold(False)
font.setWeight(50)
self.checkBox_6.setFont(font)
self.checkBox_6.setObjectName("checkBox_6")
self.pushButton = QtWidgets.QPushButton(self.groupBox_2)
self.pushButton.setGeometry(QtCore.QRect(160, 90, 101, 23))
font = QtGui.QFont()
font.setPointSize(8)
font.setBold(False)
font.setWeight(50)
self.pushButton.setFont(font)
self.pushButton.setStatusTip("")
self.pushButton.setWhatsThis("")
self.pushButton.setAccessibleDescription("")
self.pushButton.setAutoFillBackground(False)
icon = QtGui.QIcon()
icon.addPixmap(
QtGui.QPixmap(
"c:\\Users\\aky547\\GitHub\\Semesterapparate\\ui\\widgets\\../icons/information.png"
),
QtGui.QIcon.Mode.Normal,
QtGui.QIcon.State.Off,
)
self.pushButton.setIcon(icon)
self.pushButton.setCheckable(False)
self.pushButton.setChecked(False)
self.pushButton.setObjectName("pushButton")
self.retranslateUi(Form)
QtCore.QMetaObject.connectSlotsByName(Form)
def retranslateUi(self, Form):
_translate = QtCore.QCoreApplication.translate
Form.setWindowTitle(_translate("Form", "Form"))
self.group_software.setToolTip(
_translate(
"Form",
"Hier klicken, um die aDIS Abfrage in die Zwischenablage zu kopieren",
)
)
self.group_software.setTitle(_translate("Form", "Software"))
self.checkBox.setText(_translate("Form", "Apparatsdaten eingegeben"))
self.checkBox_2.setText(_translate("Form", "Medien hinzugefügt / importiert"))
self.checkBox_3.setText(
_translate("Form", "Prof-ID und Apparat-ID eingetragen")
)
self.groupBox_2.setTitle(_translate("Form", "aDIS"))
self.checkBox_4.setText(_translate("Form", "Medien geprüft"))
self.checkBox_5.setText(_translate("Form", "Medien bearbeitet"))
self.checkBox_6.setText(_translate("Form", "Apparat angelegt"))
self.pushButton.setToolTip(
_translate(
"Form",
"Hier klicken, um die aDIS Abfrage in die Zwischenablage zu kopieren",
)
)
self.pushButton.setText(_translate("Form", " aDIS Abfrage"))

View File

@@ -0,0 +1,5 @@
__all__ = ["filepicker"]
from .collapse import StatusWidget
from .filepicker import FilePicker
from .graph import GraphWidget
from .Ui_message_widget import Ui_Form as Message_Widget

View File

@@ -0,0 +1,76 @@
# import pysignal pyslot
from PyQt6.QtCore import pyqtSignal
from PyQt6.QtWidgets import (
QApplication,
QTreeWidget,
QTreeWidgetItem,
QVBoxLayout,
QWidget,
)
class StatusWidget(QWidget):
person_double_clicked = pyqtSignal(str,str, int)
def __init__(self, data, header_label: str):
super(StatusWidget, self).__init__()
self.tree_widget = QTreeWidget()
self.tree_widget.setHeaderLabels([header_label])
self.populate_tree(data)
self.header = header_label
layout = QVBoxLayout()
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()
while parent:
parent_depth += 1
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)
def populate_tree(self, data):
if data == {}:
return
def __listcount(dictlist: dict[dict[str:list]]):
ret = 0
for _, value in dictlist.items():
for _, value2 in value.items():
ret += len(value2)
return ret
listitems = __listcount(data)
for action, items in data.items():
action_item = QTreeWidgetItem(
self.tree_widget, [f"{action} ({str(listitems)})"]
)
for person, entries in items.items():
person_item = QTreeWidgetItem(
action_item, [f"{person} ({str(len(entries))})"]
)
for entry in entries:
entry_item = QTreeWidgetItem(person_item, [entry])
# Make the person entry collapsible
person_item.setExpanded(False)
# Make the action entry collapsible
action_item.setExpanded(True)
if __name__ == "__main__":
import sys
app = QApplication(sys.argv)
data = {"test": {"test2": ["test3", "test4"]}}
widget = StatusWidget(data, "test")
widget.show()
#detect emit signal
widget.person_double_clicked.connect(lambda x: print(x))
sys.exit(app.exec())

View File

@@ -0,0 +1,15 @@
from PyQt6 import QtCore, QtGui, QtWidgets
class CollapsibleWidget(object):
pass
from PyQt6 import QtCore, QtGui, QtWidgets
class CollapsibleWidget(object):
from PyQt6 import QtCore, QtGui, QtWidgets
class CollapsibleWidget(object):

View File

@@ -0,0 +1,29 @@
from PyQt6.QtWidgets import QFileDialog, QApplication
from PyQt6.QtCore import QSettings
import sys
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
filepicker.setOption(QFileDialog.Option.DontUseCustomDirectoryIcons, True)
files, _ = filepicker.getOpenFileNames(caption='Open file', directory=self.last_path)
if files:
self.last_path = files[0]
self.settings.setValue("last_path", self.last_path)
return files
if __name__ == '__main__':
app = QApplication(sys.argv)
picker = FilePicker()
files = picker.pick_files()
print(files)

49
src/ui/widgets/graph.py Normal file
View File

@@ -0,0 +1,49 @@
import matplotlib
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 PyQt6 import QtCore, QtWidgets
class graph(FigureCanvas):
def __init__(self, parent=None, width=5, height=4, dpi=100):
fig = Figure(figsize=(width, height), dpi=dpi)
self.axes = fig.add_subplot(111)
self.canvas = FigureCanvas(fig)
super().__init__(fig)
# display graph with multiple lines
class GraphWidget(QtWidgets.QWidget):
def __init__(self, parent=None, data=None, legend_labels=None):
super().__init__()
self.graph = graph(self, width=7, height=4.5, dpi=100)
self.graph.axes.plot(data["x"], data["y"], "r", data["x"], data["y2"], "b")
self.toolbar = NavigationToolbar(self.graph, self)
# set legend
self.graph.axes.legend(legend_labels, loc="upper left")
# set the layout
layout = QtWidgets.QVBoxLayout()
layout.addWidget(self.toolbar)
layout.addWidget(self.graph)
self.setLayout(layout)
# def set_area(self, top=1, bottom= 0.07, left=0.1, right=0.994,hspace=0.2,wspace=0.2):
# self.graph.
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
data = {
"x": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
"y": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
"y2": [10, 9, 8, 7, 6, 5, 4, 3, 2, 1],
}
widget = GraphWidget(data=data, legend_labels=["+", "-"])
widget.show()
sys.exit(app.exec())

View File

@@ -0,0 +1,119 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Form</class>
<widget class="QWidget" name="Form">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>295</width>
<height>110</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>10</x>
<y>0</y>
<width>47</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Apparat:</string>
</property>
</widget>
<widget class="QLineEdit" name="lineEdit">
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>60</x>
<y>0</y>
<width>41</width>
<height>20</height>
</rect>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>51</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Nachricht:</string>
</property>
</widget>
<widget class="QTextEdit" name="textEdit">
<property name="geometry">
<rect>
<x>10</x>
<y>40</y>
<width>281</width>
<height>66</height>
</rect>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="inputMethodHints">
<set>Qt::ImhNone</set>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
<widget class="QPushButton" name="pushButton">
<property name="geometry">
<rect>
<x>210</x>
<y>10</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>Löschen</string>
</property>
</widget>
<widget class="QLabel" name="hidden_id">
<property name="geometry">
<rect>
<x>140</x>
<y>10</y>
<width>47</width>
<height>13</height>
</rect>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</widget>
<tabstops>
<tabstop>lineEdit</tabstop>
<tabstop>textEdit</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,258 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Form</class>
<widget class="QWidget" name="Form">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>300</width>
<height>751</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>300</width>
<height>751</height>
</size>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<widget class="QGroupBox" name="group_software">
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>281</width>
<height>211</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="toolTip">
<string>Hier klicken, um die aDIS Abfrage in die Zwischenablage zu kopieren</string>
</property>
<property name="statusTip">
<string/>
</property>
<property name="title">
<string>Software</string>
</property>
<property name="flat">
<bool>false</bool>
</property>
<property name="checkable">
<bool>false</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<widget class="QCheckBox" name="checkBox">
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>241</width>
<height>41</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>8</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Apparatsdaten eingegeben</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_2">
<property name="geometry">
<rect>
<x>10</x>
<y>50</y>
<width>241</width>
<height>41</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>8</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Medien hinzugefügt / importiert</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_3">
<property name="geometry">
<rect>
<x>10</x>
<y>130</y>
<width>241</width>
<height>41</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>8</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Prof-ID und Apparat-ID eingetragen</string>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="groupBox_2">
<property name="geometry">
<rect>
<x>10</x>
<y>220</y>
<width>281</width>
<height>251</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<weight>75</weight>
<italic>false</italic>
<bold>true</bold>
<underline>false</underline>
<stylestrategy>PreferDefault</stylestrategy>
<kerning>true</kerning>
</font>
</property>
<property name="title">
<string>aDIS</string>
</property>
<widget class="QCheckBox" name="checkBox_4">
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>241</width>
<height>41</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>8</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Medien geprüft</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_5">
<property name="geometry">
<rect>
<x>10</x>
<y>50</y>
<width>241</width>
<height>41</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>8</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Medien bearbeitet</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBox_6">
<property name="geometry">
<rect>
<x>10</x>
<y>80</y>
<width>161</width>
<height>41</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>8</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Apparat angelegt</string>
</property>
</widget>
<widget class="QPushButton" name="pushButton">
<property name="geometry">
<rect>
<x>160</x>
<y>90</y>
<width>101</width>
<height>23</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>8</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="toolTip">
<string>Hier klicken, um die aDIS Abfrage in die Zwischenablage zu kopieren</string>
</property>
<property name="statusTip">
<string/>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="accessibleDescription">
<string/>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="text">
<string> aDIS Abfrage</string>
</property>
<property name="icon">
<iconset>
<normaloff>../icons/information.png</normaloff>../icons/information.png</iconset>
</property>
<property name="checkable">
<bool>false</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</widget>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,16 @@
from PyQt6 import QtCore, QtGui, QtWidgets
from Ui_progress_overview_widget import Ui_Form
class Progress_view(Ui_Form):
def __init__(self, MainWindow):
super().__init__()
self.setupUi(MainWindow)
self.retranslateUi(MainWindow)
self.checkBox_3.setDisabled(True)
self.pushButton.clicked.connect(self.pushButton_clicked)
def pushButton_clicked(self):
# copies text to clipboard
clipboard = QtWidgets.QApplication.clipboard()
clipboard.setText("")