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

Commit b6dc4fe9fe9dbc35c1ddce47600d37b659a8219d

Add support for removing scanned pages

Scanned pages can be removed by selecting them and using the new "Remove" tool
button. Useful for bad scans.
scan.py
(22 / 1)
  
597597 model_types = [_type for name_, _type in self._MODEL_COLUMNS]
598598 self._images_model = gtk.ListStore(*model_types)
599599 self._images_view = gtk.TreeView(self._images_model)
600 selection = self._images_view.get_selection()
601 selection.connect('changed', self._selection_changed_cb)
602 selection.set_mode(gtk.SELECTION_MULTIPLE)
600603 image_column = gtk.TreeViewColumn('Image', gtk.CellRendererPixbuf(),
601604 pixbuf=0)
602605 self._images_view.append_column(image_column)
633633 toolbar_box.toolbar.insert(settings_button, -1)
634634 settings_button.show()
635635
636 self._remove_button = ToolButton('edit-delete')
637 self._remove_button.props.tooltip = _('Remove selected page(s)')
638 self._remove_button.set_sensitive(False)
639 self._remove_button.connect('clicked', self._remove_button_cb)
640 toolbar_box.toolbar.insert(self._remove_button, -1)
641 self._remove_button.show()
642
636643 self._save_button = ToolButton('document-save')
637644 self._save_button.props.tooltip = _('Save collection as PDF')
638645 self._save_button.set_sensitive(False)
674674 logging.warning('_scan_button_cb called with status=%r',
675675 self._status)
676676
677
678677 @trace()
679678 def _scan_finished_cb(self, image_infos, exc):
680679 gobject.idle_add(self._scan_finished_real_cb, image_infos, exc)
700700 for info in image_infos:
701701 row = [info[name] for name, type_ in self._MODEL_COLUMNS]
702702 self._images_model.append(row)
703
704 def _selection_changed_cb(self, selection):
705 selected = bool(selection.count_selected_rows())
706 self._remove_button.set_sensitive(selected)
707
708 def _remove_button_cb(self, button):
709 model_, paths = self._images_view.get_selection().get_selected_rows()
710 refs = [gtk.TreeRowReference(self._images_model, path)
711 for path in paths]
712 for ref in refs:
713 iter = self._images_model.get_iter(ref.get_path())
714 self._images_model.remove(iter)
703715
704716 @trace()
705717 def _save_button_cb(self, *args):