diff --git a/src/plugins/tool/RelCalc.py b/src/plugins/tool/RelCalc.py
index 90878261d..80edd5a1e 100644
--- a/src/plugins/tool/RelCalc.py
+++ b/src/plugins/tool/RelCalc.py
@@ -36,7 +36,6 @@ from gettext import gettext as _
# GNOME libraries
#
#-------------------------------------------------------------------------
-from gtk import glade
import gtk
#-------------------------------------------------------------------------
@@ -87,22 +86,23 @@ class RelCalc(Tool.Tool, ManagedWindow.ManagedWindow):
base = os.path.dirname(__file__)
glade_file = base + os.sep + "relcalc.glade"
- self.glade = glade.XML(glade_file, "relcalc", "gramps")
+ self.glade = gtk.Builder()
+ self.glade.add_from_file(glade_file)
name = ''
if self.person:
name = name_displayer.display(self.person)
self.title = _('Relationship calculator: %(person_name)s'
) % {'person_name' : name}
- window = self.glade.get_widget('relcalc')
- self.titlelabel = self.glade.get_widget('title')
+ window = self.glade.get_object('relcalc')
+ self.titlelabel = self.glade.get_object('title')
self.set_window(window, self.titlelabel,
_('Relationship to %(person_name)s'
) % {'person_name' : name },
self.title)
- self.tree = self.glade.get_widget("peopleList")
- self.text = self.glade.get_widget("text1")
+ self.tree = self.glade.get_object("peopleList")
+ self.text = self.glade.get_object("text1")
self.textbuffer = gtk.TextBuffer()
self.text.set_buffer(self.textbuffer)
@@ -138,7 +138,7 @@ class RelCalc(Tool.Tool, ManagedWindow.ManagedWindow):
self.sel = self.tree.get_selection()
self.changedkey = self.sel.connect('changed',self.on_apply_clicked)
- self.closebtn = self.glade.get_widget("button5")
+ self.closebtn = self.glade.get_object("button5")
self.closebtn.connect('clicked', self.close)
if not self.person:
@@ -198,8 +198,7 @@ class RelCalc(Tool.Tool, ManagedWindow.ManagedWindow):
length = len(common)
if length == 1:
person = self.db.get_person_from_handle(common[0])
- if common[0] == other_person.handle or \
- common[0] == self.person.handle :
+ if common[0] in [other_person.handle, self.person.handle]:
commontext = ''
else :
name = name_displayer.display(person)
@@ -216,11 +215,11 @@ class RelCalc(Tool.Tool, ManagedWindow.ManagedWindow):
commontext = " " + _("Their common ancestors are: ")
for person_handle in common:
person = self.db.get_person_from_handle(person_handle)
- if index != 0:
- commontext = commontext + ", "
- commontext = commontext + name_displayer.display(person)
- index = index + 1
- commontext = commontext + "."
+ if index:
+ commontext += ", "
+ commontext += name_displayer.display(person)
+ index += 1
+ commontext += "."
else:
commontext = ""
text.append((rstr, commontext))
diff --git a/src/plugins/tool/relcalc.glade b/src/plugins/tool/relcalc.glade
index 236b71d63..d78b39686 100644
--- a/src/plugins/tool/relcalc.glade
+++ b/src/plugins/tool/relcalc.glade
@@ -1,167 +1,156 @@
-
-
-
-
-
-
- True
-
- GTK_WINDOW_TOPLEVEL
- GTK_WIN_POS_NONE
- False
- 600
- 400
- True
- False
- True
- False
- False
- GDK_WINDOW_TYPE_HINT_DIALOG
- GDK_GRAVITY_NORTH_WEST
- True
- False
- False
-
-
-
-
- True
- False
- 8
-
-
-
- True
- GTK_BUTTONBOX_END
-
-
-
- True
- True
- True
- gtk-close
- True
- GTK_RELIEF_NORMAL
- True
- 0
-
-
-
-
- 0
- False
- True
- GTK_PACK_END
-
-
-
-
-
- 6
- True
- False
- 6
-
-
-
- True
-
- False
- False
- GTK_JUSTIFY_CENTER
- False
- False
- 0.5
- 0.5
- 0
- 6
- PANGO_ELLIPSIZE_NONE
- -1
- False
- 0
-
-
- 5
- False
- False
-
-
-
-
-
- True
- True
- GTK_POLICY_AUTOMATIC
- GTK_POLICY_AUTOMATIC
- GTK_SHADOW_IN
- GTK_CORNER_TOP_LEFT
-
-
-
- True
- Select a person to determine the relationship
- True
- True
- True
- False
- True
- False
- False
- False
-
-
-
-
- 0
- True
- True
-
-
-
-
-
- True
- GTK_POLICY_AUTOMATIC
- GTK_POLICY_AUTOMATIC
- GTK_SHADOW_IN
- GTK_CORNER_TOP_LEFT
-
-
-
- 75
- True
- True
- False
- False
- True
- GTK_JUSTIFY_LEFT
- GTK_WRAP_WORD
- True
- 0
- 0
- 0
- 0
- 0
- 0
-
-
-
-
-
- 0
- False
- True
-
-
-
-
- 0
- True
- True
-
-
-
-
-
-
-
+
+
+
+
+