def radicalClicked(self, url): cmd = unicode(url.toString()).replace('about:blank#', '') if cmd.startswith('radical'): radicalIndex = int(re.match('radical\(([^\)]+)\)', cmd).group(1)) self.currentSelectedEntry = radicalIndex self.showRadicalCharacters(radicalIndex) elif cmd.startswith('lookup'): inputString = re.match('lookup\(([^\)]+)\)', cmd).group(1) self.emit(SIGNAL('inputReceived(const QString &)'), decodeBase64(inputString))
def componentClicked(self, url): self.clearOldSearchJobs() cmd = unicode(url.toString()).replace('about:blank#', '') if cmd.startswith('component'): char = decodeBase64(re.match('component\(([^\)]+)\)', cmd).group(1)) # map forms to reqular equivalent ones char = self._equivalentFormsMap.get(char, char) if char in self.selectedComponents: self.selectedComponents.remove(char) else: # TODO sort components, to optimize caching self.selectedComponents.append(char) self.componentEdit.setText(''.join(self.selectedComponents)) self.updateComponentView()
def handwritingResultClicked(self, url): cmd = unicode(url.toString()).replace('about:blank#', '') if cmd.startswith('lookup'): inputString = re.match('lookup\(([^\)]+)\)', cmd).group(1) self.emit(SIGNAL('inputReceived(const QString &)'), decodeBase64(inputString))
def componentResultClicked(self, url): cmd = unicode(url.toString()).replace('about:blank#', '') if cmd.startswith('lookup'): char = decodeBase64(re.match('lookup\(([^\)]+)\)', cmd).group(1)) self.emit(SIGNAL('inputReceived(const QString &)'), char)