* src/plugins/WriteGedcom.py (cl_setup): Define newline char.
* src/plugins/WriteFtree.py: Provide command line interface. * src/gramps_main.py (handle_args): Add function. Add WFT export format; (cl_export): Add WFT format. * doc/gramps.1.in: Update man page to reflect new format option. * doc/gramps.1: Likewise. * NEWS: Likewise. * TODO: Add recently discussed items from gramps-devel. svn: r2133
This commit is contained in:
parent
8a3bd40f52
commit
4f738022e8
@ -1,3 +1,13 @@
|
|||||||
|
2003-09-15 Alex Roitman <shura@alex.neuro.umn.edu>
|
||||||
|
* src/plugins/WriteGedcom.py (cl_setup): Define newline char.
|
||||||
|
* src/plugins/WriteFtree.py: Provide command line interface.
|
||||||
|
* src/gramps_main.py (handle_args): Add function. Add WFT export
|
||||||
|
format; (cl_export): Add WFT format.
|
||||||
|
* doc/gramps.1.in: Update man page to reflect new format option.
|
||||||
|
* doc/gramps.1: Likewise.
|
||||||
|
* NEWS: Likewise.
|
||||||
|
* TODO: Add recently discussed items from gramps-devel.
|
||||||
|
|
||||||
2003-09-14 Alex Roitman <shura@alex.neuro.umn.edu>
|
2003-09-14 Alex Roitman <shura@alex.neuro.umn.edu>
|
||||||
* src/SourceView.py (button_press,on_add_clicked,on_delete_clicked,
|
* src/SourceView.py (button_press,on_add_clicked,on_delete_clicked,
|
||||||
on_edit_clicked): Pass parent window to the child dialog.
|
on_edit_clicked): Pass parent window to the child dialog.
|
||||||
|
@ -30,7 +30,8 @@ Version 0.9.4 -- the "This used to bug me..." release
|
|||||||
* User can choose between the usual (left to right) or alternative (top to
|
* User can choose between the usual (left to right) or alternative (top to
|
||||||
bottom) Family View.
|
bottom) Family View.
|
||||||
* Support for graphics in Book Report.
|
* Support for graphics in Book Report.
|
||||||
* Fair share of bug fixes.
|
* Command line option for exporting to the Web Family Tree (-f wtf).
|
||||||
|
* Dozens of bug fixes.
|
||||||
|
|
||||||
Version 0.9.3
|
Version 0.9.3
|
||||||
* New reports: Ancestors (text), Fan Chart (graphics), and
|
* New reports: Ancestors (text), Fan Chart (graphics), and
|
||||||
|
13
gramps2/TODO
13
gramps2/TODO
@ -1,7 +1,12 @@
|
|||||||
* Remember where the images are added from (RFE 748974). This is actually
|
* Add support for storing reliability (confidence) of the marriage information;
|
||||||
very useful when you add 50 new images -- navigating 50 times to the same
|
see http://sourceforge.net/mailarchive/forum.php?thread_id=3066997&forum_id=1993
|
||||||
place is a nightmare. All that's needed is keeping track of a single
|
and http://sourceforge.net/mailarchive/forum.php?thread_id=3134931&forum_id=1993
|
||||||
last selected directory and then point gtk.FileSellector there.
|
for the details.
|
||||||
|
|
||||||
|
* Work out the model and the interface for the completeness of a person,
|
||||||
|
see http://sourceforge.net/mailarchive/forum.php?thread_id=3127454&forum_id=1993
|
||||||
|
and http://sourceforge.net/mailarchive/forum.php?thread_id=3134932&forum_id=1993
|
||||||
|
for the details.
|
||||||
|
|
||||||
* Presense of Notes for a person/event/whatever_else. RFE 747527 suggested
|
* Presense of Notes for a person/event/whatever_else. RFE 747527 suggested
|
||||||
either a column in the People View or something like boldfaces "Notes"
|
either a column in the People View or something like boldfaces "Notes"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
.TH gramps 1 "0.9.3" "July 2003" "0.9.3"
|
.TH gramps 1 "0.9.4" "September 2003" "0.9.4"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
gramps \- Genealogical Research and Analysis Management Programming System.
|
gramps \- Genealogical Research and Analysis Management Programming System.
|
||||||
|
|
||||||
@ -45,7 +45,8 @@ directory), \fBgedcom\fR (guessed if \fIFILENAME\fR ends with \fB.ged\fR), and
|
|||||||
.br
|
.br
|
||||||
|
|
||||||
Formats available for export are \fBgramps\fR, \fBgedcom\fR, \fBgramps\-pkg\fR,
|
Formats available for export are \fBgramps\fR, \fBgedcom\fR, \fBgramps\-pkg\fR,
|
||||||
and \fBiso\fR (never guessed, always specify with \fB\-f\fR option).
|
\fBwft\fR (guessed if \fIFILENAME\fR ends with \fB.wft\fR), and \fBiso\fR
|
||||||
|
(never guessed, always specify with \fB\-f\fR option).
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.BI \-i " FILENAME"
|
.BI \-i " FILENAME"
|
||||||
@ -65,8 +66,8 @@ gramps IDs in the resulting database.
|
|||||||
.BI \-o " FILENAME"
|
.BI \-o " FILENAME"
|
||||||
Export data into \fIFILENAME\fR. For \fBgramps\fR and \fBiso\fR formats, the
|
Export data into \fIFILENAME\fR. For \fBgramps\fR and \fBiso\fR formats, the
|
||||||
\fIFILENAME\fR is actually the name of directory the gramps database will be
|
\fIFILENAME\fR is actually the name of directory the gramps database will be
|
||||||
written into. For \fBgedcom\fR and \fBgramps\-pkg\fR, the \fIFILENAME\fR
|
written into. For \fBgedcom\fR, \fBwft\fR, and \fBgramps\-pkg\fR,
|
||||||
is the name of the resulting file.
|
the \fIFILENAME\fR is the name of the resulting file.
|
||||||
.br
|
.br
|
||||||
|
|
||||||
When more than one output file is given, each has to be preceded
|
When more than one output file is given, each has to be preceded
|
||||||
@ -106,11 +107,11 @@ of \fIstdout\fR and \fIstderr\fR to save messages and errors in files.
|
|||||||
|
|
||||||
.SH EXAMPLES
|
.SH EXAMPLES
|
||||||
.TP
|
.TP
|
||||||
To import three databases (whose formats can be determined from their names) and then check the resulting database for errors, one may type:
|
To import four databases (whose formats can be determined from their names) and then check the resulting database for errors, one may type:
|
||||||
\fBgramps\fR \fB\-i\fR \fIfile1.ged\fR \fB\-i\fR \fIfile2.tgz\fR \fB\-i\fR \fI~/db3\fR \fB\-a\fR \fIcheck\fR
|
\fBgramps\fR \fB\-i\fR \fIfile1.ged\fR \fB\-i\fR \fIfile2.tgz\fR \fB\-i\fR \fI~/db3\fR \fB\-i\fR \fIfile4.wft\fR \fB\-a\fR \fIcheck\fR
|
||||||
.TP
|
.TP
|
||||||
To explicitly specify the formats in the above example, append filenames with appropriate \fB\-f\fR options:
|
To explicitly specify the formats in the above example, append filenames with appropriate \fB\-f\fR options:
|
||||||
\fBgramps\fR \fB\-i\fR \fIfile1.ged\fR \fB\-f\fR \fIgedcom\fR \fB\-i\fR \fIfile2.tgz\fR \fB\-f\fR \fIgramps-pkg\fR \fB\-i\fR \fI~/dir3\fR \fB\-f\fR \fIgramps\fR \fB\-a\fR \fIcheck\fR
|
\fBgramps\fR \fB\-i\fR \fIfile1.ged\fR \fB\-f\fR \fIgedcom\fR \fB\-i\fR \fIfile2.tgz\fR \fB\-f\fR \fIgramps-pkg\fR \fB\-i\fR \fI~/db3\fR \fB\-f\fR \fIgramps\fR \fB\-i\fR \fIfile4.wft\fR \fB\-f\fR \fIwft\fR \fB\-a\fR \fIcheck\fR
|
||||||
.TP
|
.TP
|
||||||
To record the database resulting from all imports, supply \fB\-o\fR flag (use \fB\-f\fR if the filename does not allow gramps to guess the format):
|
To record the database resulting from all imports, supply \fB\-o\fR flag (use \fB\-f\fR if the filename does not allow gramps to guess the format):
|
||||||
\fBgramps\fR \fB\-i\fR \fIfile1.ged\fR \fB\-i\fR \fIfile2.tgz\fR \fB\-o\fR \fI~/new-package\fR \fB\-f\fR \fIgramps-pkg\fR
|
\fBgramps\fR \fB\-i\fR \fIfile1.ged\fR \fB\-i\fR \fIfile2.tgz\fR \fB\-o\fR \fI~/new-package\fR \fB\-f\fR \fIgramps-pkg\fR
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
.TH gramps 1 "@VERSION@" "July 2003" "@VERSION@"
|
.TH gramps 1 "@VERSION@" "September 2003" "@VERSION@"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
gramps \- Genealogical Research and Analysis Management Programming System.
|
gramps \- Genealogical Research and Analysis Management Programming System.
|
||||||
|
|
||||||
@ -45,7 +45,8 @@ directory), \fBgedcom\fR (guessed if \fIFILENAME\fR ends with \fB.ged\fR), and
|
|||||||
.br
|
.br
|
||||||
|
|
||||||
Formats available for export are \fBgramps\fR, \fBgedcom\fR, \fBgramps\-pkg\fR,
|
Formats available for export are \fBgramps\fR, \fBgedcom\fR, \fBgramps\-pkg\fR,
|
||||||
and \fBiso\fR (never guessed, always specify with \fB\-f\fR option).
|
\fBwft\fR (guessed if \fIFILENAME\fR ends with \fB.wft\fR), and \fBiso\fR
|
||||||
|
(never guessed, always specify with \fB\-f\fR option).
|
||||||
|
|
||||||
.TP
|
.TP
|
||||||
.BI \-i " FILENAME"
|
.BI \-i " FILENAME"
|
||||||
@ -65,8 +66,8 @@ gramps IDs in the resulting database.
|
|||||||
.BI \-o " FILENAME"
|
.BI \-o " FILENAME"
|
||||||
Export data into \fIFILENAME\fR. For \fBgramps\fR and \fBiso\fR formats, the
|
Export data into \fIFILENAME\fR. For \fBgramps\fR and \fBiso\fR formats, the
|
||||||
\fIFILENAME\fR is actually the name of directory the gramps database will be
|
\fIFILENAME\fR is actually the name of directory the gramps database will be
|
||||||
written into. For \fBgedcom\fR and \fBgramps\-pkg\fR, the \fIFILENAME\fR
|
written into. For \fBgedcom\fR, \fBwft\fR, and \fBgramps\-pkg\fR,
|
||||||
is the name of the resulting file.
|
the \fIFILENAME\fR is the name of the resulting file.
|
||||||
.br
|
.br
|
||||||
|
|
||||||
When more than one output file is given, each has to be preceded
|
When more than one output file is given, each has to be preceded
|
||||||
@ -106,11 +107,11 @@ of \fIstdout\fR and \fIstderr\fR to save messages and errors in files.
|
|||||||
|
|
||||||
.SH EXAMPLES
|
.SH EXAMPLES
|
||||||
.TP
|
.TP
|
||||||
To import three databases (whose formats can be determined from their names) and then check the resulting database for errors, one may type:
|
To import four databases (whose formats can be determined from their names) and then check the resulting database for errors, one may type:
|
||||||
\fBgramps\fR \fB\-i\fR \fIfile1.ged\fR \fB\-i\fR \fIfile2.tgz\fR \fB\-i\fR \fI~/db3\fR \fB\-a\fR \fIcheck\fR
|
\fBgramps\fR \fB\-i\fR \fIfile1.ged\fR \fB\-i\fR \fIfile2.tgz\fR \fB\-i\fR \fI~/db3\fR \fB\-i\fR \fIfile4.wft\fR \fB\-a\fR \fIcheck\fR
|
||||||
.TP
|
.TP
|
||||||
To explicitly specify the formats in the above example, append filenames with appropriate \fB\-f\fR options:
|
To explicitly specify the formats in the above example, append filenames with appropriate \fB\-f\fR options:
|
||||||
\fBgramps\fR \fB\-i\fR \fIfile1.ged\fR \fB\-f\fR \fIgedcom\fR \fB\-i\fR \fIfile2.tgz\fR \fB\-f\fR \fIgramps-pkg\fR \fB\-i\fR \fI~/dir3\fR \fB\-f\fR \fIgramps\fR \fB\-a\fR \fIcheck\fR
|
\fBgramps\fR \fB\-i\fR \fIfile1.ged\fR \fB\-f\fR \fIgedcom\fR \fB\-i\fR \fIfile2.tgz\fR \fB\-f\fR \fIgramps-pkg\fR \fB\-i\fR \fI~/db3\fR \fB\-f\fR \fIgramps\fR \fB\-i\fR \fIfile4.wft\fR \fB\-f\fR \fIwft\fR \fB\-a\fR \fIcheck\fR
|
||||||
.TP
|
.TP
|
||||||
To record the database resulting from all imports, supply \fB\-o\fR flag (use \fB\-f\fR if the filename does not allow gramps to guess the format):
|
To record the database resulting from all imports, supply \fB\-o\fR flag (use \fB\-f\fR if the filename does not allow gramps to guess the format):
|
||||||
\fBgramps\fR \fB\-i\fR \fIfile1.ged\fR \fB\-i\fR \fIfile2.tgz\fR \fB\-o\fR \fI~/new-package\fR \fB\-f\fR \fIgramps-pkg\fR
|
\fBgramps\fR \fB\-i\fR \fIfile1.ged\fR \fB\-i\fR \fIfile2.tgz\fR \fB\-o\fR \fI~/new-package\fR \fB\-f\fR \fIgramps-pkg\fR
|
||||||
|
@ -154,120 +154,7 @@ class Gramps:
|
|||||||
self.init_interface()
|
self.init_interface()
|
||||||
|
|
||||||
if args:
|
if args:
|
||||||
try:
|
self.handle_args(args)
|
||||||
options,leftargs = getopt.getopt(args,
|
|
||||||
const.shortopts,const.longopts)
|
|
||||||
except getopt.GetoptError,msg:
|
|
||||||
print "Error: %s. Exiting." % msg
|
|
||||||
os._exit(1)
|
|
||||||
except:
|
|
||||||
print "Error parsing arguments: %s " % args
|
|
||||||
if leftargs:
|
|
||||||
print "Unrecognized option: %s" % leftargs[0]
|
|
||||||
os._exit(1)
|
|
||||||
exports = []
|
|
||||||
actions = []
|
|
||||||
imports = []
|
|
||||||
for opt_ix in range(len(options)):
|
|
||||||
o = options[opt_ix][0][1]
|
|
||||||
if o == '-':
|
|
||||||
continue
|
|
||||||
elif o == 'i':
|
|
||||||
fname = options[opt_ix][1]
|
|
||||||
if opt_ix<len(options)-1 and options[opt_ix+1][0][1]=='f':
|
|
||||||
format = options[opt_ix+1][1]
|
|
||||||
if format not in [ 'gedcom', 'gramps', 'gramps-pkg' ]:
|
|
||||||
print "Invalid format: %s" % format
|
|
||||||
os._exit(1)
|
|
||||||
elif fname[-3:].upper()== "GED":
|
|
||||||
format = 'gedcom'
|
|
||||||
elif fname[-3:].upper() == "TGZ":
|
|
||||||
format = 'gramps-pkg'
|
|
||||||
elif os.path.isdir(fname):
|
|
||||||
format = 'gramps'
|
|
||||||
else:
|
|
||||||
print "Unrecognized format for input file %s" % fname
|
|
||||||
os._exit(1)
|
|
||||||
imports.append((fname,format))
|
|
||||||
elif o == 'o':
|
|
||||||
outfname = options[opt_ix][1]
|
|
||||||
if opt_ix<len(options)-1 and options[opt_ix+1][0][1]=='f':
|
|
||||||
outformat = options[opt_ix+1][1]
|
|
||||||
if outformat not in [ 'gedcom', 'gramps', 'gramps-pkg', 'iso' ]:
|
|
||||||
print "Invalid format: %s" % outformat
|
|
||||||
os._exit(1)
|
|
||||||
elif outfname[-3:].upper() == "GED":
|
|
||||||
outformat = 'gedcom'
|
|
||||||
elif outfname[-3:].upper() == "TGZ":
|
|
||||||
outformat = 'gramps-pkg'
|
|
||||||
elif not os.path.isfile(outfname):
|
|
||||||
if not os.path.isdir(outfname):
|
|
||||||
try:
|
|
||||||
os.makedirs(outfname,0700)
|
|
||||||
except:
|
|
||||||
print "Cannot create directory %s" % outfname
|
|
||||||
os._exit(1)
|
|
||||||
outformat = 'gramps'
|
|
||||||
else:
|
|
||||||
print "Unrecognized format for output file %s" % outfname
|
|
||||||
os._exit(1)
|
|
||||||
exports.append((outfname,outformat))
|
|
||||||
elif o == 'a':
|
|
||||||
action = options[opt_ix][1]
|
|
||||||
if action not in [ 'check', 'summary' ]:
|
|
||||||
print "Unknown action: %s." % action
|
|
||||||
os._exit(1)
|
|
||||||
actions.append(action)
|
|
||||||
|
|
||||||
if imports:
|
|
||||||
self.cl = bool(exports or actions)
|
|
||||||
# Create dir for imported database(s)
|
|
||||||
self.impdir_path = os.path.expanduser("~/.gramps/import" )
|
|
||||||
if not os.path.isdir(self.impdir_path):
|
|
||||||
try:
|
|
||||||
os.mkdir(self.impdir_path,0700)
|
|
||||||
except:
|
|
||||||
print "Could not create import directory %s. Exiting." \
|
|
||||||
% self.impdir_path
|
|
||||||
os._exit(1)
|
|
||||||
elif not os.access(self.impdir_path,os.W_OK):
|
|
||||||
print "Import directory %s is not writable. Exiting." \
|
|
||||||
% self.impdir_path
|
|
||||||
os._exit(1)
|
|
||||||
# and clean it up before use
|
|
||||||
files = os.listdir(self.impdir_path) ;
|
|
||||||
for fn in files:
|
|
||||||
if os.path.isfile(os.path.join(self.impdir_path,fn)):
|
|
||||||
os.remove(os.path.join(self.impdir_path,fn))
|
|
||||||
|
|
||||||
self.clear_database(0)
|
|
||||||
self.db.setSavePath(self.impdir_path)
|
|
||||||
for imp in imports:
|
|
||||||
print "Importing: file %s, format %s." % (imp[0],imp[1])
|
|
||||||
self.cl_import(imp[0],imp[1])
|
|
||||||
else:
|
|
||||||
print "No data was given. Launching interactive session."
|
|
||||||
print "To use in the command-line mode,", \
|
|
||||||
"supply at least one input file to process."
|
|
||||||
|
|
||||||
if self.cl:
|
|
||||||
for expt in exports:
|
|
||||||
print "Exporting: file %s, format %s." % (expt[0],expt[1])
|
|
||||||
self.cl_export(expt[0],expt[1])
|
|
||||||
|
|
||||||
for action in actions:
|
|
||||||
print "Performing action: %s." % action
|
|
||||||
self.cl_action(action)
|
|
||||||
|
|
||||||
print "Cleaning up."
|
|
||||||
# clean import dir up after use
|
|
||||||
files = os.listdir(self.impdir_path) ;
|
|
||||||
for fn in files:
|
|
||||||
if os.path.isfile(os.path.join(self.impdir_path,fn)):
|
|
||||||
os.remove(os.path.join(self.impdir_path,fn))
|
|
||||||
print "Exiting."
|
|
||||||
os._exit(0)
|
|
||||||
|
|
||||||
elif GrampsCfg.lastfile and GrampsCfg.autoload:
|
elif GrampsCfg.lastfile and GrampsCfg.autoload:
|
||||||
self.auto_save_load(GrampsCfg.lastfile)
|
self.auto_save_load(GrampsCfg.lastfile)
|
||||||
else:
|
else:
|
||||||
@ -1195,6 +1082,123 @@ class Gramps:
|
|||||||
self.apply_filter()
|
self.apply_filter()
|
||||||
self.goto_active_person(1)
|
self.goto_active_person(1)
|
||||||
|
|
||||||
|
def handle_args(self,args):
|
||||||
|
try:
|
||||||
|
options,leftargs = getopt.getopt(args,
|
||||||
|
const.shortopts,const.longopts)
|
||||||
|
except getopt.GetoptError,msg:
|
||||||
|
print "Error: %s. Exiting." % msg
|
||||||
|
os._exit(1)
|
||||||
|
except:
|
||||||
|
print "Error parsing arguments: %s " % args
|
||||||
|
if leftargs:
|
||||||
|
print "Unrecognized option: %s" % leftargs[0]
|
||||||
|
os._exit(1)
|
||||||
|
exports = []
|
||||||
|
actions = []
|
||||||
|
imports = []
|
||||||
|
for opt_ix in range(len(options)):
|
||||||
|
o = options[opt_ix][0][1]
|
||||||
|
if o == '-':
|
||||||
|
continue
|
||||||
|
elif o == 'i':
|
||||||
|
fname = options[opt_ix][1]
|
||||||
|
if opt_ix<len(options)-1 and options[opt_ix+1][0][1]=='f':
|
||||||
|
format = options[opt_ix+1][1]
|
||||||
|
if format not in [ 'gedcom', 'gramps', 'gramps-pkg' ]:
|
||||||
|
print "Invalid format: %s" % format
|
||||||
|
os._exit(1)
|
||||||
|
elif fname[-3:].upper()== "GED":
|
||||||
|
format = 'gedcom'
|
||||||
|
elif fname[-3:].upper() == "TGZ":
|
||||||
|
format = 'gramps-pkg'
|
||||||
|
elif os.path.isdir(fname):
|
||||||
|
format = 'gramps'
|
||||||
|
else:
|
||||||
|
print "Unrecognized format for input file %s" % fname
|
||||||
|
os._exit(1)
|
||||||
|
imports.append((fname,format))
|
||||||
|
elif o == 'o':
|
||||||
|
outfname = options[opt_ix][1]
|
||||||
|
if opt_ix<len(options)-1 and options[opt_ix+1][0][1]=='f':
|
||||||
|
outformat = options[opt_ix+1][1]
|
||||||
|
if outformat not in [ 'gedcom', 'gramps', 'gramps-pkg', 'iso', 'wft' ]:
|
||||||
|
print "Invalid format: %s" % outformat
|
||||||
|
os._exit(1)
|
||||||
|
elif outfname[-3:].upper() == "GED":
|
||||||
|
outformat = 'gedcom'
|
||||||
|
elif outfname[-3:].upper() == "TGZ":
|
||||||
|
outformat = 'gramps-pkg'
|
||||||
|
elif outfname[-3:].upper() == "WFT":
|
||||||
|
outformat = 'wft'
|
||||||
|
elif not os.path.isfile(outfname):
|
||||||
|
if not os.path.isdir(outfname):
|
||||||
|
try:
|
||||||
|
os.makedirs(outfname,0700)
|
||||||
|
except:
|
||||||
|
print "Cannot create directory %s" % outfname
|
||||||
|
os._exit(1)
|
||||||
|
outformat = 'gramps'
|
||||||
|
else:
|
||||||
|
print "Unrecognized format for output file %s" % outfname
|
||||||
|
os._exit(1)
|
||||||
|
exports.append((outfname,outformat))
|
||||||
|
elif o == 'a':
|
||||||
|
action = options[opt_ix][1]
|
||||||
|
if action not in [ 'check', 'summary' ]:
|
||||||
|
print "Unknown action: %s." % action
|
||||||
|
os._exit(1)
|
||||||
|
actions.append(action)
|
||||||
|
|
||||||
|
if imports:
|
||||||
|
self.cl = bool(exports or actions)
|
||||||
|
# Create dir for imported database(s)
|
||||||
|
self.impdir_path = os.path.expanduser("~/.gramps/import" )
|
||||||
|
if not os.path.isdir(self.impdir_path):
|
||||||
|
try:
|
||||||
|
os.mkdir(self.impdir_path,0700)
|
||||||
|
except:
|
||||||
|
print "Could not create import directory %s. Exiting." \
|
||||||
|
% self.impdir_path
|
||||||
|
os._exit(1)
|
||||||
|
elif not os.access(self.impdir_path,os.W_OK):
|
||||||
|
print "Import directory %s is not writable. Exiting." \
|
||||||
|
% self.impdir_path
|
||||||
|
os._exit(1)
|
||||||
|
# and clean it up before use
|
||||||
|
files = os.listdir(self.impdir_path) ;
|
||||||
|
for fn in files:
|
||||||
|
if os.path.isfile(os.path.join(self.impdir_path,fn)):
|
||||||
|
os.remove(os.path.join(self.impdir_path,fn))
|
||||||
|
|
||||||
|
self.clear_database(0)
|
||||||
|
self.db.setSavePath(self.impdir_path)
|
||||||
|
for imp in imports:
|
||||||
|
print "Importing: file %s, format %s." % (imp[0],imp[1])
|
||||||
|
self.cl_import(imp[0],imp[1])
|
||||||
|
else:
|
||||||
|
print "No data was given. Launching interactive session."
|
||||||
|
print "To use in the command-line mode,", \
|
||||||
|
"supply at least one input file to process."
|
||||||
|
|
||||||
|
if self.cl:
|
||||||
|
for expt in exports:
|
||||||
|
print "Exporting: file %s, format %s." % (expt[0],expt[1])
|
||||||
|
self.cl_export(expt[0],expt[1])
|
||||||
|
|
||||||
|
for action in actions:
|
||||||
|
print "Performing action: %s." % action
|
||||||
|
self.cl_action(action)
|
||||||
|
|
||||||
|
print "Cleaning up."
|
||||||
|
# clean import dir up after use
|
||||||
|
files = os.listdir(self.impdir_path) ;
|
||||||
|
for fn in files:
|
||||||
|
if os.path.isfile(os.path.join(self.impdir_path,fn)):
|
||||||
|
os.remove(os.path.join(self.impdir_path,fn))
|
||||||
|
print "Exiting."
|
||||||
|
os._exit(0)
|
||||||
|
|
||||||
def cl_import(self,filename,format):
|
def cl_import(self,filename,format):
|
||||||
if format == 'gedcom':
|
if format == 'gedcom':
|
||||||
import ReadGedcom
|
import ReadGedcom
|
||||||
@ -1326,6 +1330,13 @@ class Gramps:
|
|||||||
except:
|
except:
|
||||||
print "Error exporting %s" % filename
|
print "Error exporting %s" % filename
|
||||||
os._exit(1)
|
os._exit(1)
|
||||||
|
elif format == 'wft':
|
||||||
|
import WriteFtree
|
||||||
|
try:
|
||||||
|
WriteFtree.FtreeWriter(self.db,None,1,filename)
|
||||||
|
except:
|
||||||
|
print "Error exporting %s" % filename
|
||||||
|
os._exit(1)
|
||||||
else:
|
else:
|
||||||
print "Invalid format: %s" % format
|
print "Invalid format: %s" % format
|
||||||
os._exit(1)
|
os._exit(1)
|
||||||
|
@ -73,52 +73,56 @@ def writeData(database,person):
|
|||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class FtreeWriter:
|
class FtreeWriter:
|
||||||
|
|
||||||
def __init__(self,database,person):
|
def __init__(self,database,person,cl=0,name=""):
|
||||||
self.db = database
|
self.db = database
|
||||||
|
self.person = person
|
||||||
base = os.path.dirname(__file__)
|
|
||||||
glade_file = "%s/%s" % (base,"writeftree.glade")
|
|
||||||
|
|
||||||
|
|
||||||
dic = {
|
|
||||||
"destroy_passed_object" : self.close,
|
|
||||||
"on_ok_clicked" : self.on_ok_clicked,
|
|
||||||
}
|
|
||||||
|
|
||||||
self.plist = {}
|
self.plist = {}
|
||||||
self.top = gtk.glade.XML(glade_file,"top","gramps")
|
|
||||||
|
|
||||||
Utils.set_titles(self.top.get_widget('top'),
|
if cl:
|
||||||
|
if name:
|
||||||
|
self.export(name,None,0)
|
||||||
|
else:
|
||||||
|
base = os.path.dirname(__file__)
|
||||||
|
glade_file = "%s/%s" % (base,"writeftree.glade")
|
||||||
|
|
||||||
|
dic = {
|
||||||
|
"destroy_passed_object" : self.close,
|
||||||
|
"on_ok_clicked" : self.on_ok_clicked,
|
||||||
|
}
|
||||||
|
|
||||||
|
self.top = gtk.glade.XML(glade_file,"top","gramps")
|
||||||
|
|
||||||
|
Utils.set_titles(self.top.get_widget('top'),
|
||||||
self.top.get_widget('title'),
|
self.top.get_widget('title'),
|
||||||
_title_string)
|
_title_string)
|
||||||
|
|
||||||
self.top.signal_autoconnect(dic)
|
self.top.signal_autoconnect(dic)
|
||||||
|
|
||||||
self.topwin = self.top.get_widget("top")
|
self.topwin = self.top.get_widget("top")
|
||||||
self.restrict = self.top.get_widget("restrict")
|
self.restrict = self.top.get_widget("restrict")
|
||||||
self.filter = self.top.get_widget("filter")
|
self.filter = self.top.get_widget("filter")
|
||||||
|
|
||||||
all = GenericFilter.GenericFilter()
|
all = GenericFilter.GenericFilter()
|
||||||
all.set_name(_("Entire Database"))
|
all.set_name(_("Entire Database"))
|
||||||
all.add_rule(GenericFilter.Everyone([]))
|
all.add_rule(GenericFilter.Everyone([]))
|
||||||
|
|
||||||
des = GenericFilter.GenericFilter()
|
des = GenericFilter.GenericFilter()
|
||||||
des.set_name(_("Descendants of %s") % person.getPrimaryName().getName())
|
des.set_name(_("Descendants of %s") % person.getPrimaryName().getName())
|
||||||
des.add_rule(GenericFilter.IsDescendantOf([person.getId()]))
|
des.add_rule(GenericFilter.IsDescendantOf([person.getId()]))
|
||||||
|
|
||||||
ans = GenericFilter.GenericFilter()
|
ans = GenericFilter.GenericFilter()
|
||||||
ans.set_name(_("Ancestors of %s") % person.getPrimaryName().getName())
|
ans.set_name(_("Ancestors of %s") % person.getPrimaryName().getName())
|
||||||
ans.add_rule(GenericFilter.IsAncestorOf([person.getId()]))
|
ans.add_rule(GenericFilter.IsAncestorOf([person.getId()]))
|
||||||
|
|
||||||
com = GenericFilter.GenericFilter()
|
com = GenericFilter.GenericFilter()
|
||||||
com.set_name(_("People with common ancestor with %s") %
|
com.set_name(_("People with common ancestor with %s") %
|
||||||
person.getPrimaryName().getName())
|
person.getPrimaryName().getName())
|
||||||
com.add_rule(GenericFilter.HasCommonAncestorWith([person.getId()]))
|
com.add_rule(GenericFilter.HasCommonAncestorWith([person.getId()]))
|
||||||
|
|
||||||
self.filter_menu = GenericFilter.build_filter_menu([all,des,ans,com])
|
self.filter_menu = GenericFilter.build_filter_menu([all,des,ans,com])
|
||||||
self.filter.set_menu(self.filter_menu)
|
self.filter.set_menu(self.filter_menu)
|
||||||
|
|
||||||
self.topwin.show()
|
self.topwin.show()
|
||||||
|
|
||||||
def close(self,obj):
|
def close(self,obj):
|
||||||
self.topwin.destroy()
|
self.topwin.destroy()
|
||||||
|
@ -542,6 +542,7 @@ class GedcomWriter:
|
|||||||
self.source_refs = self.target_ged.get_source_refs()
|
self.source_refs = self.target_ged.get_source_refs()
|
||||||
|
|
||||||
self.cnvtxt = keep_utf8
|
self.cnvtxt = keep_utf8
|
||||||
|
self.nl = self.cnvtxt(self.target_ged.get_endl())
|
||||||
|
|
||||||
self.flist = {}
|
self.flist = {}
|
||||||
self.slist = {}
|
self.slist = {}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user