diff --git a/README.md b/README.md index e69de29..4ea5b34 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,31 @@ +# Study Dashboard + +## Pakete +- PySide6 +- dependency-injector + + +## Einrichten der Entwicklungsumgebung + +```bash +# Projekt herunterladen +git clone https://git.ghostnet.selfhost.eu/spektr/study-dashboard.git +cd study-dashboard + +# Virtuelle Umgebung erstellen +python -m venv .venv + +# Aktivieren (Linux/macOS) +source .venv/bin/activate + +# Aktivieren (Windows) +.venv\Scripts\activate + +# Abhängigkeiten aktualisieren +pip install -r requirements.txt +``` + +## Starten +```bash +python -m src.study-dashboard.main +``` diff --git a/requirements.txt b/requirements.txt index e69de29..a5b7f4f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -0,0 +1,13 @@ +# Runtime dependencies +PySide6 >= 6.4 +dependency-injector >= 4.41 + +# Development tools +# Testing & Type Checking +pytest >= 7.0 +mypy >= 1.0 + +# Code quality & Formating +black >= 23.0 +flake8 >= 6.0 +# pylint diff --git a/src/study-dashboard/di_container.py b/src/study-dashboard/di_container.py index e69de29..5a46981 100644 --- a/src/study-dashboard/di_container.py +++ b/src/study-dashboard/di_container.py @@ -0,0 +1,20 @@ +""" +Module: +Author: Marcel König +Description: +""" + +from dependency_injector import containers, providers +from .services.data_provider import DataProvider + +class ApplicationContainer(containers.DeclarativeContainer): + # Configuration + # config = providers.Configuration() + + # Services + # business_service = providers.Single( + # BusinessService, + # config=config.business + # ) + dataProvider = providers.Singleton(DataProvider) + \ No newline at end of file diff --git a/src/study-dashboard/gui/mainView.py b/src/study-dashboard/gui/mainView.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/study-dashboard/gui/main_view.py b/src/study-dashboard/gui/main_view.py new file mode 100644 index 0000000..f1e97c9 --- /dev/null +++ b/src/study-dashboard/gui/main_view.py @@ -0,0 +1,19 @@ +""" +Module: gui.mainView + +Dieses Modul enthält die Hauptfenster-Definition für die Qt-basierte GUI. +""" + +from PySide6.QtWidgets import QMainWindow, QLabel + +class MainView(QMainWindow): + def __init__(self, data_provider): + super().__init__() + self.setWindowTitle("Studien-Dashboard") + self.resize(800, 600) + + self.data_provider = data_provider + + label = QLabel(str(self.data_provider.get_all()), self) + self.setCentralWidget(label) + \ No newline at end of file diff --git a/src/study-dashboard/main.py b/src/study-dashboard/main.py index e69de29..021ef61 100644 --- a/src/study-dashboard/main.py +++ b/src/study-dashboard/main.py @@ -0,0 +1,31 @@ +""" +Module: +Author: Marcel König +Description: +""" + +import sys +from PySide6.QtWidgets import QApplication +from .di_container import ApplicationContainer +from .gui.main_view import MainView + +def main(): + container = ApplicationContainer() + # container.config.from_dict( + # { + # "business": { + # "setting1": "value1", + # "setting2": "value" + # } + # } + # ) + + app = QApplication(sys.argv) + window = MainView(data_provider=container.dataProvider()) + window.show() + + sys.exit(app.exec()) + +if __name__ == "__main__": + main() + \ No newline at end of file diff --git a/src/study-dashboard/services/business_logic.py b/src/study-dashboard/services/business_logic.py deleted file mode 100644 index e69de29..0000000 diff --git a/src/study-dashboard/services/data_provider.py b/src/study-dashboard/services/data_provider.py new file mode 100644 index 0000000..7a0493b --- /dev/null +++ b/src/study-dashboard/services/data_provider.py @@ -0,0 +1,26 @@ +class DataProvider: + def __init__(self): + self._data = { "foo": { "id": "foo", "value": "bar" } } + + def get_all(self): + return list(self._data.values()) + + def get(self, item_id): + return self._data.get(item_id, None) + + def create(self, data): + self._data[data['id']] = data + return data + + def update(self, item_id, data): + if item_id in self._data: + self._data[item_id].update(data) + return self._data[item_id] + return None + + def delete(self, item_id): + if item_id in self._data: + del self._data[item_id] + return True + return False + \ No newline at end of file