RelCalc.py - convert to use gtkbuilder instead of libglade
svn: r12410
This commit is contained in:
parent
a3f82400ef
commit
4d49eab84f
@ -36,7 +36,6 @@ from gettext import gettext as _
|
|||||||
# GNOME libraries
|
# GNOME libraries
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
from gtk import glade
|
|
||||||
import gtk
|
import gtk
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
@ -87,22 +86,23 @@ class RelCalc(Tool.Tool, ManagedWindow.ManagedWindow):
|
|||||||
|
|
||||||
base = os.path.dirname(__file__)
|
base = os.path.dirname(__file__)
|
||||||
glade_file = base + os.sep + "relcalc.glade"
|
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 = ''
|
name = ''
|
||||||
if self.person:
|
if self.person:
|
||||||
name = name_displayer.display(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_object('relcalc')
|
||||||
self.titlelabel = self.glade.get_widget('title')
|
self.titlelabel = self.glade.get_object('title')
|
||||||
self.set_window(window, self.titlelabel,
|
self.set_window(window, self.titlelabel,
|
||||||
_('Relationship to %(person_name)s'
|
_('Relationship to %(person_name)s'
|
||||||
) % {'person_name' : name },
|
) % {'person_name' : name },
|
||||||
self.title)
|
self.title)
|
||||||
|
|
||||||
self.tree = self.glade.get_widget("peopleList")
|
self.tree = self.glade.get_object("peopleList")
|
||||||
self.text = self.glade.get_widget("text1")
|
self.text = self.glade.get_object("text1")
|
||||||
self.textbuffer = gtk.TextBuffer()
|
self.textbuffer = gtk.TextBuffer()
|
||||||
self.text.set_buffer(self.textbuffer)
|
self.text.set_buffer(self.textbuffer)
|
||||||
|
|
||||||
@ -138,7 +138,7 @@ class RelCalc(Tool.Tool, ManagedWindow.ManagedWindow):
|
|||||||
|
|
||||||
self.sel = self.tree.get_selection()
|
self.sel = self.tree.get_selection()
|
||||||
self.changedkey = self.sel.connect('changed',self.on_apply_clicked)
|
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)
|
self.closebtn.connect('clicked', self.close)
|
||||||
|
|
||||||
if not self.person:
|
if not self.person:
|
||||||
@ -198,8 +198,7 @@ class RelCalc(Tool.Tool, ManagedWindow.ManagedWindow):
|
|||||||
length = len(common)
|
length = len(common)
|
||||||
if length == 1:
|
if length == 1:
|
||||||
person = self.db.get_person_from_handle(common[0])
|
person = self.db.get_person_from_handle(common[0])
|
||||||
if common[0] == other_person.handle or \
|
if common[0] in [other_person.handle, self.person.handle]:
|
||||||
common[0] == self.person.handle :
|
|
||||||
commontext = ''
|
commontext = ''
|
||||||
else :
|
else :
|
||||||
name = name_displayer.display(person)
|
name = name_displayer.display(person)
|
||||||
@ -216,11 +215,11 @@ class RelCalc(Tool.Tool, ManagedWindow.ManagedWindow):
|
|||||||
commontext = " " + _("Their common ancestors are: ")
|
commontext = " " + _("Their common ancestors are: ")
|
||||||
for person_handle in common:
|
for person_handle in common:
|
||||||
person = self.db.get_person_from_handle(person_handle)
|
person = self.db.get_person_from_handle(person_handle)
|
||||||
if index != 0:
|
if index:
|
||||||
commontext = commontext + ", "
|
commontext += ", "
|
||||||
commontext = commontext + name_displayer.display(person)
|
commontext += name_displayer.display(person)
|
||||||
index = index + 1
|
index += 1
|
||||||
commontext = commontext + "."
|
commontext += "."
|
||||||
else:
|
else:
|
||||||
commontext = ""
|
commontext = ""
|
||||||
text.append((rstr, commontext))
|
text.append((rstr, commontext))
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
|
<?xml version="1.0"?>
|
||||||
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
|
<!--*- mode: xml -*-->
|
||||||
|
<interface>
|
||||||
<glade-interface>
|
<object class="GtkDialog" id="relcalc">
|
||||||
|
|
||||||
<widget class="GtkDialog" id="relcalc">
|
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="title" translatable="yes"></property>
|
<property name="title" translatable="yes"/>
|
||||||
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||||
<property name="window_position">GTK_WIN_POS_NONE</property>
|
<property name="window_position">GTK_WIN_POS_NONE</property>
|
||||||
<property name="modal">False</property>
|
<property name="modal">False</property>
|
||||||
@ -21,21 +19,18 @@
|
|||||||
<property name="focus_on_map">True</property>
|
<property name="focus_on_map">True</property>
|
||||||
<property name="urgency_hint">False</property>
|
<property name="urgency_hint">False</property>
|
||||||
<property name="has_separator">False</property>
|
<property name="has_separator">False</property>
|
||||||
<signal name="delete_event" handler="on_delete_event" last_modification_time="Tue, 11 May 2004 00:39:37 GMT"/>
|
<signal handler="on_delete_event" last_modification_time="Tue, 11 May 2004 00:39:37 GMT" name="delete_event"/>
|
||||||
|
|
||||||
<child internal-child="vbox">
|
<child internal-child="vbox">
|
||||||
<widget class="GtkVBox" id="dialog-vbox2">
|
<object class="GtkVBox" id="dialog-vbox2">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="homogeneous">False</property>
|
<property name="homogeneous">False</property>
|
||||||
<property name="spacing">8</property>
|
<property name="spacing">8</property>
|
||||||
|
|
||||||
<child internal-child="action_area">
|
<child internal-child="action_area">
|
||||||
<widget class="GtkHButtonBox" id="dialog-action_area2">
|
<object class="GtkHButtonBox" id="dialog-action_area2">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="layout_style">GTK_BUTTONBOX_END</property>
|
<property name="layout_style">GTK_BUTTONBOX_END</property>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkButton" id="button5">
|
<object class="GtkButton" id="button5">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_default">True</property>
|
<property name="can_default">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
@ -43,10 +38,9 @@
|
|||||||
<property name="use_stock">True</property>
|
<property name="use_stock">True</property>
|
||||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||||
<property name="focus_on_click">True</property>
|
<property name="focus_on_click">True</property>
|
||||||
<property name="response_id">0</property>
|
</object>
|
||||||
</widget>
|
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="padding">0</property>
|
<property name="padding">0</property>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
@ -54,18 +48,16 @@
|
|||||||
<property name="pack_type">GTK_PACK_END</property>
|
<property name="pack_type">GTK_PACK_END</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkVBox" id="vbox1">
|
<object class="GtkVBox" id="vbox1">
|
||||||
<property name="border_width">6</property>
|
<property name="border_width">6</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="homogeneous">False</property>
|
<property name="homogeneous">False</property>
|
||||||
<property name="spacing">6</property>
|
<property name="spacing">6</property>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkLabel" id="title">
|
<object class="GtkLabel" id="title">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="label" translatable="yes"></property>
|
<property name="label" translatable="yes"/>
|
||||||
<property name="use_underline">False</property>
|
<property name="use_underline">False</property>
|
||||||
<property name="use_markup">False</property>
|
<property name="use_markup">False</property>
|
||||||
<property name="justify">GTK_JUSTIFY_CENTER</property>
|
<property name="justify">GTK_JUSTIFY_CENTER</property>
|
||||||
@ -79,27 +71,25 @@
|
|||||||
<property name="width_chars">-1</property>
|
<property name="width_chars">-1</property>
|
||||||
<property name="single_line_mode">False</property>
|
<property name="single_line_mode">False</property>
|
||||||
<property name="angle">0</property>
|
<property name="angle">0</property>
|
||||||
</widget>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="padding">5</property>
|
<property name="padding">5</property>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
<property name="fill">False</property>
|
<property name="fill">False</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkScrolledWindow" id="scrolledwindow3">
|
<object class="GtkScrolledWindow" id="scrolledwindow3">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||||
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||||
<property name="shadow_type">GTK_SHADOW_IN</property>
|
<property name="shadow_type">GTK_SHADOW_IN</property>
|
||||||
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
|
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkTreeView" id="peopleList">
|
<object class="GtkTreeView" id="peopleList">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="tooltip" translatable="yes">Select a person to determine the relationship</property>
|
<property name="tooltip-text" translatable="yes">Select a person to determine the relationship</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="headers_visible">True</property>
|
<property name="headers_visible">True</property>
|
||||||
<property name="rules_hint">True</property>
|
<property name="rules_hint">True</property>
|
||||||
@ -108,26 +98,24 @@
|
|||||||
<property name="fixed_height_mode">False</property>
|
<property name="fixed_height_mode">False</property>
|
||||||
<property name="hover_selection">False</property>
|
<property name="hover_selection">False</property>
|
||||||
<property name="hover_expand">False</property>
|
<property name="hover_expand">False</property>
|
||||||
</widget>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="padding">0</property>
|
<property name="padding">0</property>
|
||||||
<property name="expand">True</property>
|
<property name="expand">True</property>
|
||||||
<property name="fill">True</property>
|
<property name="fill">True</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkScrolledWindow" id="scrolledwindow2">
|
<object class="GtkScrolledWindow" id="scrolledwindow2">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||||
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||||
<property name="shadow_type">GTK_SHADOW_IN</property>
|
<property name="shadow_type">GTK_SHADOW_IN</property>
|
||||||
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
|
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkTextView" id="text1">
|
<object class="GtkTextView" id="text1">
|
||||||
<property name="height_request">75</property>
|
<property name="height_request">75</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
@ -143,25 +131,26 @@
|
|||||||
<property name="left_margin">0</property>
|
<property name="left_margin">0</property>
|
||||||
<property name="right_margin">0</property>
|
<property name="right_margin">0</property>
|
||||||
<property name="indent">0</property>
|
<property name="indent">0</property>
|
||||||
<property name="text" translatable="yes"></property>
|
</object>
|
||||||
</widget>
|
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="padding">0</property>
|
<property name="padding">0</property>
|
||||||
<property name="expand">False</property>
|
<property name="expand">False</property>
|
||||||
<property name="fill">True</property>
|
<property name="fill">True</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="padding">0</property>
|
<property name="padding">0</property>
|
||||||
<property name="expand">True</property>
|
<property name="expand">True</property>
|
||||||
<property name="fill">True</property>
|
<property name="fill">True</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
<action-widgets>
|
||||||
|
<action-widget response="0">button5</action-widget>
|
||||||
</glade-interface>
|
</action-widgets>
|
||||||
|
</object>
|
||||||
|
</interface>
|
||||||
|
Loading…
Reference in New Issue
Block a user