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,167 +1,156 @@
|
|||||||
<?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">
|
||||||
|
<property name="visible">True</property>
|
||||||
<widget class="GtkDialog" id="relcalc">
|
<property name="title" translatable="yes"/>
|
||||||
<property name="visible">True</property>
|
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||||
<property name="title" translatable="yes"></property>
|
<property name="window_position">GTK_WIN_POS_NONE</property>
|
||||||
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
<property name="modal">False</property>
|
||||||
<property name="window_position">GTK_WIN_POS_NONE</property>
|
<property name="default_width">600</property>
|
||||||
<property name="modal">False</property>
|
<property name="default_height">400</property>
|
||||||
<property name="default_width">600</property>
|
<property name="resizable">True</property>
|
||||||
<property name="default_height">400</property>
|
<property name="destroy_with_parent">False</property>
|
||||||
<property name="resizable">True</property>
|
<property name="decorated">True</property>
|
||||||
<property name="destroy_with_parent">False</property>
|
<property name="skip_taskbar_hint">False</property>
|
||||||
<property name="decorated">True</property>
|
<property name="skip_pager_hint">False</property>
|
||||||
<property name="skip_taskbar_hint">False</property>
|
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
|
||||||
<property name="skip_pager_hint">False</property>
|
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
|
||||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
|
<property name="focus_on_map">True</property>
|
||||||
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
|
<property name="urgency_hint">False</property>
|
||||||
<property name="focus_on_map">True</property>
|
<property name="has_separator">False</property>
|
||||||
<property name="urgency_hint">False</property>
|
<signal handler="on_delete_event" last_modification_time="Tue, 11 May 2004 00:39:37 GMT" name="delete_event"/>
|
||||||
<property name="has_separator">False</property>
|
<child internal-child="vbox">
|
||||||
<signal name="delete_event" handler="on_delete_event" last_modification_time="Tue, 11 May 2004 00:39:37 GMT"/>
|
<object class="GtkVBox" id="dialog-vbox2">
|
||||||
|
<property name="visible">True</property>
|
||||||
<child internal-child="vbox">
|
<property name="homogeneous">False</property>
|
||||||
<widget class="GtkVBox" id="dialog-vbox2">
|
<property name="spacing">8</property>
|
||||||
<property name="visible">True</property>
|
<child internal-child="action_area">
|
||||||
<property name="homogeneous">False</property>
|
<object class="GtkHButtonBox" id="dialog-action_area2">
|
||||||
<property name="spacing">8</property>
|
<property name="visible">True</property>
|
||||||
|
<property name="layout_style">GTK_BUTTONBOX_END</property>
|
||||||
<child internal-child="action_area">
|
<child>
|
||||||
<widget class="GtkHButtonBox" id="dialog-action_area2">
|
<object class="GtkButton" id="button5">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="layout_style">GTK_BUTTONBOX_END</property>
|
<property name="can_default">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
<child>
|
<property name="label">gtk-close</property>
|
||||||
<widget class="GtkButton" id="button5">
|
<property name="use_stock">True</property>
|
||||||
<property name="visible">True</property>
|
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||||
<property name="can_default">True</property>
|
<property name="focus_on_click">True</property>
|
||||||
<property name="can_focus">True</property>
|
</object>
|
||||||
<property name="label">gtk-close</property>
|
</child>
|
||||||
<property name="use_stock">True</property>
|
</object>
|
||||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
<packing>
|
||||||
<property name="focus_on_click">True</property>
|
<property name="padding">0</property>
|
||||||
<property name="response_id">0</property>
|
<property name="expand">False</property>
|
||||||
</widget>
|
<property name="fill">True</property>
|
||||||
</child>
|
<property name="pack_type">GTK_PACK_END</property>
|
||||||
</widget>
|
</packing>
|
||||||
<packing>
|
</child>
|
||||||
<property name="padding">0</property>
|
<child>
|
||||||
<property name="expand">False</property>
|
<object class="GtkVBox" id="vbox1">
|
||||||
<property name="fill">True</property>
|
<property name="border_width">6</property>
|
||||||
<property name="pack_type">GTK_PACK_END</property>
|
<property name="visible">True</property>
|
||||||
</packing>
|
<property name="homogeneous">False</property>
|
||||||
</child>
|
<property name="spacing">6</property>
|
||||||
|
<child>
|
||||||
<child>
|
<object class="GtkLabel" id="title">
|
||||||
<widget class="GtkVBox" id="vbox1">
|
<property name="visible">True</property>
|
||||||
<property name="border_width">6</property>
|
<property name="label" translatable="yes"/>
|
||||||
<property name="visible">True</property>
|
<property name="use_underline">False</property>
|
||||||
<property name="homogeneous">False</property>
|
<property name="use_markup">False</property>
|
||||||
<property name="spacing">6</property>
|
<property name="justify">GTK_JUSTIFY_CENTER</property>
|
||||||
|
<property name="wrap">False</property>
|
||||||
<child>
|
<property name="selectable">False</property>
|
||||||
<widget class="GtkLabel" id="title">
|
<property name="xalign">0.5</property>
|
||||||
<property name="visible">True</property>
|
<property name="yalign">0.5</property>
|
||||||
<property name="label" translatable="yes"></property>
|
<property name="xpad">0</property>
|
||||||
<property name="use_underline">False</property>
|
<property name="ypad">6</property>
|
||||||
<property name="use_markup">False</property>
|
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||||
<property name="justify">GTK_JUSTIFY_CENTER</property>
|
<property name="width_chars">-1</property>
|
||||||
<property name="wrap">False</property>
|
<property name="single_line_mode">False</property>
|
||||||
<property name="selectable">False</property>
|
<property name="angle">0</property>
|
||||||
<property name="xalign">0.5</property>
|
</object>
|
||||||
<property name="yalign">0.5</property>
|
<packing>
|
||||||
<property name="xpad">0</property>
|
<property name="padding">5</property>
|
||||||
<property name="ypad">6</property>
|
<property name="expand">False</property>
|
||||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
<property name="fill">False</property>
|
||||||
<property name="width_chars">-1</property>
|
</packing>
|
||||||
<property name="single_line_mode">False</property>
|
</child>
|
||||||
<property name="angle">0</property>
|
<child>
|
||||||
</widget>
|
<object class="GtkScrolledWindow" id="scrolledwindow3">
|
||||||
<packing>
|
<property name="visible">True</property>
|
||||||
<property name="padding">5</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="expand">False</property>
|
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||||
<property name="fill">False</property>
|
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||||
</packing>
|
<property name="shadow_type">GTK_SHADOW_IN</property>
|
||||||
</child>
|
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
|
||||||
|
<child>
|
||||||
<child>
|
<object class="GtkTreeView" id="peopleList">
|
||||||
<widget class="GtkScrolledWindow" id="scrolledwindow3">
|
<property name="visible">True</property>
|
||||||
<property name="visible">True</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="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
<property name="headers_visible">True</property>
|
||||||
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
<property name="rules_hint">True</property>
|
||||||
<property name="shadow_type">GTK_SHADOW_IN</property>
|
<property name="reorderable">False</property>
|
||||||
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
|
<property name="enable_search">True</property>
|
||||||
|
<property name="fixed_height_mode">False</property>
|
||||||
<child>
|
<property name="hover_selection">False</property>
|
||||||
<widget class="GtkTreeView" id="peopleList">
|
<property name="hover_expand">False</property>
|
||||||
<property name="visible">True</property>
|
</object>
|
||||||
<property name="tooltip" translatable="yes">Select a person to determine the relationship</property>
|
</child>
|
||||||
<property name="can_focus">True</property>
|
</object>
|
||||||
<property name="headers_visible">True</property>
|
<packing>
|
||||||
<property name="rules_hint">True</property>
|
<property name="padding">0</property>
|
||||||
<property name="reorderable">False</property>
|
<property name="expand">True</property>
|
||||||
<property name="enable_search">True</property>
|
<property name="fill">True</property>
|
||||||
<property name="fixed_height_mode">False</property>
|
</packing>
|
||||||
<property name="hover_selection">False</property>
|
</child>
|
||||||
<property name="hover_expand">False</property>
|
<child>
|
||||||
</widget>
|
<object class="GtkScrolledWindow" id="scrolledwindow2">
|
||||||
</child>
|
<property name="visible">True</property>
|
||||||
</widget>
|
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||||
<packing>
|
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||||
<property name="padding">0</property>
|
<property name="shadow_type">GTK_SHADOW_IN</property>
|
||||||
<property name="expand">True</property>
|
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
|
||||||
<property name="fill">True</property>
|
<child>
|
||||||
</packing>
|
<object class="GtkTextView" id="text1">
|
||||||
</child>
|
<property name="height_request">75</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
<child>
|
<property name="can_focus">True</property>
|
||||||
<widget class="GtkScrolledWindow" id="scrolledwindow2">
|
<property name="editable">False</property>
|
||||||
<property name="visible">True</property>
|
<property name="overwrite">False</property>
|
||||||
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
<property name="accepts_tab">True</property>
|
||||||
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
<property name="justification">GTK_JUSTIFY_LEFT</property>
|
||||||
<property name="shadow_type">GTK_SHADOW_IN</property>
|
<property name="wrap_mode">GTK_WRAP_WORD</property>
|
||||||
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
|
<property name="cursor_visible">True</property>
|
||||||
|
<property name="pixels_above_lines">0</property>
|
||||||
<child>
|
<property name="pixels_below_lines">0</property>
|
||||||
<widget class="GtkTextView" id="text1">
|
<property name="pixels_inside_wrap">0</property>
|
||||||
<property name="height_request">75</property>
|
<property name="left_margin">0</property>
|
||||||
<property name="visible">True</property>
|
<property name="right_margin">0</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="indent">0</property>
|
||||||
<property name="editable">False</property>
|
</object>
|
||||||
<property name="overwrite">False</property>
|
</child>
|
||||||
<property name="accepts_tab">True</property>
|
</object>
|
||||||
<property name="justification">GTK_JUSTIFY_LEFT</property>
|
<packing>
|
||||||
<property name="wrap_mode">GTK_WRAP_WORD</property>
|
<property name="padding">0</property>
|
||||||
<property name="cursor_visible">True</property>
|
<property name="expand">False</property>
|
||||||
<property name="pixels_above_lines">0</property>
|
<property name="fill">True</property>
|
||||||
<property name="pixels_below_lines">0</property>
|
</packing>
|
||||||
<property name="pixels_inside_wrap">0</property>
|
</child>
|
||||||
<property name="left_margin">0</property>
|
</object>
|
||||||
<property name="right_margin">0</property>
|
<packing>
|
||||||
<property name="indent">0</property>
|
<property name="padding">0</property>
|
||||||
<property name="text" translatable="yes"></property>
|
<property name="expand">True</property>
|
||||||
</widget>
|
<property name="fill">True</property>
|
||||||
</child>
|
</packing>
|
||||||
</widget>
|
</child>
|
||||||
<packing>
|
</object>
|
||||||
<property name="padding">0</property>
|
</child>
|
||||||
<property name="expand">False</property>
|
<action-widgets>
|
||||||
<property name="fill">True</property>
|
<action-widget response="0">button5</action-widget>
|
||||||
</packing>
|
</action-widgets>
|
||||||
</child>
|
</object>
|
||||||
</widget>
|
</interface>
|
||||||
<packing>
|
|
||||||
<property name="padding">0</property>
|
|
||||||
<property name="expand">True</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
</widget>
|
|
||||||
</child>
|
|
||||||
</widget>
|
|
||||||
|
|
||||||
</glade-interface>
|
|
||||||
|
Loading…
Reference in New Issue
Block a user