Add --skip option.
This commit is contained in:
parent
20e8ce597d
commit
f3808df0cd
2 changed files with 10 additions and 3 deletions
|
|
@ -17,6 +17,7 @@
|
|||
import sys
|
||||
import signal
|
||||
from threading import Thread
|
||||
from argparse import ArgumentParser
|
||||
|
||||
import sip
|
||||
sip.setapi('QString', 2)
|
||||
|
|
@ -33,13 +34,19 @@ from .window import MainWindow
|
|||
from .ocrengine import OCREngine
|
||||
|
||||
|
||||
parser = ArgumentParser(description='PixelOCR')
|
||||
parser.add_argument('--skip', metavar='N', type=int, default=0)
|
||||
parser.add_argument('filename')
|
||||
|
||||
|
||||
def main():
|
||||
app = QApplication(sys.argv)
|
||||
|
||||
QApplication.setOrganizationName("PixelOCR");
|
||||
QApplication.setApplicationName("PixelOCR");
|
||||
|
||||
ocr = OCREngine(sys.argv[1])
|
||||
args = parser.parse_args()
|
||||
ocr = OCREngine(args.filename, skip=args.skip)
|
||||
app.aboutToQuit.connect(ocr.save_glyphdb)
|
||||
|
||||
win = MainWindow(ocr)
|
||||
|
|
|
|||
|
|
@ -33,10 +33,10 @@ class OCREngine(QThread):
|
|||
unknownGlyph = signal([Glyph])
|
||||
pageChanged = signal([Page])
|
||||
|
||||
def __init__(self, dirname):
|
||||
def __init__(self, dirname, skip=0):
|
||||
super().__init__()
|
||||
self.dirname = dirname
|
||||
self.filenames = sorted(glob(path.join(dirname, '*.png')))
|
||||
self.filenames = sorted(glob(path.join(dirname, '*.png')))[skip:]
|
||||
self.glyphdb = GlyphDB(path.join(self.dirname, 'glyphdb.pickle'))
|
||||
self.help_queue = Queue()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue