Passwortschutz eingeführt.

This commit is contained in:
2024-07-25 16:39:55 +02:00
parent bff7daff82
commit 2563626def

24
main.py
View File

@@ -1,5 +1,5 @@
import tkinter as tk
from tkinter import ttk, messagebox, PhotoImage
from tkinter import ttk, messagebox, PhotoImage, simpledialog
import customtkinter
customtkinter.set_appearance_mode("light")
customtkinter.set_default_color_theme("blue")
@@ -509,14 +509,20 @@ class ArduinoGUI:
messagebox.showerror("Fehler", "Ausgewählte PID Konfiguration nicht gefunden.")
def on_closing(self):
self.running = False
if self.arduino:
self.arduino.close()
self.communication_thread = None
if self.ser:
self.ser.close()
self.root.quit()
self.root.destroy()
userInput = simpledialog.askstring("Masterpasswort eingeben", "Zum Ausführen dieses Befehls ist das Masterpasswort notwendig.\n")
if userInput == "changeme":
self.running = False
if self.arduino:
self.arduino.close()
self.communication_thread = None
if self.ser:
self.ser.close()
self.root.quit()
self.root.destroy()
elif userInput == None:
pass
else:
messagebox.showerror("Fehler", "Es wurde ein falsches Passwort eingegeben.")
if __name__ == "__main__":
root = customtkinter.CTk()