2006-10-01 Don Allingham <don@gramps-project.org>

* src/Utils.py: catch divide by zero case
	* src/ViewManager.py: change change to same page (#410)



svn: r7339
This commit is contained in:
Don Allingham 2006-10-02 02:10:12 +00:00
parent 48fbb0f0db
commit 433710c483
3 changed files with 22 additions and 5 deletions

View File

@ -1,3 +1,7 @@
2006-10-01 Don Allingham <don@gramps-project.org>
* src/Utils.py: catch divide by zero case
* src/ViewManager.py: change change to same page (#410)
2006-09-29 Don Allingham <don@gramps-project.org>
* src/FilterEditor/_EditRule.py: limit source name in menu display
to 40 characters (#451)

View File

@ -972,10 +972,14 @@ class ProgressMeter:
"""Click the progress bar over to the next value. Be paranoid
and insure that it doesn't go over 100%."""
self.pbar_index = self.pbar_index + 1.0
if (self.pbar_index > self.pbar_max):
if self.pbar_index > self.pbar_max:
self.pbar_index = self.pbar_max
val = int(100*self.pbar_index/self.pbar_max)
try:
val = int(100*self.pbar_index/self.pbar_max)
except ZeroDivisionError:
val = 0
if val != self.old_val:
self.pbar.set_text("%d%%" % val)

View File

@ -185,6 +185,7 @@ class ViewManager:
"""
Initialize the ViewManager
"""
self.page_is_changing = False
self.state = state
self.active_page = None
self.views = []
@ -690,6 +691,11 @@ class ViewManager:
self.buttons[ix].handler_unblock(self.button_handlers[ix])
def change_page(self, obj, page, num=-1):
if self.page_is_changing:
return
self.page_is_changing = True
if num == -1:
num = self.notebook.get_current_page()
@ -709,7 +715,7 @@ class ViewManager:
if grp in self.uimanager.get_action_groups():
self.uimanager.remove_action_group(grp)
if len(self.pages) > 0:
if len(self.pages) > 0 and self.active_page != self.pages[num]:
self.active_page = self.pages[num]
self.active_page.set_active()
Config.set(Config.LAST_VIEW,num)
@ -741,8 +747,11 @@ class ViewManager:
self.active_page.change_page()
if self._key:
self.uistate.disconnect(self._key)
self._key = self.uistate.connect('nameformat-changed',
self.active_page.build_tree)
self._key = self.uistate.connect(
'nameformat-changed',
self.active_page.build_tree)
self.page_is_changing = False
def import_data(self, obj):
if self.state.db.db_is_open: