[ocrfeeder] studioBuilder: Delete trailing whitespaces
- From: Joaquim Manuel Pereira Rocha <jrocha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ocrfeeder] studioBuilder: Delete trailing whitespaces
- Date: Thu, 1 Jul 2010 09:55:54 +0000 (UTC)
commit fba7874dcbacd26ff90603aba949474fca130290
Author: Joaquim Rocha <jrocha igalia com>
Date: Thu Jul 1 10:50:39 2010 +0200
studioBuilder: Delete trailing whitespaces
studio/studioBuilder.py | 76 +++++++++++++++++++++++-----------------------
1 files changed, 38 insertions(+), 38 deletions(-)
---
diff --git a/studio/studioBuilder.py b/studio/studioBuilder.py
index 585254c..7a1cfe6 100644
--- a/studio/studioBuilder.py
+++ b/studio/studioBuilder.py
@@ -3,7 +3,7 @@
###########################################################################
# OCRFeeder - The complete OCR suite
# Copyright (C) 2009 Joaquim Rocha
-#
+#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
@@ -39,12 +39,12 @@ pygtk.require('2.0')
import gtk
class Studio:
-
+
EXPORT_FORMATS = ['HTML', 'ODT']
TARGET_TYPE_URI_LIST = 80
-
+
def __init__(self):
-
+
# i18n
languages = []
lc, encoding = locale.getdefaultlocale()
@@ -84,12 +84,12 @@ class Studio:
self.ocr_engines,
self.configuration_manager)
self.project_name = None
-
+
toolbar_callback_dict = {'detection': self.source_images_controler.performBoxDetection,
'export_to_odt': self.exportToOdt}
-
+
menubar_callback_dict = {'exit': self.quit, 'add_image': self.addImage, 'export_to_odt': self.exportToOdt, 'edit_page': self.choosePageSize,
- 'delete_page': self.deleteCurrentPage, 'export_dialog': self.exportDialog, 'add_folder': self.addFolder,
+ 'delete_page': self.deleteCurrentPage, 'export_dialog': self.exportDialog, 'add_folder': self.addFolder,
'import_pdf': self.importPdf, 'save_project': self.saveProject, 'save_project_as': self.saveProjectAs,
'open_project': self.openProject, 'append_project': self.appendProject,'clear': self.clear,
'unpaper': self.unpaper, 'preferences': self.preferences, 'about': self.about,
@@ -100,14 +100,14 @@ class Studio:
'select_previous_area': self.source_images_controler.selectPreviousArea,
'select_all_areas': self.source_images_controler.selectAllAreas,
}
-
+
self.main_window.setHeader(menubar_callback_dict, toolbar_callback_dict)
self.main_window.setDestroyEvent(self.quit)
-
+
dirs = cli_command_retriever.getParams('--dir')
if dirs:
self.__addImagesToReviewer(lib.getImagesFromFolder(dirs[0]))
-
+
self.main_window.setHasSelectedBoxes(False)
self.main_window.setHasContentBoxes(False)
self.main_window.setHasImages(not self.source_images_selector.isEmpty())
@@ -122,10 +122,10 @@ class Studio:
for engine in add_engines_dialog.getChosenEngines():
self.ocr_engines_manager.addNewEngine(engine)
add_engines_dialog.destroy()
-
+
def run(self):
gtk.main()
-
+
def dragDataReceived(self, widget, context, x, y, selection, target_type, timestamp):
if target_type == self.TARGET_TYPE_URI_LIST:
uris = selection.data.strip('\r\n\x00').split()
@@ -165,7 +165,7 @@ class Studio:
for file_name in file_open_dialog.get_filenames():
self.__addImagesToReviewer([file_name])
file_open_dialog.destroy()
-
+
def importPdf(self, widget):
file_open_dialog = widgetPresenter.FileDialog('open', file_filters = [(_('PDF'), ['application/pdf'], [])])
response = file_open_dialog.run()
@@ -174,7 +174,7 @@ class Studio:
folder = lib.convertPdfToImages(file_name, self.configuration_manager.getTemporaryDir())
self.__addImagesToReviewer(lib.getImagesFromFolder(folder))
file_open_dialog.destroy()
-
+
def addFolder(self, widget):
file_open_dialog = widgetPresenter.FileDialog('select-folder')
response = file_open_dialog.run()
@@ -182,13 +182,13 @@ class Studio:
for folder in file_open_dialog.get_filenames():
self.__addImagesToReviewer(lib.getImagesFromFolder(folder))
file_open_dialog.destroy()
-
+
def exportToHtml(self, widget = None):
self.source_images_controler.exportPagesToHtml(self.source_images_selector.getPixbufsSorted())
-
+
def exportToOdt(self, widget = None):
self.source_images_controler.exportPagesToOdt(self.source_images_selector.getPixbufsSorted())
-
+
def exportDialog(self, widget):
export_dialog = widgetPresenter.ExportDialog(_('Export pages'), self.EXPORT_FORMATS)
response = export_dialog.run()
@@ -199,10 +199,10 @@ class Studio:
return None
export_dialog.destroy()
return None
-
+
def choosePageSize(self, widget):
self.source_images_controler.choosePageSize()
-
+
def deleteCurrentPage(self, widget):
delete_dialog = widgetPresenter.QuestionDialog(_('Are you sure you want to delete the current image?'))
response = delete_dialog.run()
@@ -210,7 +210,7 @@ class Studio:
self.source_images_controler.deleteCurrentPage()
self.source_images_icon_view.deleteCurrentSelection()
delete_dialog.destroy()
-
+
def __addImagesToReviewer(self, images):
if not images:
return
@@ -219,78 +219,78 @@ class Studio:
self.source_images_controler.addImage(pixbuf, image)
tree_path = self.source_images_selector.list_store.get_path(iter)
self.source_images_icon_view.select_path(tree_path)
-
+
def setProjectName(self, project_name):
self.project_name = project_name
project_title = os.path.splitext(os.path.basename(self.project_name))[0]
self.main_window.setTitle('%s - %s' % (self.title, project_title))
-
+
def saveProjectAs(self, widget = None):
file_name = self.source_images_controler.saveProjectAs()
if file_name:
self.setProjectName(file_name)
self.saveProject()
-
+
def saveProject(self, widget = None):
if self.project_name:
self.source_images_controler.saveProject(self.project_name)
else:
self.saveProjectAs()
-
+
def appendProject(self, widget = None):
self.__loadProject(False)
-
+
def openProject(self, widget = None):
self.__loadProject()
-
+
def __loadProject(self, clear_current = True):
project_title = self.source_images_controler.openProject(clear_current)
if project_title:
self.setProjectName(project_title)
-
+
def clear(self, widget = None):
self.source_images_controler.clear()
-
+
def unpaper(self, widget = None):
self.source_images_controler.unpaperTool()
-
+
def preferences(self, widget = None):
preferences_dialog = widgetPresenter.PreferencesDialog(self.configuration_manager, self.ocr_engines_manager.ocr_engines)
if preferences_dialog.run() == gtk.RESPONSE_ACCEPT:
preferences_dialog.saveToManager()
self.source_images_controler.updateFromConfiguration()
preferences_dialog.destroy()
-
+
def ocrEngines(self, widget = None):
ocr_dialog = widgetPresenter.OcrManagerDialog(self.ocr_engines_manager)
ocr_dialog.run()
ocr_dialog.destroy()
-
+
def enginesTool(self, widget = None):
pass
-
+
def selectionChanged(self, selector, is_empty):
self.main_window.setHasImages(not is_empty)
-
+
def about(self, widget = None):
from gnome import url_show
gtk.about_dialog_set_url_hook(lambda x,y,z: url_show(y), "")
about_dialog = widgetPresenter.CustomAboutDialog()
if about_dialog.run():
about_dialog.destroy()
-
+
def zoomIn(self, widget = None):
self.source_images_controler.zoomIn()
-
+
def zoomOut(self, widget = None):
self.source_images_controler.zoomOut()
-
+
def resetZoom(self, widget = None):
self.source_images_controler.resetZoom()
def zoomFit(self, widget = None):
self.source_images_controler.zoomFit()
-
+
def quit(self, widget = None, data = None):
if not self.project_name and not self.source_images_selector.isEmpty():
quit_dialog = widgetPresenter.QuestionDialog('<b>' + _("The project hasn't been saved.") + '</b>', gtk.BUTTONS_NONE)
@@ -309,7 +309,7 @@ class Studio:
else:
self.__main_quit()
return False
-
+
def __main_quit(self):
self.configuration_manager.configurationToXml()
gtk.main_quit()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]