Example #1
0
    def createWidgets(self):
        self.searchBox = rusEntry.Entry(self,
                                        font=(lambda x: self.cget('font'), 24),
                                        width=45)
        self.searchBox.bind(
            '<<textEntered>>',
            lambda event: self.updateResults(args=event, w=self.searchBox))
        self.searchBox.grid()

        self.backButton = tk.Button(self, text="Go back", command=self.goback)
        self.backButton.grid(column=1, row=0, sticky='n')

        self.resultsFrame = tk.Frame(self)
        self.resultsFrame.grid(column=0, row=1)
        self.resultsLBoxScrollBar = tk.Scrollbar(self.resultsFrame,
                                                 orient=tk.VERTICAL)
        self.resultsLBoxScrollBar.pack(side=tk.RIGHT, fill=tk.Y)

        self.resultsLBox = tk.Listbox(
            self.resultsFrame,
            font=(lambda x: self.cget('font'), 12),
            selectmode="BROWSE",
            exportselection=0,
            width=90,
            name="results",
            yscrollcommand=self.resultsLBoxScrollBar.set)
        self.resultsLBox.pack()
        self.resultsLBox.bind('<<ListboxSelect>>', self.resultsLBoxSelect)

        self.resultsLBoxScrollBar.config(command=self.resultsLBox.yview)

        self.frame = tk.Frame(self)
        self.frame.grid(row=2, column=0)

        self.updateResults(args=True)
Example #2
0
    def createEditDeckWidgets(self, frame, deck):
        for w in frame.winfo_children():
            w.destroy()

        self.deckNameLabel = tk.Label(frame, text="Deck Name")
        self.deckNameLabel.grid(row=0, column=0)

        self.deckNameEntry = rusEntry.Entry(frame, width=50)
        self.deckNameEntry.insert(0, deck)
        self.deckNameEntry.grid(row=0, column=1)

        self.saveButton = tk.Button(frame,
                                    text="Save",
                                    command=lambda: self.saveEditsDeck(deck))
        self.saveButton.grid(row=0, column=2)

        self.totalLevelsLabel = tk.Label(frame, text="Total Levels")
        self.totalLevelsLabel.grid(row=1, column=0)

        self.totalLevelsLabel2 = tk.Label(frame,
                                          text=len(self.deckLevels[deck]))
        self.totalLevelsLabel2.grid(row=1, column=1)

        self.totalEntriesLabel = tk.Label(frame, text="Total entries")
        self.totalEntriesLabel.grid(row=2, column=0)
        tc = 0
        d = self.deckLevels[deck]
        for e in d:
            tc += len(d[e])
        self.totalLevelsLabel2 = tk.Label(frame, text=tc)
        self.totalLevelsLabel2.grid(row=2, column=1)

        self.deleteDeckButton = tk.Button(
            frame, text="Delete deck", command=lambda: self.deleteDeck(deck))
        self.deleteDeckButton.grid(column=0, columnspan=2)
Example #3
0
    def createWidgets(self):
        self.titleLabel = tk.Label(self,
                                   text="Enter {} name".format(self.type))
        self.titleLabel.pack()

        self.deckNameEntry = rusEntry.Entry(self)
        self.deckNameEntry.pack()

        self.addDeckButton = tk.Button(self, text="Add", command=self.sendName)
        self.addDeckButton.pack()
Example #4
0
    def createWidgets(self):
        self.confirmButton = tk.Button(self,
                                       text="Submit",
                                       command=self.submitAnswer)
        self.confirmButton.grid(row=4, column=0, columnspan=2)

        self.label = tk.Label(self,
                              text="",
                              font=(lambda x: self.cget('font'), 32),
                              width=50,
                              wraplength=1000)
        self.label.grid(row=1, column=0, columnspan=2, rowspan=2)

        self.tagsLabel = tk.Label(self,
                                  text="",
                                  font=(lambda x: self.cget('font'), 12))
        self.tagsLabel.grid(row=3, column=0, columnspan=2, rowspan=1)

        self.exitButton = tk.Button(self,
                                    text="Exit",
                                    font=(lambda x: self.cget('font'), 32),
                                    command=self.goMainMenu)
        self.exitButton.grid(row=1, column=1, sticky='ne')

        self.answerEntry = rusEntry.Entry(self,
                                          font=(lambda x: self.cget('font'),
                                                32))
        self.answerEntry.grid(row=5, column=0, columnspan=2)
        self.answerEntry.bind('<Return>', lambda x: self.submitAnswer())

        self.editButton = tk.Button(self,
                                    text="Edit",
                                    command=lambda: self.editEntry(self.line))
        self.editButton.grid(row=6, column=0, columnspan=2)

        self.pbcont = tk.IntVar()
        self.progBar = ttk.Progressbar(self,
                                       maximum=6,
                                       mode='determinate',
                                       orient=tk.HORIZONTAL,
                                       length=200,
                                       variable=self.pbcont)
        self.progBar.grid(row=1, column=0, sticky='nw')
Example #5
0
    def createWidgets(self):
        self.titleLabel = tk.Label(
            self,
            text=
            "Enter whole Url of the Memrise course, e.g. https://www.memrise.com/course/12345/example-course/",
            wraplength=400)
        self.titleLabel.pack()

        self.updateLabelVar = tk.StringVar()
        self.updateLabel = tk.Label(self,
                                    text="Ready",
                                    textvariable=self.updateLabelVar)
        self.updateLabelVar.set("Ready")
        self.updateLabel.pack()

        self.deckNameEntry = rusEntry.Entry(self)
        self.deckNameEntry.pack()

        self.addDeckButton = tk.Button(self, text="Add", command=self.sendName)
        self.addDeckButton.pack()
Example #6
0
    def createWidgets(self):
        self.confirmButton = tk.Button(self,
                                       text="Submit",
                                       command=self.submitAnswer)
        self.confirmButton.grid(row=4, column=0, columnspan=2)

        self.label = tk.Label(self,
                              text="",
                              font=(lambda x: self.cget('font'), 32),
                              width=50,
                              wraplength=1000)
        self.label.grid(row=1, column=0, columnspan=2, rowspan=2)

        self.tagsLabel = tk.Label(self,
                                  text="",
                                  font=(lambda x: self.cget('font'), 12))
        self.tagsLabel.grid(row=3, column=0, columnspan=2, rowspan=1)

        self.exitButton = tk.Button(self,
                                    text="Exit",
                                    font=(lambda x: self.cget('font'), 32),
                                    command=self.goMainMenu)
        self.exitButton.grid(row=1, column=1, sticky='ne')

        self.countLabel = tk.Label(self,
                                   text="/",
                                   font=(lambda x: self.cget('font'), 20))
        self.countLabel.grid(row=1, column=0, sticky='nw')

        self.answerEntry = rusEntry.Entry(self,
                                          font=(lambda x: self.cget('font'),
                                                32))
        self.answerEntry.grid(row=5, column=0, columnspan=2)

        self.answerEntry.bind('<Return>', lambda x: self.submitAnswer())

        self.editButton = tk.Button(self,
                                    text="Edit",
                                    command=lambda: self.editEntry(self.line))
        self.editButton.grid(row=6, column=0, columnspan=2)
Example #7
0
    def createEditFrameWidgets(self, frame, line, search=False):
        self.labels = []
        self.entries = []

        for w in frame.winfo_children():
            w.destroy()

        self.textLabel = tk.Label(frame, text="Entry")
        self.labels.append(self.textLabel)

        self.textEntry = rusEntry.Entry(frame)
        self.entries.append(self.textEntry)

        self.transLabel = tk.Label(frame, text="Translation")
        self.labels.append(self.transLabel)

        self.transEntry = rusEntry.Entry(frame)
        self.entries.append(self.transEntry)

        self.tagsLabel = tk.Label(frame, text="Tags")
        self.labels.append(self.tagsLabel)

        self.tagsEntry = tk.Entry(frame)
        self.entries.append(self.tagsEntry)

        self.learnedLabel = tk.Label(frame, text="Learned")
        self.labels.append(self.learnedLabel)

        self.learnedEntry = tk.Label(frame, text="-")
        self.entries.append(self.learnedEntry)

        self.attemptsLabel = tk.Label(frame, text="Attmpts")
        self.labels.append(self.attemptsLabel)

        self.attemptsEntry = tk.Label(frame, text="-")
        self.entries.append(self.attemptsEntry)

        self.successfulAttemptsLabel = tk.Label(frame,
                                                text="Successful attempts")
        self.labels.append(self.successfulAttemptsLabel)

        self.successfulAttemptsEntry = tk.Label(frame, text="-")
        self.entries.append(self.successfulAttemptsEntry)

        self.dayLastAttemptLabel = tk.Label(frame, text="Day of last attempt")
        self.labels.append(self.dayLastAttemptLabel)

        self.dayLastAttemptEntry = tk.Label(frame, text="-")
        self.entries.append(self.dayLastAttemptEntry)

        self.lastAttemptResultLabel = tk.Label(frame,
                                               text="Result of last attempt")
        self.labels.append(self.lastAttemptResultLabel)

        self.lastAttemptResultEntry = tk.Label(frame, text="-")
        self.entries.append(self.lastAttemptResultEntry)

        self.dayToReviewLabel = tk.Label(frame, text="Day of next review")
        self.labels.append(self.dayToReviewLabel)

        self.dayToReviewEntry = tk.Label(frame, text="-")
        self.entries.append(self.dayToReviewEntry)

        self.attemptStreakLabel = tk.Label(frame, text="Attempt streak")
        self.labels.append(self.attemptStreakLabel)

        self.attemptStreakEntry = tk.Label(frame, text="-")
        self.entries.append(self.attemptStreakEntry)

        self.idLabel = tk.Label(frame, text="ID")
        self.labels.append(self.idLabel)

        self.idLabel2 = tk.Label(frame, text="-")
        self.entries.append(self.idLabel2)

        self.deckLabel = tk.Label(frame, text="Deck")
        self.labels.append(self.deckLabel)

        self.deckEntry = tk.Entry(frame)
        self.entries.append(self.deckEntry)

        self.levelLabel = tk.Label(frame, text="Level")
        self.labels.append(self.levelLabel)

        self.levelEntry = tk.Entry(frame)
        self.entries.append(self.levelEntry)

        self.ignoreLabel = tk.Label(frame, text="Ignore")
        self.labels.append(self.ignoreLabel)

        self.ignoreEntry = tk.Label(frame, text="-")
        self.entries.append(self.ignoreEntry)

        self.langLabel = tk.Label(frame, text="Language")
        self.labels.append(self.langLabel)

        self.langEntry = tk.Entry(frame)
        self.entries.append(self.langEntry)

        for n, w in enumerate(self.labels):
            w.grid(row=n, column=1)
        for n, w in enumerate(self.entries):
            w.grid(row=n, column=2)
            if w['text'] == "-":
                w['text'] = line[n]
            else:
                w.insert(0, line[n].replace("commaChar", ","))
            w['width'] = 55

        if self.ignoreEntry['text'] == "no":
            self.ignoreCheck = tk.Checkbutton(frame,
                                              command=self.ignoreCheckFunc)
            self.ignoreCheck.grid(column=3, row=13)
        else:
            self.ignoreCheck = tk.Checkbutton(frame,
                                              command=self.ignoreCheckFunc)
            self.ignoreCheck.grid(column=3, row=13)
            self.ignoreCheck.toggle()

        self.listenButton = tk.Button(frame,
                                      text="Listen",
                                      command=self.listen)
        self.listenButton.grid(column=3, row=0)

        if not search:
            self.saveButton = tk.Button(frame,
                                        text="Save",
                                        command=self.saveEdits)
            self.saveButton.grid(column=1, columnspan=2)
        else:
            self.saveButton = tk.Button(frame,
                                        text="Save",
                                        command=self.saveEditsSearch)
            self.saveButton.grid(column=1, columnspan=2)

        self.deleteEntryButton = tk.Button(
            frame,
            text="Delete entry",
            command=lambda: self.deleteEntry(line[10]))
        self.deleteEntryButton.grid(row=15, column=3, columnspan=2)
Example #8
0
	def createWidgets(self):
		self.labels = []
		self.entries = []

		self.textLabel = tk.Label(self, text = "Entry")
		self.labels.append(self.textLabel)

		self.textEntry = rusEntry.Entry(self)
		self.entries.append(self.textEntry)

		self.transLabel = tk.Label(self, text = "Translation")
		self.labels.append(self.transLabel)

		self.transEntry = rusEntry.Entry(self)
		self.entries.append(self.transEntry)

		self.tagsLabel = tk.Label(self, text = "Tags")
		self.labels.append(self.tagsLabel)

		self.tagsEntry = tk.Entry(self)
		self.entries.append(self.tagsEntry)

		self.learnedLabel = tk.Label(self, text = "Learned")
		self.labels.append(self.learnedLabel)

		self.learnedEntry = tk.Label(self, text = "-")
		self.entries.append(self.learnedEntry)

		self.attemptsLabel = tk.Label(self, text = "Attmpts")
		self.labels.append(self.attemptsLabel)

		self.attemptsEntry = tk.Label(self, text = "-")
		self.entries.append(self.attemptsEntry)

		self.successfulAttemptsLabel = tk.Label(self, text = "Successful attempts")
		self.labels.append(self.successfulAttemptsLabel)

		self.successfulAttemptsEntry = tk.Label(self, text = "-")
		self.entries.append(self.successfulAttemptsEntry)

		self.dayLastAttemptLabel = tk.Label(self, text = "Day of last attempt")
		self.labels.append(self.dayLastAttemptLabel)

		self.dayLastAttemptEntry = tk.Label(self, text = "-")
		self.entries.append(self.dayLastAttemptEntry)

		self.lastAttemptResultLabel = tk.Label(self, text = "Result of last attempt")
		self.labels.append(self.lastAttemptResultLabel)

		self.lastAttemptResultEntry = tk.Label(self, text = "-")
		self.entries.append(self.lastAttemptResultEntry)

		self.dayToReviewLabel = tk.Label(self, text = "Day of next review")
		self.labels.append(self.dayToReviewLabel)

		self.dayToReviewEntry = tk.Label(self, text = "-")
		self.entries.append(self.dayToReviewEntry)

		self.attemptStreakLabel = tk.Label(self, text = "Attempt streak")
		self.labels.append(self.attemptStreakLabel)

		self.attemptStreakEntry = tk.Label(self, text = "-")
		self.entries.append(self.attemptStreakEntry)

		self.idLabel = tk.Label(self, text = "ID")
		self.labels.append(self.idLabel)

		self.idLabel2 = tk.Label(self, text = "-")
		self.entries.append(self.idLabel2)

		self.deckLabel = tk.Label(self, text = "Deck")
		self.labels.append(self.deckLabel)

		self.deckEntry = tk.Entry(self)
		self.entries.append(self.deckEntry)

		self.levelLabel = tk.Label(self, text = "Level")
		self.labels.append(self.levelLabel)

		self.levelEntry = tk.Entry(self)
		self.entries.append(self.levelEntry)

		self.ignoreLabel = tk.Label(self, text = "Ignore")
		self.labels.append(self.ignoreLabel)

		self.ignoreEntry = tk.Label(self, text = "-")
		self.entries.append(self.ignoreEntry)

		self.langLabel = tk.Label(self, text = "Language")
		self.labels.append(self.langLabel)

		self.langEntry = tk.Entry(self)
		self.entries.append(self.langEntry)

		for n,w in enumerate(self.labels):
			w.grid(row = n, column = 1)
		for n,w in enumerate(self.entries):
			w.grid(row = n, column = 2, sticky = 'w', columnspan = 999)
			w['width'] = 55
			if w == self.ignoreEntry:
				w['width'] = 50

			if w['text'] == "-":
				w['text'] = self.master.line[n]
			else:
				w.insert(0, self.master.line[n].replace("commaChar", ","))

		self.ignoreCheck = tk.Checkbutton(self, command = self.ignoreCheckFunc)
		self.ignoreCheck.grid(column = 875, row = 13, sticky = 'e')
		if self.ignoreEntry['text'] == "yes":
			self.ignoreCheck.select()
		else:
			self.ignoreCheck.deselect()

		self.saveButton = tk.Button(self, text = "Save", command = self.saveEdits)
		self.saveButton.grid(column = 0, columnspan = 2)
Example #9
0
    def createWidgets(self):
        self.firstFrame = tk.Frame(self)
        self.firstFrame.grid(sticky='n')
        self.title = tk.Label(self.firstFrame,
                              font=(lambda x: self.cget('font'), 20),
                              text="Create new entry")
        self.title.grid(columnspan=2)

        self.entryLabel = tk.Label(self.firstFrame, text="Entry*")
        self.entryLabel.grid(row=1, column=0)
        self.entryEntry = rusEntry.Entry(self.firstFrame)
        self.entryEntry.grid(row=1, column=1)

        self.translationLabel = tk.Label(self.firstFrame, text="Translation*")
        self.translationLabel.grid(row=2, column=0)
        self.translationEntry = rusEntry.Entry(self.firstFrame)
        self.translationEntry.grid(row=2, column=1)

        self.languageLabel = tk.Label(self.firstFrame, text="Language code")
        self.languageLabel.grid(row=3, column=0)
        self.languageComboboxString = tk.StringVar()
        self.languageCombobox = ttk.Combobox(
            self.firstFrame,
            width=17,
            values=self.langNames,
            validate='all',
            validatecommand=self.convertLangCode,
            state='readonly',
            textvariable=self.languageComboboxString,
            exportselection=0)
        self.languageCombobox.grid(row=3, column=1)
        self.notLang = tk.IntVar()
        self.LanguageCButton = tk.Checkbutton(
            self.firstFrame,
            text="Check if not a language",
            variable=self.notLang,
            command=self.notLangCButtonPressed)
        self.LanguageCButton.grid(row=3, column=2)

        self.tagsLabel = tk.Label(self.firstFrame, text="Tags")
        self.tagsLabel.grid(row=4, column=0)
        self.tagsEntry = rusEntry.Entry(self.firstFrame)
        self.tagsEntry.grid(row=4, column=1)

        self.deckLabel = tk.Label(self.firstFrame, text="Deck")
        self.deckLabel.grid(row=5, column=0)
        self.deckEntry = tk.Entry(self.firstFrame, state=tk.DISABLED)
        self.deckEntry.grid(row=5, column=1)

        self.levelLabel = tk.Label(self.firstFrame, text="Level")
        self.levelLabel.grid(row=6, column=0)
        self.levelEntry = tk.Entry(self.firstFrame, state=tk.DISABLED)
        self.levelEntry.grid(row=6, column=1)

        self.addButton = tk.Button(self.firstFrame,
                                   text="Add entry",
                                   command=self.addEntry)
        self.addButton.grid(row=7, column=1)

        self.thirdFrame = tk.Frame(self)
        self.thirdFrame.grid(columnspan=2, sticky='n')
        self.deckSelectLabel = tk.Label(self.thirdFrame,
                                        text="Select deck for new entry")
        self.deckSelectLabel.grid(row=0, column=0)
        self.deckSelectListbox = tk.Listbox(self.thirdFrame,
                                            width=50,
                                            selectmode="BROWSE",
                                            exportselection=0,
                                            activestyle='none')
        self.deckSelectListbox.bind('<<ListboxSelect>>',
                                    self.populateLevelsListbox)
        self.deckSelectListbox.grid(row=1, column=0)
        self.addNewDeckButton = tk.Button(self.thirdFrame,
                                          text="Add new deck",
                                          command=self.addNewDeck)
        self.addNewDeckButton.grid(row=2, column=0)

        self.levelSelectLabel = tk.Label(self.thirdFrame,
                                         text="Select level for new entry")
        self.levelSelectLabel.grid(row=0, column=1)
        self.levelSelectListbox = tk.Listbox(self.thirdFrame,
                                             width=50,
                                             selectmode="BROWSE",
                                             exportselection=0,
                                             activestyle='none')
        self.levelSelectListbox.bind('<<ListboxSelect>>',
                                     self.updateDeckAndLevelEntry)
        self.levelSelectListbox.grid(row=1, column=1)
        self.addNewLevelButton = tk.Button(self.thirdFrame,
                                           text="Add new level",
                                           command=self.addNewLevel)
        self.addNewLevelButton.grid(row=2, column=1)

        self.entryShowLabel = tk.Label(self.thirdFrame,
                                       text="Entries in the current level")
        self.entryShowLabel.grid(row=0, column=2)
        self.entryShowListbox = tk.Listbox(self.thirdFrame,
                                           width=50,
                                           selectmode="BROWSE",
                                           exportselection=0,
                                           activestyle='none')
        self.entryShowListbox.bind(
            '<FocusOut>',
            lambda e: self.entryShowListbox.selection_clear(0, tk.END))
        self.entryShowListbox.grid(row=1, column=2)

        self.secondFrame = tk.Frame(self)
        self.secondFrame.grid(row=0, column=1, sticky='n')
        self.sessionAdditionsLabel = tk.Label(
            self.secondFrame,
            font=(lambda x: self.cget('font'), 20),
            text="New additions")
        self.sessionAdditionsLabel.grid()

        self.scrollFrame = tk.Frame(self.secondFrame)
        self.scrollFrame.grid(rowspan=2)
        self.sessionAdditionsListbox = tk.Listbox(self.scrollFrame,
                                                  width=50,
                                                  selectmode="BROWSE",
                                                  exportselection=0,
                                                  activestyle='none')
        self.sessionAdditionsListbox.bind(
            '<FocusOut>',
            lambda e: self.sessionAdditionsListbox.selection_clear(0, tk.END))
        self.sessionAdditionsListbox.pack()
        self.scrollBar = tk.Scrollbar(
            self.scrollFrame,
            orient=tk.HORIZONTAL,
            command=self.sessionAdditionsListbox.xview)
        self.scrollBar.pack(side=tk.BOTTOM, fill=tk.X)
        self.sessionAdditionsListbox.config(xscrollcommand=self.scrollBar.set)

        self.pushButton = tk.Button(self.secondFrame,
                                    text="Push additions",
                                    command=self.Push)
        self.pushButton.grid()

        self.removeSelectedAdditionButton = tk.Button(
            self.secondFrame,
            text="Remove selected addition",
            command=self.removeSelectedAddition)
        self.removeSelectedAdditionButton.grid(column=3, row=1)

        self.backButton = tk.Button(self.secondFrame,
                                    text="Go back",
                                    command=self.goback)
        self.backButton.grid(column=4, row=0, sticky='nw')

        self.addFromMemriseButton = tk.Button(self.secondFrame,
                                              text="Add deck from Memrise",
                                              command=self.addFromMemriseFunc)
        self.addFromMemriseButton.grid(column=3, row=0, sticky='nw')

        self.browseFromMemriseButton = tk.Button(
            self.secondFrame,
            text="Browse decks from Memrise",
            command=self.browseFromMemriseFunc)
        self.browseFromMemriseButton.grid(column=3, row=1, sticky='nw')

        self.populateDeckListbox()