password protected Reset Account

This commit is contained in:
2025-01-10 14:16:45 +01:00
parent 0c179b7191
commit 6fa7a82c26
11 changed files with 39 additions and 35 deletions
+20 -4
View File
@@ -12,9 +12,9 @@ from qtpy.QtGui import QColor, QPixmap
from qtpy.QtCore import __version__ as QT_VERSION_STR
from qtpy.QtCore import QEventLoop, Qt, QTimer, Slot
from qtpy.QtWidgets import (
QApplication, QFrame, QGridLayout, QGroupBox, QHBoxLayout, QLabel,
QMessageBox, QPushButton, QSpacerItem, QTabBar, QTabWidget,
QTableWidgetItem, QTextEdit, QWidget)
QApplication, QFrame, QGridLayout, QGroupBox, QHBoxLayout, QInputDialog,
QLabel, QLineEdit, QMessageBox, QPushButton, QSpacerItem, QTabBar,
QTabWidget, QTableWidgetItem, QTextEdit, QWidget)
try:
import elog
@@ -1327,6 +1327,7 @@ class AppGui(QWidget):
def clear_saving(self, sector_prefix_list: list = None):
if not sector_prefix_list:
return
'''
qm = QMessageBox()
mess = ("This action will reset the energy saving account to zero. \n" +
"This is typically undertaken at the end of the calendar " +
@@ -1338,7 +1339,22 @@ class AppGui(QWidget):
if reply == QMessageBox.No:
return
'''
qd = QInputDialog(self)
#pwedit = QLineEdit()
mess = ("To execute the reset,\nplease enter the password:")
text, ok = qd.getText(None, "Reset Account", mess,
QLineEdit.Password)
if ok and text:
if text.upper()!= self.settings.data["Reset"]:
qmb = QMessageBox(qd)
mess = "Incorrect password!\nTry Reset Account once again."
qmb.information(self, "Reset Account", mess)
return
else:
return
self.parent.prepare_elog_message()
print("message", self.parent.message)
print("logbook", self.parent.logbook, flush=True)