コード例 #1
0
ファイル: notes.py プロジェクト: Ghalko/noteTaker
 def prev(self):
     self.f1 = Frame(self.f)
     self.days = Days(master=self.f1, ncore=self.nc, project=self.title)
     self.p = self.days.get_current()
コード例 #2
0
ファイル: notes.py プロジェクト: spider2449/noteTaker
 def prev(self):
     self.f1 = Frame(self.f)
     self.days = Days(master=self.f1, ncore=self.nc, project=self.title)
     self.p = self.days.get_current()
コード例 #3
0
ファイル: notes.py プロジェクト: Ghalko/noteTaker
class ProjectArea(object):
    '''Main area for note taking and skimming. Also has time button.'''
    def __init__(self, parent, title, tcmd):
        self.remove = parent.rproject   #Remove function
        self.move = parent.move         #Move function
        self.nc = parent.nc
        self.title = title
        self.tcmd = tcmd #passed in from timehandler
        self.lock = 0
        self.going = parent.going
        self.stopped = parent.stopped
        self.pdate = None
        self.f = Frame(parent.f, relief=RAISED, borderwidth=2)
        f2 = Frame(self.f)
        f2.pack()
        l = Label(f2, text=title, width=42, font=("Helvetica", 16))
        l.pack(side=LEFT)
        l.bind("<Button-1>", self._click)
        self.b = Button(f2, image=self.stopped, command=self._timer)
        self.b.pack(side=LEFT)
        Button(f2, text='X', command=self.close).pack(side=LEFT)
        self.prev()
        self.entry = Text(self.f1, width=80, height=10, bg='white', wrap=WORD)
        self.entry.bind("<Shift-Key-Return>", self.commit_note)
        self.entry.bind("<Control-Key-Return>", self.p.gui_refresh)
        self.f.pack()

    def prev(self):
        self.f1 = Frame(self.f)
        self.days = Days(master=self.f1, ncore=self.nc, project=self.title)
        self.p = self.days.get_current()

    def _click(self, event=None):
        self.move(title=self.title)

    def ent(self):
        self.f1.pack()
        self.entry.pack()
        self.entry.focus_set()

    def lv(self):
        if self.lock == 0:
            self.f1.pack_forget()
            self.entry.pack_forget()

    def commit_note(self, event=None, initial=None):
        if initial is not None:
            s = "Open"
        else:
            s = self.entry.get('1.0', END).strip()
        # Does not commit empty notes.
        if s == "":
            return
        t = datetime.datetime.now() #time
        d = int(t.strftime("%Y%m%d"))
        t = int(t.strftime("%H%M"))
        self.nc.note_in(self.title, s, d, t)
        self.entry.delete('0.0', END)
        self.entry.mark_set("insert", "%d.%d" % (1, 0))
        if d == self.p.date:
            self.p.gui_refresh()
        else:
            self.days.append(d)
            self.p = self.days.get_current()

    def _timer(self):
        """
        Timer button. Calls tcmd to start or stop the timer.
        Switches the images.
        """
        temp = self.tcmd()
        if temp:
            self.b.config(image=self.going)
        else:
            self.b.config(image=self.stopped)
        self.b.pack()

    def close(self):
        self.tcmd(close=1) #stops the timer when closing.
        self.remove(self.title)
        self.nc.archive_project(self.title)
        self.f.pack_forget()
        self.f.destroy()
コード例 #4
0
ファイル: notes.py プロジェクト: spider2449/noteTaker
class ProjectArea(object):
    '''Main area for note taking and skimming. Also has time button.'''
    def __init__(self, parent, title, tcmd):
        self.remove = parent.rproject  #Remove function
        self.move = parent.move  #Move function
        self.nc = parent.nc
        self.title = title
        self.tcmd = tcmd  #passed in from timehandler
        self.lock = 0
        self.going = parent.going
        self.stopped = parent.stopped
        self.pdate = None
        self.f = Frame(parent.f, relief=RAISED, borderwidth=2)
        f2 = Frame(self.f)
        f2.pack()
        l = Label(f2, text=title, width=42, font=("Helvetica", 16))
        l.pack(side=LEFT)
        l.bind("<Button-1>", self._click)
        self.b = Button(f2, image=self.stopped, command=self._timer)
        self.b.pack(side=LEFT)
        Button(f2, text='X', command=self.close).pack(side=LEFT)
        self.prev()
        self.entry = Text(self.f1, width=80, height=10, bg='white', wrap=WORD)
        self.entry.bind("<Shift-Key-Return>", self.commit_note)
        self.entry.bind("<Control-Key-Return>", self.p.gui_refresh)
        self.f.pack()

    def prev(self):
        self.f1 = Frame(self.f)
        self.days = Days(master=self.f1, ncore=self.nc, project=self.title)
        self.p = self.days.get_current()

    def _click(self, event=None):
        self.move(title=self.title)

    def ent(self):
        self.f1.pack()
        self.entry.pack()
        self.entry.focus_set()

    def lv(self):
        if self.lock == 0:
            self.f1.pack_forget()
            self.entry.pack_forget()

    def commit_note(self, event=None, initial=None):
        if initial is not None:
            s = "Open"
        else:
            s = self.entry.get('1.0', END).strip()
        # Does not commit empty notes.
        if s == "":
            return
        t = datetime.datetime.now()  #time
        d = int(t.strftime("%Y%m%d"))
        t = int(t.strftime("%H%M"))
        self.nc.note_in(self.title, s, d, t)
        self.entry.delete('0.0', END)
        self.entry.mark_set("insert", "%d.%d" % (1, 0))
        if d == self.p.date:
            self.p.gui_refresh()
        else:
            self.days.append(d)
            self.p = self.days.get_current()

    def _timer(self):
        """
        Timer button. Calls tcmd to start or stop the timer.
        Switches the images.
        """
        temp = self.tcmd()
        if temp:
            self.b.config(image=self.going)
        else:
            self.b.config(image=self.stopped)
        self.b.pack()

    def close(self):
        self.tcmd(close=1)  #stops the timer when closing.
        self.remove(self.title)
        self.nc.archive_project(self.title)
        self.f.pack_forget()
        self.f.destroy()