Exemplo n.º 1
0
 def do(self):
     SimpleAction.do(self)
     (model, selection_iter) = self.__dialog.lists["docs"]["gui"].get_selection().get_selected()
     if selection_iter == None:
         print "No doc selected"
         return
     val = model.get_value(selection_iter, 5)
     self.__dialog.removeDocButton.set_sensitive(val)
Exemplo n.º 2
0
 def do(self):
     SimpleAction.do(self)
     (model, selection_iter) = self.__dialog.lists["docs"]["gui"].get_selection().get_selected()
     if selection_iter == None:
         print "No doc selected"
         return
     self.__dialog.lists["docs"]["gui"].set_cursor(
         model.get_path(selection_iter), self.__dialog.lists["docs"]["columns"]["nb_pages"], start_editing=True
     )
Exemplo n.º 3
0
 def do(self, new_text):
     SimpleAction.do(self, new_text=new_text)
     new_text = str(int(new_text))  # make sure it's a valid number
     (model, selection_iter) = self.__dialog.lists["docs"]["gui"].get_selection().get_selected()
     if selection_iter == None:
         print "No doc selected"
         return
     line = model[selection_iter]
     line[1] = int(new_text)
     model[selection_iter] = line
Exemplo n.º 4
0
 def do(self):
     SimpleAction.do(self)
     (model, selection_iter) = self.__dialog.lists["docs"]["gui"].get_selection().get_selected()
     if selection_iter == None:
         print "No doc selected"
         return
     model.remove(selection_iter)
     for line_idx in range(0, len(self.__dialog.lists["docs"]["model"])):
         line = self.__dialog.lists["docs"]["model"][line_idx]
         if not self.__dialog.lists["docs"]["include_current_doc"]:
             line[0] = _("Document %d") % (line_idx + 1)
         elif line_idx != 0:
             line[0] = _("Document %d") % line_idx
Exemplo n.º 5
0
 def do(self):
     SimpleAction.do(self)
     docidx = len(self.__dialog.lists["docs"]["model"])
     if not self.__dialog.lists["docs"]["include_current_doc"]:
         docidx += 1
     self.__dialog.lists["docs"]["model"].append(
         [
             _("Document %d") % docidx,
             "1",  # nb_pages
             True,  # can_edit (nb_pages)
             0,  # scan_progress_int
             "",  # scan_progress_txt
             True,  # can_delete
         ]
     )
Exemplo n.º 6
0
    def do(self):
        SimpleAction.do(self)
        try:
            scanner = self.__config.get_scanner_inst()
        except Exception:
            print "No scanner found !"
            gobject.idle_add(popup_no_scanner_found, self.__dialog.dialog)
            raise

        for line_idx in range(0, len(self.__dialog.lists["docs"]["model"])):
            line = self.__dialog.lists["docs"]["model"][line_idx]
            doc = None
            if line_idx == 0:
                doc = self.__main_win_doc
            worker = DocScanWorker(self.__config, nb_pages=int(line[1]), line_in_treeview=line_idx, doc=doc)
            self.__dialog.scan_queue.add_worker(worker)
        if not self.__dialog.scan_queue.is_running:
            try:
                scanner.options["source"].value = "ADF"
            except pyinsane.rawapi.SaneException, exc:
                print ("Warning: Unable to set scanner source to 'Auto': %s" % (str(exc)))
            scan_src = scanner.scan(multiple=True)
            self.__dialog.scan_queue.start(scan_src=scan_src)
Exemplo n.º 7
0
 def do(self):
     SimpleAction.do(self)
     self.__dialog.dialog.destroy()