PHPGedView.py: convert to use gtkbuilder instead of libglade

svn: r12420
This commit is contained in:
Gerald Britton 2009-04-09 19:37:06 +00:00
parent eec911dc0d
commit 6834c7a68d
2 changed files with 346 additions and 346 deletions

View File

@ -26,7 +26,6 @@
import httplib import httplib
import urllib2 import urllib2
import gtk import gtk
from gtk import glade
import os import os
from tempfile import mkstemp from tempfile import mkstemp
from gettext import gettext as _ from gettext import gettext as _
@ -280,22 +279,24 @@ class phpGedViewImporter:
self.url = None self.url = None
self.connector = None self.connector = None
glade_file = "%s/phpgedview.glade" % os.path.dirname(__file__) base = os.path.dirname(__file__)
top = glade.XML(glade_file,'importer','gramps') glade_file = os.path.join(base, "phpgedview.glade")
self.url_entry = top.get_widget('url_entry') top = gtk.Builder()
self.version_label = top.get_widget('version_label') top.add_from_file(glade_file)
self.url_entry = top.get_object('url_entry')
self.version_label = top.get_object('version_label')
self.version_label.set_text("") self.version_label.set_text("")
self.file_combo = top.get_widget('file_combo') self.file_combo = top.get_object('file_combo')
self.file_combo.hide() self.file_combo.hide()
self.username_entry = top.get_widget('username_entry') self.username_entry = top.get_object('username_entry')
self.username_entry.hide() self.username_entry.hide()
self.password_entry = top.get_widget('password_entry') self.password_entry = top.get_object('password_entry')
self.password_entry.hide() self.password_entry.hide()
self.ok_button = top.get_widget('ok_button') self.ok_button = top.get_object('ok_button')
self.ok_button.connect("activate", self.on_next_pressed_cb) self.ok_button.connect("activate", self.on_next_pressed_cb)
self.ok_button.connect("button_release_event", self.on_next_pressed_cb) self.ok_button.connect("button_release_event", self.on_next_pressed_cb)
self.progressbar = top.get_widget('progressbar') self.progressbar = top.get_object('progressbar')
self.dialog = top.get_widget('importer') self.dialog = top.get_object('importer')
self.dialog.show() self.dialog.show()
def filter_url(self, url): def filter_url(self, url):

View File

@ -1,335 +1,334 @@
<?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="GtkListStore" id="model1">
<columns>
<widget class="GtkDialog" id="importer"> <column type="gchararray"/>
<property name="visible">True</property> </columns>
<property name="title" translatable="yes">phpGedView import</property> <data>
<property name="type">GTK_WINDOW_TOPLEVEL</property> <row>
<property name="window_position">GTK_WIN_POS_MOUSE</property> <col id="0" translatable="yes">- default -</col>
<property name="modal">False</property> </row>
<property name="resizable">True</property> </data>
<property name="destroy_with_parent">True</property> </object>
<property name="decorated">True</property> <object class="GtkDialog" id="importer">
<property name="skip_taskbar_hint">False</property> <property name="visible">True</property>
<property name="skip_pager_hint">False</property> <property name="title" translatable="yes">phpGedView import</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property> <property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property> <property name="window_position">GTK_WIN_POS_MOUSE</property>
<property name="has_separator">True</property> <property name="modal">False</property>
<property name="resizable">True</property>
<child internal-child="vbox"> <property name="destroy_with_parent">True</property>
<widget class="GtkVBox" id="vbox1"> <property name="decorated">True</property>
<property name="visible">True</property> <property name="skip_taskbar_hint">False</property>
<property name="homogeneous">False</property> <property name="skip_pager_hint">False</property>
<property name="spacing">0</property> <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<child internal-child="action_area"> <property name="has_separator">True</property>
<widget class="GtkHButtonBox" id="hbuttonbox1"> <child internal-child="vbox">
<property name="visible">True</property> <object class="GtkVBox" id="vbox1">
<property name="layout_style">GTK_BUTTONBOX_END</property> <property name="visible">True</property>
<property name="homogeneous">False</property>
<child> <property name="spacing">0</property>
<widget class="GtkButton" id="button1"> <child internal-child="action_area">
<property name="visible">True</property> <object class="GtkHButtonBox" id="hbuttonbox1">
<property name="can_default">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="layout_style">GTK_BUTTONBOX_END</property>
<property name="label">gtk-cancel</property> <child>
<property name="use_stock">True</property> <object class="GtkButton" id="button1">
<property name="relief">GTK_RELIEF_NORMAL</property> <property name="visible">True</property>
<property name="focus_on_click">True</property> <property name="can_default">True</property>
<property name="response_id">-6</property> <property name="can_focus">True</property>
</widget> <property name="label">gtk-cancel</property>
</child> <property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<child> <property name="focus_on_click">True</property>
<widget class="GtkButton" id="ok_button"> </object>
<property name="visible">True</property> </child>
<property name="can_default">True</property> <child>
<property name="can_focus">True</property> <object class="GtkButton" id="ok_button">
<property name="label">gtk-apply</property> <property name="visible">True</property>
<property name="use_stock">True</property> <property name="can_default">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property> <property name="can_focus">True</property>
<property name="focus_on_click">True</property> <property name="label">gtk-apply</property>
<property name="response_id">-10</property> <property name="use_stock">True</property>
<signal name="activate" handler="on_ok_button_activate" last_modification_time="Fri, 29 Apr 2005 08:40:12 GMT"/> <property name="relief">GTK_RELIEF_NORMAL</property>
</widget> <property name="focus_on_click">True</property>
</child> <signal handler="on_ok_button_activate" last_modification_time="Fri, 29 Apr 2005 08:40:12 GMT" name="activate"/>
</widget> </object>
<packing> </child>
<property name="padding">0</property> </object>
<property name="expand">False</property> <packing>
<property name="fill">True</property> <property name="padding">0</property>
<property name="pack_type">GTK_PACK_END</property> <property name="expand">False</property>
</packing> <property name="fill">True</property>
</child> <property name="pack_type">GTK_PACK_END</property>
</packing>
<child> </child>
<widget class="GtkTable" id="table2"> <child>
<property name="border_width">12</property> <object class="GtkTable" id="table2">
<property name="visible">True</property> <property name="border_width">12</property>
<property name="n_rows">7</property> <property name="visible">True</property>
<property name="n_columns">2</property> <property name="n_rows">7</property>
<property name="homogeneous">False</property> <property name="n_columns">2</property>
<property name="row_spacing">9</property> <property name="homogeneous">False</property>
<property name="column_spacing">9</property> <property name="row_spacing">9</property>
<property name="column_spacing">9</property>
<child> <child>
<widget class="GtkLabel" id="label8"> <object class="GtkLabel" id="label8">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;phpGedView import&lt;/b&gt;</property> <property name="label" translatable="yes">&lt;b&gt;phpGedView import&lt;/b&gt;</property>
<property name="use_underline">False</property> <property name="use_underline">False</property>
<property name="use_markup">True</property> <property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_CENTER</property> <property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">False</property> <property name="wrap">False</property>
<property name="selectable">False</property> <property name="selectable">False</property>
<property name="xalign">0.5</property> <property name="xalign">0.5</property>
<property name="yalign">0.5</property> <property name="yalign">0.5</property>
<property name="xpad">0</property> <property name="xpad">0</property>
<property name="ypad">0</property> <property name="ypad">0</property>
</widget> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
<property name="right_attach">2</property> <property name="right_attach">2</property>
<property name="top_attach">0</property> <property name="top_attach">0</property>
<property name="bottom_attach">1</property> <property name="bottom_attach">1</property>
<property name="x_options">fill</property> <property name="x_options">fill</property>
<property name="y_options"></property> <property name="y_options"/>
</packing> </packing>
</child> </child>
<child>
<child> <object class="GtkEntry" id="url_entry">
<widget class="GtkEntry" id="url_entry"> <property name="visible">True</property>
<property name="visible">True</property> <property name="can_focus">True</property>
<property name="can_focus">True</property> <property name="editable">True</property>
<property name="editable">True</property> <property name="visibility">True</property>
<property name="visibility">True</property> <property name="max_length">0</property>
<property name="max_length">0</property> <property name="text" translatable="yes">http://</property>
<property name="text" translatable="yes">http://</property> <property name="has_frame">True</property>
<property name="has_frame">True</property> <property name="invisible_char">*</property>
<property name="invisible_char">*</property> <property name="activates_default">False</property>
<property name="activates_default">False</property> <property name="width_chars">25</property>
<property name="width_chars">25</property> </object>
</widget> <packing>
<packing> <property name="left_attach">1</property>
<property name="left_attach">1</property> <property name="right_attach">2</property>
<property name="right_attach">2</property> <property name="top_attach">1</property>
<property name="top_attach">1</property> <property name="bottom_attach">2</property>
<property name="bottom_attach">2</property> <property name="y_options"/>
<property name="y_options"></property> </packing>
</packing> </child>
</child> <child>
<object class="GtkEntry" id="username_entry">
<child> <property name="visible">True</property>
<widget class="GtkEntry" id="username_entry"> <property name="can_focus">True</property>
<property name="visible">True</property> <property name="editable">False</property>
<property name="can_focus">True</property> <property name="visibility">True</property>
<property name="editable">False</property> <property name="max_length">0</property>
<property name="visibility">True</property> <property name="text" translatable="yes"/>
<property name="max_length">0</property> <property name="has_frame">True</property>
<property name="text" translatable="yes"></property> <property name="invisible_char">*</property>
<property name="has_frame">True</property> <property name="activates_default">False</property>
<property name="invisible_char">*</property> </object>
<property name="activates_default">False</property> <packing>
</widget> <property name="left_attach">1</property>
<packing> <property name="right_attach">2</property>
<property name="left_attach">1</property> <property name="top_attach">4</property>
<property name="right_attach">2</property> <property name="bottom_attach">5</property>
<property name="top_attach">4</property> <property name="x_options">fill</property>
<property name="bottom_attach">5</property> <property name="y_options"/>
<property name="x_options">fill</property> </packing>
<property name="y_options"></property> </child>
</packing> <child>
</child> <object class="GtkEntry" id="password_entry">
<property name="visible">True</property>
<child> <property name="can_focus">True</property>
<widget class="GtkEntry" id="password_entry"> <property name="editable">False</property>
<property name="visible">True</property> <property name="visibility">False</property>
<property name="can_focus">True</property> <property name="max_length">0</property>
<property name="editable">False</property> <property name="text" translatable="yes"/>
<property name="visibility">False</property> <property name="has_frame">True</property>
<property name="max_length">0</property> <property name="invisible_char">*</property>
<property name="text" translatable="yes"></property> <property name="activates_default">False</property>
<property name="has_frame">True</property> </object>
<property name="invisible_char">*</property> <packing>
<property name="activates_default">False</property> <property name="left_attach">1</property>
</widget> <property name="right_attach">2</property>
<packing> <property name="top_attach">5</property>
<property name="left_attach">1</property> <property name="bottom_attach">6</property>
<property name="right_attach">2</property> <property name="x_options">fill</property>
<property name="top_attach">5</property> <property name="y_options"/>
<property name="bottom_attach">6</property> </packing>
<property name="x_options">fill</property> </child>
<property name="y_options"></property> <child>
</packing> <object class="GtkComboBox" id="file_combo">
</child> <property name="visible">True</property>
<property name="model">model1</property>
<child> <child>
<widget class="GtkComboBox" id="file_combo"> <object class="GtkCellRendererText" id="renderer1"/>
<property name="visible">True</property> <attributes>
<property name="items" translatable="yes">- default -</property> <attribute name="text">0</attribute>
</widget> </attributes>
<packing> </child>
<property name="left_attach">1</property> </object>
<property name="right_attach">2</property> <packing>
<property name="top_attach">3</property> <property name="left_attach">1</property>
<property name="bottom_attach">4</property> <property name="right_attach">2</property>
<property name="x_options">fill</property> <property name="top_attach">3</property>
<property name="y_options">fill</property> <property name="bottom_attach">4</property>
</packing> <property name="x_options">fill</property>
</child> <property name="y_options">fill</property>
</packing>
<child> </child>
<widget class="GtkLabel" id="label10"> <child>
<property name="visible">True</property> <object class="GtkLabel" id="label10">
<property name="label" translatable="yes">File:</property> <property name="visible">True</property>
<property name="use_underline">False</property> <property name="label" translatable="yes">File:</property>
<property name="use_markup">False</property> <property name="use_underline">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property> <property name="use_markup">False</property>
<property name="wrap">False</property> <property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="selectable">False</property> <property name="wrap">False</property>
<property name="xalign">0</property> <property name="selectable">False</property>
<property name="yalign">0.5</property> <property name="xalign">0</property>
<property name="xpad">0</property> <property name="yalign">0.5</property>
<property name="ypad">0</property> <property name="xpad">0</property>
</widget> <property name="ypad">0</property>
<packing> </object>
<property name="left_attach">0</property> <packing>
<property name="right_attach">1</property> <property name="left_attach">0</property>
<property name="top_attach">3</property> <property name="right_attach">1</property>
<property name="bottom_attach">4</property> <property name="top_attach">3</property>
<property name="y_padding">7</property> <property name="bottom_attach">4</property>
<property name="x_options">fill</property> <property name="y_padding">7</property>
<property name="y_options"></property> <property name="x_options">fill</property>
</packing> <property name="y_options"/>
</child> </packing>
</child>
<child> <child>
<widget class="GtkLabel" id="label11"> <object class="GtkLabel" id="label11">
<property name="visible">True</property> <property name="visible">True</property>
<property name="label" translatable="yes">Username:</property> <property name="label" translatable="yes">Username:</property>
<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_LEFT</property> <property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property> <property name="wrap">False</property>
<property name="selectable">False</property> <property name="selectable">False</property>
<property name="xalign">0</property> <property name="xalign">0</property>
<property name="yalign">0.5</property> <property name="yalign">0.5</property>
<property name="xpad">0</property> <property name="xpad">0</property>
<property name="ypad">0</property> <property name="ypad">0</property>
</widget> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="left_attach">0</property>
<property name="right_attach">1</property> <property name="right_attach">1</property>
<property name="top_attach">4</property> <property name="top_attach">4</property>
<property name="bottom_attach">5</property> <property name="bottom_attach">5</property>
<property name="y_padding">7</property> <property name="y_padding">7</property>
<property name="x_options">fill</property> <property name="x_options">fill</property>
<property name="y_options"></property> <property name="y_options"/>
</packing> </packing>
</child> </child>
<child>
<child> <object class="GtkLabel" id="label12">
<widget class="GtkLabel" id="label12"> <property name="visible">True</property>
<property name="visible">True</property> <property name="label" translatable="yes">Password:</property>
<property name="label" translatable="yes">Password:</property> <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_LEFT</property>
<property name="justify">GTK_JUSTIFY_LEFT</property> <property name="wrap">False</property>
<property name="wrap">False</property> <property name="selectable">False</property>
<property name="selectable">False</property> <property name="xalign">0</property>
<property name="xalign">0</property> <property name="yalign">0.5</property>
<property name="yalign">0.5</property> <property name="xpad">0</property>
<property name="xpad">0</property> <property name="ypad">0</property>
<property name="ypad">0</property> </object>
</widget> <packing>
<packing> <property name="left_attach">0</property>
<property name="left_attach">0</property> <property name="right_attach">1</property>
<property name="right_attach">1</property> <property name="top_attach">5</property>
<property name="top_attach">5</property> <property name="bottom_attach">6</property>
<property name="bottom_attach">6</property> <property name="y_padding">7</property>
<property name="y_padding">7</property> <property name="x_options">fill</property>
<property name="x_options">fill</property> <property name="y_options"/>
<property name="y_options"></property> </packing>
</packing> </child>
</child> <child>
<object class="GtkLabel" id="version_label">
<child> <property name="visible">True</property>
<widget class="GtkLabel" id="version_label"> <property name="label" translatable="yes"/>
<property name="visible">True</property> <property name="use_underline">False</property>
<property name="label" translatable="yes"></property> <property name="use_markup">False</property>
<property name="use_underline">False</property> <property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="use_markup">False</property> <property name="wrap">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property> <property name="selectable">False</property>
<property name="wrap">False</property> <property name="xalign">0</property>
<property name="selectable">False</property> <property name="yalign">0.5</property>
<property name="xalign">0</property> <property name="xpad">0</property>
<property name="yalign">0.5</property> <property name="ypad">0</property>
<property name="xpad">0</property> </object>
<property name="ypad">0</property> <packing>
</widget> <property name="left_attach">0</property>
<packing> <property name="right_attach">2</property>
<property name="left_attach">0</property> <property name="top_attach">2</property>
<property name="right_attach">2</property> <property name="bottom_attach">3</property>
<property name="top_attach">2</property> <property name="y_padding">7</property>
<property name="bottom_attach">3</property> <property name="x_options">fill</property>
<property name="y_padding">7</property> <property name="y_options"/>
<property name="x_options">fill</property> </packing>
<property name="y_options"></property> </child>
</packing> <child>
</child> <object class="GtkLabel" id="label7">
<property name="visible">True</property>
<child> <property name="label" translatable="yes">URL:</property>
<widget class="GtkLabel" id="label7"> <property name="use_underline">False</property>
<property name="visible">True</property> <property name="use_markup">False</property>
<property name="label" translatable="yes">URL:</property> <property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="use_underline">False</property> <property name="wrap">False</property>
<property name="use_markup">False</property> <property name="selectable">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property> <property name="xalign">0</property>
<property name="wrap">False</property> <property name="yalign">0.5</property>
<property name="selectable">False</property> <property name="xpad">0</property>
<property name="xalign">0</property> <property name="ypad">0</property>
<property name="yalign">0.5</property> </object>
<property name="xpad">0</property> <packing>
<property name="ypad">0</property> <property name="left_attach">0</property>
</widget> <property name="right_attach">1</property>
<packing> <property name="top_attach">1</property>
<property name="left_attach">0</property> <property name="bottom_attach">2</property>
<property name="right_attach">1</property> <property name="y_padding">7</property>
<property name="top_attach">1</property> <property name="x_options">fill</property>
<property name="bottom_attach">2</property> <property name="y_options"/>
<property name="y_padding">7</property> </packing>
<property name="x_options">fill</property> </child>
<property name="y_options"></property> <child>
</packing> <object class="GtkProgressBar" id="progressbar">
</child> <property name="visible">True</property>
<property name="orientation">GTK_PROGRESS_LEFT_TO_RIGHT</property>
<child> <property name="fraction">0</property>
<widget class="GtkProgressBar" id="progressbar"> <property name="pulse_step">0.10000000149</property>
<property name="visible">True</property> <property name="text" translatable="yes"/>
<property name="orientation">GTK_PROGRESS_LEFT_TO_RIGHT</property> </object>
<property name="fraction">0</property> <packing>
<property name="pulse_step">0.10000000149</property> <property name="left_attach">1</property>
<property name="text" translatable="yes"></property> <property name="right_attach">2</property>
</widget> <property name="top_attach">6</property>
<packing> <property name="bottom_attach">7</property>
<property name="left_attach">1</property> <property name="x_options">fill</property>
<property name="right_attach">2</property> <property name="y_options"/>
<property name="top_attach">6</property> </packing>
<property name="bottom_attach">7</property> </child>
<property name="x_options">fill</property> </object>
<property name="y_options"></property> <packing>
</packing> <property name="padding">5</property>
</child> <property name="expand">True</property>
</widget> <property name="fill">True</property>
<packing> </packing>
<property name="padding">5</property> </child>
<property name="expand">True</property> </object>
<property name="fill">True</property> </child>
</packing> <action-widgets>
</child> <action-widget response="-6">button1</action-widget>
</widget> <action-widget response="-10">ok_button</action-widget>
</child> </action-widgets>
</widget> </object>
</interface>
</glade-interface>