diff --git a/.gitignore b/.gitignore index 7bbe72c..c5bf5ab 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ env2 +dist diff --git a/changelog.md b/changelog.md index ec07159..fed3f67 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,9 @@ # Changelog GarageCalc1 +## [0.2] - 2021-06-27 +### Added +- Warnt beim Beenden falls ungespeicherte Einträge vorhanden sind + ## [0.2] - 2021-06-27 ### Added - Möglichkeit Zeilen zu kopieren und einzufügen (sowohl Kontextmenü auf Zeilenüberschrift als auch Tastenkombination Strg+C/Strg+V) diff --git a/src/main.py b/src/main.py index 06296d6..22dbd50 100644 --- a/src/main.py +++ b/src/main.py @@ -14,7 +14,7 @@ import csv # Third party imports from PySide2.QtWidgets import QApplication, QMainWindow, QTableWidgetItem, QStatusBar, QAction, QFileDialog, \ - QAbstractItemView, QMenu, QMessageBox, QInputDialog + QAbstractItemView, QMenu, QMessageBox from PySide2.QtGui import QIcon from PySide2.QtCore import QFile, QSize, Qt from PySide2.QtUiTools import QUiLoader @@ -26,7 +26,7 @@ from utils import show_about, resource_path UI_FILE = "main.ui" APP_NAME = "Garagenraum-Rechner" APP_DISPNAME = "GarageCalc" -APP_VERSION = "v0.2" +APP_VERSION = "v0.3" APP_AUTHOR = "Paul Salajean" APP_DESCR = "Berechnet zur Verfügung stehenden Garagenraum" APP_COPYRIGHT = "(c) Paul Salajean 2021" @@ -115,7 +115,7 @@ class MyMainWindow(QMainWindow): self.actionQuit = QAction() self.actionQuit.setIcon(QIcon(resource_path(ICON_QUIT))) - self.actionQuit.triggered.connect(QApplication.quit) + self.actionQuit.triggered.connect(self.app_quit) self.actionQuit.setShortcut("Ctrl+Q") self.actionQuit.setToolTip("Programm beenden (Strg+Q)") @@ -286,6 +286,15 @@ class MyMainWindow(QMainWindow): self.ui.efVol_Free.setStyleSheet("") self.is_modified = False + def app_quit(self): + if self.is_modified: + msg = "Es existieen ungespeicherte Einträge. Ohne Speichern sind alle Änderungen verloren. Trotzdem fortfahren?" + reply = QMessageBox.question(self, "Beenden", msg, \ + QMessageBox.Yes | QMessageBox.No, QMessageBox.Yes) + if reply == QMessageBox.No: + return False + QApplication.quit() + def file_new(self): if self.is_modified: msg = "Es wurden bereits Einträge manuell geändert. Ohne Speichern sind alle Änderungen verloren. Trotzdem fortfahren?"