2008-02-18 Raphael Ackermann <raphael.ackermann@gmail.com>

* src/DataViews/EventView.py
	* src/DataViews/FamilyList.py
	* src/DataViews/PedigreeView.py
	* src/DataViews/PersonView.py
	* src/GrampsCfg.py
	* src/Editors/_EditPrimary.py
	* src/DisplayTabs/_EmbeddedList.py
	* src/DisplayTabs/_BackRefList.py
	* src/plugins/RelCalc.py
	* src/QuickReports.py
	* src/Relationship.py
	* src/Selectors/_BaseSelector.py
	* src/GrampsWidgets.py
	* src/DbManager.py
	* src/DisplayState.py
	* src/DisplayModels/_BaseModel.py
	* src/DisplayModels/_PeopleModel.py
	* src/GrampsDbUtils/_GrampsDbWriteXML.py
	* src/gramps_main.py
	* src/Filters/Rules/_MatchesFilterBase.py
	* src/ManagedWindow.py
	pep8 updates. replace ''' with """ for comments
	* src/GrampsDbUtils/_WriteGedcom.py: doc fixes
	added support for exportin source, notes and repos that are not linked to 
	other records.
	0001707: export to gedcom doesn't include source, if source is the only 
	thing in the db 

svn: r10051
This commit is contained in:
Raphael Ackermann 2008-02-18 15:52:40 +00:00
parent 41c85443a3
commit 9aee82d6d0
22 changed files with 329 additions and 310 deletions

View File

@ -262,9 +262,9 @@ class EventView(PageView.ListView):
pass
def dummy_report(self, obj):
''' For the xml UI definition of popup to work, the submenu
""" For the xml UI definition of popup to work, the submenu
Quick Report must have an entry in the xml
As this submenu will be dynamically built, we offer a dummy action
'''
"""
pass

View File

@ -219,8 +219,8 @@ class FamilyListView(PageView.ListView):
pass
def dummy_report(self, obj):
''' For the xml UI definition of popup to work, the submenu
""" For the xml UI definition of popup to work, the submenu
Quick Report must have an entry in the xml
As this submenu will be dynamically built, we offer a dummy action
'''
"""
pass

View File

@ -287,7 +287,7 @@ class PersonBoxWidget( gtk.DrawingArea, _PersonWidget_base):
self.set_size_request(max(xmin,120),max(ymin,25))
def on_enter_cb(self,widget,event):
''' On mouse-over hightlight border'''
""" On mouse-over hightlight border"""
self.border_gc.line_width = 3
self.queue_draw()

View File

@ -994,9 +994,9 @@ class PersonView(PageView.PersonNavView):
ofile.close()
def dummy_report(self, obj):
''' For the xml UI definition of popup to work, the submenu
""" For the xml UI definition of popup to work, the submenu
Quick Report must have an entry in the xml
As this submenu will be dynamically built, we offer a dummy action
'''
"""
pass

View File

@ -112,13 +112,13 @@ class CLIDbManager:
self._populate_cli()
def empty(self, val):
'''Callback that does nothing
'''
"""Callback that does nothing
"""
pass
def _populate_cli(self):
''' Get the list of current names in the database dir
'''
""" Get the list of current names in the database dir
"""
# make the default directory if it does not exist
dbdir = os.path.expanduser(Config.get(Config.DATABASE_PATH))
make_dbdir(dbdir)
@ -145,18 +145,18 @@ class CLIDbManager:
self.current_names.sort()
def family_tree(self, name):
'''Given a name, return None if name not existing or
"""Given a name, return None if name not existing or
filename, filetype, name
if a known database name
'''
"""
for data in self.current_names:
if data[0] == name:
return data[1], 'x-directory/normal', name
return None
def family_tree_list(self):
'''Return a list of name, dirname of the known family trees
'''
"""Return a list of name, dirname of the known family trees
"""
lst = [(x[0], x[1]) for x in self.current_names]
return lst

View File

@ -295,15 +295,15 @@ class BaseModel(gtk.GenericTreeModel):
self.row_changed(index,node)
def on_get_flags(self):
'''returns the GtkTreeModelFlags for this particular type of model'''
"""returns the GtkTreeModelFlags for this particular type of model"""
return gtk.TREE_MODEL_LIST_ONLY | gtk.TREE_MODEL_ITERS_PERSIST
def on_get_n_columns(self):
return 1
def on_get_path(self, node):
'''returns the tree path (a tuple of indices at the various
levels) for a particular node.'''
"""returns the tree path (a tuple of indices at the various
levels) for a particular node."""
return self.node_map.get_path(node)
def on_get_column_type(self,index):
@ -327,7 +327,7 @@ class BaseModel(gtk.GenericTreeModel):
return u''
def on_iter_next(self, node):
'''returns the next node at this level of the tree'''
"""returns the next node at this level of the tree"""
return self.node_map.find_next_handle(node)
def on_iter_children(self,node):
@ -337,7 +337,7 @@ class BaseModel(gtk.GenericTreeModel):
return None
def on_iter_has_child(self, node):
'''returns true if this node has children'''
"""returns true if this node has children"""
if node == None:
return len(self.node_map) > 0
return False
@ -353,5 +353,5 @@ class BaseModel(gtk.GenericTreeModel):
return None
def on_iter_parent(self, node):
'''returns the parent of this node'''
"""returns the parent of this node"""
return None

View File

@ -417,15 +417,15 @@ class PeopleModel(gtk.GenericTreeModel):
self.mapper.assign_data()
def on_get_flags(self):
'''returns the GtkTreeModelFlags for this particular type of model'''
"""returns the GtkTreeModelFlags for this particular type of model"""
return gtk.TREE_MODEL_ITERS_PERSIST
def on_get_n_columns(self):
return len(PeopleModel.COLUMN_DEFS)
def on_get_path(self, node):
'''returns the tree path (a tuple of indices at the various
levels) for a particular node.'''
"""returns the tree path (a tuple of indices at the various
levels) for a particular node."""
return self.mapper.get_path(node)
def is_visable(self, handle):
@ -465,7 +465,7 @@ class PeopleModel(gtk.GenericTreeModel):
return None
def on_iter_next(self, node):
'''returns the next node at this level of the tree'''
"""returns the next node at this level of the tree"""
return self.mapper.find_next_node(node)
def on_iter_children(self, node):
@ -473,7 +473,7 @@ class PeopleModel(gtk.GenericTreeModel):
return self.mapper.first_child(node)
def on_iter_has_child(self, node):
'''returns true if this node has children'''
"""returns true if this node has children"""
return self.mapper.has_child(node)
def on_iter_n_children(self, node):
@ -483,7 +483,7 @@ class PeopleModel(gtk.GenericTreeModel):
return self.mapper.get_nth_child(node, n)
def on_iter_parent(self, node):
'''returns the parent of this node'''
"""returns the parent of this node"""
return self.mapper.get_parent_of(node)
def column_sort_name(self, data, node):

View File

@ -147,9 +147,9 @@ class History(gen.utils.GrampsDBCallback):
return u""
def present(self):
'''
"""
return the person handle that is now active in the history
'''
"""
try :
if self.history :
return self.history[self.index]
@ -354,7 +354,7 @@ class DisplayState(gen.utils.GrampsDBCallback):
self.relationship.set_depth(value)
def display_relationship(self, dbstate):
''' Construct the relationship in order to show it in the statusbar
""" Construct the relationship in order to show it in the statusbar
This can be a time intensive calculation, so we only want to do
it if persons are different than before.
Eg: select a person, then double click, will result in calling
@ -362,7 +362,7 @@ class DisplayState(gen.utils.GrampsDBCallback):
to obtain relationship once!
This means the relationship part of statusbar only changes on
change of row.
'''
"""
self.relationship.connect_db_signals(dbstate)
default_person = dbstate.db.get_default_person()
active = dbstate.get_active_person()
@ -384,11 +384,11 @@ class DisplayState(gen.utils.GrampsDBCallback):
return u""
def clear_history(self, handle=None):
'''Clear the history. If handle is given, then the history is
"""Clear the history. If handle is given, then the history is
immediately initialized with a first entry
(you'd eg want active person you view there as History contains the
present object too!)
'''
"""
self.phistory.clear()
if handle :
self.phistory.push(handle)

View File

@ -81,11 +81,11 @@ class BackRefList(EmbeddedList):
return self.model.count == 0
def create_buttons(self, share=False, move=False, jump=False):
'''
"""
Creates a button box consisting of one button: Edit.
This button box is then appended hbox (self).
Method has signature of, and overrides create_buttons from _ButtonTab.py
'''
"""
self.edit_btn = SimpleButton(gtk.STOCK_EDIT, self.edit_button_clicked)
self.tooltips = gtk.Tooltips()
self.tooltips.set_tip(self.edit_btn, _('Edit reference'))

View File

@ -263,10 +263,10 @@ class EmbeddedList(ButtonTab):
self.rebuild()
def _move_up(self, row_from, obj,selmethod=None):
'''
"""
Move the item a position up in the EmbeddedList.
Eg: 0,1,2,3 needs to become 0,2,1,3, here row_from = 2
'''
"""
if selmethod :
dlist = selmethod()
else :
@ -280,10 +280,10 @@ class EmbeddedList(ButtonTab):
self.tree.get_selection().select_path(path)
def _move_down(self, row_from, obj,selmethod=None):
'''
"""
Move the item a position down in the EmbeddedList.
Eg: 0,1,2,3 needs to become 0,2,1,3, here row_from = 1
'''
"""
if selmethod :
dlist = selmethod()
else :

View File

@ -198,9 +198,9 @@ class EditPrimary(ManagedWindow.ManagedWindow):
pass
def set_contexteventbox(self, eventbox):
'''Set the contextbox that grabs button presses if not grabbed
"""Set the contextbox that grabs button presses if not grabbed
by overlying widgets.
'''
"""
self.contexteventbox = eventbox
self.contexteventbox.connect('button-press-event',
self._contextmenu_button_press)

View File

@ -89,9 +89,9 @@ class MatchesFilterBase(Rule):
return False
def find_filter(self):
''' helper function that can be usefull, returning the filter
""" helper function that can be usefull, returning the filter
selected or None
'''
"""
if Filters.SystemFilters:
for filt in Filters.SystemFilters.get_filters(self.namespace):
if filt.get_name() == self.list[0]:

View File

@ -765,11 +765,11 @@ class GrampsPreferences(ManagedWindow.ManagedWindow):
def add_path_box(self, table, label, index, entry, path, callback_label,
callback_sel):
''' Add an entry to give in path and a select button to open a
""" Add an entry to give in path and a select button to open a
dialog.
Changing entry calls callback_label
Clicking open button call callback_sel
'''
"""
lwidget = BasicLabel("%s: " %label)
hbox = gtk.HBox()
if path:
@ -797,8 +797,8 @@ class GrampsPreferences(ManagedWindow.ManagedWindow):
table.attach(entry, 1, 2, index, index+1, yoptions=0)
def add_pos_int_entry(self, table, label, index, constant, callback=None):
''' entry field for positive integers
'''
""" entry field for positive integers
"""
lwidget = BasicLabel("%s: " % label)
entry = gtk.Entry()
entry.set_text(str(Config.get(constant)))

View File

@ -727,10 +727,10 @@ class GrampsDbXmlWriter(UpdateCallback):
(' '*indent,tagname,self.fix(value),tagname))
def write_line_nofix(self,tagname,value,indent=1):
'''Writes a line, but does not escape characters.
"""Writes a line, but does not escape characters.
Use this instead of write_line is the value is already fixed,
this avoids &amp; becoming &amp;amp;
'''
"""
if value:
self.g.write('%s<%s>%s</%s>\n' %
(' '*indent, tagname, value, tagname))

View File

@ -154,7 +154,7 @@ QUALITY_MAP = {
#-------------------------------------------------------------------------
def sort_by_gramps_id(first, second):
"""
Sorts objects by their GRAMPS ID
Sort objects by their GRAMPS ID.
"""
return cmp(first.gramps_id, second.gramps_id)
@ -165,9 +165,11 @@ def sort_by_gramps_id(first, second):
#-------------------------------------------------------------------------
def sort_handles_by_id(handle_list, handle_to_object):
"""
Sorts a list of handles by the GRAMPS ID. The function that returns the
object from the handle needs to be supplied so that we get the right
object.
Sort a list of handles by the GRAMPS ID.
The function that returns the object from the handle needs to be supplied
so that we get the right object.
"""
sorted_list = []
for handle in handle_list:
@ -184,7 +186,7 @@ def sort_handles_by_id(handle_list, handle_to_object):
#-------------------------------------------------------------------------
def make_date(subdate, calendar, mode, quality):
"""
Converts a GRAMPS date structure into a GEDCOM compatible date
Convert a GRAMPS date structure into a GEDCOM compatible date.
"""
retval = ""
(day, mon, year) = subdate[0:3]
@ -221,7 +223,7 @@ def make_date(subdate, calendar, mode, quality):
#-------------------------------------------------------------------------
def __build_date_string(day, mon, year, bce, mmap):
"""
Builds a date string from the supplied information
Build a date string from the supplied information.
"""
if day == 0:
if mon == 0:
@ -246,7 +248,7 @@ def __build_date_string(day, mon, year, bce, mmap):
#-------------------------------------------------------------------------
def breakup(txt, limit):
"""
Breaks a line of text into a list of strings that conform to the
Break a line of text into a list of strings that conform to the
maximum length specified, while breaking words in the middle of a word
to avoid issues with spaces.
"""
@ -283,10 +285,6 @@ class GedcomWriter(BasicUtils.UpdateCallback):
self.dirname = None
self.gedcom_file = None
self.slist = set()
self.rlist = set()
self.nlist = set()
self.setup(option_box)
def setup(self, option_box):
@ -316,7 +314,7 @@ class GedcomWriter(BasicUtils.UpdateCallback):
def write_gedcom_file(self, filename):
"""
Writes the actual GEDCOM file to the specfied filename
Write the actual GEDCOM file to the specfied filename.
"""
self.dirname = os.path.dirname (filename)
@ -336,17 +334,16 @@ class GedcomWriter(BasicUtils.UpdateCallback):
def __writeln(self, level, token, textlines="", limit=72):
"""
Writes a line of text to the output file in the form of:
Write a line of text to the output file in the form of:
LEVEL TOKEN text
LEVEL TOKEN text
If the line contains newlines, it is broken into multiple lines using
the CONT token. If any line is greater than the limit, it will broken
into multiple lines using CONC.
"""
assert(token)
if textlines:
# break the line into multiple lines if a newline is found
textlist = textlines.split('\n')
@ -365,35 +362,36 @@ class GedcomWriter(BasicUtils.UpdateCallback):
def __header(self, filename):
"""
Writes the GEDCOM header.
Write the GEDCOM header.
HEADER:=
n HEAD {1:1}
+1 SOUR <APPROVED_SYSTEM_ID> {1:1}
+2 VERS <VERSION_NUMBER> {0:1}
+2 NAME <NAME_OF_PRODUCT> {0:1}
+2 CORP <NAME_OF_BUSINESS> {0:1} # Not used
+3 <<ADDRESS_STRUCTURE>> {0:1} # Not used
+2 DATA <NAME_OF_SOURCE_DATA> {0:1} # Not used
+3 DATE <PUBLICATION_DATE> {0:1} # Not used
+3 COPR <COPYRIGHT_SOURCE_DATA> {0:1} # Not used
+1 DEST <RECEIVING_SYSTEM_NAME> {0:1*} # Not used
+1 DATE <TRANSMISSION_DATE> {0:1}
+2 TIME <TIME_VALUE> {0:1}
+1 SUBM @XREF:SUBM@ {1:1}
+1 SUBN @XREF:SUBN@ {0:1}
+1 FILE <FILE_NAME> {0:1}
+1 COPR <COPYRIGHT_GEDCOM_FILE> {0:1}
+1 GEDC {1:1}
+2 VERS <VERSION_NUMBER> {1:1}
+2 FORM <GEDCOM_FORM> {1:1}
+1 CHAR <CHARACTER_SET> {1:1}
+2 VERS <VERSION_NUMBER> {0:1}
+1 LANG <LANGUAGE_OF_TEXT> {0:1}
+1 PLAC {0:1}
+2 FORM <PLACE_HIERARCHY> {1:1}
+1 NOTE <GEDCOM_CONTENT_DESCRIPTION> {0:1}
+2 [CONT|CONC] <GEDCOM_CONTENT_DESCRIPTION> {0:M}
HEADER:=
n HEAD {1:1}
+1 SOUR <APPROVED_SYSTEM_ID> {1:1}
+2 VERS <VERSION_NUMBER> {0:1}
+2 NAME <NAME_OF_PRODUCT> {0:1}
+2 CORP <NAME_OF_BUSINESS> {0:1} # Not used
+3 <<ADDRESS_STRUCTURE>> {0:1} # Not used
+2 DATA <NAME_OF_SOURCE_DATA> {0:1} # Not used
+3 DATE <PUBLICATION_DATE> {0:1} # Not used
+3 COPR <COPYRIGHT_SOURCE_DATA> {0:1} # Not used
+1 DEST <RECEIVING_SYSTEM_NAME> {0:1*} # Not used
+1 DATE <TRANSMISSION_DATE> {0:1}
+2 TIME <TIME_VALUE> {0:1}
+1 SUBM @XREF:SUBM@ {1:1}
+1 SUBN @XREF:SUBN@ {0:1}
+1 FILE <FILE_NAME> {0:1}
+1 COPR <COPYRIGHT_GEDCOM_FILE> {0:1}
+1 GEDC {1:1}
+2 VERS <VERSION_NUMBER> {1:1}
+2 FORM <GEDCOM_FORM> {1:1}
+1 CHAR <CHARACTER_SET> {1:1}
+2 VERS <VERSION_NUMBER> {0:1}
+1 LANG <LANGUAGE_OF_TEXT> {0:1}
+1 PLAC {0:1}
+2 FORM <PLACE_HIERARCHY> {1:1}
+1 NOTE <GEDCOM_CONTENT_DESCRIPTION> {0:1}
+2 [CONT|CONC] <GEDCOM_CONTENT_DESCRIPTION> {0:M}
"""
local_time = time.localtime(time.time())
(year, mon, day, hour, minutes, sec) = local_time[0:6]
@ -426,14 +424,14 @@ class GedcomWriter(BasicUtils.UpdateCallback):
def __submitter(self):
"""
n @<XREF:SUBM>@ SUBM {1:1}
+1 NAME <SUBMITTER_NAME> {1:1}
+1 <<ADDRESS_STRUCTURE>> {0:1}
+1 <<MULTIMEDIA_LINK>> {0:M} # not used
+1 LANG <LANGUAGE_PREFERENCE> {0:3} # not used
+1 RFN <SUBMITTER_REGISTERED_RFN> {0:1} # not used
+1 RIN <AUTOMATED_RECORD_ID> {0:1} # not used
+1 <<CHANGE_DATE>> {0:1} # not used
n @<XREF:SUBM>@ SUBM {1:1}
+1 NAME <SUBMITTER_NAME> {1:1}
+1 <<ADDRESS_STRUCTURE>> {0:1}
+1 <<MULTIMEDIA_LINK>> {0:M} # not used
+1 LANG <LANGUAGE_PREFERENCE> {0:3} # not used
+1 RFN <SUBMITTER_REGISTERED_RFN> {0:1} # not used
+1 RIN <AUTOMATED_RECORD_ID> {0:1} # not used
+1 <<CHANGE_DATE>> {0:1} # not used
"""
owner = self.dbase.get_researcher()
name = owner.get_name()
@ -472,10 +470,12 @@ class GedcomWriter(BasicUtils.UpdateCallback):
def __individuals(self):
"""
Writes the individual people to the gedcom file. Since people like to
have the list sorted by ID value, we need to go through a sorting step.
We need to reset the progress bar, otherwise, people will be confused
when the progress bar is idle.
Write the individual people to the gedcom file.
Since people like to have the list sorted by ID value, we need to go
through a sorting step. We need to reset the progress bar, otherwise,
people will be confused when the progress bar is idle.
"""
phandles = self.dbase.get_person_handles()
@ -499,31 +499,31 @@ class GedcomWriter(BasicUtils.UpdateCallback):
def __person(self, person):
"""
Writes out a single person
Write out a single person.
n @XREF:INDI@ INDI {1:1}
+1 RESN <RESTRICTION_NOTICE> {0:1} # not used
+1 <<PERSONAL_NAME_STRUCTURE>> {0:M}
+1 SEX <SEX_VALUE> {0:1}
+1 <<INDIVIDUAL_EVENT_STRUCTURE>> {0:M}
+1 <<INDIVIDUAL_ATTRIBUTE_STRUCTURE>> {0:M}
+1 <<LDS_INDIVIDUAL_ORDINANCE>> {0:M}
+1 <<CHILD_TO_FAMILY_LINK>> {0:M}
+1 <<SPOUSE_TO_FAMILY_LINK>> {0:M}
+1 SUBM @<XREF:SUBM>@ {0:M}
+1 <<ASSOCIATION_STRUCTURE>> {0:M}
+1 ALIA @<XREF:INDI>@ {0:M}
+1 ANCI @<XREF:SUBM>@ {0:M}
+1 DESI @<XREF:SUBM>@ {0:M}
+1 <<SOURCE_CITATION>> {0:M}
+1 <<MULTIMEDIA_LINK>> {0:M} ,*
+1 <<NOTE_STRUCTURE>> {0:M}
+1 RFN <PERMANENT_RECORD_FILE_NUMBER> {0:1}
+1 AFN <ANCESTRAL_FILE_NUMBER> {0:1}
+1 REFN <USER_REFERENCE_NUMBER> {0:M}
+2 TYPE <USER_REFERENCE_TYPE> {0:1}
+1 RIN <AUTOMATED_RECORD_ID> {0:1}
+1 <<CHANGE_DATE>> {0:1}
n @XREF:INDI@ INDI {1:1}
+1 RESN <RESTRICTION_NOTICE> {0:1} # not used
+1 <<PERSONAL_NAME_STRUCTURE>> {0:M}
+1 SEX <SEX_VALUE> {0:1}
+1 <<INDIVIDUAL_EVENT_STRUCTURE>> {0:M}
+1 <<INDIVIDUAL_ATTRIBUTE_STRUCTURE>> {0:M}
+1 <<LDS_INDIVIDUAL_ORDINANCE>> {0:M}
+1 <<CHILD_TO_FAMILY_LINK>> {0:M}
+1 <<SPOUSE_TO_FAMILY_LINK>> {0:M}
+1 SUBM @<XREF:SUBM>@ {0:M}
+1 <<ASSOCIATION_STRUCTURE>> {0:M}
+1 ALIA @<XREF:INDI>@ {0:M}
+1 ANCI @<XREF:SUBM>@ {0:M}
+1 DESI @<XREF:SUBM>@ {0:M}
+1 <<SOURCE_CITATION>> {0:M}
+1 <<MULTIMEDIA_LINK>> {0:M} ,*
+1 <<NOTE_STRUCTURE>> {0:M}
+1 RFN <PERMANENT_RECORD_FILE_NUMBER> {0:1}
+1 AFN <ANCESTRAL_FILE_NUMBER> {0:1}
+1 REFN <USER_REFERENCE_NUMBER> {0:M}
+2 TYPE <USER_REFERENCE_TYPE> {0:1}
+1 RIN <AUTOMATED_RECORD_ID> {0:1}
+1 <<CHANGE_DATE>> {0:1}
"""
self.__writeln(0, "@%s@" % person.get_gramps_id(), "INDI")
@ -546,10 +546,10 @@ class GedcomWriter(BasicUtils.UpdateCallback):
def __assoc(self, person, level):
"""
n ASSO @<XREF:INDI>@ {0:M}
+1 RELA <RELATION_IS_DESCRIPTOR> {1:1}
+1 <<NOTE_STRUCTURE>> {0:M}
+1 <<SOURCE_CITATION>> {0:M}
n ASSO @<XREF:INDI>@ {0:M}
+1 RELA <RELATION_IS_DESCRIPTOR> {1:1}
+1 <<NOTE_STRUCTURE>> {0:M}
+1 <<SOURCE_CITATION>> {0:M}
"""
for ref in person.get_person_ref_list():
person = self.dbase.get_person_from_handle(ref.ref)
@ -560,20 +560,19 @@ class GedcomWriter(BasicUtils.UpdateCallback):
def __note_references(self, notelist, level):
"""
Write out the list of note handles to the current level. We use the
GRAMPS ID as the XREF for the GEDCOM file.
Write out the list of note handles to the current level.
We use the GRAMPS ID as the XREF for the GEDCOM file.
Add the note_handle to the nlist set so what we know which notes to
write to the output GEDCOM file.
"""
for note_handle in notelist:
note = self.dbase.get_note_from_handle(note_handle)
self.__writeln(level, 'NOTE', '@%s@' % note.get_gramps_id())
self.nlist.add(note_handle)
def __names(self, person):
"""
Write the names associated with the person to the current level.
Write the names associated with the person to the current level.
Since nicknames are now separate from the name structure, we search
the attribute list to see if we can find a nickname. Because we do
not know the mappings, we just take the first nickname we find, and
@ -581,6 +580,7 @@ class GedcomWriter(BasicUtils.UpdateCallback):
All other names are assumed to not have a nickname, even if other
nicknames exist in the attribute list.
"""
nicknames = [ attr.get_value() for attr in person.get_attribute_list()
if int(attr.get_type()) == gen.lib.AttributeType.NICKNAME ]
@ -595,9 +595,12 @@ class GedcomWriter(BasicUtils.UpdateCallback):
def __gender(self, person):
"""
Writes out the gender of the person to the file. If the gender is not
male or female, simply do not output anything. The only valid values are
M (male) or F (female). So if the geneder is unknown, we output nothing.
Write out the gender of the person to the file.
If the gender is not male or female, simply do not output anything.
The only valid values are M (male) or F (female). So if the geneder is
unknown, we output nothing.
"""
if person.get_gender() == gen.lib.Person.MALE:
self.__writeln(1, "SEX", "M")
@ -607,7 +610,7 @@ class GedcomWriter(BasicUtils.UpdateCallback):
def __lds_ords(self, obj, level):
"""
Simply loop through the list of LDS ordinances, and call the function
that write the LDS ordinance structure.
that writes the LDS ordinance structure.
"""
for lds_ord in obj.get_lds_ord_list():
self.write_ord(lds_ord, level)
@ -615,8 +618,11 @@ class GedcomWriter(BasicUtils.UpdateCallback):
def __remaining_events(self, person):
"""
Output all events associated with the person that are not BIRTH or
DEATH events. Because all we have are event references, we have to
DEATH events.
Because all we have are event references, we have to
extract the real event to discover the event type.
"""
for event_ref in person.get_event_ref_list():
event = self.dbase.get_event_from_handle(event_ref.ref)
@ -657,12 +663,13 @@ class GedcomWriter(BasicUtils.UpdateCallback):
def __adoption_records(self, person):
"""
Writes Adoption events for each child that has been adopted.
Write Adoption events for each child that has been adopted.
n ADOP
n ADOP
+1 <<INDIVIDUAL_EVENT_DETAIL>>
+1 FAMC @<XREF:FAM>@
+2 ADOP <ADOPTED_BY_WHICH_PARENT>
+2 ADOP <ADOPTED_BY_WHICH_PARENT>
"""
adoptions = []
@ -687,12 +694,14 @@ class GedcomWriter(BasicUtils.UpdateCallback):
def __attributes(self, person):
"""
Writes out the attributes to the GEDCOM file. Since we have already
looked at nicknames when we generated the names, we filter them out
here.
Write out the attributes to the GEDCOM file.
Since we have already looked at nicknames when we generated the names,
we filter them out here.
We use the GEDCOM 5.5.1 FACT command to write out attributes not
built in to GEDCOM.
"""
# filter out the nicknames
@ -798,11 +807,11 @@ class GedcomWriter(BasicUtils.UpdateCallback):
def __url_list(self, obj, level):
"""
n OBJE {1:1}
+1 FORM <MULTIMEDIA_FORMAT> {1:1}
+1 TITL <DESCRIPTIVE_TITLE> {0:1}
+1 FILE <MULTIMEDIA_FILE_REFERENCE> {1:1}
+1 <<NOTE_STRUCTURE>> {0:M}
n OBJE {1:1}
+1 FORM <MULTIMEDIA_FORMAT> {1:1}
+1 TITL <DESCRIPTIVE_TITLE> {0:1}
+1 FILE <MULTIMEDIA_FILE_REFERENCE> {1:1}
+1 <<NOTE_STRUCTURE>> {0:M}
"""
for url in obj.get_url_list():
self.__writeln(level, 'OBJE')
@ -814,7 +823,7 @@ class GedcomWriter(BasicUtils.UpdateCallback):
def __families(self):
"""
Writes out the list of families, sorting by GRAMPS ID
Write out the list of families, sorting by GRAMPS ID.
"""
# generate a list of (GRAMPS_ID, HANDLE) pairs. This list
@ -830,16 +839,16 @@ class GedcomWriter(BasicUtils.UpdateCallback):
def __family(self, family):
"""
n @<XREF:FAM>@ FAM {1:1}
+1 RESN <RESTRICTION_NOTICE> {0:1)
+1 <<FAMILY_EVENT_STRUCTURE>> {0:M}
+1 HUSB @<XREF:INDI>@ {0:1}
+1 WIFE @<XREF:INDI>@ {0:1}
+1 CHIL @<XREF:INDI>@ {0:M}
+1 NCHI <COUNT_OF_CHILDREN> {0:1}
+1 SUBM @<XREF:SUBM>@ {0:M}
+1 <<LDS_SPOUSE_SEALING>> {0:M}
+1 REFN <USER_REFERENCE_NUMBER> {0:M}
n @<XREF:FAM>@ FAM {1:1}
+1 RESN <RESTRICTION_NOTICE> {0:1)
+1 <<FAMILY_EVENT_STRUCTURE>> {0:M}
+1 HUSB @<XREF:INDI>@ {0:1}
+1 WIFE @<XREF:INDI>@ {0:1}
+1 CHIL @<XREF:INDI>@ {0:M}
+1 NCHI <COUNT_OF_CHILDREN> {0:1}
+1 SUBM @<XREF:SUBM>@ {0:M}
+1 <<LDS_SPOUSE_SEALING>> {0:M}
+1 REFN <USER_REFERENCE_NUMBER> {0:M}
"""
gramps_id = family.get_gramps_id()
@ -860,8 +869,10 @@ class GedcomWriter(BasicUtils.UpdateCallback):
def __family_child_list(self, child_ref_list):
"""
Write the child XREF values to the GEDCOM file. Sorts the child
list by ID value before writing.
Write the child XREF values to the GEDCOM file.
Sorts the child list by ID value before writing.
"""
# sort the childlist by GRAMPS ID
@ -875,8 +886,11 @@ class GedcomWriter(BasicUtils.UpdateCallback):
def __family_reference(self, token, person_handle):
"""
Write the family reference to the file. This is either 'WIFE' or
'HUSB'. As usual, we use the GRAMPS ID as the XREF value.
Write the family reference to the file.
This is either 'WIFE' or 'HUSB'. As usual, we use the GRAMPS ID as the
XREF value.
"""
if person_handle:
person = self.dbase.get_person_from_handle(person_handle)
@ -884,8 +898,11 @@ class GedcomWriter(BasicUtils.UpdateCallback):
def __family_events(self, family):
"""
Output the events associated with the family. Because all we have are event
references, we have to extract the real event to discover the event type.
Output the events associated with the family.
Because all we have are event references, we have to extract the real
event to discover the event type.
"""
for event_ref in [ ref for ref in family.get_event_ref_list()]:
event = self.dbase.get_event_from_handle(event_ref.ref)
@ -920,9 +937,11 @@ class GedcomWriter(BasicUtils.UpdateCallback):
def __family_event_attrs(self, attr_list, level):
"""
Writes the attributes assocated with the family event. The only ones we
really care about are FATHER_AGE and MOTHER_AGE which we translate
to WIFE/HUSB AGE attributes.
Write the attributes assocated with the family event.
The only ones we really care about are FATHER_AGE and MOTHER_AGE which
we translate to WIFE/HUSB AGE attributes.
"""
for attr in attr_list:
if attr.get_type() == gen.lib.AttributeType.FATHER_AGE:
@ -934,12 +953,14 @@ class GedcomWriter(BasicUtils.UpdateCallback):
def __family_attributes(self, attr_list, level):
"""
Writes out the attributes associated with a family to the GEDCOM file.
Write out the attributes associated with a family to the GEDCOM file.
Since we have already looked at nicknames when we generated the names,
we filter them out here.
We use the GEDCOM 5.5.1 FACT command to write out attributes not
built in to GEDCOM.
"""
for attr in attr_list:
@ -965,9 +986,9 @@ class GedcomWriter(BasicUtils.UpdateCallback):
def __sources(self):
"""
Writes out the list of sources, sorting by GRAMPS ID
Write out the list of sources, sorting by GRAMPS ID.
"""
sorted_list = sort_handles_by_id(self.slist,
sorted_list = sort_handles_by_id(self.dbase.get_source_handles(),
self.dbase.get_source_from_handle)
for (source_id, handle) in sorted_list:
@ -996,9 +1017,9 @@ class GedcomWriter(BasicUtils.UpdateCallback):
def __notes(self):
"""
Writes out the list of notes, sorting by GRAMPS ID
Write out the list of notes, sorting by GRAMPS ID.
"""
sorted_list = sort_handles_by_id(self.nlist,
sorted_list = sort_handles_by_id(self.dbase.get_note_handles(),
self.dbase.get_note_from_handle)
for note_handle in [hndl[1] for hndl in sorted_list]:
@ -1007,32 +1028,32 @@ class GedcomWriter(BasicUtils.UpdateCallback):
def __note_record(self, note):
"""
n @<XREF:NOTE>@ NOTE <SUBMITTER_TEXT> {1:1}
+1 [ CONC | CONT] <SUBMITTER_TEXT> {0:M}
+1 <<SOURCE_CITATION>> {0:M}
+1 REFN <USER_REFERENCE_NUMBER> {0:M}
+2 TYPE <USER_REFERENCE_TYPE> {0:1}
+1 RIN <AUTOMATED_RECORD_ID> {0:1}
+1 <<CHANGE_DATE>> {0:1}
n @<XREF:NOTE>@ NOTE <SUBMITTER_TEXT> {1:1}
+1 [ CONC | CONT] <SUBMITTER_TEXT> {0:M}
+1 <<SOURCE_CITATION>> {0:M}
+1 REFN <USER_REFERENCE_NUMBER> {0:M}
+2 TYPE <USER_REFERENCE_TYPE> {0:1}
+1 RIN <AUTOMATED_RECORD_ID> {0:1}
+1 <<CHANGE_DATE>> {0:1}
"""
self.__writeln(0, '@%s@' % note.get_gramps_id(), 'NOTE ' + note.get())
def __repos(self):
"""
Writes out the list of repositories, sorting by GRAMPS ID
Write out the list of repositories, sorting by GRAMPS ID.
REPOSITORY_RECORD:=
n @<XREF:REPO>@ REPO {1:1}
+1 NAME <NAME_OF_REPOSITORY> {1:1}
+1 <<ADDRESS_STRUCTURE>> {0:1}
+1 <<NOTE_STRUCTURE>> {0:M}
+1 REFN <USER_REFERENCE_NUMBER> {0:M}
+2 TYPE <USER_REFERENCE_TYPE> {0:1}
+1 RIN <AUTOMATED_RECORD_ID> {0:1}
+1 <<CHANGE_DATE>> {0:1}
n @<XREF:REPO>@ REPO {1:1}
+1 NAME <NAME_OF_REPOSITORY> {1:1}
+1 <<ADDRESS_STRUCTURE>> {0:1}
+1 <<NOTE_STRUCTURE>> {0:M}
+1 REFN <USER_REFERENCE_NUMBER> {0:M}
+2 TYPE <USER_REFERENCE_TYPE> {0:1}
+1 RIN <AUTOMATED_RECORD_ID> {0:1}
+1 <<CHANGE_DATE>> {0:1}
"""
sorted_list = sort_handles_by_id(self.rlist,
sorted_list = sort_handles_by_id(self.dbase.get_repository_handles(),
self.dbase.get_repository_from_handle)
# GEDCOM only allows for a single repository per source
@ -1058,18 +1079,15 @@ class GedcomWriter(BasicUtils.UpdateCallback):
def __reporef(self, reporef, level):
"""
n REPO [ @XREF:REPO@ | <NULL>] {1:1}
+1 <<NOTE_STRUCTURE>> {0:M}
+1 CALN <SOURCE_CALL_NUMBER> {0:M}
+2 MEDI <SOURCE_MEDIA_TYPE> {0:1}
n REPO [ @XREF:REPO@ | <NULL>] {1:1}
+1 <<NOTE_STRUCTURE>> {0:M}
+1 CALN <SOURCE_CALL_NUMBER> {0:M}
+2 MEDI <SOURCE_MEDIA_TYPE> {0:1}
"""
if reporef.ref == None:
return
# Append handle to the list for exporting REPOs later
self.rlist.add(reporef.ref)
repo = self.dbase.get_repository_from_handle(reporef.ref)
repo_id = repo.get_gramps_id()
@ -1084,7 +1102,7 @@ class GedcomWriter(BasicUtils.UpdateCallback):
def __person_event_ref(self, key, event_ref):
"""
Writes out the BIRTH and DEATH events for the person.
Write out the BIRTH and DEATH events for the person.
"""
if event_ref:
event = self.dbase.get_event_from_handle(event_ref.ref)
@ -1099,8 +1117,8 @@ class GedcomWriter(BasicUtils.UpdateCallback):
def __change(self, timeval, level):
"""
CHANGE_DATE:=
n CHAN {1:1}
CHANGE_DATE:=
n CHAN {1:1}
+1 DATE <CHANGE_DATE> {1:1}
+2 TIME <TIME_VALUE> {0:1}
+1 <<NOTE_STRUCTURE>> # not used
@ -1114,9 +1132,11 @@ class GedcomWriter(BasicUtils.UpdateCallback):
def __dump_event_stats(self, event, event_ref):
"""
Writes the event details for the event, using the event and event
reference information. GEDCOM does not make a distinction between the
two.
Write the event details for the event, using the event and event
reference information.
GEDCOM does not make a distinction between the two.
"""
dateobj = event.get_date_object()
self.__date(2, dateobj)
@ -1205,7 +1225,7 @@ class GedcomWriter(BasicUtils.UpdateCallback):
def __date(self, level, date):
"""
Writes the 'DATE' GEDCOM token, along with the date in GEDCOM's
Write the 'DATE' GEDCOM token, along with the date in GEDCOM's
expected formta.
"""
start = date.get_start_date()
@ -1229,15 +1249,15 @@ class GedcomWriter(BasicUtils.UpdateCallback):
def __person_name(self, name, nick):
"""
n NAME <NAME_PERSONAL> {1:1}
+1 NPFX <NAME_PIECE_PREFIX> {0:1}
+1 GIVN <NAME_PIECE_GIVEN> {0:1}
+1 NICK <NAME_PIECE_NICKNAME> {0:1}
+1 SPFX <NAME_PIECE_SURNAME_PREFIX {0:1}
+1 SURN <NAME_PIECE_SURNAME> {0:1}
+1 NSFX <NAME_PIECE_SUFFIX> {0:1}
+1 <<SOURCE_CITATION>> {0:M}
+1 <<NOTE_STRUCTURE>> {0:M}
n NAME <NAME_PERSONAL> {1:1}
+1 NPFX <NAME_PIECE_PREFIX> {0:1}
+1 GIVN <NAME_PIECE_GIVEN> {0:1}
+1 NICK <NAME_PIECE_NICKNAME> {0:1}
+1 SPFX <NAME_PIECE_SURNAME_PREFIX {0:1}
+1 SURN <NAME_PIECE_SURNAME> {0:1}
+1 NSFX <NAME_PIECE_SUFFIX> {0:1}
+1 <<SOURCE_CITATION>> {0:M}
+1 <<NOTE_STRUCTURE>> {0:M}
"""
firstname = name.get_first_name().strip()
patron = name.get_patronymic().strip()
@ -1280,17 +1300,17 @@ class GedcomWriter(BasicUtils.UpdateCallback):
def __source_ref_record(self, level, ref):
"""
n SOUR @<XREF:SOUR>@ /* pointer to source record */ {1:1}
+1 PAGE <WHERE_WITHIN_SOURCE> {0:1}
+1 EVEN <EVENT_TYPE_CITED_FROM> {0:1}
+2 ROLE <ROLE_IN_EVENT> {0:1}
+1 DATA {0:1}
+2 DATE <ENTRY_RECORDING_DATE> {0:1}
+2 TEXT <TEXT_FROM_SOURCE> {0:M}
+3 [ CONC | CONT ] <TEXT_FROM_SOURCE> {0:M}
+1 QUAY <CERTAINTY_ASSESSMENT> {0:1}
+1 <<MULTIMEDIA_LINK>> {0:M} ,*
+1 <<NOTE_STRUCTURE>> {0:M}
n SOUR @<XREF:SOUR>@ /* pointer to source record */ {1:1}
+1 PAGE <WHERE_WITHIN_SOURCE> {0:1}
+1 EVEN <EVENT_TYPE_CITED_FROM> {0:1}
+2 ROLE <ROLE_IN_EVENT> {0:1}
+1 DATA {0:1}
+2 DATE <ENTRY_RECORDING_DATE> {0:1}
+2 TEXT <TEXT_FROM_SOURCE> {0:M}
+3 [ CONC | CONT ] <TEXT_FROM_SOURCE> {0:M}
+1 QUAY <CERTAINTY_ASSESSMENT> {0:1}
+1 <<MULTIMEDIA_LINK>> {0:M} ,*
+1 <<NOTE_STRUCTURE>> {0:M}
"""
src_handle = ref.get_reference_handle()
@ -1298,7 +1318,6 @@ class GedcomWriter(BasicUtils.UpdateCallback):
return
src = self.dbase.get_source_from_handle(src_handle)
self.slist.add(src_handle)
# Reference to the source
self.__writeln(level, "SOUR", "@%s@" % src.get_gramps_id())
@ -1335,11 +1354,11 @@ class GedcomWriter(BasicUtils.UpdateCallback):
def __photo(self, photo, level):
"""
n OBJE {1:1}
+1 FORM <MULTIMEDIA_FORMAT> {1:1}
+1 TITL <DESCRIPTIVE_TITLE> {0:1}
+1 FILE <MULTIMEDIA_FILE_REFERENCE> {1:1}
+1 <<NOTE_STRUCTURE>> {0:M}
n OBJE {1:1}
+1 FORM <MULTIMEDIA_FORMAT> {1:1}
+1 TITL <DESCRIPTIVE_TITLE> {0:1}
+1 FILE <MULTIMEDIA_FILE_REFERENCE> {1:1}
+1 <<NOTE_STRUCTURE>> {0:M}
"""
photo_obj_id = photo.get_reference_handle()
photo_obj = self.dbase.get_object_from_handle(photo_obj_id)
@ -1359,16 +1378,16 @@ class GedcomWriter(BasicUtils.UpdateCallback):
def __place(self, place, level):
"""
PLACE_STRUCTURE:=
n PLAC <PLACE_NAME> {1:1}
PLACE_STRUCTURE:=
n PLAC <PLACE_NAME> {1:1}
+1 FORM <PLACE_HIERARCHY> {0:1}
+1 FONE <PLACE_PHONETIC_VARIATION> {0:M} # not used
+2 TYPE <PHONETIC_TYPE> {1:1}
+2 TYPE <PHONETIC_TYPE> {1:1}
+1 ROMN <PLACE_ROMANIZED_VARIATION> {0:M} # not used
+2 TYPE <ROMANIZED_TYPE> {1:1}
+2 TYPE <ROMANIZED_TYPE> {1:1}
+1 MAP {0:1}
+2 LATI <PLACE_LATITUDE> {1:1}
+2 LONG <PLACE_LONGITUDE> {1:1}
+2 LATI <PLACE_LATITUDE> {1:1}
+2 LONG <PLACE_LONGITUDE> {1:1}
+1 <<NOTE_STRUCTURE>> {0:M}
"""
place_name = place.get_title()

View File

@ -744,7 +744,7 @@ class ObjEntry:
"""
def __init__(self, dbstate, uistate, track, label, set_val,
get_val, add_edt, share):
'''Pass the dbstate and uistate and present track.
"""Pass the dbstate and uistate and present track.
label is a gtk.Label that shows the persent value
set_val is function that is called when handle changes, use it
to update the calling module
@ -753,7 +753,7 @@ class ObjEntry:
share is the gtk.Button to call the object selector or del connect
add_edt is the gtk.Button with add or edit value. Pass None if
this button should not be present.
'''
"""
self.label = label
self.add_edt = add_edt
self.share = share
@ -808,25 +808,25 @@ class ObjEntry:
self.label.set_text(name)
def _init_dnd(self):
'''inheriting objects must set this
'''
"""inheriting objects must set this
"""
pass
def _init_object(self):
'''inheriting objects can use this to set extra variables
'''
"""inheriting objects can use this to set extra variables
"""
pass
def get_from_handle(self, handle):
''' return the object given the hande
""" return the object given the hande
inheriting objects must set this
'''
"""
pass
def get_label(self, object):
''' return the label
""" return the label
inheriting objects must set this
'''
"""
pass
def after_edit(self, obj):
@ -834,8 +834,8 @@ class ObjEntry:
self.label.set_text(name)
def add_edt_clicked(self, obj):
''' if value, edit, if no value, call editor on new object
'''
""" if value, edit, if no value, call editor on new object
"""
if self.get_val():
obj = self.get_from_handle(self.get_val())
self.call_editor(obj)
@ -843,13 +843,13 @@ class ObjEntry:
self.call_editor()
def call_editor(self, obj):
'''inheriting objects must set this
'''
"""inheriting objects must set this
"""
pass
def call_selector(self):
'''inheriting objects must set this
'''
"""inheriting objects must set this
"""
pass
def drag_data_received(self, widget, context, x, y, selection, info, time):
@ -859,14 +859,14 @@ class ObjEntry:
self.obj_added(data)
def obj_added(self, data):
''' callback from adding an object to the entry'''
""" callback from adding an object to the entry"""
self.set_val(data.handle)
self.label.set_text(self.get_label(data))
self.set_button(True)
def share_clicked(self, obj):
''' if value, delete connect, in no value, select existing object
'''
""" if value, delete connect, in no value, select existing object
"""
if self.get_val():
self.set_val(None)
self.label.set_text(self.EMPTY_TEXT)
@ -879,10 +879,10 @@ class ObjEntry:
self.obj_added(obj)
def set_button(self, use_add):
''' This sets the correct image to the two buttons.
""" This sets the correct image to the two buttons.
If False: select icon and add icon
If True: remove icon and edit icon
'''
"""
if self.add_edt is not None:
for i in self.add_edt.get_children():
self.add_edt.remove(i)
@ -933,15 +933,15 @@ class PlaceEntry(ObjEntry):
get_val, add_edt, share)
def _init_dnd(self):
'''connect drag and drop of places
'''
"""connect drag and drop of places
"""
self.label.drag_dest_set(gtk.DEST_DEFAULT_ALL, [DdTargets.PLACE_LINK.target()],
gtk.gdk.ACTION_COPY)
self.label.connect('drag_data_received', self.drag_data_received)
def get_from_handle(self, handle):
''' return the object given the hande
'''
""" return the object given the hande
"""
return self.db.get_place_from_handle(handle)
def get_label(self, place):
@ -987,15 +987,15 @@ class MediaEntry(ObjEntry):
get_val, add_edt, share)
def _init_dnd(self):
'''connect drag and drop of places
'''
"""connect drag and drop of places
"""
self.label.drag_dest_set(gtk.DEST_DEFAULT_ALL, [DdTargets.MEDIAOBJ.target()],
gtk.gdk.ACTION_COPY)
self.label.connect('drag_data_received', self.drag_data_received)
def get_from_handle(self, handle):
''' return the object given the hande
'''
""" return the object given the hande
"""
return self.db.get_object_from_handle(handle)
def get_label(self, object):
@ -1042,25 +1042,25 @@ class NoteEntry(ObjEntry):
self.notetype = None
def set_notetype(self, type):
''' set a notetype to use in new notes
'''
""" set a notetype to use in new notes
"""
self.notetype = type
def get_notetype(self):
''' return the set notetype
'''
""" return the set notetype
"""
return self.notetype
def _init_dnd(self):
'''connect drag and drop of places
'''
"""connect drag and drop of places
"""
self.label.drag_dest_set(gtk.DEST_DEFAULT_ALL, [DdTargets.NOTE_LINK.target()],
gtk.gdk.ACTION_COPY)
self.label.connect('drag_data_received', self.drag_data_received)
def get_from_handle(self, handle):
''' return the object given the hande
'''
""" return the object given the hande
"""
return self.db.get_note_from_handle(handle)
def get_label(self, note):
@ -1142,16 +1142,16 @@ class Statusbar(gtk.HBox):
# Virtual methods
def do_get_property(self, prop):
'''Return the gproperty's value.
'''
"""Return the gproperty's value.
"""
if prop.name == 'has-resize-grip':
return self.__has_resize_grip
else:
raise AttributeError, 'unknown property %s' % prop.name
def do_set_property(self, prop, value):
'''Set the property of writable properties.
'''
"""Set the property of writable properties.
"""
if prop.name == 'has-resize-grip':
self.__has_resize_grip = value
self._set_resize_grip()
@ -1389,7 +1389,7 @@ if gtk.pygtk_version < (2, 8, 0):
gobject.type_register(FadeOut)
class Tooltip(gtk.Window):
'''Tooltip for the Icon in the MaskedEntry'''
"""Tooltip for the Icon in the MaskedEntry"""
DEFAULT_DELAY = 500
BORDER_WIDTH = 4
@ -2191,14 +2191,14 @@ class MaskedEntry(gtk.Entry):
return
def set_completion_mode(self, popup=None, inline=None):
'''
"""
Set the way how completion is presented.
@param popup: enable completion in popup window
@type popup: boolean
@param inline: enable inline completion
@type inline: boolean
'''
"""
completion = self._get_completion()
if popup is not None:
completion.set_popup_completion(popup)
@ -2683,7 +2683,7 @@ class ValidatableMaskedEntry(MaskedEntry):
self.validate()
def do_get_property(self, prop):
'''Return the gproperty's value.'''
"""Return the gproperty's value."""
if prop.name == 'data-type':
return self.data_type
@ -2693,7 +2693,7 @@ class ValidatableMaskedEntry(MaskedEntry):
raise AttributeError, 'unknown property %s' % prop.name
def do_set_property(self, prop, value):
'''Set the property of writable properties.'''
"""Set the property of writable properties."""
if prop.name == 'data-type':
if value is None:

View File

@ -419,7 +419,7 @@ class ManagedWindow:
self.window.show_all()
def modal_call(self, after_ok_func=None):
'''
"""
Method to do modal run of the ManagedWindow.
Connect the OK button to a method that checks if all is ok,
Do not call close, close is called here.
@ -432,7 +432,7 @@ class ManagedWindow:
Do not generete RESPONSE_OK/CANCEL/DELETE_EVENT on button clicks
of other buttons
after_ok_func is called on ok click in this method
'''
"""
#self.show()
while True:
response = self.window.run()

View File

@ -63,7 +63,7 @@ from ReportBase import CATEGORY_QR_PERSON, CATEGORY_QR_FAMILY,\
def create_quickreport_menu(category,dbstate,uistate,handle) :
#import present version of the
from PluginUtils import quick_report_list
''' This functions querries the registered quick reports with
""" This functions querries the registered quick reports with
quick_report_list of _PluginMgr.py
It collects the reports of the requested category, which must be one of
CATEGORY_QR_PERSON, CATEGORY_QR_FAMILY,
@ -74,7 +74,7 @@ def create_quickreport_menu(category,dbstate,uistate,handle) :
handle as input method.
A tuple is returned, containing the ui string of the quick report menu,
and its associated actions
'''
"""
actions = []
ofile = StringIO()

View File

@ -18,7 +18,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
# $Id:Relationship.py 9912 2008-01-22 09:17:46Z acraphae $
#-------------------------------------------------------------------------
#
@ -395,16 +395,16 @@ class RelationshipCalculator:
pass
def set_depth(self, depth):
''' set how deep relationships must be searched. Input must be an
""" set how deep relationships must be searched. Input must be an
integer > 0
'''
"""
if not depth == self.depth:
self.depth = depth
self.dirtymap = True
def get_depth(self):
''' obtain depth of relationship search
'''
""" obtain depth of relationship search
"""
return self.depth
@ -877,7 +877,7 @@ class RelationshipCalculator:
def __apply_filter(self, db, person, rel_str, rel_fam, pmap,
depth=1, stoprecursemap=None):
'''Typically this method is called recursively in two ways:
"""Typically this method is called recursively in two ways:
First method is stoprecursemap= None
In this case a recursemap is builded by storing all data.
@ -888,7 +888,7 @@ class RelationshipCalculator:
of first contains loops, and parents
will be looked up anyway an stored if common. At end the doubles
are filtered out
'''
"""
if person == None or not person.handle :
return

View File

@ -18,7 +18,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
# $Id:_BaseSelector.py 9912 2008-01-22 09:17:46Z acraphae $
#-------------------------------------------------------------------------
#
@ -54,11 +54,11 @@ class BaseSelector(ManagedWindow.ManagedWindow):
def __init__(self, dbstate, uistate, track=[], filter=None, skip=set(),
show_search_bar = True):
'''Set up the dialog with the dbstate and uistate, track of parent
"""Set up the dialog with the dbstate and uistate, track of parent
windows for ManagedWindow, initial filter for the model, skip with
set of handles to skip in the view, and search_bar to show the
SearchBar at the top or not.
'''
"""
self.title = self.get_window_title()
ManagedWindow.ManagedWindow.__init__(self, uistate, track, self)
@ -179,8 +179,8 @@ class BaseSelector(ManagedWindow.ManagedWindow):
assert False, "Must be defined in the subclass"
def set_show_search_bar(self, value):
'''make the search bar at the top shown
'''
"""make the search bar at the top shown
"""
self.show_search_bar = value
if not self.search_bar :
return

View File

@ -18,7 +18,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
# $Id:gramps_main.py 9912 2008-01-22 09:17:46Z acraphae $
#-------------------------------------------------------------------------
#
@ -63,10 +63,10 @@ from QuestionDialog import ErrorDialog
def register_stock_icons ():
'''
"""
Add the gramps names for its icons (eg gramps-person) to the GTK icon
factory. This allows all gramps modules to call up the icons by their name
'''
"""
#iconpath to the base image. The front of the list has highest priority
if platform.system() == "Windows":

View File

@ -148,9 +148,9 @@ class RelCalc(Tool.Tool, ManagedWindow.ManagedWindow):
self.show()
def close(self, *obj):
''' Close relcalc tool. Remove non-gtk connections so garbage
""" Close relcalc tool. Remove non-gtk connections so garbage
collection can do its magic.
'''
"""
self.relationship.disconnect_db_signals(self.dbstate)
self.sel.disconnect(self.changedkey)
ManagedWindow.ManagedWindow.close(self, *obj)