2007-01-15 Don Allingham <don@gramps-project.org>
* src/DataViews/_PersonView.py: use watch cursor on node expand * src/GrampsDb/_ReadGedcom.py: handle empty repo instances * src/plugins/TestCaseGenerator.py: fix typo * src/DisplayState.py: manage watch cursors better (don't set twice) * src/DisplayModels/_PeopleModel.py: maintain backref hash table for quick access to iter to node mappings at the top level. svn: r7914
This commit is contained in:
parent
cd12fc26f5
commit
88e4ddc0a6
@ -1,3 +1,11 @@
|
||||
2007-01-15 Don Allingham <don@gramps-project.org>
|
||||
* src/DataViews/_PersonView.py: use watch cursor on node expand
|
||||
* src/GrampsDb/_ReadGedcom.py: handle empty repo instances
|
||||
* src/plugins/TestCaseGenerator.py: fix typo
|
||||
* src/DisplayState.py: manage watch cursors better (don't set twice)
|
||||
* src/DisplayModels/_PeopleModel.py: maintain backref hash table for quick access
|
||||
to iter to node mappings at the top level.
|
||||
|
||||
2007-01-15 Martin Hawlisch <Martin.Hawlisch@gmx.de>
|
||||
* src/ViewManager.py: Switch pages during DnD; Set active sidebar
|
||||
button properly
|
||||
|
@ -254,6 +254,12 @@ class PersonView(PageView.PersonNavView):
|
||||
"""
|
||||
return 'gramps-person'
|
||||
|
||||
def start_expand(self, *obj):
|
||||
self.uistate.set_busy_cursor(True)
|
||||
|
||||
def expanded(self, *obj):
|
||||
self.uistate.set_busy_cursor(False)
|
||||
|
||||
def build_widget(self):
|
||||
"""
|
||||
Builds the interface and returns a gtk.Container type that
|
||||
@ -274,6 +280,8 @@ class PersonView(PageView.PersonNavView):
|
||||
self.tree.set_headers_visible(True)
|
||||
self.tree.set_fixed_height_mode(True)
|
||||
self.tree.connect('key-press-event', self.key_press)
|
||||
self.tree.connect('row-expanded', self.expanded)
|
||||
self.tree.connect('test-expand-row', self.start_expand)
|
||||
|
||||
scrollwindow = gtk.ScrolledWindow()
|
||||
scrollwindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
|
||||
@ -561,8 +569,14 @@ class PersonView(PageView.PersonNavView):
|
||||
pass
|
||||
|
||||
def open_all_nodes(self, obj):
|
||||
self.uistate.status_text(_("Updating display..."))
|
||||
self.uistate.set_busy_cursor(True)
|
||||
|
||||
self.tree.expand_all()
|
||||
|
||||
self.uistate.set_busy_cursor(False)
|
||||
self.uistate.modify_statusbar(self.dbstate)
|
||||
|
||||
def close_all_nodes(self, obj):
|
||||
self.tree.collapse_all()
|
||||
|
||||
|
@ -248,7 +248,6 @@ class PeopleModel(gtk.GenericTreeModel):
|
||||
"""
|
||||
Calculates the new path to node values for the model.
|
||||
"""
|
||||
|
||||
self.lru_data = LRU(_CACHE_SIZE)
|
||||
self.lru_name = LRU(_CACHE_SIZE)
|
||||
self.lru_bdate = LRU(_CACHE_SIZE)
|
||||
@ -292,6 +291,11 @@ class PeopleModel(gtk.GenericTreeModel):
|
||||
self.iter2path = self.temp_iter2path
|
||||
self.path2iter = self.temp_path2iter
|
||||
self.sname_sub = self.temp_sname_sub
|
||||
self.top_iter2path = {}
|
||||
i = 0
|
||||
for item in self.top_path2iter:
|
||||
self.top_iter2path[item] = i
|
||||
i+=1
|
||||
|
||||
def on_get_flags(self):
|
||||
'''returns the GtkTreeModelFlags for this particular type of model'''
|
||||
@ -304,10 +308,10 @@ class PeopleModel(gtk.GenericTreeModel):
|
||||
'''returns the tree path (a tuple of indices at the various
|
||||
levels) for a particular node.'''
|
||||
try:
|
||||
return (self.top_path2iter.index(node), )
|
||||
return (self.top_iter2path[node], )
|
||||
except:
|
||||
(surname, index) = self.iter2path[node]
|
||||
return (self.top_path2iter.index(surname), index)
|
||||
return (self.top_iter2path[surname], index)
|
||||
|
||||
def is_visable(self, handle):
|
||||
return self.iter2path.has_key(handle)
|
||||
@ -355,7 +359,7 @@ class PeopleModel(gtk.GenericTreeModel):
|
||||
def on_iter_next(self, node):
|
||||
'''returns the next node at this level of the tree'''
|
||||
try:
|
||||
path = self.top_path2iter.index(node)
|
||||
path = self.top_iter2path[node]
|
||||
if path+1 == len(self.top_path2iter):
|
||||
return None
|
||||
return self.top_path2iter[path+1]
|
||||
|
@ -258,7 +258,8 @@ class DisplayState(GrampsDb.GrampsDBCallback):
|
||||
}
|
||||
|
||||
def __init__(self, window, status, progress, warnbtn, uimanager):
|
||||
|
||||
|
||||
self.busy = False
|
||||
self.uimanager = uimanager
|
||||
self.window = window
|
||||
GrampsDb.GrampsDBCallback.__init__(self)
|
||||
@ -306,6 +307,10 @@ class DisplayState(GrampsDb.GrampsDBCallback):
|
||||
self.phistory.clear()
|
||||
|
||||
def set_busy_cursor(self,value):
|
||||
if value == self.busy:
|
||||
return
|
||||
else:
|
||||
self.busy = value
|
||||
if value:
|
||||
self.window.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH))
|
||||
else:
|
||||
|
@ -957,7 +957,7 @@ class GedcomParser(UpdateCallback):
|
||||
self.ignore_sub_junk(level+1)
|
||||
|
||||
def func_source_repo(self, matches, source, level):
|
||||
if matches[2][0] == '@':
|
||||
if matches[2] and matches[2][0] == '@':
|
||||
gid = matches[2][1:-1]
|
||||
repo = self.find_or_create_repository(gid)
|
||||
else:
|
||||
|
@ -722,27 +722,27 @@ class TestcaseGenerator(Tool.Tool):
|
||||
if not ndate:
|
||||
ndate = RelLib.Date()
|
||||
ndate.set_as_text("DateParser None")
|
||||
person.set_marker(RelLib.MarkerType.TODO)
|
||||
person.set_marker(RelLib.MarkerType.TODO_TYPE)
|
||||
else:
|
||||
person.set_marker(RelLib.MarkerType.COMPLETE)
|
||||
except:
|
||||
ndate = RelLib.Date()
|
||||
ndate.set_as_text("DateParser Exception %s" % ("".join(traceback.format_exception(*sys.exc_info())),))
|
||||
person.set_marker(RelLib.MarkerType.TODO)
|
||||
person.set_marker(RelLib.MarkerType.TODO_TYPE)
|
||||
except:
|
||||
ndate = RelLib.Date()
|
||||
ndate.set_as_text("DateDisplay Exception: %s" % ("".join(traceback.format_exception(*sys.exc_info())),))
|
||||
person.set_marker(RelLib.MarkerType.TODO)
|
||||
person.set_marker(RelLib.MarkerType.TODO_TYPE)
|
||||
|
||||
if dateval.get_modifier() != RelLib.Date.MOD_TEXTONLY \
|
||||
and ndate.get_modifier() == RelLib.Date.MOD_TEXTONLY:
|
||||
# parser was unable to correctly parse the string
|
||||
ndate.set_as_text( "TEXTONLY: "+ndate.get_text())
|
||||
person.set_marker(RelLib.MarkerType.TODO)
|
||||
person.set_marker(RelLib.MarkerType.TODO_TYPE)
|
||||
if dateval.get_modifier() == RelLib.Date.MOD_TEXTONLY \
|
||||
and dateval.get_text().count("Traceback") \
|
||||
and person.get_marker() == RelLib.MarkerType.COMPLETE:
|
||||
person.set_marker(RelLib.MarkerType.TODO)
|
||||
person.set_marker(RelLib.MarkerType.TODO_TYPE)
|
||||
|
||||
devent = RelLib.Event()
|
||||
devent.set_type(RelLib.EventType.DEATH)
|
||||
|
Loading…
Reference in New Issue
Block a user