Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Silbe <sascha-pgp@silbe.org>2013-06-04 06:28:36 (GMT)
committer Sascha Silbe <sascha-pgp@silbe.org>2013-06-04 06:28:36 (GMT)
commit11611772efa058bcf7aae715d2dbbe0b8cc51840 (patch)
tree3b3a2516c0cfde5692afcfbf56898a5dce4b0424
parent6be79c4d1f8ad118e21b75985087292ae530a6b2 (diff)
Remember scanner settings across re-open
Save and re-apply the scanner settings before resp. after the scan so they don't get lost due to the re-open of the scanner device.
-rw-r--r--scan.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/scan.py b/scan.py
index faa403d..cdd5cc8 100644
--- a/scan.py
+++ b/scan.py
@@ -606,6 +606,7 @@ class ScanActivity(activity.Activity):
self._status_entry = None
self._scan_button = None
self._settings_toolbar = None
+ self._old_settings = None
temp_dir = os.path.join(self.get_activity_root(), 'tmp')
self._scan_thread = ScanThread(temp_dir,
callback=self._scan_finished_cb)
@@ -878,6 +879,9 @@ class ScanActivity(activity.Activity):
self._scan_thread.autocontrast = self._settings_toolbar.autocontrast
self._scan_thread.autocontrast_cutoff = self._settings_toolbar.autocontrast_cutoff
self._scan_thread.autocrop_threshold = self._settings_toolbar.autocrop_threshold
+ # Remember current settings as we need to restore them
+ # when re-opening the scanner after the scan.
+ self._old_settings = self._get_settings()
self._scan_thread.start_scan()
elif self._status == 'scanning':
self._add_msg('stopping scan')
@@ -909,6 +913,10 @@ class ScanActivity(activity.Activity):
# always re-open scanner, to work around HPLIP bugs
self._open_scanner(self._current_scanner_name)
+ self._set_settings(self._old_settings)
+ # HACK: cause the toolbar to re-read the settings after
+ # changing them
+ self._settings_toolbar.set_scanner(self._current_scanner)
def _add_images(self, image_infos):
for info in image_infos: