def checkForNavigation(self, event): if util.checkIfClickedButton(event.x, event.y, self.forwardButtonX, self.forwardButtonY, 20, 20): self.pageNum += 1 if util.checkIfClickedButton(event.x, event.y, self.backButtonX, self.backButtonY, 20, 20): # if self.pageNum != 0: disables back button on 0th page self.pageNum -= 1 self.pageNum = self.pageNum % self.totalPages
def mousePressed(self, event): # if clicked font tagger button if util.checkIfClickedButton(event.x, event.y, self.fontTaggerBtnCoords[0], self.fontTaggerBtnCoords[1], self.buttonWidth, self.buttonHeight): # self.onSplashPage = False self.app.setActiveMode(self.app.fontTagger) # self.onFontTagger = True # if clicked font explorer button if util.checkIfClickedButton(event.x, event.y, self.fontExplorerBtnCoords[0], self.fontExplorerBtnCoords[1], self.buttonWidth, self.buttonHeight): self.app.setActiveMode(self.app.fontBoard)
def checkForTagInput(self, event): if util.checkIfClickedButton(event.x, event.y, self.tagInputCoords[0], self.tagInputCoords[1], 100, 20): self.isTypingTag = True self.isTypingTag = True else: self.isTypingTag = False
def checkForClickedBoardButton(self, event): if util.checkIfClickedButton(event.x, event.y, self.boardButtonCoords[0], self.boardButtonCoords[1], self.boardButtonDims[0], self.boardButtonDims[1]): self.app.setActiveMode(self.app.Board)
def checkForBackButton(self, event): if util.checkIfClickedButton( event.x, event.y, self.backButtonCoords[0], #cx self.backButtonCoords[1], #cy self.backButtonDims[0], self.backButtonDims[1]): self.app.setActiveMode(self.app.splashPage)
def checkForItalicButton(self, event): if util.checkIfClickedButton(event.x, event.y, self.italicButtonCoords[0], self.italicButtonCoords[1], self.buttonDims[0], self.buttonDims[1]): if self.fontWeight[self.activeTextBox] == "normal": self.fontWeight[self.activeTextBox] = "italic" elif self.fontWeight[self.activeTextBox] == "bold": self.fontWeight[self.activeTextBox] = "bold italic" else: self.fontWeight[self.activeTextBox] = "normal"
def checkForClickedSearchBar(self, event): if util.checkIfClickedButton(event.x, event.y, self.searchBarCoords[0], self.searchBarCoords[1], self.searchBarWidth, self.searchBarHeight): self.isTypingSearch = True return else: self.isTypingSearch = False
def checkForAutoTagButton(self, event): if util.checkIfClickedButton( event.x, event.y, self.autoTagButtonCoords[0], #cx self.autoTagButtonCoords[1], #cy self.autoTagButtonWidth, self.autoTagButtonHeight): # autoFontTags = at.AutoFontTagger(width=150, height=150) self.app.setActiveMode(self.app.autoFontTagger)
def checkForBoldButton(self, event): if util.checkIfClickedButton(event.x, event.y, self.boldButtonCoords[0], self.boldButtonCoords[1], self.buttonDims[0], self.buttonDims[1]): # font weight specifications taken from here: https://docs.python.org/3/library/tkinter.font.html if self.fontWeight[self.activeTextBox] == "normal": self.fontWeight[self.activeTextBox] = "bold" elif self.fontWeight[self.activeTextBox] == "italic": self.fontWeight[self.activeTextBox] = "bold italic" else: self.fontWeight[self.activeTextBox] = "normal"
def checkForTagButton(self, event): if util.checkIfClickedButton( event.x, event.y, self.tagButtonCoords[0], #cx self.tagButtonCoords[1], #cy self.tagButtonWidth, self.tagButtonHeight): print("recognized button click") if self.selectedFonts != set(): print("fonts added to selected fonts") for font in self.selectedFonts: self.tagInput = self.tagInput.strip() if font not in self.app.fontTags: self.app.fontTags[font] = [self.tagInput] elif self.tagInput not in self.app.fontTags[font]: self.app.fontTags[font] += [self.tagInput] print(font, self.app.fontTags[font]) util.saveTagsToComputer(self)
def checkForSaveButton(self, event): if util.checkIfClickedButton(event.x, event.y, self.saveButtonCoords[0], self.saveButtonCoords[1], self.buttonDims[0], self.buttonDims[1]): filename = self.widgetFont[0] + "and" + self.widgetFont[1] filename.replace(" ", "") self.app.saveSnapshot(f"fontboard/{filename}.png")