diff --git a/gramps2/src/plugins/WriteCD.py b/gramps2/src/plugins/WriteCD.py new file mode 100644 index 000000000..e7c1e1272 --- /dev/null +++ b/gramps2/src/plugins/WriteCD.py @@ -0,0 +1,112 @@ +# +# Gramps - a GTK+/GNOME based genealogy program +# +# Copyright (C) 2000 Donald N. Allingham +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# + +"Export to GRAMPS package" + +#------------------------------------------------------------------------- +# +# standard python modules +# +#------------------------------------------------------------------------- +import time +import os +from cStringIO import StringIO + +#------------------------------------------------------------------------- +# +# GNOME/GTK modules +# +#------------------------------------------------------------------------- +import gtk +import gtk.glade +import gnome.vfs + +#------------------------------------------------------------------------- +# +# GRAMPS modules +# +#------------------------------------------------------------------------- +import WriteXML +import TarFile +import Utils + +from intl import gettext as _ + +#------------------------------------------------------------------------- +# +# writeData +# +#------------------------------------------------------------------------- +def writeData(database,person): + try: + PackageWriter(database) + except: + import DisplayTrace + DisplayTrace.DisplayTrace() + +#------------------------------------------------------------------------- +# +# PackageWriter +# +#------------------------------------------------------------------------- +class PackageWriter: + + def __init__(self,database): + self.db = database + + base = os.path.dirname(__file__) + glade_file = "%s/%s" % (base,"cdexport.glade") + + + dic = { + "destroy_passed_object" : Utils.destroy_passed_object, + "on_ok_clicked" : self.on_ok_clicked + } + + self.top = gtk.glade.XML(glade_file,"packageExport") + + Utils.set_titles(self.top.get_widget('packageExport'), + self.top.get_widget('title'), + _('Export to CD')) + + self.top.signal_autoconnect(dic) + self.top.get_widget("packageExport").show() + + def on_ok_clicked(self,obj): + Utils.destroy_passed_object(obj) + + base = os.path.basename(self.db.getSavePath()) + + gnome.vfs.make_directory('burn:///%s' % base,gnome.vfs.OPEN_WRITE) + g = gnome.vfs.create('burn:///%s/data.gramps' % base,gnome.vfs.OPEN_WRITE ) + + gfile = WriteXML.XmlWriter(self.db,None,1) + gfile.write_handle(g) + mtime = time.time() + g.close() + +#------------------------------------------------------------------------- +# +# Register the plugin +# +#------------------------------------------------------------------------- +from Plugins import register_export + +register_export(writeData,_("Export to CD (nautilus)")) diff --git a/gramps2/src/plugins/cdexport.glade b/gramps2/src/plugins/cdexport.glade new file mode 100644 index 000000000..dd55acc45 --- /dev/null +++ b/gramps2/src/plugins/cdexport.glade @@ -0,0 +1,179 @@ + + + + + + + + True + + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + True + 400 + 350 + True + False + False + + + + True + False + 8 + + + + True + GTK_BUTTONBOX_END + + + + True + True + True + GTK_RELIEF_NORMAL + 0 + + + + + True + 0.5 + 0.5 + 0 + 0 + + + + True + False + 2 + + + + True + gtk-cdrom + 4 + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + _Export to CD + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + + + + + + + True + True + True + gtk-cancel + True + GTK_RELIEF_NORMAL + 0 + + + + + + 0 + False + True + GTK_PACK_END + + + + + + 12 + True + False + 12 + + + + True + + False + False + GTK_JUSTIFY_CENTER + False + False + 0.5 + 0.5 + 0 + 0 + + + 6 + False + False + + + + + + True + Exporting to a CD will not immediately write the CD. It will prepare the nautilus-cd-burner so that you can burn the CD from nautilus. + +After exporting, go to the <b>burn:///</b> directory in nautilus and select the Write to CD button. + False + True + GTK_JUSTIFY_LEFT + True + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + 0 + True + True + + + + + + +