[ocrfeeder] Use one status bar instead of three (gb#635219)
- From: Joaquim Manuel Pereira Rocha <jrocha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ocrfeeder] Use one status bar instead of three (gb#635219)
- Date: Sun, 13 Feb 2011 15:15:48 +0000 (UTC)
commit 752d98dc81587467cedff4a25e770b0f8d03788a
Author: Joaquim Rocha <jrocha igalia com>
Date: Sun Feb 13 16:08:34 2011 +0100
Use one status bar instead of three (gb#635219)
src/ocrfeeder/studio/customWidgets.py | 33 -------------------------------
src/ocrfeeder/studio/widgetModeler.py | 31 +++++++++++++++++++++++-----
src/ocrfeeder/studio/widgetPresenter.py | 7 +++--
3 files changed, 29 insertions(+), 42 deletions(-)
---
diff --git a/src/ocrfeeder/studio/customWidgets.py b/src/ocrfeeder/studio/customWidgets.py
index 5bb3269..ff8e637 100644
--- a/src/ocrfeeder/studio/customWidgets.py
+++ b/src/ocrfeeder/studio/customWidgets.py
@@ -408,36 +408,3 @@ class PlainFrame(gtk.Frame):
def add(self, widget):
self.container.add(widget)
-
-class SimpleStatusBar(gtk.Statusbar):
-
- def __init__(self):
- super(SimpleStatusBar, self).__init__()
- self.context_id = self.get_context_id('OCR Feeder')
- def insert(self, text):
- self.clear()
- self.push(self.context_id, text)
-
- def clear(self):
- self.pop(self.context_id)
-
-class TrippleStatusBar(gtk.HBox):
-
- def __init__(self):
- super(TrippleStatusBar, self).__init__(spacing = 10)
- self.left_statusbar = SimpleStatusBar()
- self.left_statusbar.set_has_resize_grip(False)
- self.center_statusbar = SimpleStatusBar()
- self.center_statusbar.set_has_resize_grip(False)
- self.right_statusbar = SimpleStatusBar()
- self.add(self.left_statusbar)
- self.pack_start(gtk.VSeparator(), False)
- self.add(self.center_statusbar)
- self.pack_start(gtk.VSeparator(), False)
- self.add(self.right_statusbar)
- self.show_all()
-
- def clear(self):
- self.left_statusbar.clear()
- self.center_statusbar.clear()
- self.right_statusbar.clear()
diff --git a/src/ocrfeeder/studio/widgetModeler.py b/src/ocrfeeder/studio/widgetModeler.py
index 5574ae5..44f407b 100644
--- a/src/ocrfeeder/studio/widgetModeler.py
+++ b/src/ocrfeeder/studio/widgetModeler.py
@@ -409,8 +409,10 @@ class ImageReviewer_Controler:
self.source_images_selector_widget = source_images_selector_widget
self.ocr_engines = ocr_engines
self.configuration_manager = configuration_manager
- self.tripple_statusbar = self.main_window.tripple_statusbar
+ self.statusbar = self.main_window.statusbar
+ self._page_info_message_id = self.statusbar.get_context_id('page_info_message')
self.source_images_selector_widget.connect(selection_changed_signal, self.selectImageReviewer)
+ self.__updateStatusBar()
def __createdImageReviewer(self, pixbuf, image):
image_reviewer = ImageReviewer(self.main_window, image, self.ocr_engines)
@@ -514,12 +516,28 @@ class ImageReviewer_Controler:
reviewer = self.image_reviewer_dict[pixbuf]
self.notebook.set_current_page(self.notebook.page_num(reviewer.reviewer_area))
self.__setZoomStatus(None, reviewer.selectable_boxes_area.get_scale())
- self.tripple_statusbar.center_statusbar.insert((_('Page size') + ': %.2f x %.2f') % (reviewer.getPageData().width, reviewer.getPageData().height))
- self.tripple_statusbar.right_statusbar.insert((_('Resolution') + ': %i x %i') % (reviewer.getPageData().resolution[0], reviewer.getPageData().resolution[1]))
+ self.__updateStatusBar(reviewer)
reviewer.updateMainWindow()
def __setZoomStatus(self, widget, zoom):
- self.tripple_statusbar.left_statusbar.insert(_('Zoom') + ': ' + str(int(zoom * 100)) + '%')
+ self.__updateStatusBar()
+
+ def __updateStatusBar(self, reviewer = None):
+ reviewer = reviewer or self.__getCurrentReviewer()
+
+ if not reviewer:
+ status_message = _('No images added')
+ else:
+ zoom = int(reviewer.selectable_boxes_area.get_scale() * 100)
+ status_message = _('Zoom: %s %%') % zoom
+ page_data = reviewer.getPageData()
+ status_message += ' ' + _('Resolution: %.2f x %.2f') % (page_data.resolution[0],
+ page_data.resolution[1])
+ status_message += ' ' + _('Page size: %i x %i') % (page_data.width,
+ page_data.height)
+
+ self.statusbar.pop(self._page_info_message_id)
+ self.statusbar.push(self._page_info_message_id, status_message)
def recognizeSelectedAreas(self, widget):
image_reviewer = self.__getCurrentReviewer()
@@ -729,7 +747,8 @@ class ImageReviewer_Controler:
if image_reviewer == current_reviewer:
del self.image_reviewer_dict[pixbuf]
self.notebook.remove_page(self.notebook.get_current_page())
- return True
+ break
+ self.__updateStatusBar()
def unpaperTool(self):
current_reviewer = self.__getCurrentReviewer()
@@ -746,7 +765,7 @@ class ImageReviewer_Controler:
del self.image_reviewer_dict[pixbuf]
self.notebook.remove_page(self.notebook.get_current_page())
self.source_images_selector_widget.clear()
- self.tripple_statusbar.clear()
+ self.__updateStatusBar()
def getPixbufsSorted(self):
return self.source_images_selector_widget.source_images_selector.getPixbufsSorted()
diff --git a/src/ocrfeeder/studio/widgetPresenter.py b/src/ocrfeeder/studio/widgetPresenter.py
index 517e909..b9c3a79 100644
--- a/src/ocrfeeder/studio/widgetPresenter.py
+++ b/src/ocrfeeder/studio/widgetPresenter.py
@@ -18,7 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
###########################################################################
-from customWidgets import PlainFrame, TrippleStatusBar
+from customWidgets import PlainFrame
from dataHolder import DataBox, TEXT_TYPE, IMAGE_TYPE
from configuration import ConfigurationManager
from ocrfeeder.util import lib, PAPER_SIZES
@@ -119,8 +119,9 @@ class MainWindow:
self.main_box = gtk.VBox()
self.main_box.show()
- self.tripple_statusbar = TrippleStatusBar()
- self.main_box.pack_end(self.tripple_statusbar, False)
+ self.statusbar = gtk.Statusbar()
+ self.statusbar.show()
+ self.main_box.pack_end(self.statusbar, False)
self.main_area = gtk.HPaned()
self.main_area.set_position(150)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]