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.
scan.py
(8 / 0)
  
606606 self._status_entry = None
607607 self._scan_button = None
608608 self._settings_toolbar = None
609 self._old_settings = None
609610 temp_dir = os.path.join(self.get_activity_root(), 'tmp')
610611 self._scan_thread = ScanThread(temp_dir,
611612 callback=self._scan_finished_cb)
879879 self._scan_thread.autocontrast = self._settings_toolbar.autocontrast
880880 self._scan_thread.autocontrast_cutoff = self._settings_toolbar.autocontrast_cutoff
881881 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()
882885 self._scan_thread.start_scan()
883886 elif self._status == 'scanning':
884887 self._add_msg('stopping scan')
913913
914914 # always re-open scanner, to work around HPLIP bugs
915915 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
917921 def _add_images(self, image_infos):
918922 for info in image_infos: