* src/DbPrompter.py: cleanup dialogs

* src/EditPerson.py: update screen properly
* src/PeopleModel.py: handle stored maps correctly
* src/PeopleView.py: handle stored maps correctly
* src/gramps_main.py: eliminate unnecessary rebuilds, display
loading dialog
* src/gramp.glade: loading dialog


svn: r3519
This commit is contained in:
Don Allingham 2004-08-29 05:45:40 +00:00
parent 684d47f512
commit 8ce99f9853
7 changed files with 132 additions and 15 deletions

View File

@ -1,3 +1,12 @@
2004-08-28 Don Allingham <dallingham@users.sourceforge.net>
* src/DbPrompter.py: cleanup dialogs
* src/EditPerson.py: update screen properly
* src/PeopleModel.py: handle stored maps correctly
* src/PeopleView.py: handle stored maps correctly
* src/gramps_main.py: eliminate unnecessary rebuilds, display
loading dialog
* src/gramp.glade: loading dialog
2004-08-25 Jim Smart <jim@jimsmart.org> 2004-08-25 Jim Smart <jim@jimsmart.org>
* src/RelLib.py: guess_gender fix * src/RelLib.py: guess_gender fix

View File

@ -76,12 +76,15 @@ class DbPrompter:
new.set_active(want_new) new.set_active(want_new)
while 1: while 1:
top.show()
response = top.run() response = top.run()
top.hide()
if response == gtk.RESPONSE_OK: if response == gtk.RESPONSE_OK:
if new.get_active(): if new.get_active():
prompter = NewNativeDbPrompter(self.parent,self.parent_window) prompter = NewNativeDbPrompter(self.parent,self.parent_window)
else: else:
prompter = ExistingDbPrompter(self.parent,self.parent_window) prompter = ExistingDbPrompter(self.parent,self.parent_window)
if prompter.chooser(): if prompter.chooser():
break break
elif response == gtk.RESPONSE_CANCEL: elif response == gtk.RESPONSE_CANCEL:
@ -179,7 +182,10 @@ class ExistingDbPrompter:
if filetype == const.app_gramps: if filetype == const.app_gramps:
choose.destroy() choose.destroy()
self.parent.db = GrampsBSDDB.GrampsBSDDB() self.parent.db = GrampsBSDDB.GrampsBSDDB()
msgxml = gtk.glade.XML(const.gladeFile, "load_message","gramps")
msg_top = msgxml.get_widget('load_message')
self.parent.read_file(filename) self.parent.read_file(filename)
msg_top.destroy()
return 1 return 1
elif filetype == const.app_gramps_xml: elif filetype == const.app_gramps_xml:
choose.destroy() choose.destroy()

View File

@ -1622,7 +1622,7 @@ class EditPerson:
self.db.transaction_commit(trans,_("Edit Person (%s)") % n) self.db.transaction_commit(trans,_("Edit Person (%s)") % n)
self.update_lists() self.update_lists()
if self.callback: if self.callback:
self.callback(self,0) self.callback(self,1)
self.close() self.close()
def get_place(self,field,makenew=0): def get_place(self,field,makenew=0):

View File

@ -75,7 +75,7 @@ class PeopleModel(gtk.GenericTreeModel):
self.top_visible = {} self.top_visible = {}
maps = self.db.get_people_view_maps() maps = self.db.get_people_view_maps()
if maps[0] != None and len(maps[0]) != 0: if maps[1] != None and len(maps[1]) != 0:
self.top_path2iter = maps[1] self.top_path2iter = maps[1]
self.iter2path = maps[2] self.iter2path = maps[2]
self.path2iter = maps[3] self.path2iter = maps[3]
@ -87,6 +87,11 @@ class PeopleModel(gtk.GenericTreeModel):
# self.connect('row-inserted',self.on_row_inserted) # self.connect('row-inserted',self.on_row_inserted)
def rebuild_data(self): def rebuild_data(self):
import traceback
print traceback.print_stack()
self.top_path2iter = [] self.top_path2iter = []
self.iter2path = {} self.iter2path = {}
self.path2iter = {} self.path2iter = {}
@ -230,7 +235,7 @@ class PeopleModel(gtk.GenericTreeModel):
def on_iter_nth_child(self,node,n): def on_iter_nth_child(self,node,n):
if node == None: if node == None:
return self.top_path2iter.get(n) return self.top_path2iter[n]
try: try:
path = self.top_path2iter.index(node) path = self.top_path2iter.index(node)
return self.path2iter[(node,n)] return self.path2iter[(node,n)]

View File

@ -115,8 +115,12 @@ class PeopleView:
index += 1 index += 1
def build_tree(self): def build_tree(self):
import time
t = time.time()
self.person_model = PeopleModel.PeopleModel(self.parent.db) self.person_model = PeopleModel.PeopleModel(self.parent.db)
self.sort_model = self.person_model.filter_new() print "new",time.time() - t
#self.sort_model = self.person_model.filter_new()
self.sort_model = self.person_model
self.person_tree.set_model(self.sort_model) self.person_tree.set_model(self.sort_model)
def blist(self, store, path, iter, id_list): def blist(self, store, path, iter, id_list):
@ -145,9 +149,8 @@ class PeopleView:
self.build_columns() self.build_columns()
maps = db.get_people_view_maps() maps = db.get_people_view_maps()
self.person_model = PeopleModel.PeopleModel(db) self.person_model = PeopleModel.PeopleModel(db)
if not maps[0]: #self.sort_model = self.person_model.filter_new()
self.build_tree() self.sort_model = self.person_model
self.sort_model = self.person_model.filter_new()
self.person_tree.set_model(self.sort_model) self.person_tree.set_model(self.sort_model)
def remove_from_person_list(self,person): def remove_from_person_list(self,person):
@ -174,6 +177,7 @@ class PeopleView:
self.parent.mhistory.remove(del_id) self.parent.mhistory.remove(del_id)
def apply_filter_clicked(self): def apply_filter_clicked(self):
print "Applying Filter"
mi = self.parent.filter_list.get_menu().get_active() mi = self.parent.filter_list.get_menu().get_active()
self.DataFilter = mi.get_data("filter") self.DataFilter = mi.get_data("filter")
if self.DataFilter.need_param: if self.DataFilter.need_param:
@ -181,6 +185,7 @@ class PeopleView:
self.DataFilter.set_parameter(qual) self.DataFilter.set_parameter(qual)
self.apply_filter() self.apply_filter()
self.goto_active_person() self.goto_active_person()
print "Done"
def add_to_person_list(self,person,change=0): def add_to_person_list(self,person,change=0):
self.apply_filter_clicked() self.apply_filter_clicked()
@ -207,7 +212,7 @@ class PeopleView:
for person_handle in keys: for person_handle in keys:
self.person_model.set_visible(person_handle,1) self.person_model.set_visible(person_handle,1)
self.sort_model.refilter() #self.sort_model.refilter()
self.parent.modify_statusbar() self.parent.modify_statusbar()
def on_plist_button_press(self,obj,event): def on_plist_button_press(self,obj,event):
@ -255,7 +260,5 @@ class PeopleView:
menu.popup(None,None,None,event.button,event.time) menu.popup(None,None,None,event.button,event.time)
def redisplay_person_list(self,person): def redisplay_person_list(self,person):
self.person_model = PeopleModel.PeopleModel(self.parent.db) self.build_tree()
self.sort_model = self.person_model.filter_new()
self.person_tree.set_model(self.sort_model)

View File

@ -30814,4 +30814,99 @@ Other</property>
</child> </child>
</widget> </widget>
<widget class="GtkWindow" id="load_message">
<property name="visible">True</property>
<property name="title" translatable="yes">GRAMPS - Loading Database</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_CENTER_ALWAYS</property>
<property name="modal">False</property>
<property name="resizable">False</property>
<property name="destroy_with_parent">False</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<child>
<widget class="GtkTable" id="table47">
<property name="border_width">12</property>
<property name="visible">True</property>
<property name="n_rows">2</property>
<property name="n_columns">2</property>
<property name="homogeneous">False</property>
<property name="row_spacing">0</property>
<property name="column_spacing">0</property>
<child>
<widget class="GtkImage" id="image2223">
<property name="visible">True</property>
<property name="stock">gtk-dialog-info</property>
<property name="icon_size">6</property>
<property name="xalign">0.5</property>
<property name="yalign">0</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">0</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label401">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;span size=&quot;larger&quot; weight=&quot;bold&quot;&gt;Loading Database&lt;/span&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label402">
<property name="visible">True</property>
<property name="label" translatable="yes">GRAMPS is loading the database you selected. Please wait.</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface> </glade-interface>

View File

@ -178,7 +178,7 @@ class Gramps:
TipOfDay.TipOfDay() TipOfDay.TipOfDay()
self.db.set_researcher(GrampsCfg.get_researcher()) self.db.set_researcher(GrampsCfg.get_researcher())
self.update_display(0) #self.update_display(0)
def date_format_key_update(self,client,cnxn_id,entry,data): def date_format_key_update(self,client,cnxn_id,entry,data):
GrampsCfg.set_calendar_date_format() GrampsCfg.set_calendar_date_format()
@ -1090,7 +1090,7 @@ class Gramps:
return 0 return 0
self.topWindow.set_resizable(gtk.TRUE) self.topWindow.set_resizable(gtk.TRUE)
self.people_view.apply_filter() #self.people_view.apply_filter()
self.goto_active_person() self.goto_active_person()
return 1 return 1
@ -1532,7 +1532,6 @@ class Gramps:
self.place_view.change_db(self.db) self.place_view.change_db(self.db)
self.source_view.change_db(self.db) self.source_view.change_db(self.db)
self.media_view.change_db(self.db) self.media_view.change_db(self.db)
#self.full_update()
self.change_active_person(self.find_initial_person()) self.change_active_person(self.find_initial_person())
self.statusbar.set_progress_percentage(0.0) self.statusbar.set_progress_percentage(0.0)