Пример #1
0
    def review_window(self, name):
        self.reviewwindow = tk.Toplevel(self)
        self.reviewwindow.geometry("350x50")
        review_deck = dark_fns.determine_review(name)
        back_front = review_deck.copy()
        self.var = tk.IntVar(self)

        self.labl = tk.Label(self.reviewwindow, text=review_deck[0][2])
        self.labl.pack(side="top")
        self.ans = tk.Entry(self.reviewwindow)
        self.ans.pack(side="top")
        self.ans.config(state="normal")

        print(review_deck)
        for i in review_deck:
            # self.labl = tk.Label(self.reviewwindow, text=i[2])
            # self.labl.pack(side="top")
            # self.ans = tk.Entry(self.reviewwindow)
            # self.ans.pack(side="top")
            self.ans.config(state="normal")
            self.ans.bind('<Return>', lambda x: self.correct_or_not(i, review_deck))
            self.ans.wait_variable(self.var)
        for i in back_front:
            # self.labl = tk.Label(self.reviewwindow, text=i[3])
            # self.labl.pack(side="top")
            # self.ans = tk.Entry(self.reviewwindow)
            # self.ans.pack(side="top")
            self.ans.config(state="normal")
            self.ans.bind('<Return>', lambda x: self.not_or_correct(i, back_front))
            self.ans.wait_variable(self.var)
Пример #2
0
    def load_display_decks(self):
        # listbox = tk.Listbox(self)
        # listbox.grid(column=0)

        decks = dark_fns.get_list_of_decks()
        tk.Label(self, text="List of All Decks:\tTotal Items\tFor Review").grid(column=0)
        labels = []
        for i in decks:
            num = dark_fns.get_card_id(i)
            num1 = dark_fns.determine_review(i)
            labels.append(tk.Label(self, text=i+"\t"+str(num)+"\t"+str(len(num1)*2)))
            # label.grid(column=0)
            # label.bind("<Button-1>", lambda e: self.review_window(i))

        for x in range(0, len(labels)):
            labels[x].grid(column=0)
            #listbox.insert(tk.END, labels[x].cget("text"))
            labels[x].bind("<Button-1>", lambda event, bound_x=x: self.review_window(decks[bound_x]))
Пример #3
0
def review_window(self, event):
    widget = event.widget
    cs = widget.curselection()
    name = ""
    decks = dark_fns.get_list_of_decks()
    for i in cs:
        name = decks[i]

    self.reviewwindow = tk.Toplevel(self)
    self.reviewwindow.geometry("350x50")
    review_deck = dark_fns.determine_review(name)
    back_front = review_deck.copy()
    self.var = tk.IntVar(self)

    self.labl = tk.Label(self.reviewwindow, text=review_deck[0][2])
    self.labl.pack(side="top")
    self.ans = tk.Entry(self.reviewwindow)
    self.ans.pack(side="top")
    self.ans.config(state="normal")

    print(review_deck)
    for i in review_deck:
        # self.labl = tk.Label(self.reviewwindow, text=i[2])
        # self.labl.pack(side="top")
        # self.ans = tk.Entry(self.reviewwindow)
        # self.ans.pack(side="top")
        self.ans.config(state="normal")
        self.ans.bind('<Return>',
                      lambda x: correct_or_not(self, i, review_deck))
        self.ans.wait_variable(self.var)
    if dark_fns.get_backfront():
        for i in back_front:
            # self.labl = tk.Label(self.reviewwindow, text=i[3])
            # self.labl.pack(side="top")
            # self.ans = tk.Entry(self.reviewwindow)
            # self.ans.pack(side="top")
            self.ans.config(state="normal")
            self.ans.bind('<Return>',
                          lambda x: not_or_correct(self, i, review_deck))
            self.ans.wait_variable(self.var)
Пример #4
0
    def load_display_decks(self):
        testframe = tk.Frame(self)
        listbox = tk.Listbox(testframe)
        scrollbar = tk.Scrollbar(testframe, orient="vertical")

        decks = dark_fns.get_list_of_decks()
        tk.Label(
            self,
            text="List of All Decks:\tTotal Items\tFor Review").grid(column=0)

        for i in decks:
            num = dark_fns.get_card_id(i)
            num1 = dark_fns.determine_review(i)
            listbox.insert(tk.END,
                           i + "    " + str(num) + "    " + str(len(num1) * 2))

        listbox.bind("<Double-1>", partial(dark_review.review_window, self))
        listbox.pack(side="left")

        listbox.config(yscrollcommand=scrollbar.set)
        scrollbar.config(command=listbox.yview)
        scrollbar.pack(side="right", fill="y")
        testframe.grid(column=0)


#in order of easiest
#               |
#              \ /
#            hardest
#TODO: DONE[make it populate a list of decks], DONE[add deck] and DONE[card button], make it look not like crap.
#TODO: delete deck button
#TODO: [kinda already does it?]check review then [DONE]make the reviews
#TODO: [DONE]setting options: back to front review option and manual interval setup
#TODO: [DONE]find/[DONE]edit/[DONE]delete cards
#TODO: [DONE]ReOrganize and Tests

#ISSUES:
#[RESOLVED]review_deck in correct_or functions becomes complete garbage and not letting the index function work
#[RESOLVED]the entry and label entries wont delete and remake themselves
#[RESOLVED]the deck_name labels all open the same deck which is the last created deck.
 def test3_determine_review(self):
     review = determine_review("testnamedeck")
     self.assertEqual(review[0][3], "testback")