2008-01-03 Benny Malengier <benny.malengier@gramps-project.org>

* src/plugins/RelCalc.py: managed window error, bug 1499



svn: r9700
This commit is contained in:
Benny Malengier 2008-01-03 14:54:26 +00:00
parent 1e3ce27007
commit af1fd6eb0a
2 changed files with 14 additions and 7 deletions

View File

@ -1,3 +1,6 @@
2008-01-03 Benny Malengier <benny.malengier@gramps-project.org>
* src/plugins/RelCalc.py: managed window error, bug 1499
2008-01-03 Douglas S. Blank <dblank@cs.brynmawr.edu> 2008-01-03 Douglas S. Blank <dblank@cs.brynmawr.edu>
* src/ReportBase/_Constants.py: added QR_NOTE, QR_DATE * src/ReportBase/_Constants.py: added QR_NOTE, QR_DATE
* src/gen/lib/date.py: working on date math * src/gen/lib/date.py: working on date math

View File

@ -81,12 +81,6 @@ class RelCalc(Tool.Tool, ManagedWindow.ManagedWindow):
Tool.Tool.__init__(self, dbstate, options_class, name) Tool.Tool.__init__(self, dbstate, options_class, name)
ManagedWindow.ManagedWindow.__init__(self,uistate,[],self.__class__) ManagedWindow.ManagedWindow.__init__(self,uistate,[],self.__class__)
if not self.person:
ErrorDialog(_('Active person has not been set'),
_('You must select an active person for this '
'tool to work properly.'))
return
self.dbstate = dbstate self.dbstate = dbstate
self.relationship = relationship_class() self.relationship = relationship_class()
self.relationship.connect_db_signals(dbstate) self.relationship.connect_db_signals(dbstate)
@ -95,7 +89,9 @@ class RelCalc(Tool.Tool, ManagedWindow.ManagedWindow):
glade_file = base + os.sep + "relcalc.glade" glade_file = base + os.sep + "relcalc.glade"
self.glade = gtk.glade.XML(glade_file, "relcalc", "gramps") self.glade = gtk.glade.XML(glade_file, "relcalc", "gramps")
name = name_displayer.display(self.person) name = ''
if self.person:
name = name_displayer.display(self.person)
self.title = _('Relationship calculator: %(person_name)s' self.title = _('Relationship calculator: %(person_name)s'
) % {'person_name' : name} ) % {'person_name' : name}
window = self.glade.get_widget('relcalc') window = self.glade.get_widget('relcalc')
@ -141,6 +137,14 @@ class RelCalc(Tool.Tool, ManagedWindow.ManagedWindow):
self.closebtn = self.glade.get_widget("button5") self.closebtn = self.glade.get_widget("button5")
self.closebtn.connect('clicked', self.close) self.closebtn.connect('clicked', self.close)
if not self.person:
self.window.hide()
ErrorDialog(_('Active person has not been set'),
_('You must select an active person for this '
'tool to work properly.'))
self.close()
return
self.show() self.show()
def close(self, *obj): def close(self, *obj):