Patch from Raphael Ackermann <raphael.ackermann@gmail.com> -- Fix 0001538: tabs and spaces are mixed in some source files

svn: r9713
This commit is contained in:
Brian Matherly 2008-01-05 20:10:26 +00:00
parent aa8288eddd
commit bf3900f043
57 changed files with 499 additions and 440 deletions

View File

@ -1,3 +1,64 @@
2008-01-05 Raphael Ackermann <raphael.ackermann@gmail.com>
2008-01-05 Brian Matherly <brian@gramps-project.org>
* src/DataViews/PedigreeView.py:
* src/Config/__init__.py:
* src/gen/utils/longop.py:
* src/Editors/_EditLocation.py:
* src/DisplayTabs/_TextTab.py:
* src/plugins/WebCal.py:
* src/plugins/NarrativeWeb.py:
* src/plugins/rel_sv.py:
* src/plugins/rel_de.py:
* src/plugins/MarkerReport.py:
* src/plugins/FindDupes.py:
* src/plugins/DescendChart.py:
* src/plugins/PHPGedViewConnector.py:
* src/plugins/rel_pl.py:
* src/plugins/FamilyGroup.py:
* src/plugins/GVRelGraph.py:
* src/plugins/StatisticsChart.py:
* src/plugins/WriteGeneWeb.py:
* src/ObjectSelector/_FilterFrameBase.py:
* src/ObjectSelector/_FamilyPreviewFrame.py:
* src/ObjectSelector/_ObjectSelectorWindow.py:
* src/ObjectSelector/_PersonTreeFrame.py:
* src/ObjectSelector/_FamilyFilterFrame.py:
* src/ObjectSelector/_FamilyTreeFrame.py:
* src/ObjectSelector/_PersonPreviewFrame.py:
* src/ObjectSelector/_PersonFilterFrame.py:
* src/GrampsWidgets.py:
* src/DbManager.py:
* src/Models/_ListCursor.py:
* src/Models/_PathCursor.py:
* src/GrampsLogger/_GtkHandler.py:
* src/DisplayModels/_BaseModel.py:
* src/AutoComp.py:
* src/UndoHistory.py:
* src/GrampsDbUtils/_GedcomUtils.py:
* src/docgen/HtmlDoc.py:
* src/docgen/SpreadSheetDoc.py:
* src/docgen/ODFDoc.py:
* src/docgen/LaTeXDoc.py:
* src/docgen/ODSDoc.py:
* src/docgen/ODSTab.py:
* src/docgen/PSDrawDoc.py:
* src/Filters/_FilterMenu.py:
* src/Filters/_FilterList.py:
* src/Filters/SideBar/_MediaSidebarFilter.py:
* src/Filters/SideBar/_SourceSidebarFilter.py:
* src/Filters/SideBar/_EventSidebarFilter.py:
* src/Filters/SideBar/_NoteSidebarFilter.py:
* src/Filters/SideBar/_RepoSidebarFilter.py:
* src/Filters/Rules/Person/_IsLessThanNthGenerationAncestorOfDefaultPerson.py:
* src/Filters/Rules/Person/_RelationshipPathBetweenBookmarks.py:
* src/Filters/Rules/Person/_IsLessThanNthGenerationAncestorOfBookmarked.py:
* src/Filters/Rules/_MatchesFilterBase.py:
* src/DateHandler/_DateParser.py:
* src/DateHandler/_Date_fi.py:
* src/DateHandler/_Date_fr.py:
Patch from Raphael Ackermann
Fix 0001538: tabs and spaces are mixed in some source files
2008-01-05 Gary Burton <gary.burton@zen.co.uk>
* src/plugins/Verify.py: Remove a line of redundant code added yesterday.

View File

@ -46,7 +46,7 @@ def fill_combo(combo, data_list):
for data in [ item for item in data_list if item ]:
store.append(row=[data])
combo.set_model(store)
combo.set_text_column(0)
completion = gtk.EntryCompletion()
@ -89,7 +89,7 @@ class StandardCustomSelector:
To set up the combo box, specify the active key at creation time,
or later (or with custom text) use:
type_sel.set_values(i,s)
type_sel.set_values(i,s)
and later, when or before the dialog is closed, do:
(i,s) = type_sel.get_values()
@ -232,3 +232,4 @@ class StandardCustomSelector:
return True
return False

View File

@ -31,17 +31,17 @@ from _GrampsIniKeys import *
import os
def __upgrade_gconf():
import _GrampsGconfKeys as GconfKeys
print "Upgrading INI file"
for key in default_value.keys():
data = GconfKeys.get(key)
set(key, data)
import _GrampsGconfKeys as GconfKeys
print "Upgrading INI file"
for key in default_value.keys():
data = GconfKeys.get(key)
set(key, data)
if not os.path.exists(INIFILE):
try:
__upgrade_gconf()
except ImportError:
print "Cannot upgrade GCONF settings"
if not os.path.exists(INIFILE):
try:
__upgrade_gconf()
except ImportError:
print "Cannot upgrade GCONF settings"

View File

@ -368,7 +368,7 @@ class FormattingHelper:
text += "\n"
text += self.get_place_name(event.get_place_handle())
if line_count < 5:
return text;
return text;
break
if not text:
text = str(family.get_relationship())

View File

@ -207,14 +207,14 @@ class DateParser:
self.ymd = False
def re_longest_first(self, keys):
"""
returns a string for a RE group which contains the given keys
"""
returns a string for a RE group which contains the given keys
sorted so that longest keys match first. Any '.' characters
are quoted.
"""
keys.sort(lambda x, y: cmp(len(y), len(x)))
return '(' + '|'.join([key.replace('.', '\.') for key in keys]) + ')'
are quoted.
"""
keys.sort(lambda x, y: cmp(len(y), len(x)))
return '(' + '|'.join([key.replace('.', '\.') for key in keys]) + ')'
def init_strings(self):
"""
This method compiles regular expression strings for matching dates.
@ -508,7 +508,7 @@ class DateParser:
match = self._bce_re.match(text)
bc = False
if match:
# bce is in the match.group(2)
# bce is in the match.group(2)
try:
text = match.group(1) + match.group(3)
except:

View File

@ -98,7 +98,7 @@ class DateParserFI(DateParser):
def init_strings(self):
DateParser.init_strings(self)
# date, whitespace
# date, whitespace
self._span = re.compile(u"(?P<start>.+)\s+(-)\s+(?P<stop>.+)",
re.IGNORECASE)
self._range = re.compile(
@ -142,9 +142,9 @@ class DateDisplayFI(DateDisplay):
if start == Date.EMPTY:
return u""
# select numerical date format
self.format = 1
# select numerical date format
self.format = 1
if mod == Date.MOD_SPAN:
d1 = self.display_cal[cal](start)
d2 = self.display_cal[cal](date.get_stop_date())
@ -167,15 +167,15 @@ class DateDisplayFI(DateDisplay):
text = u"noin " + text
elif mod == Date.MOD_BEFORE:
text = u"ennen " + text
if qual:
# prepend quality
text = u"%s %s" % (self._qual_str[qual], text)
if cal:
# append calendar type
text = u"%s %s" % (text, self.calendar[cal])
return text
return text
#-------------------------------------------------------------------------
#

View File

@ -167,21 +167,21 @@ class DateParserFR(DateParser):
self._numeric = re.compile("((\d+)[/\. ])?\s*((\d+)[/\.])?\s*(\d+)\s*$")
self._span = re.compile(u"(de)\s+(?P<start>.+)\s+(à)\s+(?P<stop>.+)", re.IGNORECASE)
self._range = re.compile(u"(entre|ent\.|ent)\s+(?P<start>.+)\s+(et)\s+(?P<stop>.+)", re.IGNORECASE)
# This self._text are different from the base
# This self._text are different from the base
# by adding ".?" after the first date and removing "\s*$" at the end
#gregorian and julian
#gregorian and julian
self._text2 = re.compile('(\d+)?.?\s+?%s\s*((\d+)(/\d+)?)?' % self._mon_str,
re.IGNORECASE)
#hebrew
#hebrew
self._jtext2 = re.compile('(\d+)?.?\s+?%s\s*((\d+)(/\d+)?)?' % self._jmon_str,
re.IGNORECASE)
#french
#french
self._ftext2 = re.compile('(\d+)?.?\s+?%s\s*((\d+)(/\d+)?)?' % self._fmon_str,
re.IGNORECASE)
#persian
#persian
self._ptext2 = re.compile('(\d+)?.?\s+?%s\s*((\d+)(/\d+)?)?' % self._pmon_str,
re.IGNORECASE)
#islamic
#islamic
self._itext2 = re.compile('(\d+)?.?\s+?%s\s*((\d+)(/\d+)?)?' % self._imon_str,
re.IGNORECASE)
@ -221,8 +221,8 @@ class DateDisplayFR(DateDisplay):
else:
value = self._tformat.replace('%m', str(date_val[1]))
value = value.replace('%d', str(date_val[0]))
# base_display :
# value = value.replace('%Y', str(abs(date_val[2])))
# base_display :
# value = value.replace('%Y', str(abs(date_val[2])))
# value = value.replace('-', '/')
value = value.replace('%Y', str(date_val[2]))
elif self.format == 2:
@ -251,8 +251,8 @@ class DateDisplayFR(DateDisplay):
else:
value = "%s %s" % (self._months[date_val[1]], year)
else:
# base_display :
# value = "%d %s %s" % (date_val[0], self._months[date_val[1]], year)
# base_display :
# value = "%d %s %s" % (date_val[0], self._months[date_val[1]], year)
value = "%d. %s %s" % (date_val[0], self._months[date_val[1]], year)
else:
# Day MON Year
@ -262,8 +262,8 @@ class DateDisplayFR(DateDisplay):
else:
value = "%s %s" % (self.MONS[date_val[1]], year)
else:
# base_display :
# value = "%d %s %s" % (date_val[0], self.MONS[date_val[1]], year)
# base_display :
# value = "%d %s %s" % (date_val[0], self.MONS[date_val[1]], year)
value = "%d. %s %s" % (date_val[0], self.MONS[date_val[1]], year)
if date_val[2] < 0:
return self._bce_str % value

View File

@ -494,7 +494,7 @@ class DbManager(CLIDbManager):
self.__rename_revision(path, new_text)
else:
"""
Check in recent_files.xml if there is another database
Check in recent_files.xml if there is another database
or Family Tree with the same name as new_text.
"""
if RecentFiles.check_if_recent(new_text):

View File

@ -145,7 +145,7 @@ class BaseModel(gtk.GenericTreeModel):
self.set_property("leak_references",False)
self.db = db
if sort_map:
self.sort_map = [ f for f in sort_map if f[0]]
self.sort_map = [ f for f in sort_map if f[0]]
col = self.sort_map[scol][1]
self.sort_func = self.smap[col]
else:

View File

@ -51,7 +51,7 @@ class TextTab(GrampsTab):
def __init__(self, dbstate, uistate, track, obj, title=_('Text')):
self.obj = obj
self.original = self.obj.get_text()
self.original = self.obj.get_text()
GrampsTab.__init__(self, dbstate, uistate, track, title)
self.show_all()
@ -109,4 +109,4 @@ class TextTab(GrampsTab):
self._set_label()
def cancel(self):
self.obj.set_text(self.original)
self.obj.set_text(self.original)

View File

@ -114,6 +114,7 @@ class EditLocation(EditSecondary):
def save(self,*obj):
if self.callback:
self.callback(self.obj)
self.callback(self.obj)
self.close()

View File

@ -57,7 +57,7 @@ class IsLessThanNthGenerationAncestorOfBookmarked(Rule):
"not more than N generations away")
def prepare(self,db):
self.db = db
self.db = db
bookmarks = db.get_bookmarks().get()
if len(bookmarks) == 0:
self.apply = lambda db,p : False
@ -66,7 +66,7 @@ class IsLessThanNthGenerationAncestorOfBookmarked(Rule):
self.bookmarks = set(bookmarks)
self.apply = self.apply_real
for self.bookmarkhandle in self.bookmarks:
self.init_ancestor_list(self.bookmarkhandle, 1)
self.init_ancestor_list(self.bookmarkhandle, 1)
def init_ancestor_list(self,handle,gen):

View File

@ -52,8 +52,8 @@ class IsLessThanNthGenerationAncestorOfDefaultPerson(Rule):
"not more than N generations away")
def prepare(self,db):
self.db = db
p = db.get_default_person()
self.db = db
p = db.get_default_person()
if p:
self.def_handle = p.get_handle()
self.apply = self.apply_real

View File

@ -95,19 +95,19 @@ class RelationshipPathBetweenBookmarks(Rule):
prev_generation = {}
for handle in generation:
try:
person = self.db.get_person_from_handle(handle)
if person == None:
continue
fam_id = person.get_main_parents_family_handle()
family = self.db.get_family_from_handle(fam_id)
if family == None:
continue
fhandle = family.get_father_handle()
mhandle = family.get_mother_handle()
if fhandle:
prev_generation[fhandle] = generation[handle] + [fhandle]
if mhandle:
prev_generation[mhandle] = generation[handle] + [mhandle]
person = self.db.get_person_from_handle(handle)
if person == None:
continue
fam_id = person.get_main_parents_family_handle()
family = self.db.get_family_from_handle(fam_id)
if family == None:
continue
fhandle = family.get_father_handle()
mhandle = family.get_mother_handle()
if fhandle:
prev_generation[fhandle] = generation[handle] + [fhandle]
if mhandle:
prev_generation[mhandle] = generation[handle] + [mhandle]
except:
pass
return prev_generation
@ -123,20 +123,20 @@ class RelationshipPathBetweenBookmarks(Rule):
map1 = {}
map2 = {}
overlap = set( {} )
for rank in range(1, 50): # Limit depth of search
for rank in range(1, 50): # Limit depth of search
try:
gmap1 = self.parents(gmap1) # Get previous generation into map
gmap2 = self.parents(gmap2) # Get previous generation into map
map1.update(gmap1) # Merge previous generation into map
map2.update(gmap2) # Merge previous generation into map
overlap = set(map1).intersection(set(map2)) # Any common ancestors?
if len(overlap) > 0: break # If so, stop walking through generations
gmap1 = self.parents(gmap1) # Get previous generation into map
gmap2 = self.parents(gmap2) # Get previous generation into map
map1.update(gmap1) # Merge previous generation into map
map2.update(gmap2) # Merge previous generation into map
overlap = set(map1).intersection(set(map2)) # Any common ancestors?
if len(overlap) > 0: break # If so, stop walking through generations
except: pass
if len(overlap) < 1: # No common ancestor found
rel_path[handle1] = handle1 # Results for degenerate case
rel_path[handle2] = handle2
#print " In rel_path_for_two, returning rel_path = ", rel_path
return rel_path
if len(overlap) < 1: # No common ancestor found
rel_path[handle1] = handle1 # Results for degenerate case
rel_path[handle2] = handle2
#print " In rel_path_for_two, returning rel_path = ", rel_path
return rel_path
for handle in overlap: # Handle of common ancestor(s)
for phandle in map1[handle] + map2[handle]:
rel_path[phandle] = phandle
@ -147,7 +147,7 @@ class RelationshipPathBetweenBookmarks(Rule):
Map = {}
pathmap = {}
bmarks = {}
#
# Handle having fewer than 2 bookmarks, or unrelated people.
nb = 0
for handle in self.bookmarks:
@ -157,7 +157,7 @@ class RelationshipPathBetweenBookmarks(Rule):
#print "bmarks[", nb, "] = ", handle, self.hnm(handle)
if nb <= 1: return
#print "bmarks = ", bmarks
#
#
# Go through all bookmarked individuals, and mark all
# of the people in each of the paths betweent them.
for i in range(1, nb):
@ -165,12 +165,13 @@ class RelationshipPathBetweenBookmarks(Rule):
for j in range(i+1, nb+1):
handle2 = bmarks[j]
try:
pathmap = self.rel_path_for_two(handle1,handle2)
for handle in pathmap:
self.map[handle] = 1
pathmap = self.rel_path_for_two(handle1,handle2)
for handle in pathmap:
self.map[handle] = 1
except:
pass
def apply(self,db,person):
return self.map.has_key(person.handle)

View File

@ -54,38 +54,38 @@ class MatchesFilterBase(Rule):
category = _('General filters')
def prepare(self,db):
if Filters.SystemFilters:
for filt in Filters.SystemFilters.get_filters(self.namespace):
if filt.get_name() == self.list[0]:
for rule in filt.flist:
rule.prepare(db)
if Filters.CustomFilters:
for filt in Filters.CustomFilters.get_filters(self.namespace):
if filt.get_name() == self.list[0]:
for rule in filt.flist:
rule.prepare(db)
if Filters.SystemFilters:
for filt in Filters.SystemFilters.get_filters(self.namespace):
if filt.get_name() == self.list[0]:
for rule in filt.flist:
rule.prepare(db)
if Filters.CustomFilters:
for filt in Filters.CustomFilters.get_filters(self.namespace):
if filt.get_name() == self.list[0]:
for rule in filt.flist:
rule.prepare(db)
def reset(self):
if Filters.SystemFilters:
for filt in Filters.SystemFilters.get_filters(self.namespace):
if filt.get_name() == self.list[0]:
for rule in filt.flist:
rule.reset()
if Filters.CustomFilters:
for filt in Filters.CustomFilters.get_filters(self.namespace):
if filt.get_name() == self.list[0]:
for rule in filt.flist:
rule.reset()
if Filters.SystemFilters:
for filt in Filters.SystemFilters.get_filters(self.namespace):
if filt.get_name() == self.list[0]:
for rule in filt.flist:
rule.reset()
if Filters.CustomFilters:
for filt in Filters.CustomFilters.get_filters(self.namespace):
if filt.get_name() == self.list[0]:
for rule in filt.flist:
rule.reset()
def apply(self,db,obj):
if Filters.SystemFilters:
for filt in Filters.SystemFilters.get_filters(self.namespace):
if filt.get_name() == self.list[0]:
return filt.check(db,obj.handle)
if Filters.CustomFilters:
for filt in Filters.CustomFilters.get_filters(self.namespace):
if filt.get_name() == self.list[0]:
return filt.check(db,obj.handle)
if Filters.SystemFilters:
for filt in Filters.SystemFilters.get_filters(self.namespace):
if filt.get_name() == self.list[0]:
return filt.check(db,obj.handle)
if Filters.CustomFilters:
for filt in Filters.CustomFilters.get_filters(self.namespace):
if filt.get_name() == self.list[0]:
return filt.check(db,obj.handle)
return False
def find_filter(self):

View File

@ -76,10 +76,10 @@ class EventSidebarFilter(SidebarFilter):
self.filter_regex = gtk.CheckButton(_('Use regular expressions'))
self.generic = gtk.ComboBox()
cell = gtk.CellRendererText()
self.generic.pack_start(cell, True)
self.generic.add_attribute(cell, 'text', 0)
self.generic = gtk.ComboBox()
cell = gtk.CellRendererText()
self.generic.pack_start(cell, True)
self.generic.add_attribute(cell, 'text', 0)
self.on_filters_changed('Event')
self.add_text_entry(_('ID'), self.filter_id)
@ -107,7 +107,7 @@ class EventSidebarFilter(SidebarFilter):
place = unicode(self.filter_place.get_text()).strip()
note = unicode(self.filter_note.get_text()).strip()
regex = self.filter_regex.get_active()
gen = self.generic.get_active() > 0
gen = self.generic.get_active() > 0
etype = self.filter_event.get_type().xml_str()
empty = not (gid or desc or date or place or note
@ -133,12 +133,12 @@ class EventSidebarFilter(SidebarFilter):
rule = HasNoteMatchingSubstringOf([note])
generic_filter.add_rule(rule)
if self.generic.get_active() != 0:
model = self.generic.get_model()
node = self.generic.get_active_iter()
obj = model.get_value(node, 0)
rule = MatchesFilter([obj])
generic_filter.add_rule(rule)
if self.generic.get_active() != 0:
model = self.generic.get_model()
node = self.generic.get_active_iter()
obj = model.get_value(node, 0)
rule = MatchesFilter([obj])
generic_filter.add_rule(rule)
return generic_filter

View File

@ -69,10 +69,10 @@ class MediaSidebarFilter(SidebarFilter):
self.filter_regex = gtk.CheckButton(_('Use regular expressions'))
self.generic = gtk.ComboBox()
cell = gtk.CellRendererText()
self.generic.pack_start(cell, True)
self.generic.add_attribute(cell, 'text', 0)
self.generic = gtk.ComboBox()
cell = gtk.CellRendererText()
self.generic.pack_start(cell, True)
self.generic.add_attribute(cell, 'text', 0)
self.on_filters_changed('MediaObject')
self.add_text_entry(_('ID'), self.filter_id)
@ -101,7 +101,7 @@ class MediaSidebarFilter(SidebarFilter):
date = unicode(self.filter_date.get_text()).strip()
note = unicode(self.filter_note.get_text()).strip()
regex = self.filter_regex.get_active()
gen = self.generic.get_active() > 0
gen = self.generic.get_active() > 0
empty = not (gid or title or mime or path or date
or note or regex or gen)
@ -126,12 +126,12 @@ class MediaSidebarFilter(SidebarFilter):
rule = HasNoteMatchingSubstringOf([note])
generic_filter.add_rule(rule)
if self.generic.get_active() != 0:
model = self.generic.get_model()
node = self.generic.get_active_iter()
obj = model.get_value(node, 0)
rule = MatchesFilter([obj])
generic_filter.add_rule(rule)
if self.generic.get_active() != 0:
model = self.generic.get_model()
node = self.generic.get_active_iter()
obj = model.get_value(node, 0)
rule = MatchesFilter([obj])
generic_filter.add_rule(rule)
return generic_filter

View File

@ -72,10 +72,10 @@ class NoteSidebarFilter(SidebarFilter):
self.filter_regex = gtk.CheckButton(_('Use regular expressions'))
self.generic = gtk.ComboBox()
cell = gtk.CellRendererText()
self.generic.pack_start(cell, True)
self.generic.add_attribute(cell, 'text', 0)
self.generic = gtk.ComboBox()
cell = gtk.CellRendererText()
self.generic.pack_start(cell, True)
self.generic.add_attribute(cell, 'text', 0)
self.on_filters_changed('Note')
self.add_text_entry(_('ID'), self.filter_id)

View File

@ -76,10 +76,10 @@ class RepoSidebarFilter(SidebarFilter):
self.filter_regex = gtk.CheckButton(_('Use regular expressions'))
self.generic = gtk.ComboBox()
cell = gtk.CellRendererText()
self.generic.pack_start(cell, True)
self.generic.add_attribute(cell, 'text', 0)
self.generic = gtk.ComboBox()
cell = gtk.CellRendererText()
self.generic.pack_start(cell, True)
self.generic.add_attribute(cell, 'text', 0)
self.on_filters_changed('Repository')
self.add_text_entry(_('ID'), self.filter_id)
@ -108,7 +108,7 @@ class RepoSidebarFilter(SidebarFilter):
rtype = self.repo.get_type().xml_str()
note = unicode(self.filter_note.get_text()).strip()
regex = self.filter_regex.get_active()
gen = self.generic.get_active() > 0
gen = self.generic.get_active() > 0
empty = not (gid or title or address or url or rtype
or note or regex or gen)
@ -133,12 +133,12 @@ class RepoSidebarFilter(SidebarFilter):
rule = HasNoteMatchingSubstringOf([note])
generic_filter.add_rule(rule)
if self.generic.get_active() != 0:
model = self.generic.get_model()
node = self.generic.get_active_iter()
obj = model.get_value(node, 0)
rule = MatchesFilter([obj])
generic_filter.add_rule(rule)
if self.generic.get_active() != 0:
model = self.generic.get_model()
node = self.generic.get_active_iter()
obj = model.get_value(node, 0)
rule = MatchesFilter([obj])
generic_filter.add_rule(rule)
return generic_filter

View File

@ -67,10 +67,10 @@ class SourceSidebarFilter(SidebarFilter):
self.filter_regex = gtk.CheckButton(_('Use regular expressions'))
self.generic = gtk.ComboBox()
cell = gtk.CellRendererText()
self.generic.pack_start(cell, True)
self.generic.add_attribute(cell, 'text', 0)
self.generic = gtk.ComboBox()
cell = gtk.CellRendererText()
self.generic.pack_start(cell, True)
self.generic.add_attribute(cell, 'text', 0)
self.on_filters_changed('Source')
self.add_text_entry(_('ID'), self.filter_id)
@ -96,7 +96,7 @@ class SourceSidebarFilter(SidebarFilter):
pub = unicode(self.filter_pub.get_text()).strip()
note = unicode(self.filter_note.get_text()).strip()
regex = self.filter_regex.get_active()
gen = self.generic.get_active() > 0
gen = self.generic.get_active() > 0
empty = not (gid or title or author or pub or note or regex or gen)
if empty:
@ -120,12 +120,12 @@ class SourceSidebarFilter(SidebarFilter):
rule = HasNoteMatchingSubstringOf([note])
generic_filter.add_rule(rule)
if self.generic.get_active() != 0:
model = self.generic.get_model()
node = self.generic.get_active_iter()
obj = model.get_value(node, 0)
rule = MatchesFilter([obj])
generic_filter.add_rule(rule)
if self.generic.get_active() != 0:
model = self.generic.get_model()
node = self.generic.get_active_iter()
obj = model.get_value(node, 0)
rule = MatchesFilter([obj])
generic_filter.add_rule(rule)
return generic_filter

View File

@ -64,17 +64,17 @@ class FilterList:
self.filter_namespaces[namespace].append(filt)
def load(self):
try:
if os.path.isfile(self.file):
parser = make_parser()
parser.setContentHandler(FilterParser(self))
the_file = open(self.file)
parser.parse(the_file)
the_file.close()
except (IOError,OSError):
pass
except SAXParseException:
print "Parser error"
try:
if os.path.isfile(self.file):
parser = make_parser()
parser.setContentHandler(FilterParser(self))
the_file = open(self.file)
parser.parse(the_file)
the_file.close()
except (IOError,OSError):
pass
except SAXParseException:
print "Parser error"
def fix(self,line):
l = line.strip()

View File

@ -71,5 +71,5 @@ def build_filter_model(space, local = [], default=""):
CustomFilters.get_filters(space)
for filt in flist:
model.append(row=[filt.get_name(), filt])
model.append(row=[filt.get_name(), filt])
return model

View File

@ -91,7 +91,7 @@ class PlaceParser:
def __init__(self, line=None):
self.parse_function = []
if line:
self.parse_form(line)

View File

@ -24,11 +24,11 @@ class GtkHandler(logging.Handler):
"""
self._record = record
self._record = record
ErrorView(error_detail=self,rotate_handler=self._rotate_handler)
def get_formatted_log(self):
return self.format(self._record)
return self.format(self._record)
def get_record(self):
return self._record
return self._record

View File

@ -2081,9 +2081,9 @@ class MaskedEntry(gtk.Entry):
else:
# Keep the static char where it is.
if direction == DIRECTION_LEFT:
new_text = new_text + text[i]
new_text = new_text + text[i]
else:
new_text = text[i] + new_text
new_text = text[i] + new_text
i += direction
return new_text

View File

@ -31,21 +31,21 @@ class ListCursor(object):
records. It should probably also have DB_DUPSORT if you want to
have sorted records.
"""
self._cursor = cursor
self._cursor = cursor
self._object_cache = {}
self.top()
def top(self):
self._cursor.first()
self._index = 0
self._cursor.first()
self._index = 0
def next(self):
"""
Move to the next record.
"""
data = self._cursor.next()
data = self._cursor.next()
# If there was a next record that data will
# not be None
@ -54,13 +54,13 @@ class ListCursor(object):
# they point to the current record.
self._index+= 1
return data
return data
def prev(self):
"""
Move to the previous record.
"""
data = self._cursor.prev()
data = self._cursor.prev()
# If there was a next record that data will
# not be None
@ -69,7 +69,7 @@ class ListCursor(object):
# they point to the current record.
self._index -= 1
return data
return data
def has_children(self,path):
@ -149,7 +149,7 @@ class ListCursor(object):
ret = self._unpickle(ret)
self._object_cache[index] = ret
return ret
return ret
def _unpickle(self,rec):
"""
@ -174,3 +174,4 @@ class ListCursor(object):
return self.lookup(path[0])

View File

@ -16,13 +16,13 @@ class PathCursor(object):
For example, with the following table indexed on Surname::
Record Value Index
============ =====
Record Value Index
============ =====
Blogs, Jo [0,0]
Blogs, Jane [0,1]
Smith, Wilman [1,0]
Smith, John [1,1]
Blogs, Jo [0,0]
Blogs, Jane [0,1]
Smith, Wilman [1,0]
Smith, John [1,1]
@ivar _index: The current index pointed to by the cursor.
@ -43,21 +43,21 @@ class PathCursor(object):
records. It should probably also have DB_DUPSORT if you want to
have sorted records.
"""
self._cursor = cursor
self._cursor = cursor
self._object_cache = {}
self.top()
def top(self):
self._cursor.first()
self._index = [0,0]
self._cursor.first()
self._index = [0,0]
def next_nodup(self):
"""
Move to the next non-duplcate record.
"""
data = self._cursor.next_nodup()
data = self._cursor.next_nodup()
# If there was a next record that data will
# not be None
@ -67,13 +67,13 @@ class PathCursor(object):
self._index[0] += 1
self._index[1] = 0
return data
return data
def prev_nodup(self):
"""
Move to the previous non-duplicate record.
"""
data = self._cursor.prev_nodup()
data = self._cursor.prev_nodup()
# If there was a next record that data will
# not be None
@ -83,13 +83,13 @@ class PathCursor(object):
self._index[0] -= 1
self._index[1] = 0
return data
return data
def next_dup(self):
"""
Move to the next record with a duplicate key to the current record.
"""
data = self._cursor.next_dup()
data = self._cursor.next_dup()
# If there was a next record that data will
# not be None
@ -97,7 +97,7 @@ class PathCursor(object):
# Update the secondary index.
self._index[1] += 1
return data
return data
def has_children(self,path):
"""
@ -228,7 +228,7 @@ class PathCursor(object):
ret = self._unpickle(ret)
self._object_cache[index] = {'primary':ret}
return ret
return ret
def _unpickle(self,rec):
"""
@ -322,3 +322,4 @@ class PathCursor(object):
return ret

View File

@ -36,34 +36,34 @@ class FamilyFilterFrame(FilterFrameBase):
__default_border_width = 5
def __init__(self,filter_spec=None,label="Filter"):
FilterFrameBase.__init__(self,filter_spec,label)
FilterFrameBase.__init__(self,filter_spec,label)
# Gramps ID
self._id_check,self._id_label,self._id_edit = \
self._id_check,self._id_label,self._id_edit = \
self.make_text_widget("Gramps ID")
# Name
self._name_check,self._name_label,self._name_edit = \
self._name_check,self._name_label,self._name_edit = \
self.make_text_widget("Name")
# Mar
self._mar_check, self._m_edit, \
self._mar_check, self._m_edit, \
self._m_before, self._m_after, \
self._m_unknown = self.make_year_widget("Marriage Year")
# Filter
default_filters = []
# don't currently support filters that need an attribute.
filters = [ filter for filter in default_filters if \
# don't currently support filters that need an attribute.
filters = [ filter for filter in default_filters if \
not hasattr(filter,'labels') or len(filter.labels) == 0 ]
self._filter_list = gtk.ListStore(str,object)
for filter in filters:
self._filter_list.append([filter.name,filter])
self._filter_list.append([filter.name,filter])
self._filter_check,self._filter_label,self._filter_combo = \
self._filter_check,self._filter_label,self._filter_combo = \
self.make_combo_widget("Filter",self._filter_list)
self._reset_widgets()

View File

@ -41,11 +41,9 @@ class FamilyPreviewFrame(PreviewFrameBase):
__default_border_width = 5
def __init__(self,dbstate,label="Preview"):
PreviewFrameBase.__init__(self,label)
PreviewFrameBase.__init__(self,label)
self._dbstate = dbstate
align = gtk.Alignment()
align = gtk.Alignment()
# Image
self._image_l = gtk.Image()
@ -69,20 +67,18 @@ class FamilyPreviewFrame(PreviewFrameBase):
box = gtk.VBox()
box.pack_start(image_box,False,False)
box.pack_start(label)
# align
align.add(box)
align.add(box)
align.set_padding(self.__class__.__default_border_width,
self.__class__.__default_border_width,
self.__class__.__default_border_width,
self.__class__.__default_border_width)
align.set(0.5,0.5,
1.0,1.0)
self.add(align)
self.add(align)
self.clear_object()

View File

@ -38,7 +38,7 @@ class FamilyTreeFrame(TreeFrameBase):
def __init__(self,dbstate):
TreeFrameBase.__init__(self)
TreeFrameBase.__init__(self)
self._selection = None
self._model = None

View File

@ -26,7 +26,7 @@ import gobject
from GrampsWidgets import IntEdit
class FilterFrameBase(gtk.Frame):
__gproperties__ = {}
__gsignals__ = {
@ -235,3 +235,4 @@ class FilterFrameBase(gtk.Frame):
if gtk.pygtk_version < (2,8,0):
gobject.type_register(FilterFrameBase)

View File

@ -90,7 +90,7 @@ class ObjectSelectorWindow(gtk.Window,ManagedWindow):
ManagedWindow.__init__(self,uistate,track,self)
# Init the Window
gtk.Window.__init__(self)
gtk.Window.__init__(self)
self._dbstate = dbstate
self._uistate = dbstate
@ -157,25 +157,25 @@ class ObjectSelectorWindow(gtk.Window,ManagedWindow):
try:
person_pixbuf = gtk.gdk.pixbuf_new_from_file(os.path.join(const.IMAGE_DIR,"person.svg"))
flist_pixbuf = gtk.gdk.pixbuf_new_from_file(os.path.join(const.IMAGE_DIR,"flist.svg"))
person_pixbuf = gtk.gdk.pixbuf_new_from_file(os.path.join(const.IMAGE_DIR,"person.svg"))
flist_pixbuf = gtk.gdk.pixbuf_new_from_file(os.path.join(const.IMAGE_DIR,"flist.svg"))
self._tool_list = gtk.ListStore(gtk.gdk.Pixbuf, str,int)
d={ObjectTypes.PERSON: [person_pixbuf,'People',ObjectTypes.PERSON],
ObjectTypes.FAMILY: [flist_pixbuf,'Families',ObjectTypes.FAMILY],
ObjectTypes.EVENT: [person_pixbuf,'Events',ObjectTypes.EVENT]}
self._object_type_column = 2
self._tool_list = gtk.ListStore(gtk.gdk.Pixbuf, str,int)
except gobject.GError:
self._tool_list = gtk.ListStore(str,int)
d={ObjectTypes.PERSON: [person_pixbuf,'People',ObjectTypes.PERSON],
ObjectTypes.FAMILY: [flist_pixbuf,'Families',ObjectTypes.FAMILY],
ObjectTypes.EVENT: [person_pixbuf,'Events',ObjectTypes.EVENT]}
self._object_type_column = 2
except gobject.GError:
self._tool_list = gtk.ListStore(str,int)
d={ObjectTypes.PERSON: ['People',ObjectTypes.PERSON],
d={ObjectTypes.PERSON: ['People',ObjectTypes.PERSON],
ObjectTypes.FAMILY: ['Families',ObjectTypes.FAMILY],
ObjectTypes.EVENT: ['Events',ObjectTypes.EVENT]}
self._object_type_column = 1
self._object_type_column = 1
for object_type in self._object_list:
@ -288,7 +288,7 @@ class ObjectSelectorWindow(gtk.Window,ManagedWindow):
align.add(box)
align.show()
self.add(align)
self.add(align)
self._set_object_type(default_object_type)
self.set_default_size(700,300)
@ -313,9 +313,9 @@ class ObjectSelectorWindow(gtk.Window,ManagedWindow):
store = self._tool_list
it = store.get_iter_first()
while it:
if store.get(it, self._object_type_column)[0] == selected_object_type:
break
it = store.iter_next(it)
if store.get(it, self._object_type_column)[0] == selected_object_type:
break
it = store.iter_next(it)
if it != None:
self._tool_combo.set_active_iter(it)
@ -345,3 +345,4 @@ class ObjectSelectorWindow(gtk.Window,ManagedWindow):
if gtk.pygtk_version < (2,8,0):
gobject.type_register(ObjectSelectorWindow)

View File

@ -43,17 +43,17 @@ class PersonFilterFrame(FilterFrameBase):
__default_border_width = 5
def __init__(self,filter_spec=None,label="Filter"):
FilterFrameBase.__init__(self,filter_spec,label)
FilterFrameBase.__init__(self,filter_spec,label)
# Build the filter widgets, the make_* methods are
# in the FilterFrameBase base class.
# Build the filter widgets, the make_* methods are
# in the FilterFrameBase base class.
# Gramps ID
self._id_check,self._id_label,self._id_edit = \
self._id_check,self._id_label,self._id_edit = \
self.make_text_widget("Gramps ID")
# Name
self._name_check,self._name_label,self._name_edit = \
self._name_check,self._name_label,self._name_edit = \
self.make_text_widget("Name")
# Gender
@ -61,21 +61,21 @@ class PersonFilterFrame(FilterFrameBase):
[_("Female"),gen.lib.Person.FEMALE],
[_("Unknown"),gen.lib.Person.UNKNOWN]]
self._gender_list = gtk.ListStore(str,int)
self._gender_list = gtk.ListStore(str,int)
for entry in genders:
self._gender_list.append(entry)
for entry in genders:
self._gender_list.append(entry)
self._gender_check,self._gender_label, self._gender_combo = \
self._gender_check,self._gender_label, self._gender_combo = \
self.make_combo_widget("Gender",self._gender_list)
# Birth
self._birth_check, self._b_edit, \
self._birth_check, self._b_edit, \
self._b_before, self._b_after, \
self._b_unknown = self.make_year_widget("Birth Year")
# Death
self._death_check, self._d_edit, \
self._death_check, self._d_edit, \
self._d_before, self._d_after, \
self._d_unknown = self.make_year_widget("Death Year")
@ -106,16 +106,16 @@ class PersonFilterFrame(FilterFrameBase):
Rules.Person.IsFemale,
]
# don't currently support filters that need an attribute.
filters = [ filter for filter in default_filters if \
# don't currently support filters that need an attribute.
filters = [ filter for filter in default_filters if \
not hasattr(filter,'labels') or len(filter.labels) == 0 ]
self._filter_list = gtk.ListStore(str,object)
for filter in filters:
self._filter_list.append([filter.name,filter])
self._filter_list.append([filter.name,filter])
self._filter_check,self._filter_label,self._filter_combo = \
self._filter_check,self._filter_label,self._filter_combo = \
self.make_combo_widget("Filter",self._filter_list)
self._reset_widgets()
@ -223,7 +223,7 @@ class PersonFilterFrame(FilterFrameBase):
if self._filter_check.get_active():
filter.add_rule(self._filter_list.get_value(self._filter_combo.get_active_iter(),1)([]))
self.emit('apply-filter',filter)
self.emit('apply-filter',filter)
if gtk.pygtk_version < (2,8,0):
gobject.type_register(PersonFilterFrame)

View File

@ -53,11 +53,9 @@ class PersonPreviewFrame(PreviewFrameBase):
__default_border_width = 5
def __init__(self,dbstate,label="Preview"):
PreviewFrameBase.__init__(self,label)
PreviewFrameBase.__init__(self,label)
self._dbstate = dbstate
align = gtk.Alignment()
align = gtk.Alignment()
# Image
self._image = gtk.Image()
@ -77,10 +75,8 @@ class PersonPreviewFrame(PreviewFrameBase):
box.pack_start(self._image,False,False)
box.pack_start(label)
# align
align.add(box)
align.add(box)
align.set_padding(self.__class__.__default_border_width,
self.__class__.__default_border_width,
self.__class__.__default_border_width,
@ -88,9 +84,7 @@ class PersonPreviewFrame(PreviewFrameBase):
align.set(0.5,0.5,
1.0,1.0)
self.add(align)
self.add(align)
self._label = label
def _get_text_preview(self,person):

View File

@ -54,7 +54,7 @@ class PersonTreeFrame(TreeFrameBase):
def __init__(self,dbstate):
TreeFrameBase.__init__(self)
TreeFrameBase.__init__(self)
self._dbstate = dbstate
self._selection = None

View File

@ -164,7 +164,7 @@ class UndoHistory(ManagedWindow.ManagedWindow):
self._move(nsteps)
elif response_id == gtk.RESPONSE_APPLY:
self._clear_clicked()
elif response_id == gtk.RESPONSE_DELETE_EVENT:
elif response_id == gtk.RESPONSE_DELETE_EVENT:
self.close(obj)
def build_menu_names(self,obj):

View File

@ -270,7 +270,7 @@ class HtmlDoc(BaseDoc.BaseDoc,BaseDoc.TextDoc):
if style.get_bottom_border():
bottom = 'thin solid #000000'
if style.get_left_border():
left = 'thin solid #000000'
left = 'thin solid #000000'
if style.get_right_border():
right = 'thin solid #000000'
text.append('.%s {\n'
@ -298,7 +298,7 @@ class HtmlDoc(BaseDoc.BaseDoc,BaseDoc.TextDoc):
if style.get_bottom_border():
bottom = 'thin solid #000000'
if style.get_left_border():
left = 'thin solid #000000'
left = 'thin solid #000000'
if style.get_right_border():
right = 'thin solid #000000'
@ -470,7 +470,7 @@ class HtmlDoc(BaseDoc.BaseDoc,BaseDoc.TextDoc):
text = text.replace('&lt;/super&gt;','</sup>')
if text != "":
self.empty = 0
self.f.write(text)
self.f.write(text)
#------------------------------------------------------------------------
#

View File

@ -452,7 +452,7 @@ class LaTeXDoc(BaseDoc.BaseDoc,BaseDoc.TextDoc):
if self.bborder == 1:
self.doline = 1
elif self.curcol == 1:
self.skipfirst = 1
self.skipfirst = 1
if self.tborder != 0:
self.f.write('\\hline\n')

View File

@ -244,21 +244,21 @@ class ODFDoc(BaseDoc.BaseDoc, BaseDoc.TextDoc, BaseDoc.DrawDoc):
self.cntnt.write('<style:paragraph-properties ')
if style.get_padding() != 0.0:
self.cntnt.write('fo:padding="%.2fcm" ' % style.get_padding())
self.cntnt.write('fo:padding="%.2fcm" ' % style.get_padding())
if style.get_header_level() > 0:
self.cntnt.write('fo:keep-with-next="true" ')
align = style.get_alignment()
if align == BaseDoc.PARA_ALIGN_LEFT:
self.cntnt.write('fo:text-align="start" ')
self.cntnt.write('fo:text-align="start" ')
elif align == BaseDoc.PARA_ALIGN_RIGHT:
self.cntnt.write('fo:text-align="end" ')
self.cntnt.write('fo:text-align="end" ')
elif align == BaseDoc.PARA_ALIGN_CENTER:
self.cntnt.write('fo:text-align="center" ')
self.cntnt.write('style:justify-single-word="false" ')
self.cntnt.write('fo:text-align="center" ')
self.cntnt.write('style:justify-single-word="false" ')
else:
self.cntnt.write('fo:text-align="justify" ')
self.cntnt.write('style:justify-single-word="false" ')
self.cntnt.write('fo:text-align="justify" ')
self.cntnt.write('style:justify-single-word="false" ')
font = style.get_font()
if font.get_type_face() == BaseDoc.FONT_SANS_SERIF:
self.cntnt.write('style:font-name="Arial" ')
@ -288,12 +288,12 @@ class ODFDoc(BaseDoc.BaseDoc, BaseDoc.TextDoc, BaseDoc.DrawDoc):
self.cntnt.write('<style:text-properties ')
align = style.get_alignment()
if align == BaseDoc.PARA_ALIGN_LEFT:
self.cntnt.write('fo:text-align="start" ')
self.cntnt.write('fo:text-align="start" ')
elif align == BaseDoc.PARA_ALIGN_RIGHT:
self.cntnt.write('fo:text-align="end" ')
self.cntnt.write('fo:text-align="end" ')
elif align == BaseDoc.PARA_ALIGN_CENTER:
self.cntnt.write('fo:text-align="center" ')
self.cntnt.write('style:justify-single-word="false" ')
self.cntnt.write('fo:text-align="center" ')
self.cntnt.write('style:justify-single-word="false" ')
font = style.get_font()
if font.get_type_face() == BaseDoc.FONT_SANS_SERIF:
self.cntnt.write('style:font-name="Arial" ')
@ -680,22 +680,22 @@ class ODFDoc(BaseDoc.BaseDoc, BaseDoc.TextDoc, BaseDoc.DrawDoc):
self.sfile.write('fo:margin-bottom="0.212cm"\n')
if style.get_padding() != 0.0:
self.sfile.write('fo:padding="%.2fcm" ' % style.get_padding())
self.sfile.write('fo:padding="%.2fcm" ' % style.get_padding())
if style.get_header_level() > 0:
self.sfile.write('fo:keep-with-next="always" ')
align = style.get_alignment()
if align == BaseDoc.PARA_ALIGN_LEFT:
self.sfile.write('fo:text-align="start" ')
self.sfile.write('style:justify-single-word="false" ')
self.sfile.write('fo:text-align="start" ')
self.sfile.write('style:justify-single-word="false" ')
elif align == BaseDoc.PARA_ALIGN_RIGHT:
self.sfile.write('fo:text-align="end" ')
self.sfile.write('fo:text-align="end" ')
elif align == BaseDoc.PARA_ALIGN_CENTER:
self.sfile.write('fo:text-align="center" ')
self.sfile.write('style:justify-single-word="false" ')
self.sfile.write('fo:text-align="center" ')
self.sfile.write('style:justify-single-word="false" ')
else:
self.sfile.write('fo:text-align="justify" ')
self.sfile.write('style:justify-single-word="false" ')
self.sfile.write('fo:text-align="justify" ')
self.sfile.write('style:justify-single-word="false" ')
self.sfile.write('fo:text-indent="%.2fcm" ' % style.get_first_indent())
self.sfile.write('style:auto-text-indent="false"/> ')
self.sfile.write('<style:text-properties ')

View File

@ -113,11 +113,11 @@ class ODSDoc(SpreadSheetDoc):
self.f.write('</office:font-face-decls>\n')
self.f.write('<office:automatic-styles>\n')
for key in self.table_styles.keys():
table = self.table_styles[key]
self.f.write('<style:style style:name="')
self.f.write(key)
self.f.write('" style:family="table" ')
for key in self.table_styles.keys():
table = self.table_styles[key]
self.f.write('<style:style style:name="')
self.f.write(key)
self.f.write('" style:family="table" ')
self.f.write('style:master-page-name="Default"> \n')
self.f.write('<style:table-properties table:display="true" ')
self.f.write('style:writing-mode="lr-tb" /> \n')
@ -151,20 +151,20 @@ class ODSDoc(SpreadSheetDoc):
self.f.write('style:text-outline="false" ')
self.f.write('style:text-crossing-out="none" ')
if font.get_type_face() == BaseDoc.FONT_SERIF:
self.f.write('style:font-name="Times New Roman" ')
self.f.write('style:font-name="Times New Roman" ')
else:
self.f.write('style:font-name="Arial" ')
self.f.write('style:font-name="Arial" ')
self.f.write('fo:font-size="%dpt" ' % font.get_size())
if font.get_italic():
self.f.write('fo:font-style="italic" ')
else:
self.f.write('fo:font-style="normal" ')
self.f.write('fo:text-shadow="none" ')
self.f.write('style:text-underline="none" ')
self.f.write('fo:text-shadow="none" ')
self.f.write('style:text-underline="none" ')
if font.get_bold():
self.f.write('fo:font-weight="bold"/>\n')
self.f.write('fo:font-weight="bold"/>\n')
else:
self.f.write('fo:font-weight="normal"/>\n')
self.f.write('fo:font-weight="normal"/>\n')
self.f.write('</style:style>\n')
self.f.write('</office:automatic-styles>\n')
self.f.write('<office:body>\n')
@ -190,19 +190,19 @@ class ODSDoc(SpreadSheetDoc):
self.f.write('</table:table-row>\n')
def start_cell(self,style_name,span=1):
self.content = 0
self.span = span
self.f.write('<table:table-cell table:style-name="')
self.content = 0
self.span = span
self.f.write('<table:table-cell table:style-name="')
self.f.write(style_name)
self.f.write('" table:value-type="string"')
if span > 1:
self.f.write(' table:number-columns-spanned="' + str(span) + '">\n')
else:
else:
self.f.write('>\n')
def end_cell(self):
if self.content == 0:
self.f.write('<text:p/>\n')
self.f.write('<text:p/>\n')
else:
self.f.write('</text:p>\n')
self.f.write('</table:table-cell>\n')
@ -389,22 +389,22 @@ class ODSDoc(SpreadSheetDoc):
self.f.close()
def start_page(self,name,style_name):
table = self.table_styles[style_name]
table = self.table_styles[style_name]
self.f.write('<table:table table:name="')
self.f.write(name)
self.f.write('" table:style-name="')
self.f.write(style_name)
self.f.write('">\n')
for col in range(0,table.get_columns()):
self.f.write('<table:table-column table:style-name="')
self.f.write(style_name + '_' + str(col) +'"/>\n')
self.f.write(name)
self.f.write('" table:style-name="')
self.f.write(style_name)
self.f.write('">\n')
for col in range(0,table.get_columns()):
self.f.write('<table:table-column table:style-name="')
self.f.write(style_name + '_' + str(col) +'"/>\n')
def end_page(self):
self.f.write('</table:table>\n')
def write_text(self,text,mark=None):
if text == "":
return
return
if self.content == 0:
self.f.write('<text:p>')
self.content = 1
@ -413,7 +413,7 @@ class ODSDoc(SpreadSheetDoc):
text = text.replace('>','&gt;')
text = text.replace('\t','<text:tab-stop/>')
text = text.replace('\n','<text:line-break/>')
self.f.write(unicode(text))
self.f.write(unicode(text))
def _write_manifest(self):
self.manifest_xml = tempfile.mktemp()

View File

@ -145,7 +145,7 @@ class ODSTab(TabbedDoc):
self.f.write('</table:table-row>\n')
def write_cell(self, text):
self.f.write('<table:table-cell office:value-type="string">')
self.f.write('<table:table-cell office:value-type="string">')
self.f.write('>\n')
self.f.write('<text:p>')
@ -154,7 +154,7 @@ class ODSTab(TabbedDoc):
text = text.replace('>','&gt;')
text = text.replace('\t','<text:tab-stop/>')
text = text.replace('\n','<text:line-break/>')
self.f.write(unicode(text))
self.f.write(unicode(text))
self.f.write('</text:p>\n')
self.f.write('</table:table-cell>\n')
@ -342,8 +342,8 @@ class ODSTab(TabbedDoc):
def start_page(self):
self.f.write('<table:table table:name="ta1">')
for col in range(0,self.columns):
self.f.write('<table:table-column table:style-name="co1"/>\n')
for col in range(0,self.columns):
self.f.write('<table:table-column table:style-name="co1"/>\n')
def end_page(self):
self.f.write('</table:table>\n')

View File

@ -155,7 +155,7 @@ class PSDrawDoc(BaseDoc.BaseDoc,BaseDoc.DrawDoc):
self.f.close()
if self.print_req:
if print_label == _("Print a copy"):
run_print_dialog (self.filename)
run_print_dialog (self.filename)
elif print_label:
app = Mime.get_application(_apptype)
Utils.launch(app[0],self.filename)

View File

@ -42,7 +42,7 @@ class SpreadSheetDoc:
self.font = BaseDoc.FontStyle()
self.actfont = self.font
self.style_list = {}
self.table_styles = {}
self.table_styles = {}
self.cell_styles = {}
self.name = ""

View File

@ -26,31 +26,31 @@ class LongOpStatus(GrampsDBCallback):
}
def long(self):
status = LongOpStatus("doing long job", 100, 10)
status = LongOpStatus("doing long job", 100, 10)
for i in xrange(0,99):
time.sleep(0.1)
status.heartbeat()
time.sleep(0.1)
status.heartbeat()
status.end()
class MyListener(object):
def __init__(self):
self._op = MyClass()
self._op.connect('op-start', self.start)
self._current_op = None
self._op = MyClass()
self._op.connect('op-start', self.start)
self._current_op = None
def start(self,long_op):
self._current_op.connect('op-heartbeat', self.heartbeat)
self._current_op.connect('op-end', self.stop)
self._current_op.connect('op-heartbeat', self.heartbeat)
self._current_op.connect('op-end', self.stop)
def hearbeat(self):
# update status display
# update status display
def stop(self):
# close the status display
# close the status display
self._current_op = None
"""
@ -121,7 +121,7 @@ class LongOpStatus(GrampsDBCallback):
@return: estimated seconds to complete.
@rtype: int
"""
"""
return self._secs_left
def cancel(self):
@ -138,7 +138,7 @@ class LongOpStatus(GrampsDBCallback):
def should_cancel(self):
"""Returns true of the user has asked for the operation to be cancelled.
@return: True of the operation should be cancelled.
@rtype: bool
"""

View File

@ -376,7 +376,7 @@ class DescendChart(Report):
self.doc.draw_line('DC2-line', xlast, ystop, xnext, ystop)
if x%2:
phys_x +=1
phys_x +=1
phys_y += 1
if not self.force_fit:

View File

@ -473,7 +473,7 @@ class FamilyGroup(Report):
spouse_id = family.get_mother_handle()
else:
spouse_id = family.get_father_handle()
if spouse_id:
self.doc.start_row()
if m or index != families:
@ -528,7 +528,7 @@ class FamilyGroup(Report):
mark = BaseDoc.IndexMark(title,BaseDoc.INDEX_TYPE_TOC,1)
self.doc.write_text( title, mark )
self.doc.end_paragraph()
family = self.database.get_family_from_handle(family_handle)
self.dump_parent(_("Husband"),family.get_father_handle())

View File

@ -179,11 +179,11 @@ class Merge(Tool.Tool,ManagedWindow.ManagedWindow):
_("No matches found"),
_("No potential duplicate people were found"))
else:
try:
ShowMatches(self.dbstate,self.uistate,self.track,
self.list,self.map,self.update)
except Errors.WindowActiveError:
pass
try:
ShowMatches(self.dbstate,self.uistate,self.track,
self.list,self.map,self.update)
except Errors.WindowActiveError:
pass
def find_potentials(self,thresh):
self.progress = Utils.ProgressMeter(_('Find duplicates'),
@ -336,12 +336,12 @@ class Merge(Tool.Tool,ManagedWindow.ManagedWindow):
f2 = self.db.get_family_from_handle(f2_id)
dad1_id = f1.get_father_handle()
if dad1_id:
dad1 = get_name_obj(self.db.get_person_from_handle(dad1_id))
dad1 = get_name_obj(self.db.get_person_from_handle(dad1_id))
else:
dad1 = None
dad2_id = f2.get_father_handle()
if dad2_id:
dad2 = get_name_obj(self.db.get_person_from_handle(dad2_id))
dad2 = get_name_obj(self.db.get_person_from_handle(dad2_id))
else:
dad2 = None
@ -354,12 +354,12 @@ class Merge(Tool.Tool,ManagedWindow.ManagedWindow):
mom1_id = f1.get_mother_handle()
if mom1_id:
mom1 = get_name_obj(self.db.get_person_from_handle(mom1_id))
mom1 = get_name_obj(self.db.get_person_from_handle(mom1_id))
else:
mom1 = None
mom2_id = f2.get_mother_handle()
if mom2_id:
mom2 = get_name_obj(self.db.get_person_from_handle(mom2_id))
mom2 = get_name_obj(self.db.get_person_from_handle(mom2_id))
else:
mom2 = None

View File

@ -275,9 +275,9 @@ class RelGraphReport(Report):
color = self.colors['unknown']
elif self.colorize == 'filled':
if style != "":
style += ",filled"
style += ",filled"
else:
style = "filled"
style = "filled"
if gender == person.MALE:
fill = self.colors['male']
elif gender == person.FEMALE:
@ -512,3 +512,4 @@ register_report(
author_email ="brian@gramps-project.org"
)

View File

@ -462,8 +462,8 @@ class MarkerOptions(ReportOptions):
nextint = self.max_non_custom+1
custommarkers = dialog.db.get_marker_types()
for item in custommarkers:
int_to_string_map[nextint] = item
nextint += 1
int_to_string_map[nextint] = item
nextint += 1
marker_index = 0
for int, str in int_to_string_map.items() :

View File

@ -232,9 +232,9 @@ class BasePage:
return of
def link_path(self,name,path):
path = "%s/%s/%s" % (path,name[0].lower(),name[1].lower())
path = self.build_name(path,name)
return path
path = "%s/%s/%s" % (path,name[0].lower(),name[1].lower())
path = self.build_name(path,name)
return path
def create_link_file(self,name,path):
self.cur_name = self.link_path(name,path)
@ -1708,8 +1708,8 @@ class IndividualPage(BasePage):
family = self.db.get_family_from_handle(handle)
media_list += family.get_media_list()
for evt_ref in family.get_event_ref_list():
event = self.db.get_event_from_handle(evt_ref.ref)
media_list += event.get_media_list()
event = self.db.get_event_from_handle(evt_ref.ref)
media_list += event.get_media_list()
for evt_ref in self.person.get_primary_event_ref_list():
event = self.db.get_event_from_handle(evt_ref.ref)
if event:

View File

@ -267,7 +267,7 @@ class PHPGedViewConnector:
result.append(line.strip())
line = f.readline()
if len(result) > 0:
return result
return result
return None

View File

@ -211,7 +211,7 @@ class Extract:
if place_handle:
place = self.db.get_place_from_handle(place_handle).get_title()
if place:
places.append(place)
places.append(place)
else:
places.append(_("Place missing"))
return places
@ -503,15 +503,15 @@ class StatisticsChart(Report):
'year_from': year_from,
'year_to': year_to
}
self.progress = ProgressMeter(_('Statistics Charts'))
self.progress = ProgressMeter(_('Statistics Charts'))
# extract requested items from the database and count them
self.progress.set_pass(_('Collecting data...'), 1)
self.progress.set_pass(_('Collecting data...'), 1)
tables = _Extract.collect_data(database, filterfun, options,
gender, year_from, year_to, options['no_years'])
self.progress.step()
self.progress.step()
self.progress.set_pass(_('Sorting data...'), len(tables))
self.progress.set_pass(_('Sorting data...'), len(tables))
self.data = []
sortby = options['sortby']
reverse = options['reverse']
@ -525,8 +525,8 @@ class StatisticsChart(Report):
else:
heading = _("Persons born %(year_from)04d-%(year_to)04d: %(chart_title)s") % mapping
self.data.append((heading, table[0], table[1], lookup))
self.progress.step()
#DEBUG
self.progress.step()
#DEBUG
#print heading
#print table[1]
@ -558,7 +558,7 @@ class StatisticsChart(Report):
def write_report(self):
"output the selected statistics..."
self.progress.set_pass(_('Saving charts...'), len(self.data))
self.progress.set_pass(_('Saving charts...'), len(self.data))
for data in self.data:
self.doc.start_page()
if len(data[2]) < self.bar_items:
@ -566,8 +566,8 @@ class StatisticsChart(Report):
else:
self.output_barchart(data[0], data[1], data[2], data[3])
self.doc.end_page()
self.progress.step()
self.progress.close()
self.progress.step()
self.progress.close()
def output_piechart(self, title, typename, data, lookup):
@ -591,17 +591,17 @@ class StatisticsChart(Report):
chart_data.append((style, data[key], text))
color = (color+1) % 7 # There are only 7 color styles defined
margin = 1.0
legendx = 2.0
margin = 1.0
legendx = 2.0
# output data...
radius = middle - 2*margin
yoffset = yoffset + margin + radius
ReportUtils.draw_pie_chart(self.doc, middle, yoffset, radius, chart_data, -90)
yoffset = yoffset + radius + margin
text = _("%s (persons):") % typename
ReportUtils.draw_legend(self.doc, legendx, yoffset, chart_data, text,'SC-legend')
text = _("%s (persons):") % typename
ReportUtils.draw_legend(self.doc, legendx, yoffset, chart_data, text,'SC-legend')
def output_barchart(self, title, typename, data, lookup):
@ -622,10 +622,10 @@ class StatisticsChart(Report):
for key in lookup:
max_value = max(data[key], max_value)
# horizontal area for the gfx bars
margin = 1.0
middle = width/2.0
textx = middle + margin/2.0
stopx = middle - margin/2.0
margin = 1.0
middle = width/2.0
textx = middle + margin/2.0
stopx = middle - margin/2.0
maxsize = stopx - margin
# start output
@ -634,10 +634,10 @@ class StatisticsChart(Report):
yoffset = pt2cm(pstyle.get_font().get_size())
#print title
# header
yoffset += (row_h + pad)
text = _("%s (persons):") % typename
self.doc.draw_text('SC-text', text, textx, yoffset)
# header
yoffset += (row_h + pad)
text = _("%s (persons):") % typename
self.doc.draw_text('SC-text', text, textx, yoffset)
for key in lookup:
yoffset += (row_h + pad)
@ -651,8 +651,8 @@ class StatisticsChart(Report):
value = data[key]
startx = stopx - (maxsize * value / max_value)
self.doc.draw_box('SC-bar',"",startx,yoffset,stopx-startx,row_h)
# text after bar
text = "%s (%d)" % (key, data[key])
# text after bar
text = "%s (%d)" % (key, data[key])
self.doc.draw_text('SC-text', text, textx, yoffset)
#print key + ":",

View File

@ -539,9 +539,9 @@ class WebReport(Report):
if first:
first = False
if day_col > 1:
of.write(' <td colspan="%s" class="cal_cell">&nbsp;</td>\n' % str(day_col))
of.write(' <td colspan="%s" class="cal_cell">&nbsp;</td>\n' % str(day_col))
elif day_col == 1:
of.write(' <td class="cal_cell">&nbsp;</td>\n')
of.write(' <td class="cal_cell">&nbsp;</td>\n')
of.write(' <td class="%s">%s' % (cellclass,str(thisday.day)))
something_this_week = 1
if list > []:
@ -570,7 +570,7 @@ class WebReport(Report):
if week_row == 5:
of.write(' class="cal_note">')
if self.Note[month-1].strip() != '':
of.write(self.Note[month-1])
of.write(self.Note[month-1])
else:
of.write("&nbsp;")
of.write('</td>\n')

View File

@ -332,7 +332,7 @@ class GeneWebWriter:
return
if reflist:
for sr in reflist:
for sr in reflist:
sbase = sr.get_reference_handle()
if sbase:
source = self.db.get_source_from_handle(sbase)

View File

@ -375,7 +375,7 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
if other_person.get_gender() == gen.lib.Person.MALE:
return (self.get_nephew(firstRel-secondRel,secondRel),common)
else:
return (self.get_niece(firstRel-secondRel,secondRel),common)
return (self.get_niece(firstRel-secondRel,secondRel),common)
else: # obviously secondRel == firstRel
if other_person.get_gender() == gen.lib.Person.MALE:
return (self.get_male_cousin(firstRel-1),common)

View File

@ -274,20 +274,20 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
# other_level+orig_level=stopień pokrewieństwa (degree of kinship)
def get_junior_male_cousin_father_uncle(self,other_level,orig_level):
if other_level == orig_level == 2:
return "brat stryjeczny"
if other_level == orig_level == 2:
return "brat stryjeczny"
else:
return "daleki kuzyn (%d. stopień pokrewieństwa)" % (other_level+orig_level)
def get_junior_male_cousin_mother_uncle(self,other_level,orig_level):
if other_level == orig_level == 2:
return "brat wujeczny"
if other_level == orig_level == 2:
return "brat wujeczny"
else:
return "daleki kuzyn (%d. stopień pokrewieństwa)" % (other_level+orig_level)
def get_junior_male_cousin_aunt(self,other_level,orig_level):
if other_level == orig_level == 2:
return "brat cioteczny"
if other_level == orig_level == 2:
return "brat cioteczny"
else:
return "daleki kuzyn (%d. stopień pokrewieństwa)" % (other_level+orig_level)
@ -304,20 +304,20 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
return "daleki %s (%d. stopień pokrewieństwa)" % (_brother_level_of_female[level],other_level+orig_level)
def get_junior_female_cousin_father_uncle(self,other_level,orig_level):
if other_level == orig_level == 2:
return "siostra stryjeczna"
if other_level == orig_level == 2:
return "siostra stryjeczna"
else:
return "daleka kuzynka (%d. stopień pokrewieństwa)" % (other_level+orig_level)
def get_junior_female_cousin_mother_uncle(self,other_level,orig_level):
if other_level == orig_level == 2:
return "siostra wujeczna"
if other_level == orig_level == 2:
return "siostra wujeczna"
else:
return "daleka kuzynka (%d. stopień pokrewieństwa)" % (other_level+orig_level)
def get_junior_female_cousin_aunt(self,other_level,orig_level):
if other_level == orig_level == 2:
return "siostra cioteczna"
if other_level == orig_level == 2:
return "siostra cioteczna"
else:
return "daleka kuzynka (%d. stopień pokrewieństwa)" % (other_level+orig_level)
@ -349,14 +349,14 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
def get_mother(self,other_level,orig_level):
level=other_level
if level>len(_mother_level)-1:
if level>len(_mother_level)-1:
return "oddalona pra*babcia (%d. stopień pokrewieństwa)" %(other_level+orig_level)
else:
return _mother_level[level]
def get_daughter(self,other_level,orig_level):
level=orig_level
if level>len(_daughter_level)-1:
if level>len(_daughter_level)-1:
return "oddalona pra*wnuczka (%d. stopień pokrewieństwa)" %(other_level+orig_level)
else:
return _daughter_level[level]
@ -390,56 +390,56 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
return _brother_level_of_female[level]
def get_nephew_of_brothers_son(self,other_level,orig_level):
level=orig_level-1
level=orig_level-1
if level>len(_nephew_level_of_brothers_son)-1:
return "oddalony pra*wnuk bratanka (%d. stopień pokrewieństwa)" %(other_level+orig_level)
else:
return _nephew_level_of_brothers_son[level]
return _nephew_level_of_brothers_son[level]
def get_nephew_of_brothers_daughter(self,other_level,orig_level):
level=orig_level-1
level=orig_level-1
if level>len(_nephew_level_of_brothers_daughter)-1:
return "oddalony pra*wnuk bratanicy (%d. stopień pokrewieństwa)" %(other_level+orig_level)
else:
return _nephew_level_of_brothers_daughter[level]
return _nephew_level_of_brothers_daughter[level]
def get_nephew_of_sisters_son(self,other_level,orig_level):
level=orig_level-1
level=orig_level-1
if level>len(_nephew_level_of_sisters_son)-1:
return "oddalony pra*wnuk siostrzeńca (%d. stopień pokrewieństwa)" %(other_level+orig_level)
else:
return _nephew_level_of_sisters_son[level]
return _nephew_level_of_sisters_son[level]
def get_nephew_of_sisters_daughter(self,other_level,orig_level):
level=orig_level-1
level=orig_level-1
if level>len(_nephew_level_of_sisters_daughter)-1:
return "oddalony pra*wnuk siostrzenicy (%d. stopień pokrewieństwa)" %(other_level+orig_level)
else:
return _nephew_level_of_sisters_daughter[level]
return _nephew_level_of_sisters_daughter[level]
def get_niece_of_brothers_son(self,other_level,orig_level):
level=orig_level-1
level=orig_level-1
if level>len(_niece_level_of_brothers_son)-1:
return "oddalona pra*wnuczka bratanka (%d. stopień pokrewieństwa)" %(other_level+orig_level)
else:
return _niece_level_of_brothers_son[level]
def get_niece_of_brothers_daughter(self,other_level,orig_level):
level=orig_level-1
level=orig_level-1
if level>len(_niece_level_of_brothers_daughter)-1:
return "oddalona pra*wnuczka bratanicy (%d. stopień pokrewieństwa)" %(other_level+orig_level)
else:
return _niece_level_of_brothers_daughter[level]
def get_niece_of_sisters_son(self,other_level,orig_level):
level=orig_level-1
level=orig_level-1
if level>len(_niece_level_of_sisters_son)-1:
return "oddalona pra*wnuczka siostrzeńca (%d. stopień pokrewieństwa)" %(other_level+orig_level)
else:
return _niece_level_of_sisters_son[level]
def get_niece_of_sisters_daughter(self,other_level,orig_level):
level=orig_level-1
level=orig_level-1
if level>len(_niece_level_of_sisters_daughter)-1:
return "oddalona pra*wnuczka siostrzenicy (%d. stopień pokrewieństwa)" %(other_level+orig_level)
else:
@ -688,7 +688,7 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
else:
return (self.get_senior_female_cousin_of_female(secondRel-firstRel+1,firstRel,secondRel),common)
else:
families1 = db.get_person_from_handle(common[0]).get_family_handle_list()
families1 = db.get_person_from_handle(common[0]).get_family_handle_list()
families2 = None
if len(common) >1:
families2 = db.get_person_from_handle(common[1]).get_family_handle_list()
@ -704,32 +704,32 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
children = ancFamily.get_child_ref_list()
for sibling_handle in children:
if sibling_handle.ref in firstList:
for other_sibling_handle in children:
if other_sibling_handle.ref in secondList:
sibling = db.get_person_from_handle(sibling_handle.ref)
other_sibling = db.get_person_from_handle(other_sibling_handle.ref)
if other_person.get_gender() == gen.lib.Person.MALE:
if other_sibling.get_gender() == gen.lib.Person.MALE:
if sibling.get_gender() == gen.lib.Person.MALE:
# brat stryjeczny
return (self.get_junior_male_cousin_father_uncle(secondRel,firstRel),common)
else:
# brat wujeczny
return (self.get_junior_male_cousin_mother_uncle(secondRel,firstRel),common)
else:
# brat cioteczny
return (self.get_junior_male_cousin_aunt(secondRel,firstRel),common)
else:
if other_sibling.get_gender() == gen.lib.Person.MALE:
if sibling.get_gender() == gen.lib.Person.MALE:
# siostra stryjeczna
return (self.get_junior_female_cousin_father_uncle(secondRel,firstRel),common)
else:
# siostra wujeczna
return (self.get_junior_female_cousin_mother_uncle(secondRel,firstRel),common)
else:
# siostra cioteczna
return (self.get_junior_female_cousin_aunt(secondRel,firstRel),common)
for other_sibling_handle in children:
if other_sibling_handle.ref in secondList:
sibling = db.get_person_from_handle(sibling_handle.ref)
other_sibling = db.get_person_from_handle(other_sibling_handle.ref)
if other_person.get_gender() == gen.lib.Person.MALE:
if other_sibling.get_gender() == gen.lib.Person.MALE:
if sibling.get_gender() == gen.lib.Person.MALE:
# brat stryjeczny
return (self.get_junior_male_cousin_father_uncle(secondRel,firstRel),common)
else:
# brat wujeczny
return (self.get_junior_male_cousin_mother_uncle(secondRel,firstRel),common)
else:
# brat cioteczny
return (self.get_junior_male_cousin_aunt(secondRel,firstRel),common)
else:
if other_sibling.get_gender() == gen.lib.Person.MALE:
if sibling.get_gender() == gen.lib.Person.MALE:
# siostra stryjeczna
return (self.get_junior_female_cousin_father_uncle(secondRel,firstRel),common)
else:
# siostra wujeczna
return (self.get_junior_female_cousin_mother_uncle(secondRel,firstRel),common)
else:
# siostra cioteczna
return (self.get_junior_female_cousin_aunt(secondRel,firstRel),common)
#-------------------------------------------------------------------------
#

View File

@ -93,7 +93,7 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
item = ""
result.append(word)
continue
if item:
if item:
if word == 'syster':
item = item[0:-1]
word = 'ster'
@ -186,11 +186,11 @@ class RelationshipCalculator(Relationship.RelationshipCalculator):
removed = len(rel_string_long)-len(rel_string_short)-1
level = len(rel_string_short)-1
if level:
result.append(self._get_cousin(level,step,inlaw))
result.append(self._get_cousin(level,step,inlaw))
elif rel_string_long[removed] == 'f':
result.append('bror')
result.append('bror')
else:
result.append('syster')
result.append('syster')
for ix in range(removed-1,-1,-1):
if rel_string_long[ix] == 'f':
result.append('son')