Пример #1
0
 def delete_button_clicked(self, note_id, application_name):
     db = database.DatabaseQueries()
     db.delete_note(note_id)
     self.edit_window.destroy()
     for child in self.framefornote.winfo_children():
         child.destroy()
     self.display_notes(application_name)
Пример #2
0
 def save_changes_button_clicked(self, note_id, application_name):
     db = database.DatabaseQueries()
     db.edit_note(note_id, time.strftime("%Y-%m-%d %H:%M"),
                  self.text2.get("1.0", 'end-1c'))
     self.edit_window.destroy()
     for child in self.framefornote.winfo_children():
         child.destroy()
     self.display_notes(application_name)
Пример #3
0
 def save_button_clicked(self, application_name):
     db = database.DatabaseQueries()
     db.save_note(time.strftime("%Y-%m-%d %H:%M"),
                  self.text1.get("1.0", 'end-1c'), application_name)
     self.add_new_window.destroy()
     for child in self.framefornote.winfo_children():
         child.destroy()
     self.display_notes(application_name)
Пример #4
0
    def list_button_clicked(self):

        self.open_window = Toplevel(self.main_window)
        self.open_window.wm_attributes('-topmost', True)
        self.open_window.minsize(200, 350)
        self.open_window.maxsize(200, 500)

        self.list_menu_button = Menubutton(self.open_window)
        self.list_menu_button.config(bd=0)
        self.list_menu = Menu(self.list_menu_button)
        self.list_menu.config(tearoff=0)
        self.list_menu_button["menu"] = self.list_menu
        self.list_menu_button.pack()

        self.canvas2 = Canvas(self.open_window, borderwidth=0)
        self.vsb2 = Scrollbar(self.open_window,
                              orient="vertical",
                              command=self.canvas2.yview)
        self.canvas2.configure(yscrollcommand=self.vsb2.set)

        self.vsb2.pack(side="right", fill="y")
        self.canvas2.pack(side="left", fill=X)

        self.list_area = Frame(self.canvas2)
        self.canvas2.create_window((0, 0),
                                   window=self.list_area,
                                   tags="self.list_area")
        self.list_area.bind("<Configure>", self.onFrameConfigure2)

        db = database.DatabaseQueries()
        apps = db.get_application_list()

        self.list_menu.add_command(
            label="all", command=lambda all_apps=apps: self.list_all(all_apps))
        for app in apps:
            self.list_menu.add_command(label=app,
                                       command=lambda application=app: self.
                                       list_by_application(application))
        self.list_all(apps)
Пример #5
0
    def edit_note(self, application_name, note_id):
        self.edit_window = Toplevel(self.main_window)
        self.edit_window.title('Edit Note')
        x = self.edit_window.winfo_screenwidth() - 520
        self.edit_window.geometry('250x150+%d+100' % (x))
        self.edit_window.resizable(width=False, height=False)
        self.edit_window.config(bd=0)

        self.label4 = Label(self.edit_window)
        self.label4.config(text=application_name)
        self.label4.pack(side=TOP, fill=X)

        self.text2 = Text(self.edit_window)
        db = database.DatabaseQueries()
        self.text2.insert(END, db.get_note_by_id(note_id))
        self.text2.config(wrap=WORD, height=3)
        self.text2.pack(fill=BOTH, expand=1)

        self.edit_panel = Frame(self.edit_window)
        self.edit_panel.pack(side=BOTTOM, fill=X)

        self.photo_save = PhotoImage(file="save.png")
        self.save_changes_button = Button(self.edit_panel)
        self.save_changes_button.config(
            image=self.photo_save,
            bd=0,
            command=lambda temp=note_id, application=application_name: self.
            save_changes_button_clicked(temp, application))
        self.save_changes_button.pack(side=LEFT)

        self.photo_delete = PhotoImage(file="delete.png")
        self.delete_button = Button(self.edit_panel)
        self.delete_button.config(
            image=self.photo_delete,
            bd=0,
            command=lambda temp=note_id, application=application_name: self.
            delete_button_clicked(temp, application))
        self.delete_button.pack(side=RIGHT)
Пример #6
0
    def list_all(self, apps):
        self.list_menu_button.config(text="all")

        for child in self.canvas2.winfo_children():
            child.destroy()
        self.list_area = Frame(self.canvas2)
        #self.list_area.pack(fill = X, expand = 1)
        self.list_area.bind("<Configure>", self.onFrameConfigure2)
        self.canvas2.create_window((0, 0),
                                   window=self.list_area,
                                   tags="self.list_area")
        '''
        #self.vsb2 = Scrollbar(self.open_window, orient="vertical", command=self.canvas2.yview)
        #self.vsb2.pack(side="right", fill="y")
        #self.canvas2.configure(yscrollcommand=self.vsb2.set)
        #self.canvas2.pack(side="left", fill="both", expand=True)
        '''
        for app in apps:
            db = database.DatabaseQueries()
            notes = db.get_notes_by_application(app)
            for note in notes:
                note_id = str(note[0])
                note_text = note[2]
                application_name = note[3]
                self.single_note_entry = Label(self.list_area,
                                               anchor=W,
                                               justify=LEFT)
                self.single_note_entry.bind(
                    "<1>",
                    lambda event, application=application_name, temp=note_id:
                    self.OnClick(event, application, temp))
                self.single_note_entry.config(text=(note_text + " | " +
                                                    application_name),
                                              wraplength=160,
                                              bg="white")
                self.single_note_entry.pack(fill=X, expand=1, padx=5, pady=5)

            db.database_connection.close()
Пример #7
0
 def display_notes(self, application_name):
     db = database.DatabaseQueries()
     notes = db.get_notes_by_application(application_name)
     self.display(notes)
     db.database_connection.close()
Пример #8
0
    def OnClick(self, event, application_name, note_id):

        db = database.DatabaseQueries()
        notes = self.edit_note(application_name, note_id)