* src/plugins/ImportCSV.py: add progress meter
2007-11-29 Douglas S. Blank <dblank@cs.brynmawr.edu> svn: r9430
This commit is contained in:
parent
15f4b137da
commit
dc87456a37
@ -1,3 +1,6 @@
|
|||||||
|
2007-11-29 Douglas S. Blank <dblank@cs.brynmawr.edu>
|
||||||
|
* src/plugins/ImportCSV.py: add progress meter
|
||||||
|
|
||||||
2007-11-29 Douglas S. Blank <dblank@cs.brynmawr.edu>
|
2007-11-29 Douglas S. Blank <dblank@cs.brynmawr.edu>
|
||||||
* src/ViewManager.py: use PluginsWindows
|
* src/ViewManager.py: use PluginsWindows
|
||||||
* src/PluginUtils/_PluginStatus.py: moved from
|
* src/PluginUtils/_PluginStatus.py: moved from
|
||||||
|
@ -61,6 +61,7 @@ from QuestionDialog import ErrorDialog
|
|||||||
from DateHandler import parser as _dp
|
from DateHandler import parser as _dp
|
||||||
from PluginUtils import register_import
|
from PluginUtils import register_import
|
||||||
from Utils import gender as gender_map
|
from Utils import gender as gender_map
|
||||||
|
from Utils import ProgressMeter
|
||||||
from htmlentitydefs import name2codepoint
|
from htmlentitydefs import name2codepoint
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
@ -251,7 +252,10 @@ class CSVParser:
|
|||||||
print "error: invalid storeup type in CSV import: '%s'" % type
|
print "error: invalid storeup type in CSV import: '%s'" % type
|
||||||
|
|
||||||
def process(self):
|
def process(self):
|
||||||
|
progress = ProgressMeter(_('CSV Import'))
|
||||||
|
progress.set_pass(_('Reading data...'), 1)
|
||||||
data = self.readCSV()
|
data = self.readCSV()
|
||||||
|
progress.set_pass(_('Importing data...'), len(data))
|
||||||
self.trans = self.db.transaction_begin("",batch=True)
|
self.trans = self.db.transaction_begin("",batch=True)
|
||||||
self.db.disable_signals()
|
self.db.disable_signals()
|
||||||
t = time.time()
|
t = time.time()
|
||||||
@ -260,11 +264,11 @@ class CSVParser:
|
|||||||
self.fam_count = 0
|
self.fam_count = 0
|
||||||
self.indi_count = 0
|
self.indi_count = 0
|
||||||
self.pref = {} # person ref, internal to this sheet
|
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
|
header = None
|
||||||
line_number = 0
|
line_number = 0
|
||||||
for row in data:
|
for row in data:
|
||||||
|
progress.step()
|
||||||
line_number += 1
|
line_number += 1
|
||||||
if "".join(row) == "": # no blanks are allowed inside a table
|
if "".join(row) == "": # no blanks are allowed inside a table
|
||||||
header = None # clear headers, ready for next "table"
|
header = None # clear headers, ready for next "table"
|
||||||
@ -523,6 +527,7 @@ class CSVParser:
|
|||||||
print msg
|
print msg
|
||||||
print "New Families: %d" % self.fam_count
|
print "New Families: %d" % self.fam_count
|
||||||
print "New Individuals: %d" % self.indi_count
|
print "New Individuals: %d" % self.indi_count
|
||||||
|
progress.close()
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def get_or_create_family(self, family_ref, husband, wife):
|
def get_or_create_family(self, family_ref, husband, wife):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user