From 8b0aa1f6338469cfc09c7490bf4f421d69268a9c Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Sat, 19 Feb 2005 00:49:49 +0000 Subject: [PATCH] * src/docgen/LPRDoc.py (draw_path,draw_bar): Fill, then stroke. * src/DbPrompter.py: Change file filter name. * src/Report.py (doc_type_changed): Deal with empty extensions. * src/docgen/AsciiDoc.py (add_photo): Add method; (end_row): Inlcude last cell into proper formatting. * src/GedcomInfo.py: Properly import expat.ParserCreate class. * src/TipOfDay.py: Properly import expat.ParserCreate class. * src/RecentFiles.py: Properly import expat.ParserCreate class. * src/ReadXML.py: Properly import expat.* classes. * doc/gramps-manual/C/usage.xml: Update. * doc/gramps-manual/C/usage.xml: Update. * doc/xmldocs.make: Switch Makefile from CLEANFILES to DISTCLEANFILES. * src/Makefile.am: Add const.pyc and const.pyo to CLEANFILES. svn: r4051 --- ChangeLog | 16 +++ doc/gramps-manual/C/usage.xml | 192 ++++++++++++++++++++++++---------- doc/xmldocs.make | 5 +- src/GedcomInfo.py | 8 +- src/Makefile.am | 2 +- src/ReadXML.py | 8 +- src/RecentFiles.py | 8 +- src/Report.py | 2 + src/TipOfDay.py | 4 +- src/docgen/AsciiDoc.py | 21 ++-- 10 files changed, 189 insertions(+), 77 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2d4554bd1..2541a0ff7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +2005-02-18 Alex Roitman + * src/docgen/LPRDoc.py (draw_path,draw_bar): Fill, then stroke. + * src/DbPrompter.py: Change file filter name. + + * src/Report.py (doc_type_changed): Deal with empty extensions. + * src/docgen/AsciiDoc.py (add_photo): Add method; + (end_row): Inlcude last cell into proper formatting. + * src/GedcomInfo.py: Properly import expat.ParserCreate class. + * src/TipOfDay.py: Properly import expat.ParserCreate class. + * src/RecentFiles.py: Properly import expat.ParserCreate class. + * src/ReadXML.py: Properly import expat.* classes. + * doc/gramps-manual/C/usage.xml: Update. + * doc/gramps-manual/C/usage.xml: Update. + * doc/xmldocs.make: Switch Makefile from CLEANFILES to DISTCLEANFILES. + * src/Makefile.am: Add const.pyc and const.pyo to CLEANFILES. + 2005-02-18 Eero Tamminen * src/plugins/StatisticsChart.py: fix date object checking diff --git a/doc/gramps-manual/C/usage.xml b/doc/gramps-manual/C/usage.xml index 55068a57b..5d841cb0c 100644 --- a/doc/gramps-manual/C/usage.xml +++ b/doc/gramps-manual/C/usage.xml @@ -1,5 +1,3 @@ - - + Usage As commonly encountered in everyday life, in &app; there is usually more than one way to @@ -33,10 +32,19 @@ Starting a New Database To start a new database, choose File New. You will then be - prompted with the Save Database dialog asking + prompted with the Create GRAMPS database dialog asking to specify the name under which the new database will be stored. - Choose an empty directory for your new - database (create one if necessary). + The new database will be created in the BSDDB format, with .grdb + as the default extension. + + + Selecting file + + Unlike the version 1.0.X of &app;, this version does not require selecting directory + for the database. Please select filename, as you would in any other application. + + + @@ -45,39 +53,77 @@ To open a database, either choose FileOpen or click the Open button on the Toolbar. - The Open Database dialog will appear. - Either type the full path into the Database text - entry field, or click the Browse... button to get - the Open File dialog in which you can select the - database that you want to open. After you have selected the database, - click the OK button to open it. + The Open database dialog will appear. + - If you have previously opened databases with &app; you can - retrieve your past selections from the drop-down menu by clicking the - down arrow button. Finally, if the Revision Control System (RCS) is - enabled in the Preferences dialog, the check box - Revert to an older version from RCS will be - available. Check it to revert your database to an older RCS - version. + + The filetype filter in the Open database dialog allows + you to display files of a certain type. If the All files + filter is selected (the default), all the files will be shown. The type will + be deteremined by the extension of the selected filename. + + + Selecting file + + Unlike the version 1.0.X of &app;, this version does not require selecting directory + for the database. Please select filename, as you would in any other application. + + - NOTE: you should open a DIRECTORY and - NOT a FILE when opening - &app; database. The directory you need to open should contain the - database file data.gramps as well as any - possible copies - of media objects. Such a directory is created by &app; when you start - a new database and is updated each time the database is saved. + If you do not have write permissions for the selected database, it will + be opened in a Read Only mode. In this mode, the data may be viewed, but + no changes will be made to the database. To indicate this mode, the title of the + main window will be appended with (Read Only) text. + + + Opening XML and GEDCOM databases + + This version allows direct opening and editing of &app; XML and GEDCOM + databases. Please keep in mind that, unlike using the native grdb format, + these formats require holding all data in memory. This leads to performance + and memory consumption problems which grdb was designed to solve. + + While direct opening of a &app; XML or GEDCOM file is convenient + for a small database, it may prove burdensome for large databases. + If you experience this, please consider creating a new native (grdb) database + and importing your XML or GEDCOM data into it. This will make accessing + your data much more efficient and quick. + + + + + GEDCOM Editing + + Please keep in mind that some information in GEDCOM file may be lost + during import into &app;. Simply opening and viewing the file will not change it. + However, if any changes were made and they were not abandoned upon exit, + exiting &app; will save the data, with the possible data loss. + + + + - Saving a Database - To save changes made to your database, choose - File - Save or click the - Save button on the Toolbar. The statusbar will then - display the Saving databasename... - message, and the progressbar will advance as the saving progresses. + Saving a Database + + A consequence of the new database backend is that the changes, once approved + by the user, are applied immediately. In short, once you click OK + in the Person, Family, Source, Place, Media object, or Event editor, all the changes made to + this object are recorded in the database. No saving is necessary, or even possible. + + + Choosing EditUndo + allows you to undo the changes you made, one step at a time. + + Reverting the whole session + If you would like to revert the whole editing session, choose + FileAbandon changes + and quit. This will be analogous to quitting + without saving any changes in other applications. + + @@ -85,33 +131,71 @@ Importing Data Importing allows you to incorporate the data from other databases into your currently open &app; database. Currently, - &app; can import data from three different - formats: GEDCOM, &app; database, and &app; package. All of these are - available as items of File - Import submenu. + &app; can import data from the following formats: &app; database (grdb), + GEDCOM, &app; XML, &app; package, and GeneWeb. All of these are + available by choosing File + Import and + selecting an appropriate file. - Both &app; database, and &app; package are native &app; - formats. The package is a compressed archive containing the database - file and all media objects (images, sound files, etc.) that the - database refers to. The package is created by exporting data to - the &app; package, see . - The &app; database is a directory containing the database file and - the local media objects. The database may also have references + &app; database (grdb), &app; XML, and &app; package are + all native &app; formats in that there is no information loss resulting + from reading from and writing into these formats. + + + &app; database (grdb) + + The native &app; database format is a specific form of Berkeley database (BSDDB) + with special structure of data tables. This format is binary and architecture-dependent. + It is very quick and efficient, but not generally portable across computers with + different binary architecture (e.g. i386 vs alpha). + + + + &app; XML + + The &app; XML file was the default format for the previous stable + version of &app;. Unlike the grdb format, it is architecture + independent and human-readable. The database may also have references to non-local (external) media objects, therefore it is not guaranteed - to be completely portable. The &app; database is created by saving - the data in a usual way, see . + to be completely portable. The &app; XML database is created by saving + (FileSave + As...) or exporting ( + FileExport... + ) data in that format. + + + + &app; package + + The package is a compressed archive containing the &app; XML + file and all media objects (images, sound files, etc.) that the + database refers to. The &app; package is created by exporting + ( File + Export...) data in that format. + + + + + - Note that the difference between opening &app; database and - importing from &app; database is that importing incorporates all the - data into your currently open database, if any. + Opening vs importing + The difference between opening &app; database (in any format) and + importing from &app; or GEDCOM database is that importing incorporates all the + data into your currently open database, if any. In contrast, opening the database + will switch from editing your current data to editing another file. + + After choosing an import format, you will be prompted with the + Import database dialog asking you to specify the + file name from which to import. + - After choosing an import format, you will be prompted with the - Open File dialog asking you to specify the - file name from which to import. For GEDCOM and - &app; package, select an appropriate file. - For &app; database, select a directory which stores - the database and all media files (if any). + Selecting file + + Unlike the version 1.0.X of &app;, this version does not require selecting directory + for the database. Please select filename, as you would in any other application. + + Upon starting the GEDCOM import, &app; will display the following GEDCOM import dialog with the summary of the diff --git a/doc/xmldocs.make b/doc/xmldocs.make index cd49aec8a..39b42ac04 100644 --- a/doc/xmldocs.make +++ b/doc/xmldocs.make @@ -1,3 +1,4 @@ +# $Id$ # # No modifications of this Makefile should be necessary. # @@ -43,7 +44,8 @@ xml_files = $(entities) $(docname).xml omf_dir=$(top_srcdir)/omf-install EXTRA_DIST = $(xml_files) $(omffile) -CLEANFILES = omf_timestamp Makefile +CLEANFILES = omf_timestamp +DISTCLEANFILES = Makefile include $(top_srcdir)/doc/omf.make @@ -61,6 +63,7 @@ distclean-hook: then \ rm -f $(entities); \ fi + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) app-dist-hook: diff --git a/src/GedcomInfo.py b/src/GedcomInfo.py index aca5c1f0a..a06dc9883 100644 --- a/src/GedcomInfo.py +++ b/src/GedcomInfo.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2000 Donald N. Allingham +# Copyright (C) 2000-2005 Donald N. Allingham # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -18,6 +18,8 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# $Id$ + import const ADOPT_NONE = 0 @@ -50,7 +52,7 @@ SOURCE_REFS_YES = 1 # XML parser # #------------------------------------------------------------------------- -import xml.parsers.expat +from xml.parsers.expat import ParserCreate class GedcomDescription: def __init__(self,name): @@ -190,7 +192,7 @@ class GedInfoParser: self.current = None def parse(self,file): - p = xml.parsers.expat.ParserCreate() + p = ParserCreate() p.StartElementHandler = self.startElement p.ParseFile(file) diff --git a/src/Makefile.am b/src/Makefile.am index 301463cc0..9b68176a7 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -4,7 +4,7 @@ SUBDIRS = docgen plugins dates data po # For intl. support, how do we compile? MOSTLYCLEANFILES = - +CLEANFILES = const.pyc const.pyo # What are the PYTHON scripts for this package that need to be handled? # # We only want optimized byte-compiled (.pyo) versions, no .pyc diff --git a/src/ReadXML.py b/src/ReadXML.py index c72409b64..267eda21a 100644 --- a/src/ReadXML.py +++ b/src/ReadXML.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2000-2004 Donald N. Allingham +# Copyright (C) 2000-2005 Donald N. Allingham # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -29,7 +29,7 @@ import string import os import gtk import shutil -import xml.parsers.expat +from xml.parsers.expat import ExpatError, ParserCreate from gettext import gettext as _ #------------------------------------------------------------------------- @@ -125,7 +125,7 @@ def importData(database, filename, callback=None,cl=0,use_trans=True): import traceback traceback.print_exc() return - except xml.parsers.expat.ExpatError, msg: + except ExpatError, msg: if cl: print "Error reading %s" % filename print "The file is probably either corrupt or not a valid GRAMPS database." @@ -538,7 +538,7 @@ class GrampsParser: self.trans = self.db.transaction_begin() else: self.trans = None - p = xml.parsers.expat.ParserCreate() + p = ParserCreate() p.StartElementHandler = self.startElement p.EndElementHandler = self.endElement p.CharacterDataHandler = self.characters diff --git a/src/RecentFiles.py b/src/RecentFiles.py index 7c1aae407..43676a471 100644 --- a/src/RecentFiles.py +++ b/src/RecentFiles.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2004 Donald N. Allingham +# Copyright (C) 2004-2005 Donald N. Allingham # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -30,7 +30,7 @@ import os import fcntl import time -import xml.parsers.expat +from xml.parsers.expat import ParserCreate #------------------------------------------------------------------------- # @@ -285,7 +285,7 @@ class GnomeRecentParser: xml_file = open(os.path.expanduser(GNOME_FILENAME)) fcntl.lockf(xml_file,fcntl.LOCK_SH) - p = xml.parsers.expat.ParserCreate() + p = ParserCreate() p.StartElementHandler = self.startElement p.EndElementHandler = self.endElement p.CharacterDataHandler = self.characters @@ -345,7 +345,7 @@ class GrampsRecentParser: xml_file = open(os.path.expanduser(GRAMPS_FILENAME)) fcntl.lockf(xml_file,fcntl.LOCK_SH) - p = xml.parsers.expat.ParserCreate() + p = ParserCreate() p.StartElementHandler = self.startElement p.EndElementHandler = self.endElement p.CharacterDataHandler = self.characters diff --git a/src/Report.py b/src/Report.py index b9251261b..657197b42 100644 --- a/src/Report.py +++ b/src/Report.py @@ -1050,6 +1050,8 @@ class ReportDialog(BareReportDialog): ext_val = obj.get_ext() if ext_val: fname = spath + ext_val + else: + fname = spath self.target_fileentry.set_filename(fname) # Does this report format use styles? diff --git a/src/TipOfDay.py b/src/TipOfDay.py index 47ff476e2..ce9e7ca9d 100644 --- a/src/TipOfDay.py +++ b/src/TipOfDay.py @@ -25,7 +25,7 @@ # standard python modules # #------------------------------------------------------------------------- -import xml.parsers.expat +from xml.parsers.expat import ParserCreate from random import Random #------------------------------------------------------------------------- @@ -100,7 +100,7 @@ class TipParser: self.mylist = [] xml_file = open(const.tipdata) self.tlist = [] - p = xml.parsers.expat.ParserCreate() + p = ParserCreate() p.StartElementHandler = self.startElement p.EndElementHandler = self.endElement p.CharacterDataHandler = self.characters diff --git a/src/docgen/AsciiDoc.py b/src/docgen/AsciiDoc.py index 39adbe62d..1adc839bb 100644 --- a/src/docgen/AsciiDoc.py +++ b/src/docgen/AsciiDoc.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2000-2004 Donald N. Allingham +# Copyright (C) 2000-2005 Donald N. Allingham # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -25,20 +25,18 @@ # python modules # #------------------------------------------------------------------------ -import string import os -import GrampsMime +from gettext import gettext as _ #------------------------------------------------------------------------ # -# Load the base BaseDoc class +# Gramps modules # #------------------------------------------------------------------------ import BaseDoc import PluginMgr import Errors - -from gettext import gettext as _ +import GrampsMime LEFT,RIGHT,CENTER = 'LEFT','RIGHT','CENTER' _WIDTH_IN_CHARS = 72 @@ -291,7 +289,7 @@ class AsciiDoc(BaseDoc.BaseDoc): for cell in range(self.ncols): if self.cell_widths[cell]: blanks = ' '*self.cell_widths[cell] + '\n' - if self.cell_lines[cell] < self.maxlines and cell < self.ncols - 1: + if self.cell_lines[cell] < self.maxlines: self.cellpars[cell] = self.cellpars[cell] \ + blanks * (self.maxlines-self.cell_lines[cell]) cell_text[cell] = self.cellpars[cell].split('\n') @@ -327,6 +325,13 @@ class AsciiDoc(BaseDoc.BaseDoc): if self.cell_lines[self.cellnum] > self.maxlines: self.maxlines = self.cell_lines[self.cellnum] + def add_photo(self,name,pos,x,y): + this_text = '(photo)' + if self.in_cell: + self.cellpars[self.cellnum] = self.cellpars[self.cellnum] + this_text + else: + self.f.write(this_text) + def write_note(self,text,format,style_name): if format == 1: for line in text.split('\n'): @@ -337,7 +342,7 @@ class AsciiDoc(BaseDoc.BaseDoc): for line in text.split('\n\n'): self.start_paragraph(style_name) line = line.replace('\n',' ') - line = string.join(string.split(line)) + line = ' '.join(line.split()) self.write_text(line) self.end_paragraph()