[ocrfeeder] Fix exporting a document loaded from a project file
- From: Joaquim Manuel Pereira Rocha <jrocha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ocrfeeder] Fix exporting a document loaded from a project file
- Date: Sat, 20 Dec 2014 22:40:05 +0000 (UTC)
commit 0001abf6f8ec7c675c3059ba091f41d4011e84fa
Author: Joaquim Rocha <me joaquimrocha com>
Date: Thu Dec 18 21:21:26 2014 +0000
Fix exporting a document loaded from a project file
src/ocrfeeder/studio/dataHolder.py | 10 ++++++++++
src/ocrfeeder/studio/widgetModeler.py | 7 +++++++
2 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/src/ocrfeeder/studio/dataHolder.py b/src/ocrfeeder/studio/dataHolder.py
index e32be1d..3a0c6a5 100644
--- a/src/ocrfeeder/studio/dataHolder.py
+++ b/src/ocrfeeder/studio/dataHolder.py
@@ -197,6 +197,16 @@ class DataBox(GObject.GObject):
self.setHeight(height)
return (x, y, width, height)
+ def updateImage(self, pixbuf):
+ pixbuf_width = pixbuf.get_width()
+ pixbuf_height = pixbuf.get_height()
+ sub_pixbuf = pixbuf.new_subpixbuf(self.x, self.y,
+ min(self.width, pixbuf_width),
+ min(self.height, pixbuf_height))
+ sub_pixbuf.x = self.x
+ sub_pixbuf.y = self.y
+ sub_pixbuf.width = pixbuf_width
+ self.setImage(sub_pixbuf)
class PageData:
diff --git a/src/ocrfeeder/studio/widgetModeler.py b/src/ocrfeeder/studio/widgetModeler.py
index 818c7ee..5bb91ae 100644
--- a/src/ocrfeeder/studio/widgetModeler.py
+++ b/src/ocrfeeder/studio/widgetModeler.py
@@ -594,7 +594,14 @@ class ImageReviewer_Controler:
if os.path.exists(file_name):
os.remove(file_name)
document_generator = generator(file_name, **extra_args)
+ reviewer = self.__getCurrentReviewer()
for page in pages:
+ # if the page is not the current reviewer, we need to
+ # update the box's image before exporting it
+ if page != reviewer.page:
+ pixbuf = GdkPixbuf.Pixbuf.new_from_file(page.image_path)
+ for box in page.data_boxes:
+ box.updateImage(pixbuf)
document_generator.addPage(page)
document_generator.save()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]