Subversion Repositories basico

Rev

Rev 129 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 129 Rev 130
Line 504... Line 504...
504
504
505
505
506
    def import_notes_from_file(self):
506
    def import_notes_from_file(self):
507
        db = self.get_service('DB')
507
        db = self.get_service('DB')
508
        notebook = self.gui.get_widget('notebook')
508
        notebook = self.gui.get_widget('notebook')
509
        rootwin = self.gui.get_widget('mainbox')
-
 
-
 
509
        #~ rootwin = self.gui.get_widget('mainbox')
-
 
510
        #~ self.log.debug (type(rootwin))
510
511
511
        dialog = Gtk.FileChooserDialog("Select Basico JSON file", rootwin,
-
 
-
 
512
        dialog = Gtk.FileChooserDialog("Select Basico JSON file", None,
512
            Gtk.FileChooserAction.OPEN,
513
            Gtk.FileChooserAction.OPEN,
513
                (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
514
                (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
514
                 Gtk.STOCK_SAVE, Gtk.ResponseType.OK))
515
                 Gtk.STOCK_SAVE, Gtk.ResponseType.OK))
515
        response = dialog.run()
516
        response = dialog.run()
516
517
Line 528... Line 529...
528
            self.current_notes = bag
529
            self.current_notes = bag
529
            sapnoteview.populate(bag)
530
            sapnoteview.populate(bag)
530
            db.save_notes()
531
            db.save_notes()
531
            self.refresh_view()
532
            self.refresh_view()
532
            switch = self.gui.get_widget('schSelectNotesAllNone')
533
            switch = self.gui.get_widget('schSelectNotesAllNone')
533
            sapnoteview.select_all_none(switch, True)
-
 
534
            sapnoteview.select_all_none(switch, False)
-
 
535
            sapnoteview.expand_all()
-
 
-
 
534
            #~ sapnoteview.select_all_none(switch, True)
-
 
535
            #~ sapnoteview.select_all_none(switch, False)
-
 
536
            #~ sapnoteview.expand_all()
536
        else:
537
        else:
537
            self.alert.show('Import', 'Nothing imported', 'error')
538
            self.alert.show('Import', 'Nothing imported', 'error')
538
            self.log.debug("Nothing imported")
539
            self.log.debug("Nothing imported")
539
        dialog.destroy()
540
        dialog.destroy()
540
541
Line 565... Line 566...
565
566
566
        self.sap.start_fetching(len(bag))
567
        self.sap.start_fetching(len(bag))
567
        dlbag = {}
568
        dlbag = {}
568
569
569
        # FIXME: max_workers = 1 = Threads disabled
570
        # FIXME: max_workers = 1 = Threads disabled
570
        with Executor(max_workers=2) as exe:
-
 
-
 
571
        with Executor(max_workers=1) as exe:
571
            jobs = []
572
            jobs = []
572
            for sapnote in bag:
573
            for sapnote in bag:
573
                job = exe.submit(self.sap.fetch, sapnote)
574
                job = exe.submit(self.sap.fetch, sapnote)
574
                jobs.append(job)
575
                jobs.append(job)
575
576