This commit is contained in:
Michael S. 2023-11-20 20:20:46 +01:00
parent 23036dd928
commit 464f81b059
2 changed files with 75 additions and 71 deletions

View file

@ -52,25 +52,69 @@ def neditadd(notiz=str,text=str):
datei.write(crypt(text, passwort)) datei.write(crypt(text, passwort))
datei.close() datei.close()
return back return back
class eigene_fenster:
def welcome_w():
w_welcome = tk.Tk()
w_welcome.title("Welcome zu n")
w_welcome.geometry("450x300")
class tkf : l_wtext = tk.Label(w_welcome, text="""
def close_w() : ACHTUNG: Falls du dein Passwort falsch eingibst überprüfe
global passwort erst ob deine Notizen richtig angezeigt werden sonnst falls
passwort = l_wpassword.get() du eine neue Notiz erstellst wird sie anderst verschlüsselt.
w_welcome.destroy()
ACHTUNG: Es kann seine das einige Zeichen wie Umlaute falsch
angezeigt werden können.
Passwort:""")
l_wpassword = tk.Entry(w_welcome)
l_wbutton = tk.Button(w_welcome, text="Start" ,command=w_welcome.destroy)
l_wtext.pack()
l_wpassword.pack()
l_wbutton.pack(fill="x")
w_welcome.mainloop()
#w_welcome.destroy()
passwort = "hallo" #l_wpassword.get()
passwort = sha512(passwort) passwort = sha512(passwort)
return passwort
def refresh_list(): def main():
w_main = tk.Tk()
w_main.title("n")
w_main.geometry("800x600")
menu = tk.Menu(w_main)
w_main.config(menu=menu)
nmenu = tk.Menu(menu, tearoff=0)
menu.add_cascade(label="n", menu=nmenu)
#nmenu.add_command(label="New", command=)
nmenu.add_command(label="refresh", command=tkf.refresh_list)
nmenu.add_command(label="edit", command=eigene_dialoge.notiz_dialog)
#nmenu.add_command(label="delete", command=tkf.nlist)
moremenu = tk.Menu(menu, tearoff=0)
menu.add_cascade(label="more", menu=moremenu)
moremenu.add_command(label="secure", command=tkf.secure)
moremenu.add_command(label="help", command=tkf.help)
moremenu.add_command(label="debug", command=tkf.debug)
global notiz_list
notiz_list = tk.StringVar()
notiz_list.set(nlist()[0]) notiz_list.set(nlist()[0])
def notiz_auswahl(): l_nlist = tk.Label(w_main, textvariable=notiz_list)
w_auswahl = tk.Tk() l_nlist.pack()
l_wtauswahl = tk.Label(w_auswahl, text="Notiz:") w_main.mainloop()
l_wtauswahl.pack()
tkf.dropdown(nlist()[1],w_auswahl)
def edit_notiz(title):
notiz = o(title,"r") class eigene_dialoge:
def notiz_dialog(title):
notiz = "inhalt"#o(title,"r")
w_editnotiz = tk.Tk() w_editnotiz = tk.Tk()
def cancel():
w_editnotiz.destroy
def ok():
w_editnotiz.destroy
l_wttitle = tk.Label(w_editnotiz, text="Titel:") l_wttitle = tk.Label(w_editnotiz, text="Titel:")
l_wtitle = tk.Entry(w_editnotiz) l_wtitle = tk.Entry(w_editnotiz)
@ -78,8 +122,8 @@ class tkf :
l_wtinhalt = tk.Label(w_editnotiz, text="Inhalt:") l_wtinhalt = tk.Label(w_editnotiz, text="Inhalt:")
l_winhalt = tk.Entry(w_editnotiz) l_winhalt = tk.Entry(w_editnotiz)
l_winhalt.insert(0,notiz.read()) l_winhalt.insert(0,notiz.read())
l_button_save = tk.Button(w_editnotiz, text="Save" ,command=tkf.close_w) l_button_save = tk.Button(w_editnotiz, text="Save" ,command=ok)
l_button_cancel = tk.Button(w_editnotiz, text="Abbrechen" ,command=w_editnotiz.destroy) l_button_cancel = tk.Button(w_editnotiz, text="Abbrechen" ,command=cancel)
l_wttitle.pack() l_wttitle.pack()
l_wtitle.pack() l_wtitle.pack()
@ -91,6 +135,17 @@ class tkf :
l_button_save.pack(fill="x") l_button_save.pack(fill="x")
l_button_cancel.pack(fill="x") l_button_cancel.pack(fill="x")
w_editnotiz.mainloop() w_editnotiz.mainloop()
return [l_wtitle.get(),l_winhalt.get()]
class tkf :
def refresh_list():
notiz_list.set(nlist()[0])
def notiz_auswahl():
w_auswahl = tk.Tk()
l_wtauswahl = tk.Label(w_auswahl, text="Notiz:")
l_wtauswahl.pack()
tkf.dropdown(nlist()[1],w_auswahl)
def help(): def help():
messagebox.showinfo("help", """Hilfe: messagebox.showinfo("help", """Hilfe:
@ -136,62 +191,13 @@ if not os.path.exists(f"{n_path}n{tzeichen}"):
messagebox.showinfo("Verzeichniss","Notizenverzeichniss angelegt.") messagebox.showinfo("Verzeichniss","Notizenverzeichniss angelegt.")
n_path += "n"+tzeichen n_path += "n"+tzeichen
tkf.edit_notiz("test") print(eigene_dialoge.notiz_dialog("test"))
exit()
# Welcome screen # Welcome screen
w_welcome = tk.Tk() passwort = eigene_fenster.welcome_w()
w_welcome.title("Welcome zu n")
w_welcome.geometry("450x300")
l_wtext = tk.Label(w_welcome, text="""
ACHTUNG: Falls du dein Passwort falsch eingibst überprüfe
erst ob deine Notizen richtig angezeigt werden sonnst falls
du eine neue Notiz erstellst wird sie anderst verschlüsselt.
ACHTUNG: Es kann seine das einige Zeichen wie Umlaute falsch
angezeigt werden können.
Passwort:""")
l_wpassword = tk.Entry(w_welcome)
selected_option = tk.StringVar()
l_wbutton = tk.Button(w_welcome, text="Start" ,command=tkf.close_w)
l_wtext.pack()
l_wpassword.pack()
l_wbutton.pack(fill="x")
w_welcome.mainloop()
# main fenster # main fenster
w_main = tk.Tk() eigene_fenster.main()
w_main.title("n")
w_main.geometry("800x600")
menu = tk.Menu(w_main)
w_main.config(menu=menu)
nmenu = tk.Menu(menu, tearoff=0)
menu.add_cascade(label="n", menu=nmenu)
#nmenu.add_command(label="New", command=)
nmenu.add_command(label="refresh", command=tkf.refresh_list)
nmenu.add_command(label="edit", command=tkf.edit_notiz)
#nmenu.add_command(label="delete", command=tkf.nlist)
moremenu = tk.Menu(menu, tearoff=0)
menu.add_cascade(label="more", menu=moremenu)
moremenu.add_command(label="secure", command=tkf.secure)
moremenu.add_command(label="help", command=tkf.help)
moremenu.add_command(label="debug", command=tkf.debug)
notiz_list = tk.StringVar()
notiz_list.set(nlist()[0])
l_nlist = tk.Label(w_main, textvariable=notiz_list)
l_nlist.pack()
w_welcome.mainloop()
## start ## start
exit() exit()

View file

@ -1,2 +0,0 @@
^S
Q T^R WZ