[Debian-hebrew-package] r912 - in /pkg/hocr/trunk/debian/patches: no-scanner.patch series
kaplan at users.alioth.debian.org
kaplan at users.alioth.debian.org
Mon Jul 25 09:04:34 UTC 2011
Author: kaplan
Date: Mon Jul 25 09:04:33 2011
New Revision: 912
URL: http://svn.debian.org/wsvn/debian-hebrew/?sc=1&rev=912
Log:
Add a patch by Oron Peled <oron at actcom.co.il>
See https://bugzilla.redhat.com/show_bug.cgi?id=574259 for details.
Added:
pkg/hocr/trunk/debian/patches/no-scanner.patch
Modified:
pkg/hocr/trunk/debian/patches/series
Added: pkg/hocr/trunk/debian/patches/no-scanner.patch
URL: http://svn.debian.org/wsvn/debian-hebrew/pkg/hocr/trunk/debian/patches/no-scanner.patch?rev=912&op=file
==============================================================================
--- pkg/hocr/trunk/debian/patches/no-scanner.patch (added)
+++ pkg/hocr/trunk/debian/patches/no-scanner.patch Mon Jul 25 09:04:33 2011
@@ -1,0 +1,79 @@
+--- a/examples/hocr-gtk/sane-pygtk
++++ b/examples/hocr-gtk/sane-pygtk
+@@ -39,14 +39,14 @@
+
+ # set gettext support
+ locale_dir = '/usr/share/locale'
+-try:
+- import locale
+- import gettext
+- locale.setlocale(locale.LC_ALL, "")
+- gtk.glade.bindtextdomain(app_name, locale_dir)
+- gettext.install(app_name, locale_dir, unicode=1)
++try:
++ import locale
++ import gettext
++ locale.setlocale(locale.LC_ALL, "")
++ gtk.glade.bindtextdomain(app_name, locale_dir)
++ gettext.install(app_name, locale_dir, unicode=1)
+ except (IOError,locale.Error), e:
+- print "WARNING: Can't load locale"
++ print "WARNING: Can't load locale"
+ _ = lambda x : x
+
+ # set global functions
+@@ -152,7 +152,6 @@
+
+ # get scanners in system
+ self.sane_devices = sane.get_devices()
+- self.sane_devices_counter = len(self.sane_devices)
+
+ # set the scanners combobox
+ for device in self.sane_devices:
+@@ -205,13 +204,22 @@
+
+ dialog.destroy()
+
+- def button_preview_clicked_cb(self, obj):
+- "button_preview_clicked_cb activated"
+-
++ def open_scanner(self):
++ if len(self.sane_devices) <= 0:
++ show_error_message(_("No scanners reported by sane"))
++ raise RuntimeError("No scanners reported by sane\nRecheck your sane configuration")
+ # open scanner
+ scanner_number = self.config.getint('settings', 'scanner') - 1
++ if scanner_number < 0 or scanner_number >= len(self.sane_devices):
++ show_error_message(_("Bad scanner number %d configured.\nPlease select a valid scanner from the list") % scanner_number)
++ raise RuntimeError("Invalid scanner %d" % scanner_number)
+ scanner = sane.open(self.sane_devices[scanner_number][0])
+-
++ return scanner
++
++ def button_preview_clicked_cb(self, obj):
++ "button_preview_clicked_cb activated"
++ # open scanner
++ scanner = self.open_scanner()
+ # options
+ options = get_scanner_option (scanner, 'mode')
+ if options:
+@@ -278,9 +286,7 @@
+ def button_scan_clicked_cb(self, obj):
+ "button_scan_clicked_cb activated"
+ # open scanner
+- scanner_number = self.config.getint('settings', 'scanner') - 1
+- scanner = sane.open(self.sane_devices[scanner_number][0])
+-
++ scanner = self.open_scanner()
+ # options
+ options = get_scanner_option (scanner, 'mode')
+ if options:
+@@ -529,7 +535,7 @@
+ # reset settings options
+ if scanner_number < len(self.sane_devices):
+ try:
+- scanner = sane.open(self.sane_devices[scanner_number][0])
++ scanner = self.open_scanner()
+
+ # if scanner exist fill in all the settings
+
Modified: pkg/hocr/trunk/debian/patches/series
URL: http://svn.debian.org/wsvn/debian-hebrew/pkg/hocr/trunk/debian/patches/series?rev=912&op=diff
==============================================================================
--- pkg/hocr/trunk/debian/patches/series (original)
+++ pkg/hocr/trunk/debian/patches/series Mon Jul 25 09:04:33 2011
@@ -1,1 +1,2 @@
missing-includes.patch
+no-scanner.patch
More information about the Debian-hebrew-package
mailing list