Web · Wiki · Activities · Blog · Lists · Chat · Meeting · Bugs · Git · Translate · Archive · People · Donate

Commit 11611772efa058bcf7aae715d2dbbe0b8cc51840

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.
  • Diff rendering mode:
  • inline
  • side by side

scan.py

606 self._status_entry = None606 self._status_entry = None
607 self._scan_button = None607 self._scan_button = None
608 self._settings_toolbar = None608 self._settings_toolbar = None
609 self._old_settings = None
609 temp_dir = os.path.join(self.get_activity_root(), 'tmp')610 temp_dir = os.path.join(self.get_activity_root(), 'tmp')
610 self._scan_thread = ScanThread(temp_dir,611 self._scan_thread = ScanThread(temp_dir,
611 callback=self._scan_finished_cb)612 callback=self._scan_finished_cb)
879 self._scan_thread.autocontrast = self._settings_toolbar.autocontrast879 self._scan_thread.autocontrast = self._settings_toolbar.autocontrast
880 self._scan_thread.autocontrast_cutoff = self._settings_toolbar.autocontrast_cutoff880 self._scan_thread.autocontrast_cutoff = self._settings_toolbar.autocontrast_cutoff
881 self._scan_thread.autocrop_threshold = self._settings_toolbar.autocrop_threshold881 self._scan_thread.autocrop_threshold = self._settings_toolbar.autocrop_threshold
882 # Remember current settings as we need to restore them
883 # when re-opening the scanner after the scan.
884 self._old_settings = self._get_settings()
882 self._scan_thread.start_scan()885 self._scan_thread.start_scan()
883 elif self._status == 'scanning':886 elif self._status == 'scanning':
884 self._add_msg('stopping scan')887 self._add_msg('stopping scan')
913913
914 # always re-open scanner, to work around HPLIP bugs914 # always re-open scanner, to work around HPLIP bugs
915 self._open_scanner(self._current_scanner_name)915 self._open_scanner(self._current_scanner_name)
916 self._set_settings(self._old_settings)
917 # HACK: cause the toolbar to re-read the settings after
918 # changing them
919 self._settings_toolbar.set_scanner(self._current_scanner)
916920
917 def _add_images(self, image_infos):921 def _add_images(self, image_infos):
918 for info in image_infos:922 for info in image_infos: