diff --git a/notizen_w/n.py b/notizen_w/n.py index 09e41bd..db5416f 100644 --- a/notizen_w/n.py +++ b/notizen_w/n.py @@ -52,25 +52,69 @@ def neditadd(notiz=str,text=str): datei.write(crypt(text, passwort)) datei.close() return back +class eigene_fenster: + def welcome_w(): + w_welcome = tk.Tk() + w_welcome.title("Welcome zu n") + w_welcome.geometry("450x300") -class tkf : - def close_w() : - global passwort - passwort = l_wpassword.get() - w_welcome.destroy() + 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) + 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) - - def refresh_list(): + return passwort + + 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]) - def notiz_auswahl(): - w_auswahl = tk.Tk() - l_wtauswahl = tk.Label(w_auswahl, text="Notiz:") - l_wtauswahl.pack() - tkf.dropdown(nlist()[1],w_auswahl) + l_nlist = tk.Label(w_main, textvariable=notiz_list) + l_nlist.pack() + w_main.mainloop() - def edit_notiz(title): - notiz = o(title,"r") + +class eigene_dialoge: + def notiz_dialog(title): + notiz = "inhalt"#o(title,"r") w_editnotiz = tk.Tk() + def cancel(): + w_editnotiz.destroy + def ok(): + w_editnotiz.destroy l_wttitle = tk.Label(w_editnotiz, text="Titel:") l_wtitle = tk.Entry(w_editnotiz) @@ -78,8 +122,8 @@ class tkf : l_wtinhalt = tk.Label(w_editnotiz, text="Inhalt:") l_winhalt = tk.Entry(w_editnotiz) l_winhalt.insert(0,notiz.read()) - l_button_save = tk.Button(w_editnotiz, text="Save" ,command=tkf.close_w) - l_button_cancel = tk.Button(w_editnotiz, text="Abbrechen" ,command=w_editnotiz.destroy) + l_button_save = tk.Button(w_editnotiz, text="Save" ,command=ok) + l_button_cancel = tk.Button(w_editnotiz, text="Abbrechen" ,command=cancel) l_wttitle.pack() l_wtitle.pack() @@ -91,6 +135,17 @@ class tkf : l_button_save.pack(fill="x") l_button_cancel.pack(fill="x") 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(): messagebox.showinfo("help", """Hilfe: @@ -136,62 +191,13 @@ if not os.path.exists(f"{n_path}n{tzeichen}"): messagebox.showinfo("Verzeichniss","Notizenverzeichniss angelegt.") n_path += "n"+tzeichen -tkf.edit_notiz("test") - +print(eigene_dialoge.notiz_dialog("test")) +exit() # Welcome screen -w_welcome = tk.Tk() -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() +passwort = eigene_fenster.welcome_w() # main fenster -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=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() - +eigene_fenster.main() ## start exit() diff --git a/notizen_w/n/banane.txt b/notizen_w/n/banane.txt deleted file mode 100644 index 4dd13a6..0000000 --- a/notizen_w/n/banane.txt +++ /dev/null @@ -1,2 +0,0 @@ -^S -Q T^R WZ \ No newline at end of file