Add Configuration() class and make it accessible as Document.config and PageObject.config.
This commit is contained in:
parent
8805803e53
commit
d3c32b82ab
3 changed files with 35 additions and 4 deletions
|
|
@ -22,6 +22,7 @@ from . import formatting
|
|||
from .image import Image
|
||||
from .page import Page, Space
|
||||
from .glyphdb import GlyphDB, SPACE, NEWLINE
|
||||
from .config import Configuration
|
||||
|
||||
|
||||
class Document(object):
|
||||
|
|
@ -33,6 +34,7 @@ class Document(object):
|
|||
self.ui = ui
|
||||
self.filenames = sorted(glob(path.join(dirname, '*.png')))[skip:skip + limit if limit else None]
|
||||
self.glyphdb = GlyphDB(path.join(self.dirname, 'glyphdb.pickle'))
|
||||
self.config = Configuration.load_file(path.join(self.dirname, 'config.yaml'))
|
||||
self.output_format = output_format
|
||||
self.last_style = (False, False, (255, 255, 255)) # FIXME get rid of hardcoded value
|
||||
|
||||
|
|
@ -40,7 +42,7 @@ class Document(object):
|
|||
self.glyphdb.save()
|
||||
|
||||
def load_page(self, filename):
|
||||
return Page(Image.fromfile(filename), filename)
|
||||
return Page(self, Image.fromfile(filename), filename)
|
||||
|
||||
def recognize(self):
|
||||
for filename in self.filenames:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue