[ocrfeeder] Refactor the Editor's update method



commit 933bb26d18c57feafa965023aa469182674a5c9d
Author: Joaquim Rocha <me joaquimrocha com>
Date:   Thu Dec 18 21:25:21 2014 +0000

    Refactor the Editor's update method
    
    Replace the code with the DataBox's updateImage.

 src/ocrfeeder/studio/widgetModeler.py |   13 ++-----------
 1 files changed, 2 insertions(+), 11 deletions(-)
---
diff --git a/src/ocrfeeder/studio/widgetModeler.py b/src/ocrfeeder/studio/widgetModeler.py
index 5bb91ae..7361244 100644
--- a/src/ocrfeeder/studio/widgetModeler.py
+++ b/src/ocrfeeder/studio/widgetModeler.py
@@ -941,17 +941,8 @@ class Editor:
             self.data_box.setLanguage(self.box_editor.getLanguage())
 
     def update(self, box):
-        self.box = box
-        x, y, width, height = self.data_box.updateBoundsFromBox(self.box)
-        pixbuf_width = self.pixbuf.get_width()
-        pixbuf_height = self.pixbuf.get_height()
-        sub_pixbuf = self.pixbuf.new_subpixbuf(x, y,
-                                               min(width, pixbuf_width),
-                                               min(height, pixbuf_height))
-        sub_pixbuf.x = x
-        sub_pixbuf.y = y
-        sub_pixbuf.width = pixbuf_width
-        self.data_box.setImage(sub_pixbuf)
+        self.data_box.updateBoundsFromBox(self.box)
+        self.data_box.updateImage(self.pixbuf)
 
     def updateOcrEngines(self, engines_list):
         engines_names = [engine.name for engine, path in engines_list]


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]