* src/const.py.in: handle new translation table class
* src/TransTable.py: new Translation table class * src/GenericFilter.py: handle translated rule names * src/plugins/FilterEditor.py: handle translated rule names svn: r2678
This commit is contained in:
parent
0e2b35c484
commit
aff1d5db9a
@ -53,6 +53,7 @@ import const
|
|||||||
import RelLib
|
import RelLib
|
||||||
import Date
|
import Date
|
||||||
import Calendar
|
import Calendar
|
||||||
|
from TransTable import TransTable
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
from Utils import for_each_ancestor
|
from Utils import for_each_ancestor
|
||||||
|
|
||||||
@ -214,22 +215,12 @@ class RelationshipPathBetween(Rule):
|
|||||||
path1 = { p1.getId() : 1}
|
path1 = { p1.getId() : 1}
|
||||||
path2 = { p2.getId() : 1}
|
path2 = { p2.getId() : 1}
|
||||||
|
|
||||||
print common[0].getId()
|
|
||||||
print common[1].getId()
|
|
||||||
|
|
||||||
for person in common:
|
for person in common:
|
||||||
new_map = {}
|
new_map = {}
|
||||||
self.desc_list(person,new_map,1)
|
self.desc_list(person,new_map,1)
|
||||||
self.get_intersection(path1,firstMap,new_map)
|
self.get_intersection(path1,firstMap,new_map)
|
||||||
self.get_intersection(path2,secondMap,new_map)
|
self.get_intersection(path2,secondMap,new_map)
|
||||||
|
|
||||||
print "Common Ancestor desc"
|
|
||||||
print new_map
|
|
||||||
print "p1 ancestors"
|
|
||||||
print path1
|
|
||||||
print "p2 ancestors"
|
|
||||||
print path2
|
|
||||||
|
|
||||||
for e in path1:
|
for e in path1:
|
||||||
self.map[e] = 1
|
self.map[e] = 1
|
||||||
for e in path2:
|
for e in path2:
|
||||||
@ -237,10 +228,6 @@ class RelationshipPathBetween(Rule):
|
|||||||
for e in common:
|
for e in common:
|
||||||
self.map[e.getId()] = 1
|
self.map[e.getId()] = 1
|
||||||
|
|
||||||
print path1
|
|
||||||
print path2
|
|
||||||
print self.map
|
|
||||||
|
|
||||||
def get_intersection(self,target, map1, map2):
|
def get_intersection(self,target, map1, map2):
|
||||||
for e in map1.keys():
|
for e in map1.keys():
|
||||||
if map2.has_key(e):
|
if map2.has_key(e):
|
||||||
@ -1425,28 +1412,21 @@ tasks = {
|
|||||||
unicode(_("Has the death")) : HasDeath,
|
unicode(_("Has the death")) : HasDeath,
|
||||||
unicode(_("Has the birth")) : HasBirth,
|
unicode(_("Has the birth")) : HasBirth,
|
||||||
unicode(_("Is a descendant of")) : IsDescendantOf,
|
unicode(_("Is a descendant of")) : IsDescendantOf,
|
||||||
unicode(_("Is a descendant family member of"))
|
unicode(_("Is a descendant family member of")) : IsDescendantFamilyOf,
|
||||||
: IsDescendantFamilyOf,
|
unicode(_("Is a descendant of filter match")) : IsDescendantOfFilterMatch,
|
||||||
unicode(_("Is a descendant of filter match"))
|
|
||||||
: IsDescendantOfFilterMatch,
|
|
||||||
unicode(_("Is a descendant of person not more than N generations away"))
|
unicode(_("Is a descendant of person not more than N generations away"))
|
||||||
: IsLessThanNthGenerationDescendantOf,
|
: IsLessThanNthGenerationDescendantOf,
|
||||||
unicode(_("Is a descendant of person at least N generations away"))
|
unicode(_("Is a descendant of person at least N generations away"))
|
||||||
: IsMoreThanNthGenerationDescendantOf,
|
: IsMoreThanNthGenerationDescendantOf,
|
||||||
unicode(_("Is a child of filter match"))
|
unicode(_("Is a child of filter match")) : IsChildOfFilterMatch,
|
||||||
: IsChildOfFilterMatch,
|
unicode(_("Is an ancestor of")) : IsAncestorOf,
|
||||||
unicode(_("Is an ancestor of"))
|
unicode(_("Is an ancestor of filter match")) : IsAncestorOfFilterMatch,
|
||||||
: IsAncestorOf,
|
|
||||||
unicode(_("Is an ancestor of filter match"))
|
|
||||||
: IsAncestorOfFilterMatch,
|
|
||||||
unicode(_("Is an ancestor of person not more than N generations away"))
|
unicode(_("Is an ancestor of person not more than N generations away"))
|
||||||
: IsLessThanNthGenerationAncestorOf,
|
: IsLessThanNthGenerationAncestorOf,
|
||||||
unicode(_("Is an ancestor of person at least N generations away"))
|
unicode(_("Is an ancestor of person at least N generations away"))
|
||||||
: IsMoreThanNthGenerationAncestorOf,
|
: IsMoreThanNthGenerationAncestorOf,
|
||||||
unicode(_("Is a parent of filter match"))
|
unicode(_("Is a parent of filter match")) : IsParentOfFilterMatch,
|
||||||
: IsParentOfFilterMatch,
|
unicode(_("Has a common ancestor with")) : HasCommonAncestorWith,
|
||||||
unicode(_("Has a common ancestor with"))
|
|
||||||
: HasCommonAncestorWith,
|
|
||||||
unicode(_("Has a common ancestor with filter match"))
|
unicode(_("Has a common ancestor with filter match"))
|
||||||
: HasCommonAncestorWithFilterMatch,
|
: HasCommonAncestorWithFilterMatch,
|
||||||
unicode(_("Is a female")) : IsFemale,
|
unicode(_("Is a female")) : IsFemale,
|
||||||
@ -1458,8 +1438,7 @@ tasks = {
|
|||||||
unicode(_("Has the family attribute")) : HasFamilyAttribute,
|
unicode(_("Has the family attribute")) : HasFamilyAttribute,
|
||||||
unicode(_("Matches the filter named")) : MatchesFilter,
|
unicode(_("Matches the filter named")) : MatchesFilter,
|
||||||
unicode(_("Is spouse of filter match")) : IsSpouseOfFilterMatch,
|
unicode(_("Is spouse of filter match")) : IsSpouseOfFilterMatch,
|
||||||
unicode(_("Relationship path between two people"))
|
unicode(_("Relationship path between two people")) : RelationshipPathBetween,
|
||||||
: RelationshipPathBetween,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
@ -1569,7 +1548,7 @@ class FilterParser(handler.ContentHandler):
|
|||||||
self.gfilter_list.add(self.f)
|
self.gfilter_list.add(self.f)
|
||||||
elif tag == "rule":
|
elif tag == "rule":
|
||||||
cname = attrs['class']
|
cname = attrs['class']
|
||||||
name = _(cname)
|
name = unicode(_(cname))
|
||||||
self.a = []
|
self.a = []
|
||||||
self.cname = tasks[name]
|
self.cname = tasks[name]
|
||||||
elif tag == "arg":
|
elif tag == "arg":
|
||||||
|
@ -410,7 +410,6 @@ class FilterEditor:
|
|||||||
self.rule = gtk.glade.XML(const.filterFile,'rule_editor',"gramps")
|
self.rule = gtk.glade.XML(const.filterFile,'rule_editor',"gramps")
|
||||||
self.rule_top = self.rule.get_widget('rule_editor')
|
self.rule_top = self.rule.get_widget('rule_editor')
|
||||||
self.valuebox = self.rule.get_widget('valuebox')
|
self.valuebox = self.rule.get_widget('valuebox')
|
||||||
self.valuebox.set_sensitive(0)
|
|
||||||
self.rname = self.rule.get_widget('ruletree')
|
self.rname = self.rule.get_widget('ruletree')
|
||||||
self.rule_name = self.rule.get_widget('rulename')
|
self.rule_name = self.rule.get_widget('rulename')
|
||||||
|
|
||||||
@ -428,8 +427,7 @@ class FilterEditor:
|
|||||||
list = []
|
list = []
|
||||||
keylist = GenericFilter.tasks.keys()
|
keylist = GenericFilter.tasks.keys()
|
||||||
keylist.sort()
|
keylist.sort()
|
||||||
for xname in keylist:
|
for name in keylist:
|
||||||
name = unicode(xname)
|
|
||||||
cname = GenericFilter.tasks[name]
|
cname = GenericFilter.tasks[name]
|
||||||
arglist = cname.labels
|
arglist = cname.labels
|
||||||
vallist = []
|
vallist = []
|
||||||
@ -494,7 +492,7 @@ class FilterEditor:
|
|||||||
#
|
#
|
||||||
sel_node = None
|
sel_node = None
|
||||||
if self.active_rule:
|
if self.active_rule:
|
||||||
sel_name = _(self.active_rule.name())
|
sel_name = unicode(_(self.active_rule.name()))
|
||||||
else:
|
else:
|
||||||
sel_name = ""
|
sel_name = ""
|
||||||
|
|
||||||
@ -561,7 +559,8 @@ class FilterEditor:
|
|||||||
|
|
||||||
def rule_ok(self,obj):
|
def rule_ok(self,obj):
|
||||||
name = unicode(self.rule_name.get_text())
|
name = unicode(self.rule_name.get_text())
|
||||||
print name
|
class_def = GenericFilter.tasks[name]
|
||||||
|
obj = class_def([])
|
||||||
try:
|
try:
|
||||||
page = self.name2page[name]
|
page = self.name2page[name]
|
||||||
(n,c,v,t) = self.page[page]
|
(n,c,v,t) = self.page[page]
|
||||||
@ -577,7 +576,6 @@ class FilterEditor:
|
|||||||
self.draw_rules()
|
self.draw_rules()
|
||||||
self.rule_top.destroy()
|
self.rule_top.destroy()
|
||||||
except KeyError:
|
except KeyError:
|
||||||
print name, self.name2page
|
|
||||||
pass
|
pass
|
||||||
except:
|
except:
|
||||||
import DisplayTrace
|
import DisplayTrace
|
||||||
|
Loading…
Reference in New Issue
Block a user