From dc87456a370f32162c9d3f62b07b7ee6330d1cb1 Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Thu, 29 Nov 2007 06:40:06 +0000 Subject: [PATCH] * src/plugins/ImportCSV.py: add progress meter 2007-11-29 Douglas S. Blank svn: r9430 --- ChangeLog | 3 +++ src/plugins/ImportCSV.py | 9 +++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 78ed3b77c..1a3eda13e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2007-11-29 Douglas S. Blank + * src/plugins/ImportCSV.py: add progress meter + 2007-11-29 Douglas S. Blank * src/ViewManager.py: use PluginsWindows * src/PluginUtils/_PluginStatus.py: moved from diff --git a/src/plugins/ImportCSV.py b/src/plugins/ImportCSV.py index 70c7679ee..9a6e44f67 100644 --- a/src/plugins/ImportCSV.py +++ b/src/plugins/ImportCSV.py @@ -61,6 +61,7 @@ from QuestionDialog import ErrorDialog from DateHandler import parser as _dp from PluginUtils import register_import from Utils import gender as gender_map +from Utils import ProgressMeter from htmlentitydefs import name2codepoint #------------------------------------------------------------------------- @@ -251,7 +252,10 @@ class CSVParser: print "error: invalid storeup type in CSV import: '%s'" % type def process(self): + progress = ProgressMeter(_('CSV Import')) + progress.set_pass(_('Reading data...'), 1) data = self.readCSV() + progress.set_pass(_('Importing data...'), len(data)) self.trans = self.db.transaction_begin("",batch=True) self.db.disable_signals() t = time.time() @@ -260,11 +264,11 @@ class CSVParser: self.fam_count = 0 self.indi_count = 0 self.pref = {} # person ref, internal to this sheet - self.fref = {} # family ref, internal to this sheet - + self.fref = {} # family ref, internal to this sheet header = None line_number = 0 for row in data: + progress.step() line_number += 1 if "".join(row) == "": # no blanks are allowed inside a table header = None # clear headers, ready for next "table" @@ -523,6 +527,7 @@ class CSVParser: print msg print "New Families: %d" % self.fam_count print "New Individuals: %d" % self.indi_count + progress.close() return None def get_or_create_family(self, family_ref, husband, wife):