Ejemplo n.º 1
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,
                                   docsearch=self.__docsearch,
                                   doc=doc)
            self.__dialog.scan_queue.add_worker(worker)
        if self.__dialog.scan_queue.is_running:
            return
        try:
            scanner.options['source'].value = "ADF"
        except pyinsane.rawapi.SaneException, exc:
            print ("Warning: Unable to set scanner source to 'Auto': %s" %
                   (str(exc)))
Ejemplo n.º 2
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,
                                   docsearch=self.__docsearch,
                                   doc=doc)
            self.__dialog.scan_queue.add_worker(worker)
        if self.__dialog.scan_queue.is_running:
            return
        try:
            scanner.options['source'].value = "ADF"
        except pyinsane.rawapi.SaneException, exc:
            print("Warning: Unable to set scanner source to 'Auto': %s" %
                  (str(exc)))
Ejemplo n.º 3
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)
Ejemplo n.º 4
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
     docs_gui = self.__dialog.lists['docs']['gui']
     (model, selection_iter) = docs_gui.get_selection().get_selected()
     if selection_iter is None:
         logger.warn("No doc selected")
         return
     line = model[selection_iter]
     int(new_text)  # make sure it's a valid number
     line[1] = new_text
Ejemplo n.º 5
0
 def do(self):
     SimpleAction.do(self)
     docs_gui = self.__dialog.lists['docs']['gui']
     (model, selection_iter) = docs_gui.get_selection().get_selected()
     if selection_iter is None:
         logger.warn("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)
Ejemplo n.º 6
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
     docs_gui = self.__dialog.lists['docs']['gui']
     (model, selection_iter) = docs_gui.get_selection().get_selected()
     if selection_iter is None:
         logger.warn("No doc selected")
         return
     line = model[selection_iter]
     int(new_text)  # make sure it's a valid number
     line[1] = new_text
Ejemplo n.º 7
0
 def do(self):
     SimpleAction.do(self)
     docs_gui = self.__dialog.lists['docs']['gui']
     (model, selection_iter) = docs_gui.get_selection().get_selected()
     if selection_iter is None:
         logger.warn("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)
Ejemplo n.º 8
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
Ejemplo n.º 9
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)
Ejemplo n.º 10
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)
Ejemplo n.º 11
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]
     int(new_text)  # make sure it's a valid number
     line[1] = new_text
Ejemplo n.º 12
0
 def do(self):
     SimpleAction.do(self)
     selection = self.__dialog.lists['docs']['gui'].get_selection()
     if selection is None:
         logger.warn("No doc selected")
         return
     (model, selection_iter) = selection.get_selected()
     if selection_iter is None:
         logger.warn("No doc selected")
         return
     val = model.get_value(selection_iter, 5)
     self.__dialog.removeDocButton.set_sensitive(val)
Ejemplo n.º 13
0
 def do(self):
     SimpleAction.do(self)
     selection = self.__dialog.lists['docs']['gui'].get_selection()
     if selection is None:
         logger.warn("No doc selected")
         return
     (model, selection_iter) = selection.get_selected()
     if selection_iter is None:
         logger.warn("No doc selected")
         return
     val = model.get_value(selection_iter, 5)
     self.__dialog.removeDocButton.set_sensitive(val)
Ejemplo n.º 14
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
     ])
Ejemplo n.º 15
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
Ejemplo n.º 16
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
         ])
Ejemplo n.º 17
0
 def do(self):
     SimpleAction.do(self)
     docs_gui = self.__dialog.lists['docs']['gui']
     (model, selection_iter) = docs_gui.get_selection().get_selected()
     if selection_iter is None:
         logger.warn("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
Ejemplo n.º 18
0
    def do(self):
        SimpleAction.do(self)

        job = self.__multiscan_win.job_factories['scan'].make_head()
        self.__multiscan_win.schedulers['main'].schedule(job)
        try:
            try:
                scanner = self.__config.get_scanner_inst()
            except Exception:
                logger.error("No scanner found !")
                GObject.idle_add(popup_no_scanner_found,
                                 self.__multiscan_win.dialog)
                raise

            try:
                set_scanner_opt('source', scanner.options['source'],
                                ["ADF", ".*ADF.*", ".*Feeder.*"])
            except (KeyError, pyinsane.SaneException), exc:
                logger.error("Warning: Unable to set scanner source to 'Auto': %s"
                       % exc)
            maximize_scan_area(scanner)
            try:
                scan_src = scanner.scan(multiple=True)
            except Exception:
                logger.error("No scanner found !")
                GObject.idle_add(popup_no_scanner_found,
                                 self.__multiscan_win.dialog)
                raise

            rng = xrange(0, len(self.__multiscan_win.lists['docs']['model']))
            for line_idx in rng:
                line = self.__multiscan_win.lists['docs']['model'][line_idx]
                doc = None
                if line_idx == 0:
                    doc = self.__main_win_doc
                job = self.__multiscan_win.job_factories['scan'].make(
                    int(line[1]), line_idx, self.__docsearch, doc, scan_src)
                self.__multiscan_win.schedulers['main'].schedule(job)
Ejemplo n.º 19
0
    def do(self):
        SimpleAction.do(self)

        job = self.__multiscan_win.job_factories['scan'].make_head()
        self.__multiscan_win.schedulers['main'].schedule(job)
        try:
            try:
                scanner = self.__config.get_scanner_inst()
            except Exception:
                logger.error("No scanner found !")
                GObject.idle_add(popup_no_scanner_found,
                                 self.__multiscan_win.dialog)
                raise

            try:
                set_scanner_opt('source', scanner.options['source'],
                                ["ADF", ".*ADF.*", ".*Feeder.*"])
            except (KeyError, pyinsane.SaneException), exc:
                logger.error("Warning: Unable to set scanner source to 'Auto': %s"
                       % exc)
            try:
                scan_src = scanner.scan(multiple=True)
            except Exception:
                logger.error("No scanner found !")
                GObject.idle_add(popup_no_scanner_found,
                                 self.__multiscan_win.dialog)
                raise

            rng = xrange(0, len(self.__multiscan_win.lists['docs']['model']))
            for line_idx in rng:
                line = self.__multiscan_win.lists['docs']['model'][line_idx]
                doc = None
                if line_idx == 0:
                    doc = self.__main_win_doc
                job = self.__multiscan_win.job_factories['scan'].make(
                    int(line[1]), line_idx, self.__docsearch, doc, scan_src)
                self.__multiscan_win.schedulers['main'].schedule(job)
Ejemplo n.º 20
0
 def __init__(self, multiscan_win):
     SimpleAction.__init__(self, "Cancel multi-scan")
     self.__multiscan_win = multiscan_win
Ejemplo n.º 21
0
 def __init__(self, multiscan_dialog):
     SimpleAction.__init__(self, "Add doc to the multi-scan list")
     self.__dialog = multiscan_dialog
Ejemplo n.º 22
0
 def do(self):
     SimpleAction.do(self)
     self.__multiscan_win.dialog.destroy()
Ejemplo n.º 23
0
 def __init__(self, multiscan_dialog):
     SimpleAction.__init__(self, "Doc selected in multi-scan list")
     self.__dialog = multiscan_dialog
Ejemplo n.º 24
0
 def __init__(self, settings_win):
     SimpleAction.__init__(self, "New scanner selected")
     self.__settings_win = settings_win
Ejemplo n.º 25
0
 def __init__(self, multiscan_win, config, docsearch, main_win_doc):
     SimpleAction.__init__(self, "Start multi-scan")
     self.__multiscan_win = multiscan_win
     self.__config = config
     self.__docsearch = docsearch
     self.__main_win_doc = main_win_doc
Ejemplo n.º 26
0
 def __init__(self, settings_win, config):
     SimpleAction.__init__(self, "Cancel settings")
     self.__settings_win = settings_win
     self.__config = config
Ejemplo n.º 27
0
 def __init__(self, settings_win):
     SimpleAction.__init__(self, "Scan calibration sheet")
     self.__settings_win = settings_win
Ejemplo n.º 28
0
 def __init__(self, multiscan_dialog):
     SimpleAction.__init__(self, "Cancel multi-scan")
     self.__dialog = multiscan_dialog
Ejemplo n.º 29
0
 def __init__(self, multiscan_dialog):
     SimpleAction.__init__(self, "End doc edit in multi-scan list")
     self.__dialog = multiscan_dialog
Ejemplo n.º 30
0
 def __init__(self, multiscan_dialog):
     SimpleAction.__init__(self, "Doc selected in multi-scan list")
     self.__dialog = multiscan_dialog
Ejemplo n.º 31
0
 def __init__(self, multiscan_dialog, config, docsearch, main_win_doc):
     SimpleAction.__init__(self, "Start multi-scan")
     self.__dialog = multiscan_dialog
     self.__config = config
     self.__docsearch = docsearch
     self.__main_win_doc = main_win_doc
Ejemplo n.º 32
0
 def __init__(self, multiscan_dialog, config):
     SimpleAction.__init__(self, "Add doc to the multi-scan list")
     self.__dialog = multiscan_dialog
     self.__config = config
Ejemplo n.º 33
0
 def do(self):
     SimpleAction.do(self)
     self.__dialog.dialog.destroy()
Ejemplo n.º 34
0
 def __init__(self, multiscan_dialog):
     SimpleAction.__init__(self, "End doc edit in multi-scan list")
     self.__dialog = multiscan_dialog
Ejemplo n.º 35
0
 def do(self):
     SimpleAction.do(self)
     self.__dialog.dialog.destroy()
Ejemplo n.º 36
0
 def __init__(self, settings_win):
     SimpleAction.__init__(self, "Scan calibration sheet")
     self.__settings_win = settings_win
Ejemplo n.º 37
0
 def __init__(self, settings_win, config):
     SimpleAction.__init__(self, "Cancel settings")
     self.__settings_win = settings_win
     self.__config = config
Ejemplo n.º 38
0
 def __init__(self, multiscan_dialog):
     SimpleAction.__init__(self, "Cancel multi-scan")
     self.__dialog = multiscan_dialog
Ejemplo n.º 39
0
 def __init__(self, multiscan_win):
     SimpleAction.__init__(self, "Cancel multi-scan")
     self.__multiscan_win = multiscan_win
Ejemplo n.º 40
0
 def do(self):
     SimpleAction.do(self)
     self.__multiscan_win.dialog.destroy()
Ejemplo n.º 41
0
 def __init__(self, settings_win):
     SimpleAction.__init__(self, "New scanner selected")
     self.__settings_win = settings_win