Bug 2888: Export plugins - convert from libglade to gtkbuilder

svn: r12456
This commit is contained in:
Gerald Britton 2009-04-16 19:29:40 +00:00
parent f2d12e5c89
commit 29ff457d25
12 changed files with 1362 additions and 1476 deletions

View File

@ -68,8 +68,13 @@ def build_filter_model(space, local = [], default=""):
model = gtk.ListStore(gobject.TYPE_STRING, object)
flist = local + SystemFilters.get_filters(space) + \
CustomFilters.get_filters(space)
if isinstance(space, basestring):
flist = local + SystemFilters.get_filters(space) + \
CustomFilters.get_filters(space)
elif isinstance(space, (list, tuple)):
flist = space
else:
return None
for filt in flist:
model.append(row=[filt.get_name(), filt])

View File

@ -1,355 +1,302 @@
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
<glade-interface>
<requires lib="gnome"/>
<widget class="GtkDialog" id="csvExport">
<property name="visible">True</property>
<property name="title" translatable="yes"></property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">True</property>
<property name="default_width">400</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
<property name="urgency_hint">False</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">8</property>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="cancel">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-cancel</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">0</property>
<signal name="clicked" handler="destroy_passed_object" object="gedcomExport"/>
</widget>
</child>
<child>
<widget class="GtkButton" id="ok">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-ok</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">0</property>
<signal name="clicked" handler="on_ok_clicked" object="gedcomExport"/>
</widget>
</child>
<child>
<widget class="GtkButton" id="button1">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-help</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-11</property>
<signal name="clicked" handler="on_help_clicked" last_modification_time="Tue, 02 Dec 2003 01:53:26 GMT"/>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">False</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkEventBox" id="eventbox1">
<property name="visible">True</property>
<property name="visible_window">True</property>
<property name="above_child">False</property>
<child>
<widget class="GtkTable" id="table3">
<property name="border_width">12</property>
<property name="visible">True</property>
<property name="n_rows">4</property>
<property name="n_columns">3</property>
<property name="homogeneous">False</property>
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<child>
<widget class="GtkLabel" id="label9">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Options&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">3</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="label" translatable="yes">Filt_er:</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">filter</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkOptionMenu" id="filter">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="history">-1</property>
<child internal-child="menu">
<widget class="GtkMenu" id="convertwidget1">
<property name="visible">True</property>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkTable" id="table4">
<property name="visible">True</property>
<property name="n_rows">5</property>
<property name="n_columns">2</property>
<property name="homogeneous">False</property>
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<child>
<widget class="GtkCheckButton" id="marriages">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">_Marriages</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">True</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="children">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Chil_dren</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">True</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="individuals">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">I_ndividuals</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">True</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkDrawingArea" id="drawingarea1">
<property name="visible">True</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">shrink|fill</property>
<property name="y_options">fill</property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="translate_headers">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Translate _Headers</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">True</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">3</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">fill</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label10">
<property name="visible">True</property>
<property name="label" translatable="yes">Export:</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">filter</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">3</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>
<?xml version="1.0"?>
<interface>
<requires lib="gtk+" version="2.16"/>
<!-- interface-naming-policy toplevel-contextual -->
<object class="GtkDialog" id="csvExport">
<property name="visible">True</property>
<property name="modal">True</property>
<property name="default_width">400</property>
<property name="type_hint">dialog</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>
<property name="spacing">8</property>
<child>
<object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<child>
<object class="GtkEventBox" id="eventbox1">
<property name="visible">True</property>
<child>
<object class="GtkTable" id="table3">
<property name="visible">True</property>
<property name="border_width">12</property>
<property name="n_rows">4</property>
<property name="n_columns">3</property>
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
<child>
<object class="GtkLabel" id="label9">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">&lt;b&gt;Options&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
<packing>
<property name="right_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Filt_er:</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkTable" id="table4">
<property name="visible">True</property>
<property name="n_rows">5</property>
<property name="n_columns">2</property>
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
<child>
<object class="GtkCheckButton" id="marriages">
<property name="label" translatable="yes">_Marriages</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="children">
<property name="label" translatable="yes">Chil_dren</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="individuals">
<property name="label" translatable="yes">I_ndividuals</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkDrawingArea" id="drawingarea1">
<property name="visible">True</property>
</object>
<packing>
<property name="x_options">GTK_SHRINK | GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="translate_headers">
<property name="label" translatable="yes">Translate _Headers</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">3</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label10">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Export:</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">3</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="filter">
<property name="visible">True</property>
<property name="model">liststore1</property>
<child>
<object class="GtkCellRendererText" id="cellrenderertext1"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
<child internal-child="action_area">
<object class="GtkHButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="cancel">
<property name="label">gtk-cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="destroy_passed_object" object="gedcomExport"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="ok">
<property name="label">gtk-ok</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_ok_clicked" object="gedcomExport"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="button1">
<property name="label">gtk-help</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_help_clicked"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="fill">False</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
</object>
</child>
<action-widgets>
<action-widget response="0">cancel</action-widget>
<action-widget response="0">ok</action-widget>
<action-widget response="-11">button1</action-widget>
</action-widgets>
</object>
<object class="GtkListStore" id="liststore1">
<columns>
<!-- column-name gchararray1 -->
<column type="gchararray"/>
</columns>
</object>
</interface>

View File

@ -39,7 +39,7 @@ import codecs
# GNOME/GTK modules
#
#-------------------------------------------------------------------------
from gtk import glade
import gtk
#------------------------------------------------------------------------
#
@ -55,13 +55,20 @@ log = logging.getLogger(".ExportCSV")
#
#-------------------------------------------------------------------------
import gen.lib
from Filters import GenericFilter, Rules, build_filter_menu
from Filters import GenericFilter, Rules, build_filter_model
import Utils
from QuestionDialog import ErrorDialog
from gen.plug import PluginManager, ExportPlugin
import gen.proxy
import DateHandler
#-------------------------------------------------------------------------
#
# Constants
#
#-------------------------------------------------------------------------
_GLADE_FILE = "ExportCsv.glade"
#-------------------------------------------------------------------------
#
# The function that does the exporting
@ -172,10 +179,13 @@ class CSVWriterOptionBox:
self.translate_headers = 1
def get_option_box(self):
glade_file = os.path.join(os.path.dirname(__file__), "ExportCsv.glade")
glade_file = os.path.join(
os.path.split(__file__)[0],
_GLADE_FILE)
self.topDialog = glade.XML(glade_file,"csvExport","gramps")
filter_obj = self.topDialog.get_widget("filter")
self.topDialog = gtk.Builder()
self.topDialog.add_from_file(glade_file)
self.filters = self.topDialog.get_object("filter")
all = GenericFilter()
all.set_name(_("Entire Database"))
@ -206,21 +216,22 @@ class CSVWriterOptionBox:
from Filters import CustomFilters
the_filters.extend(CustomFilters.get_filters('Person'))
self.filter_menu = build_filter_menu(the_filters)
filter_obj.set_menu(self.filter_menu)
self.filter_menu = build_filter_model(the_filters)
self.filters.set_model(self.filter_menu)
self.filters.set_active(0)
the_box = self.topDialog.get_widget('vbox1')
the_parent = self.topDialog.get_widget('dialog-vbox1')
the_box = self.topDialog.get_object('vbox1')
the_parent = self.topDialog.get_object('dialog-vbox1')
the_parent.remove(the_box)
self.topDialog.get_widget("csvExport").destroy()
self.topDialog.get_object("csvExport").destroy()
return the_box
def parse_options(self):
self.include_individuals = self.topDialog.get_widget("individuals").get_active()
self.include_marriages = self.topDialog.get_widget("marriages").get_active()
self.include_children = self.topDialog.get_widget("children").get_active()
self.translate_headers = self.topDialog.get_widget("translate_headers").get_active()
self.cfilter = self.filter_menu.get_active().get_data("filter")
self.include_individuals = self.topDialog.get_object("individuals").get_active()
self.include_marriages = self.topDialog.get_object("marriages").get_active()
self.include_children = self.topDialog.get_object("children").get_active()
self.translate_headers = self.topDialog.get_object("translate_headers").get_active()
self.cfilter = self.filter_menu[self.filters.get_active()][1]
#-------------------------------------------------------------------------
#
@ -406,7 +417,9 @@ class CSVWriter:
family = self.db.get_family_from_handle(key)
if family:
marriage_id = family.get_gramps_id()
sortorder.append( (sortable_string_representation(marriage_id), key) )
sortorder.append(
(sortable_string_representation(marriage_id), key)
)
sortorder.sort() # will sort on tuples
flist = [data[1] for data in sortorder]
###########################

View File

@ -1,229 +1,194 @@
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
<glade-interface>
<widget class="GtkDialog" id="top">
<property name="visible">True</property>
<property name="title" translatable="yes"></property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">True</property>
<property name="default_width">480</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">8</property>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="cancel">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-cancel</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">0</property>
<signal name="clicked" handler="destroy_passed_object" object="gedcomExport"/>
</widget>
</child>
<child>
<widget class="GtkButton" id="ok">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-ok</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">0</property>
<signal name="clicked" handler="on_ok_clicked" object="gedcomExport"/>
</widget>
</child>
<child>
<widget class="GtkButton" id="button1">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-help</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-11</property>
<signal name="clicked" handler="on_help_clicked" last_modification_time="Tue, 02 Dec 2003 02:01:12 GMT"/>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkLabel" id="title">
<property name="visible">True</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">6</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkTable" id="table3">
<property name="border_width">12</property>
<property name="visible">True</property>
<property name="n_rows">3</property>
<property name="n_columns">3</property>
<property name="homogeneous">False</property>
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<child>
<widget class="GtkLabel" id="label9">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Options&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">3</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="label" translatable="yes">Filt_er:</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">filter</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">shrink|fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkOptionMenu" id="filter">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="history">-1</property>
<child internal-child="menu">
<widget class="GtkMenu" id="convertwidget1">
<property name="visible">True</property>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="restrict">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">_Restrict data on living people</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">True</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">3</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>
<?xml version="1.0"?>
<interface>
<requires lib="gtk+" version="2.16"/>
<!-- interface-naming-policy toplevel-contextual -->
<object class="GtkDialog" id="top">
<property name="visible">True</property>
<property name="modal">True</property>
<property name="default_width">480</property>
<property name="type_hint">dialog</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>
<property name="spacing">8</property>
<child>
<object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<child>
<object class="GtkLabel" id="title">
<property name="visible">True</property>
<property name="ypad">6</property>
<property name="justify">center</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkTable" id="table3">
<property name="visible">True</property>
<property name="border_width">12</property>
<property name="n_rows">3</property>
<property name="n_columns">3</property>
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
<child>
<object class="GtkLabel" id="label9">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">&lt;b&gt;Options&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
<packing>
<property name="right_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Filt_er:</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_SHRINK | GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="restrict">
<property name="label" translatable="yes">_Restrict data on living people</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">3</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="filter">
<property name="visible">True</property>
<property name="model">liststore1</property>
<child>
<object class="GtkCellRendererText" id="cellrenderertext1"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
<child internal-child="action_area">
<object class="GtkHButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="cancel">
<property name="label">gtk-cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="destroy_passed_object" object="gedcomExport"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="ok">
<property name="label">gtk-ok</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_ok_clicked" object="gedcomExport"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="button1">
<property name="label">gtk-help</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_help_clicked"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
</object>
</child>
<action-widgets>
<action-widget response="0">cancel</action-widget>
<action-widget response="0">ok</action-widget>
<action-widget response="-11">button1</action-widget>
</action-widgets>
</object>
<object class="GtkListStore" id="liststore1">
<columns>
<!-- column-name gchararray1 -->
<column type="gchararray"/>
</columns>
</object>
</interface>

View File

@ -44,7 +44,7 @@ log = logging.getLogger(".WriteFtree")
# GNOME/GTK modules
#
#-------------------------------------------------------------------------
from gtk import glade
import gtk
#-------------------------------------------------------------------------
#
@ -52,11 +52,18 @@ from gtk import glade
#
#-------------------------------------------------------------------------
import Utils
from Filters import GenericFilter, Rules, build_filter_menu
from Filters import GenericFilter, Rules, build_filter_model
import Errors
from QuestionDialog import ErrorDialog
from gen.plug import PluginManager, ExportPlugin
#-------------------------------------------------------------------------
#
# Constants
#
#-------------------------------------------------------------------------
_GLADE_FILE = "ExportFtree.glade"
#-------------------------------------------------------------------------
#
# writeData
@ -76,12 +83,14 @@ class FtreeWriterOptionBox:
self.restrict = True
def get_option_box(self):
glade_file = os.path.join(os.path.dirname(__file__),
"ExportFtree.glade")
glade_file = os.path.join(
os.path.split(__file__)[0],
_GLADE_FILE)
self.top = glade.XML(glade_file, "top", "gramps")
self.top = gtk.Builder()
self.top.add_from_file(glade_file)
filter_obj = self.top.get_widget("filter")
self.filters = self.top.get_object("filter")
all = GenericFilter()
all.set_name(_("Entire Database"))
@ -112,18 +121,19 @@ class FtreeWriterOptionBox:
from Filters import CustomFilters
the_filters.extend(CustomFilters.get_filters('Person'))
self.filter_menu = build_filter_menu(the_filters)
filter_obj.set_menu(self.filter_menu)
self.filter_menu = build_filter_model(the_filters)
self.filters.set_model(self.filter_menu)
self.filters.set_active(0)
the_box = self.top.get_widget("vbox1")
the_parent = self.top.get_widget('dialog-vbox1')
the_box = self.top.get_object("vbox1")
the_parent = self.top.get_object('dialog-vbox1')
the_parent.remove(the_box)
self.top.get_widget("top").destroy()
self.top.get_object("top").destroy()
return the_box
def parse_options(self):
self.restrict = self.top.get_widget("restrict").get_active()
self.cfilter = self.filter_menu.get_active().get_data("filter")
self.restrict = self.top.get_object("restrict").get_active()
self.cfilter = self.filter_menu[self.filters.get_active()][1]
#-------------------------------------------------------------------------
#
@ -156,7 +166,9 @@ class FtreeWriter:
self.plist[p] = 1
else:
try:
for p in self.option_box.cfilter.apply(self.db, self.db.get_person_handles(sort_handles=False)):
for p in self.option_box.cfilter.apply(
self.db, self.db.get_person_handles(sort_handles=False)
):
self.plist[p] = 1
except Errors.FilterError, msg:
(m1, m2) = msg.messages()
@ -191,10 +203,7 @@ class FtreeWriter:
pn = self.db.get_person_from_handle(key).get_primary_name()
sn = pn.get_surname()
items = pn.get_first_name().split()
if len(items) > 0:
n = "%s %s" % (items[0], sn)
else:
n = sn
n = ("%s %s" % (items[0], sn)) if items else sn
count = -1
if n in name_map:
@ -217,17 +226,16 @@ class FtreeWriter:
self.update()
p = self.db.get_person_from_handle(key)
name = id_name[key]
father = ""
mother = ""
email = ""
web = ""
father = mother = email = web = ""
family_handle = p.get_main_parents_family_handle()
if family_handle:
family = self.db.get_family_from_handle(family_handle)
if family.get_father_handle() and family.get_father_handle() in id_map:
if family.get_father_handle() and \
family.get_father_handle() in id_map:
father = id_map[family.get_father_handle()]
if family.get_mother_handle() and family.get_mother_handle() in id_map:
if family.get_mother_handle() and \
family.get_mother_handle() in id_map:
mother = id_map[family.get_mother_handle()]
#
@ -291,14 +299,17 @@ def get_name(name, count):
if (name.suffix == ""):
if name.prefix:
return "%s %s %s%s" % (name.first_name, name.prefix, name.surname, val)
return "%s %s %s%s" % (name.first_name, name.prefix,
name.surname, val)
else:
return "%s %s%s" % (name.first_name, name.surname, val)
else:
if name.prefix:
return "%s %s %s%s, %s" % (name.first_name, name.prefix, name.surname, val, name.suffix)
return "%s %s %s%s, %s" % (name.first_name, name.prefix,
name.surname, val, name.suffix)
else:
return "%s %s%s, %s" % (name.first_name, name.surname, val, name.suffix)
return "%s %s%s, %s" % (name.first_name,
name.surname, val, name.suffix)
#------------------------------------------------------------------------
#

View File

@ -1,386 +1,333 @@
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
<glade-interface>
<widget class="GtkDialog" id="genewebExport">
<property name="visible">True</property>
<property name="title" translatable="yes"></property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">True</property>
<property name="default_width">400</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">8</property>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="cancel">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-cancel</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">0</property>
<signal name="clicked" handler="destroy_passed_object" object="gedcomExport"/>
</widget>
</child>
<child>
<widget class="GtkButton" id="ok">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-ok</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">0</property>
<signal name="clicked" handler="on_ok_clicked" object="gedcomExport"/>
</widget>
</child>
<child>
<widget class="GtkButton" id="button1">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-help</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-11</property>
<signal name="clicked" handler="on_help_clicked" last_modification_time="Tue, 02 Dec 2003 01:53:26 GMT"/>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkTable" id="table3">
<property name="border_width">12</property>
<property name="visible">True</property>
<property name="n_rows">6</property>
<property name="n_columns">3</property>
<property name="homogeneous">False</property>
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<child>
<widget class="GtkLabel" id="label9">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Options&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">3</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="label" translatable="yes">Filt_er:</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">filter</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkOptionMenu" id="filter">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="history">-1</property>
<child internal-child="menu">
<widget class="GtkMenu" id="convertwidget1">
<property name="visible">True</property>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="private">
<property name="border_width">3</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">_Do not include records marked private</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">True</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">3</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="restrict">
<property name="border_width">3</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">_Restrict data on living people</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">True</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_restrict_toggled" last_modification_time="Tue, 22 Jul 2003 09:50:16 GMT"/>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">3</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkTable" id="table4">
<property name="visible">True</property>
<property name="n_rows">3</property>
<property name="n_columns">2</property>
<property name="homogeneous">False</property>
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<child>
<widget class="GtkCheckButton" id="notes">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Exclude _notes</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">True</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="sources">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Exclude _sources</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">True</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkCheckButton" id="living">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Use _Living as first name</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">True</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkDrawingArea" id="drawingarea1">
<property name="visible">True</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">shrink|fill</property>
<property name="y_options">fill</property>
</packing>
</child>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">3</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">fill</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox1">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkCheckButton" id="images">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Reference i_mages from path: </property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkEntry" id="images_path">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="editable">True</property>
<property name="visibility">True</property>
<property name="max_length">0</property>
<property name="text" translatable="yes">media</property>
<property name="has_frame">True</property>
<property name="invisible_char" translatable="yes">*</property>
<property name="activates_default">False</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">3</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">fill</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>
<?xml version="1.0"?>
<interface>
<requires lib="gtk+" version="2.16"/>
<!-- interface-naming-policy toplevel-contextual -->
<object class="GtkDialog" id="genewebExport">
<property name="visible">True</property>
<property name="modal">True</property>
<property name="default_width">400</property>
<property name="type_hint">dialog</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>
<property name="spacing">8</property>
<child>
<object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<child>
<object class="GtkTable" id="table3">
<property name="visible">True</property>
<property name="border_width">12</property>
<property name="n_rows">6</property>
<property name="n_columns">3</property>
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
<child>
<object class="GtkLabel" id="label9">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">&lt;b&gt;Options&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
<packing>
<property name="right_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Filt_er:</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="private">
<property name="label" translatable="yes">_Do not include records marked private</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="border_width">3</property>
<property name="use_underline">True</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">3</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="restrict">
<property name="label" translatable="yes">_Restrict data on living people</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="border_width">3</property>
<property name="use_underline">True</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_restrict_toggled"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">3</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkTable" id="table4">
<property name="visible">True</property>
<property name="n_rows">3</property>
<property name="n_columns">2</property>
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
<child>
<object class="GtkCheckButton" id="notes">
<property name="label" translatable="yes">Exclude _notes</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="sources">
<property name="label" translatable="yes">Exclude _sources</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="living">
<property name="label" translatable="yes">Use _Living as first name</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkDrawingArea" id="drawingarea1">
<property name="visible">True</property>
</object>
<packing>
<property name="x_options">GTK_SHRINK | GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">3</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox1">
<property name="visible">True</property>
<child>
<object class="GtkCheckButton" id="images">
<property name="label" translatable="yes">Reference i_mages from path: </property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="images_path">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="text" translatable="yes">media</property>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">3</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="filter">
<property name="visible">True</property>
<property name="model">liststore1</property>
<child>
<object class="GtkCellRendererText" id="cellrenderertext1"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
<child internal-child="action_area">
<object class="GtkHButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="cancel">
<property name="label">gtk-cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="destroy_passed_object" object="gedcomExport"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="ok">
<property name="label">gtk-ok</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_ok_clicked" object="gedcomExport"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="button1">
<property name="label">gtk-help</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_help_clicked"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
</object>
</child>
<action-widgets>
<action-widget response="0">cancel</action-widget>
<action-widget response="0">ok</action-widget>
<action-widget response="-11">button1</action-widget>
</action-widgets>
</object>
<object class="GtkListStore" id="liststore1"/>
</interface>

View File

@ -37,7 +37,7 @@ from gettext import gettext as _
# GNOME/GTK modules
#
#-------------------------------------------------------------------------
from gtk import glade
import gtk
#------------------------------------------------------------------------
#
@ -53,12 +53,19 @@ log = logging.getLogger(".WriteGeneWeb")
#
#-------------------------------------------------------------------------
import gen.lib
from Filters import GenericFilter, Rules, build_filter_menu
from Filters import GenericFilter, Rules, build_filter_model
#import const
import Utils
from QuestionDialog import ErrorDialog
from gen.plug import PluginManager, ExportPlugin
#-------------------------------------------------------------------------
#
# Constants
#
#-------------------------------------------------------------------------
_GLADE_FILE = "ExportGeneWeb.glade"
#-------------------------------------------------------------------------
#
#
@ -77,15 +84,17 @@ class GeneWebWriterOptionBox:
self.restrict = 1
self.private = 1
glade_file = os.path.join(os.path.dirname(__file__),
"ExportGeneWeb.glade")
self.topDialog = glade.XML(glade_file, "genewebExport", "gramps")
self.topDialog.signal_autoconnect({
glade_file = os.path.join(
os.path.split(__file__)[0],
_GLADE_FILE)
self.topDialog = gtk.Builder()
self.topDialog.add_from_file(glade_file)
self.topDialog.connect_signals({
"on_restrict_toggled": self.on_restrict_toggled
})
filter_obj = self.topDialog.get_widget("filter")
self.filters = self.topDialog.get_object("filter")
self.copy = 0
all = GenericFilter()
@ -117,37 +126,38 @@ class GeneWebWriterOptionBox:
from Filters import CustomFilters
the_filters.extend(CustomFilters.get_filters('Person'))
self.filter_menu = build_filter_menu(the_filters)
filter_obj.set_menu(self.filter_menu)
self.filter_menu = build_filter_model(the_filters)
self.filters.set_model(self.filter_menu)
self.filters.set_active(0)
the_box = self.topDialog.get_widget('vbox1')
the_parent = self.topDialog.get_widget('dialog-vbox1')
the_box = self.topDialog.get_object('vbox1')
the_parent = self.topDialog.get_object('dialog-vbox1')
the_parent.remove(the_box)
self.topDialog.get_widget("genewebExport").destroy()
self.topDialog.get_object("genewebExport").destroy()
return the_box
def on_restrict_toggled(self, restrict):
active = restrict.get_active ()
for x in [self.topDialog.get_widget("living"),
self.topDialog.get_widget("notes"),
self.topDialog.get_widget("sources")]:
for x in [self.topDialog.get_object("living"),
self.topDialog.get_object("notes"),
self.topDialog.get_object("sources")]:
x.set_sensitive(active)
def parse_options(self):
self.restrict = self.topDialog.get_widget("restrict").get_active()
self.restrict = self.topDialog.get_object("restrict").get_active()
self.living = (self.restrict and
self.topDialog.get_widget("living").get_active())
self.topDialog.get_object("living").get_active())
self.exclnotes = (self.restrict and
self.topDialog.get_widget("notes").get_active())
self.topDialog.get_object("notes").get_active())
self.exclsrcs = (self.restrict and
self.topDialog.get_widget("sources").get_active())
self.private = self.topDialog.get_widget("private").get_active()
self.topDialog.get_object("sources").get_active())
self.private = self.topDialog.get_object("private").get_active()
self.cfilter = self.filter_menu.get_active().get_data("filter")
self.cfilter = self.filter_menu[self.filters.get_active()][1]
self.images = self.topDialog.get_widget ("images").get_active ()
self.images = self.topDialog.get_object ("images").get_active ()
if self.images:
images_path = self.topDialog.get_widget ("images_path")
images_path = self.topDialog.get_object ("images_path")
self.images_path = unicode(images_path.get_text ())
else:
self.images_path = ""
@ -263,7 +273,14 @@ class GeneWebWriter:
mother_handle = family.get_mother_handle()
if mother_handle:
mother = self.db.get_person_from_handle(mother_handle)
self.writeln("fam %s %s +%s %s %s" % (self.get_ref_name(father), self.get_full_person_info_fam(father), self.get_wedding_data(family), self.get_ref_name(mother), self.get_full_person_info_fam(mother)))
self.writeln("fam %s %s +%s %s %s" %
(self.get_ref_name(father),
self.get_full_person_info_fam(father),
self.get_wedding_data(family),
self.get_ref_name(mother),
self.get_full_person_info_fam(mother)
)
)
self.write_witness( family)
self.write_sources( family.get_source_references())
self.write_children( family, father)
@ -273,8 +290,7 @@ class GeneWebWriter:
note = ""
for notehandle in notelist:
noteobj = self.db.get_note_from_handle(notehandle)
note += noteobj.get()
note += " "
note += noteobj.get() + " "
if note and note != "":
note = note.replace('\n\r',' ')
note = note.replace('\r\n',' ')
@ -296,15 +312,20 @@ class GeneWebWriter:
if w_list:
for witness in w_list:
if witness and witness.type == gen.lib.Event.ID:
person = self.db.get_person_from_handle(witness.get_value())
person = self.db.get_person_from_handle(
witness.get_value())
if person:
gender = ""
if person.get_gender() == gen.lib.Person.MALE:
gender = "h"
elif person.get_gender() == gen.lib.Person.FEMALE:
gender = "f"
self.writeln("wit %s %s %s" % (gender, self.get_ref_name(person), self.get_full_person_info_fam(person)))
self.writeln("wit %s %s %s" %
(gender,
self.get_ref_name(person),
self.get_full_person_info_fam(person)
)
)
def write_sources(self,reflist):
if self.restrict and self.exclnotes:
@ -316,7 +337,9 @@ class GeneWebWriter:
if sbase:
source = self.db.get_source_from_handle(sbase)
if source:
self.writeln( "src %s" % (self.rem_spaces(source.get_title())))
self.writeln( "src %s" %
(self.rem_spaces(source.get_title()))
)
def write_children(self,family, father):
father_lastname = father.get_primary_name().get_surname()
@ -331,7 +354,12 @@ class GeneWebWriter:
gender = "h"
elif child.get_gender() == gen.lib.Person.FEMALE:
gender = "f"
self.writeln("- %s %s %s" % (gender, self.get_child_ref_name(child, father_lastname), self.get_full_person_info_child(child)))
self.writeln("- %s %s %s" %
(gender,
self.get_child_ref_name(child, father_lastname),
self.get_full_person_info_child(child)
)
)
self.writeln("end")
def write_notes(self,family, father, mother):
@ -452,24 +480,24 @@ class GeneWebWriter:
def get_ref_name(self,person):
surname = self.rem_spaces( person.get_primary_name().get_surname())
firstname = _("Living")
if not (Utils.probably_alive(person,self.db) and self.restrict and self.living):
if not (Utils.probably_alive(person,self.db) and \
self.restrict and self.living):
firstname = self.rem_spaces( person.get_primary_name().get_first_name())
if person.get_handle() not in self.person_ids:
self.person_ids[person.get_handle()] = len(self.person_ids)
ret = "%s %s.%d" % (surname, firstname, self.person_ids[person.get_handle()])
return ret
return "%s %s.%d" % (surname, firstname,
self.person_ids[person.get_handle()])
def get_child_ref_name(self,person,father_lastname):
surname = self.rem_spaces( person.get_primary_name().get_surname())
firstname = _("Living")
if not (Utils.probably_alive(person,self.db) and self.restrict and self.living):
if not (Utils.probably_alive(person,self.db) and \
self.restrict and self.living):
firstname = self.rem_spaces( person.get_primary_name().get_first_name())
if person.get_handle() not in self.person_ids:
self.person_ids[person.get_handle()] = len(self.person_ids)
if surname != father_lastname:
ret = "%s.%d %s" % (firstname, self.person_ids[person.get_handle()], surname)
else:
ret = "%s.%d" % (firstname, self.person_ids[person.get_handle()])
ret = "%s.%d" % (firstname, self.person_ids[person.get_handle()])
if surname != father_lastname: ret += " " + surname
return ret
def get_wedding_data(self,family):

View File

@ -1,188 +1,162 @@
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
<glade-interface>
<widget class="GtkDialog" id="calendarExport">
<property name="visible">True</property>
<property name="title" translatable="yes"></property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">True</property>
<property name="default_width">400</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">8</property>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="cancel">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-cancel</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">0</property>
<signal name="clicked" handler="destroy_passed_object" object="gedcomExport"/>
</widget>
</child>
<child>
<widget class="GtkButton" id="ok">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-ok</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">0</property>
<signal name="clicked" handler="on_ok_clicked" object="gedcomExport"/>
</widget>
</child>
<child>
<widget class="GtkButton" id="button1">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-help</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-11</property>
<signal name="clicked" handler="on_help_clicked" last_modification_time="Tue, 02 Dec 2003 01:53:26 GMT"/>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkTable" id="table3">
<property name="border_width">12</property>
<property name="visible">True</property>
<property name="n_rows">2</property>
<property name="n_columns">3</property>
<property name="homogeneous">False</property>
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<child>
<widget class="GtkLabel" id="label9">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Options&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">3</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="label" translatable="yes">Filt_er:</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">filter</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkOptionMenu" id="filter">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="history">-1</property>
<child internal-child="menu">
<widget class="GtkMenu" id="convertwidget1">
<property name="visible">True</property>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>
<?xml version="1.0"?>
<interface>
<requires lib="gtk+" version="2.16"/>
<!-- interface-naming-policy toplevel-contextual -->
<object class="GtkDialog" id="calendarExport">
<property name="visible">True</property>
<property name="modal">True</property>
<property name="default_width">400</property>
<property name="type_hint">dialog</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>
<property name="spacing">8</property>
<child>
<object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<child>
<object class="GtkTable" id="table3">
<property name="visible">True</property>
<property name="border_width">12</property>
<property name="n_rows">2</property>
<property name="n_columns">3</property>
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
<child>
<object class="GtkLabel" id="label9">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">&lt;b&gt;Options&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
<packing>
<property name="right_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Filt_er:</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="filter">
<property name="visible">True</property>
<property name="model">liststore1</property>
<child>
<object class="GtkCellRendererText" id="cellrenderertext1"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
<child internal-child="action_area">
<object class="GtkHButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="cancel">
<property name="label">gtk-cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="destroy_passed_object" object="gedcomExport"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="ok">
<property name="label">gtk-ok</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_ok_clicked" object="gedcomExport"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="button1">
<property name="label">gtk-help</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_help_clicked"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
</object>
</child>
<action-widgets>
<action-widget response="0">cancel</action-widget>
<action-widget response="0">ok</action-widget>
<action-widget response="-11">button1</action-widget>
</action-widgets>
</object>
<object class="GtkListStore" id="liststore1">
<columns>
<!-- column-name gchararray1 -->
<column type="gchararray"/>
</columns>
</object>
</interface>

View File

@ -39,7 +39,6 @@ from gettext import gettext as _
#
#-------------------------------------------------------------------------
import gtk
from gtk import glade
#------------------------------------------------------------------------
#
@ -54,13 +53,20 @@ log = logging.getLogger(".ExportVCal")
# GRAMPS modules
#
#-------------------------------------------------------------------------
from Filters import GenericFilter, Rules, build_filter_menu
from Filters import GenericFilter, Rules, build_filter_model
import Utils
from gen.lib import Date, EventType
import Errors
from QuestionDialog import ErrorDialog
from gen.plug import PluginManager, ExportPlugin
#-------------------------------------------------------------------------
#
# Constants
#
#-------------------------------------------------------------------------
_GLADE_FILE = "ExportVCalendar.glade"
#-------------------------------------------------------------------------
#
#
@ -75,15 +81,16 @@ class CalendarWriterOptionBox:
def __init__(self, person):
self.person = person
glade_file = os.path.join(os.path.dirname(__file__),
"ExportVCalendar.glade")
glade_file = os.path.join(
os.path.split(__file__)[0],
_GLADE_FILE)
self.topDialog = glade.XML(glade_file, "calendarExport", "gramps")
self.topDialog = gtk.Builder()
self.topDialog.add_from_file(glade_file)
self.copy = 0
self.filter_menu = gtk.Menu()
def get_option_box(self):
filter_obj = self.topDialog.get_widget("filter")
self.filters = self.topDialog.get_object("filter")
everyone_filter = GenericFilter()
everyone_filter.set_name(_("Entire Database"))
@ -114,18 +121,18 @@ class CalendarWriterOptionBox:
from Filters import CustomFilters
the_filters.extend(CustomFilters.get_filters('Person'))
self.filter_menu = build_filter_menu(the_filters)
filter_obj.set_menu(self.filter_menu)
self.filter_menu = build_filter_model(the_filters)
self.filters.set_model(self.filter_menu)
self.filters.set_active(0)
the_box = self.topDialog.get_widget('vbox1')
the_parent = self.topDialog.get_widget('dialog-vbox1')
the_box = self.topDialog.get_object('vbox1')
the_parent = self.topDialog.get_object('dialog-vbox1')
the_parent.remove(the_box)
self.topDialog.get_widget("calendarExport").destroy()
self.topDialog.get_object("calendarExport").destroy()
return the_box
def parse_options(self):
self.cfilter = self.filter_menu.get_active().get_data("filter")
self.cfilter = self.filter_menu[self.filters.get_active()][1]
class CalendarWriter:
def __init__(self, database, cl=0, filename="", option_box=None,
@ -160,7 +167,8 @@ class CalendarWriter:
self.plist[p] = 1
else:
try:
for p in self.option_box.cfilter.apply(self.db, self.db.get_person_handles(sort_handles=False)):
for p in self.option_box.cfilter.apply(self.db,
self.db.get_person_handles(sort_handles=False)):
self.plist[p] = 1
except Errors.FilterError, msg:
(m1, m2) = msg.messages()
@ -257,10 +265,13 @@ class CalendarWriter:
place_handle = birth.get_place_handle()
if place_handle:
place = self.db.get_place_from_handle(place_handle)
self.write_vevent(_("Birth of %s") % person.get_primary_name().get_name(), b_date, place.get_title())
self.write_vevent(_("Birth of %s") %
person.get_primary_name().get_name(),
b_date, place.get_title())
else:
self.write_vevent(_("Birth of %s")
% person.get_primary_name().get_name(), b_date)
self.write_vevent(_("Birth of %s") %
person.get_primary_name().get_name(),
b_date)
death_ref = person.get_death_ref()
if death_ref:
@ -270,9 +281,14 @@ class CalendarWriter:
place_handle = death.get_place_handle()
if place_handle:
place = self.db.get_place_from_handle(place_handle)
self.write_vevent(_("Death of %s") % person.get_primary_name().get_name(), d_date, place.get_title())
self.write_vevent(_("Death of %s") %
person.get_primary_name().get_name(),
d_date,
place.get_title())
else:
self.write_vevent(_("Death of %s") % person.get_primary_name().get_name(), d_date)
self.write_vevent(_("Death of %s") %
person.get_primary_name().get_name(),
d_date)
def format_single_date(self, subdate, thisyear, cal):
@ -359,4 +375,4 @@ plugin = ExportPlugin(name = _('vC_alendar'),
export_function = exportData,
extension = "vcs",
config = _config )
pmgr.register_plugin(plugin)
pmgr.register_plugin(plugin)

View File

@ -1,188 +1,155 @@
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
<glade-interface>
<widget class="GtkDialog" id="vcardExport">
<property name="visible">True</property>
<property name="title" translatable="yes"></property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">True</property>
<property name="default_width">400</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">8</property>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="cancel">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-cancel</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">0</property>
<signal name="clicked" handler="destroy_passed_object" object="gedcomExport"/>
</widget>
</child>
<child>
<widget class="GtkButton" id="ok">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-ok</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">0</property>
<signal name="clicked" handler="on_ok_clicked" object="gedcomExport"/>
</widget>
</child>
<child>
<widget class="GtkButton" id="button1">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-help</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-11</property>
<signal name="clicked" handler="on_help_clicked" last_modification_time="Tue, 02 Dec 2003 01:53:26 GMT"/>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkTable" id="table3">
<property name="border_width">12</property>
<property name="visible">True</property>
<property name="n_rows">2</property>
<property name="n_columns">3</property>
<property name="homogeneous">False</property>
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<child>
<widget class="GtkLabel" id="label9">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Options&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">3</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="label" translatable="yes">Filt_er:</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">filter</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkOptionMenu" id="filter">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="history">-1</property>
<child internal-child="menu">
<widget class="GtkMenu" id="convertwidget1">
<property name="visible">True</property>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface>
<?xml version="1.0"?>
<interface>
<requires lib="gtk+" version="2.16"/>
<!-- interface-naming-policy toplevel-contextual -->
<object class="GtkDialog" id="vcardExport">
<property name="visible">True</property>
<property name="modal">True</property>
<property name="default_width">400</property>
<property name="type_hint">dialog</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>
<property name="spacing">8</property>
<child>
<object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<child>
<object class="GtkTable" id="table3">
<property name="visible">True</property>
<property name="border_width">12</property>
<property name="n_rows">2</property>
<property name="n_columns">3</property>
<property name="column_spacing">12</property>
<property name="row_spacing">6</property>
<child>
<object class="GtkLabel" id="label9">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">&lt;b&gt;Options&lt;/b&gt;</property>
<property name="use_markup">True</property>
</object>
<packing>
<property name="right_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Filt_er:</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="filter">
<property name="visible">True</property>
<property name="model">liststore1</property>
<child>
<object class="GtkCellRendererText" id="cellrenderertext1"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
</object>
<packing>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
</packing>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
<child internal-child="action_area">
<object class="GtkHButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="cancel">
<property name="label">gtk-cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="destroy_passed_object" object="gedcomExport"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="ok">
<property name="label">gtk-ok</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_ok_clicked" object="gedcomExport"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="button1">
<property name="label">gtk-help</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_help_clicked"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
</object>
</child>
<action-widgets>
<action-widget response="0">cancel</action-widget>
<action-widget response="0">ok</action-widget>
<action-widget response="-11">button1</action-widget>
</action-widgets>
</object>
<object class="GtkListStore" id="liststore1"/>
</interface>

View File

@ -45,19 +45,26 @@ log = logging.getLogger(".ExportVCard")
# GNOME/GTK modules
#
#-------------------------------------------------------------------------
from gtk import glade
import gtk
#-------------------------------------------------------------------------
#
# GRAMPS modules
#
#-------------------------------------------------------------------------
from Filters import GenericFilter, Rules, build_filter_menu
from Filters import GenericFilter, Rules, build_filter_model
from gen.lib import Date
import Errors
from QuestionDialog import ErrorDialog
from gen.plug import PluginManager, ExportPlugin
#-------------------------------------------------------------------------
#
# Constants
#
#-------------------------------------------------------------------------
_GLADE_FILE = "ExportVCard.glade"
#-------------------------------------------------------------------------
#
#
@ -74,12 +81,14 @@ class CardWriterOptionBox:
def get_option_box(self):
glade_file = os.path.join(os.path.dirname(__file__),
"ExportVCard.glade")
glade_file = os.path.join(
os.path.split(__file__)[0],
_GLADE_FILE)
self.topDialog = glade.XML(glade_file,"vcardExport","gramps")
self.topDialog = gtk.Builder()
self.topDialog.add_from_file(glade_file)
filter_obj = self.topDialog.get_widget("filter")
self.filters = self.topDialog.get_object("filter")
self.copy = 0
all = GenericFilter()
@ -111,17 +120,18 @@ class CardWriterOptionBox:
from Filters import CustomFilters
the_filters.extend(CustomFilters.get_filters('Person'))
self.filter_menu = build_filter_menu(the_filters)
filter_obj.set_menu(self.filter_menu)
self.filter_menu = build_filter_model(the_filters)
self.filters.set_model(self.filter_menu)
self.filters.set_active(0)
the_box = self.topDialog.get_widget('vbox1')
the_parent = self.topDialog.get_widget('dialog-vbox1')
the_box = self.topDialog.get_object('vbox1')
the_parent = self.topDialog.get_object('dialog-vbox1')
the_parent.remove(the_box)
self.topDialog.get_widget("vcardExport").destroy()
self.topDialog.get_object("vcardExport").destroy()
return the_box
def parse_options(self):
self.cfilter = self.filter_menu.get_active().get_data("filter")
self.cfilter = self.filter_menu[self.filters.get_active()][1]
class CardWriter:
def __init__(self, database, cl=0, filename="", option_box=None,
@ -204,7 +214,14 @@ class CardWriter:
prname = person.get_primary_name()
self.writeln("FN:%s" % prname.get_regular_name())
self.writeln("N:%s;%s;%s;%s;%s" % (prname.get_surname(), prname.get_first_name(), person.get_nick_name(), prname.get_surname_prefix(), prname.get_suffix()))
self.writeln("N:%s;%s;%s;%s;%s" %
(prname.get_surname(),
prname.get_first_name(),
person.get_nick_name(),
prname.get_surname_prefix(),
prname.get_suffix()
)
)
if prname.get_title():
self.writeln("TITLE:%s" % prname.get_title())
@ -233,10 +250,8 @@ class CardWriter:
zip = address.get_postal_code()
country = address.get_country()
if street or city or state or zip or country:
self.writeln("ADR:%s;%s;%s;%s;%s;%s;%s" % (postbox, ext,
street, city,
state, zip,
country))
self.writeln("ADR:%s;%s;%s;%s;%s;%s;%s" %
(postbox, ext, street, city,state, zip, country))
phone = address.get_phone()
if phone:

View File

@ -148,16 +148,14 @@ class EventComparison(Tool.Tool,ManagedWindow.ManagedWindow):
all.set_name(_("Entire Database"))
all.add_rule(Rules.Person.Everyone([]))
# the following three lines appear to be unnecessary.
# variable "the_filters" is not used anywhere else
# commenting out for now
#the_filters = [all]
#from Filters import CustomFilters
#the_filters.extend(CustomFilters.get_filters('Person'))
the_filters = [all]
from Filters import CustomFilters
the_filters.extend(CustomFilters.get_filters('Person'))
self.filter_menu = build_filter_model('Person')
self.filter_menu = build_filter_model(the_filters)
filter_num = self.options.handler.options_dict['filter']
self.filters.set_model(self.filter_menu)
self.filters.set_active(0)
self.show()