Make GlyphEditor return proper bold and italic flags (and store them in the DB).
This commit is contained in:
parent
9c8de1ce0f
commit
892038f65b
3 changed files with 9 additions and 9 deletions
|
|
@ -28,7 +28,7 @@ from PyQt4.QtGui import (
|
|||
|
||||
|
||||
class GlyphEdit(QWidget):
|
||||
glyphEntered = signal([str])
|
||||
glyphEntered = signal([str, bool, bool])
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
|
@ -54,4 +54,4 @@ class GlyphEdit(QWidget):
|
|||
self.layout.addWidget(self.text)
|
||||
|
||||
def sendGlyph(self):
|
||||
self.glyphEntered.emit(self.text.text())
|
||||
self.glyphEntered.emit(self.text.text(), self.bold.isChecked(), self.italic.isChecked())
|
||||
|
|
|
|||
|
|
@ -77,16 +77,16 @@ class OCREngine(QThread):
|
|||
try:
|
||||
return self.glyphdb[glyph].text
|
||||
except KeyError:
|
||||
text = self.ask_for_help(glyph)
|
||||
self.glyphdb.add_glyph(glyph, text)
|
||||
text, bold, italic = self.ask_for_help(glyph)
|
||||
self.glyphdb.add_glyph(glyph, text, bold, italic)
|
||||
return text
|
||||
|
||||
def ask_for_help(self, unknown_glyph):
|
||||
self.unknownGlyph.emit(unknown_glyph)
|
||||
return self.receive_help()
|
||||
|
||||
def give_help(self, text):
|
||||
self.help_queue.put(text)
|
||||
def give_help(self, *args):
|
||||
self.help_queue.put(args)
|
||||
|
||||
def receive_help(self):
|
||||
return self.help_queue.get()
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ from .glyphdbedit import GlyphDBEdit
|
|||
class MainWindow(QMainWindow):
|
||||
BASE_TITLE = 'PixelOCR'
|
||||
dbedit = None
|
||||
glyphEntered = signal([str])
|
||||
glyphEntered = signal([str, bool, bool])
|
||||
|
||||
def __init__(self, ocr):
|
||||
super().__init__()
|
||||
|
|
@ -105,10 +105,10 @@ class MainWindow(QMainWindow):
|
|||
self.glyphEdit.text.clear()
|
||||
self.glyphEdit.text.setFocus()
|
||||
|
||||
def unknownGlyphEntered(self, text):
|
||||
def unknownGlyphEntered(self, text, bold, italic):
|
||||
self.glyphEdit.setEnabled(False)
|
||||
self.glyphEdit.text.clear()
|
||||
self.glyphEntered.emit(text)
|
||||
self.glyphEntered.emit(text, bold, italic)
|
||||
|
||||
def showGlyphDBEdit(self):
|
||||
if self.dbedit is None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue