2005-06-05 09:31:56 +05:30
|
|
|
#
|
|
|
|
# Gramps - a GTK+/GNOME based genealogy program
|
|
|
|
#
|
2006-03-11 06:42:06 +05:30
|
|
|
# Copyright (C) 2000-2006 Donald N. Allingham
|
2005-06-05 09:31:56 +05:30
|
|
|
#
|
|
|
|
# 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
|
|
|
|
#
|
|
|
|
|
|
|
|
# $Id$
|
|
|
|
|
|
|
|
"Database Processing/Extract information from names"
|
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# python modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
import os
|
2007-04-05 08:28:54 +05:30
|
|
|
import subprocess
|
2005-06-05 09:31:56 +05:30
|
|
|
import locale
|
|
|
|
import time
|
2006-04-07 03:32:46 +05:30
|
|
|
from gettext import gettext as _
|
2005-06-05 09:31:56 +05:30
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# gnome/gtk
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
import gtk
|
2005-12-06 12:08:09 +05:30
|
|
|
import gtk.glade
|
2005-06-05 09:31:56 +05:30
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
# gramps modules
|
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2007-04-08 09:54:38 +05:30
|
|
|
import GrampsDb
|
2007-02-03 22:41:05 +05:30
|
|
|
import GrampsDbUtils
|
2005-12-06 12:08:09 +05:30
|
|
|
import Utils
|
2005-12-13 07:37:16 +05:30
|
|
|
import GrampsDisplay
|
2006-04-10 04:23:53 +05:30
|
|
|
import ManagedWindow
|
|
|
|
|
|
|
|
from QuestionDialog import OkDialog, ErrorDialog
|
|
|
|
from PluginUtils import Tool, register_tool
|
2005-06-05 09:31:56 +05:30
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
2005-12-06 12:08:09 +05:30
|
|
|
# Constants
|
2005-06-05 09:31:56 +05:30
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2006-07-20 09:55:44 +05:30
|
|
|
if os.sys.platform == "win32":
|
|
|
|
_rcs_found = os.system("rcs -V >nul 2>nul") == 0
|
|
|
|
else:
|
2006-09-16 17:25:53 +05:30
|
|
|
_rcs_found = os.system("rcs -V >/dev/null 2>/dev/null") == 0
|
2005-12-06 12:08:09 +05:30
|
|
|
|
|
|
|
# Some message strings
|
|
|
|
rcs_setup_failure_msg = [
|
|
|
|
_("Checkpoint Archive Creation Failed"),
|
|
|
|
_("No checkpointing archive was found. "
|
|
|
|
"An attempt to create it has failed with the "
|
|
|
|
"following message:\n\n%s")
|
|
|
|
]
|
|
|
|
|
|
|
|
rcs_setup_success_msg = [
|
|
|
|
_("Checkpoint Archive Created"),
|
|
|
|
_("No checkpointing archive was found, "
|
|
|
|
"so it was created to enable archiving.\n\n"
|
|
|
|
"The archive file name is %s\n"
|
|
|
|
"Deleting this file will lose the archive "
|
|
|
|
"and make impossible to extract archived data "
|
|
|
|
"from it.")
|
|
|
|
]
|
|
|
|
|
|
|
|
archive_failure_msg = [
|
|
|
|
_("Checkpoint Failed"),
|
|
|
|
_("An attempt to archive the data failed "
|
|
|
|
"with the following message:\n\n%s")
|
|
|
|
]
|
|
|
|
|
|
|
|
archive_success_msg = [
|
|
|
|
_("Checkpoint Succeeded "),
|
|
|
|
_("The data was successfully archived.")
|
|
|
|
]
|
|
|
|
|
|
|
|
retrieve_failure_msg = [
|
|
|
|
_("Checkpoint Failed"),
|
|
|
|
_("An attempt to retrieve the data failed "
|
|
|
|
"with the following message:\n\n%s")
|
|
|
|
]
|
|
|
|
|
|
|
|
retrieve_success_msg = [
|
|
|
|
_("Checkpoint Succeeded "),
|
|
|
|
_("The data was successfully retrieved.")
|
|
|
|
]
|
2005-06-05 09:31:56 +05:30
|
|
|
|
|
|
|
#-------------------------------------------------------------------------
|
|
|
|
#
|
2005-12-06 12:08:09 +05:30
|
|
|
# Checkpoint class
|
2005-06-05 09:31:56 +05:30
|
|
|
#
|
|
|
|
#-------------------------------------------------------------------------
|
2006-04-10 04:23:53 +05:30
|
|
|
class Checkpoint(Tool.Tool, ManagedWindow.ManagedWindow):
|
|
|
|
|
|
|
|
def __init__(self, dbstate, uistate, options_class, name, callback=None):
|
2005-12-06 12:08:09 +05:30
|
|
|
|
2006-04-10 04:23:53 +05:30
|
|
|
Tool.Tool.__init__(self, dbstate, options_class, name)
|
2006-08-22 09:02:00 +05:30
|
|
|
self.dbstate = dbstate
|
2005-12-06 12:08:09 +05:30
|
|
|
|
2006-04-10 04:23:53 +05:30
|
|
|
if uistate:
|
|
|
|
ManagedWindow.ManagedWindow.__init__(self, uistate, [],
|
|
|
|
Checkpoint)
|
2005-12-06 12:08:09 +05:30
|
|
|
self.callback = self.callback_real
|
2006-04-10 04:23:53 +05:30
|
|
|
self.init_gui()
|
2005-12-06 12:08:09 +05:30
|
|
|
else:
|
|
|
|
self.callback = lambda a: None
|
|
|
|
self.run_tool(cli=True)
|
2005-06-05 09:31:56 +05:30
|
|
|
|
2006-04-10 04:23:53 +05:30
|
|
|
def init_gui(self):
|
2005-12-06 12:08:09 +05:30
|
|
|
# Draw dialog and make it handle everything
|
|
|
|
|
|
|
|
base = os.path.dirname(__file__)
|
|
|
|
glade_file = "%s/%s" % (base,"checkpoint.glade")
|
|
|
|
self.glade = gtk.glade.XML(glade_file,"top","gramps")
|
|
|
|
|
|
|
|
self.cust_arch_cb = self.glade.get_widget("cust_arch")
|
|
|
|
self.cust_ret_cb = self.glade.get_widget("cust_ret")
|
|
|
|
self.rcs_rb = self.glade.get_widget("rcs")
|
|
|
|
self.cust_rb = self.glade.get_widget("custom")
|
|
|
|
|
|
|
|
# Fill in the stored values
|
|
|
|
self.cust_arch_cb.set_text(
|
|
|
|
self.options.handler.options_dict['cacmd'])
|
|
|
|
self.cust_ret_cb.set_text(
|
|
|
|
self.options.handler.options_dict['crcmd'])
|
|
|
|
|
|
|
|
# Display controls according to the state
|
|
|
|
if self.options.handler.options_dict['rcs']:
|
2007-04-08 09:54:38 +05:30
|
|
|
self.rcs_rb.set_active(_rcs_found)
|
|
|
|
self.cust_rb.set_active(not _rcs_found)
|
2005-12-06 12:08:09 +05:30
|
|
|
else:
|
2007-04-08 09:54:38 +05:30
|
|
|
self.cust_rb.set_active(True)
|
2005-12-06 12:08:09 +05:30
|
|
|
self.cust_arch_cb.set_sensitive(self.cust_rb.get_active())
|
|
|
|
self.cust_ret_cb.set_sensitive(self.cust_rb.get_active())
|
|
|
|
|
|
|
|
self.rcs_rb.connect('toggled',self.rcs_toggled)
|
|
|
|
|
2006-07-20 09:55:44 +05:30
|
|
|
# Disable RCS if the rcs binary is not available
|
|
|
|
# and show the normally hidden warning
|
2007-04-08 09:54:38 +05:30
|
|
|
warning_label = self.glade.get_widget('warning_label')
|
2006-07-20 09:55:44 +05:30
|
|
|
|
2005-12-06 12:08:09 +05:30
|
|
|
self.title = _("Checkpoint Data")
|
2006-04-27 07:34:05 +05:30
|
|
|
window = self.glade.get_widget('top')
|
|
|
|
self.set_window(window,self.glade.get_widget('title'),self.title)
|
2005-06-05 09:31:56 +05:30
|
|
|
|
2005-12-06 12:08:09 +05:30
|
|
|
self.glade.signal_autoconnect({
|
|
|
|
"on_close_clicked" : self.close,
|
|
|
|
"on_arch_clicked" : self.on_archive_clicked,
|
|
|
|
"on_ret_clicked" : self.on_retrieve_clicked,
|
|
|
|
"on_help_clicked" : self.on_help_clicked,
|
|
|
|
})
|
|
|
|
|
2006-04-10 04:23:53 +05:30
|
|
|
self.show()
|
2005-12-06 12:08:09 +05:30
|
|
|
|
2007-04-08 09:54:38 +05:30
|
|
|
if not _rcs_found:
|
|
|
|
self.rcs_rb.set_sensitive(False)
|
|
|
|
self.cust_rb.set_sensitive(True)
|
|
|
|
warning_label.show()
|
|
|
|
else:
|
|
|
|
warning_label.hide()
|
|
|
|
|
2006-04-27 07:34:05 +05:30
|
|
|
def build_menu_names(self,obj):
|
|
|
|
return (_("Checkpoint tool"),None)
|
|
|
|
|
2005-12-06 12:08:09 +05:30
|
|
|
def rcs_toggled(self,obj):
|
|
|
|
self.cust_arch_cb.set_sensitive(not obj.get_active())
|
|
|
|
self.cust_ret_cb.set_sensitive(not obj.get_active())
|
|
|
|
|
|
|
|
def on_help_clicked(self,obj):
|
|
|
|
"""Display the relevant portion of GRAMPS manual"""
|
2005-12-13 07:37:16 +05:30
|
|
|
GrampsDisplay.help('index')
|
2005-12-06 12:08:09 +05:30
|
|
|
|
|
|
|
def on_archive_clicked(self,obj):
|
|
|
|
self.options.handler.options_dict['cacmd'] = unicode(
|
|
|
|
self.cust_arch_cb.get_text())
|
|
|
|
self.options.handler.options_dict['rcs'] = int(
|
|
|
|
self.rcs_rb.get_active())
|
|
|
|
|
|
|
|
self.run_tool(archive=True,cli=False)
|
|
|
|
# Save options
|
|
|
|
self.options.handler.save_options()
|
|
|
|
|
|
|
|
def on_retrieve_clicked(self,obj):
|
|
|
|
self.options.handler.options_dict['crcmd'] = unicode(
|
|
|
|
self.cust_ret_cb.get_text())
|
|
|
|
self.options.handler.options_dict['rcs'] = int(
|
|
|
|
self.rcs_rb.get_active())
|
|
|
|
|
|
|
|
self.run_tool(archive=False,cli=False)
|
|
|
|
# Save options
|
|
|
|
self.options.handler.save_options()
|
|
|
|
|
|
|
|
def run_tool(self,archive=True,cli=False):
|
2005-06-05 09:31:56 +05:30
|
|
|
"""
|
|
|
|
RCS will be a builtin command, since we can handle all
|
|
|
|
configuration on our own. This isn't true for most versioning
|
|
|
|
systems, which usually require external setup, and external
|
|
|
|
communication.
|
|
|
|
"""
|
2005-12-06 12:08:09 +05:30
|
|
|
if not cli:
|
2006-04-10 04:23:53 +05:30
|
|
|
self.uistate.status_text(_("Checkpointing database..."))
|
2006-07-16 20:30:35 +05:30
|
|
|
self.uistate.window.window.set_cursor(
|
|
|
|
gtk.gdk.Cursor(gtk.gdk.WATCH))
|
|
|
|
self.window.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH))
|
2005-06-05 09:31:56 +05:30
|
|
|
|
2005-12-06 12:08:09 +05:30
|
|
|
if self.options.handler.options_dict['rcs']:
|
2007-04-08 09:54:38 +05:30
|
|
|
self.rcs(archive, cli)
|
2005-12-06 12:08:09 +05:30
|
|
|
elif archive:
|
2007-04-08 09:54:38 +05:30
|
|
|
self.custom(self.options.handler.options_dict['cacmd'], True, cli)
|
2005-06-05 09:31:56 +05:30
|
|
|
else:
|
2007-04-08 09:54:38 +05:30
|
|
|
self.custom(self.options.handler.options_dict['crcmd'], False, cli)
|
2005-06-05 09:31:56 +05:30
|
|
|
|
2005-12-06 12:08:09 +05:30
|
|
|
if not cli:
|
2006-07-16 20:30:35 +05:30
|
|
|
self.uistate.window.window.set_cursor(None)
|
|
|
|
self.window.window.set_cursor(None)
|
2006-04-10 04:23:53 +05:30
|
|
|
self.uistate.pulse_progressbar(0)
|
In .:
2006-07-31 Alex Roitman <shura@gramps-project.org>
* src/Filters/_SearchBar.py (SearchBar.__init__): Take dbstate as
a constructor argument; (SearchBar.apply_filter): pass dbstate.
* src/PageView.py (BookMarkView.add_bookmark,
PersonNavView.jumpto, PersonNavView.fwd_clicked,
PersonNavView.back_clicked, ListView.build_widget): Pass dbstate.
* src/Navigation.py (BaseNavigation.__init__,
PersonNavigation.__init__): Take dbstate as a constructor argument;
(PersonNavigation.build_item_name): properly access dbstate.
* src/DisplayState.py (__init__): Do not take dbstate as a
constructor argument; Do not connect dbstate signal here (moved to
ViewManager);
(display_relationship,push_message,modify_statusbar): Make dbstate
an argument.
* src/plugins/Checkpoint.py (run_tool): Pass dbstate.
* src/ViewManager.py (_build_main_window): Do not pass dbstate to
uistate DisplayState constructor; connect dbstate signal handler;
pass dbstate to Navigation; (keypress): Pass dbstate;
(statusbar_key_update): Pass dbstate;
(do_load_plugins): Pass dbstate;
(ViewManager.add_bookmark): Pass dbstate.
* src/DataViews/_RelationView.py (shade_update): Pass dbstate.
* src/DataViews/_PersonView.py (build_widget,_goto,
key_goto_home_person, key_edit_selected_person): Pass dbstate.
* src/Filters/Makefile.am (pkgdata_PYTHON): Remove obsolete file.
* src/Filters/__init__.py: Remove importing obsolete module.
* src/Filters/_FilterWidget.py: Remove obsolete module.
In po:
2006-07-31 Alex Roitman <shura@gramps-project.org>
* POTFILES.in: Remove obsolete file.
svn: r7104
2006-08-01 10:01:10 +05:30
|
|
|
self.uistate.modify_statusbar(self.dbstate)
|
2005-06-05 09:31:56 +05:30
|
|
|
|
|
|
|
def timestamp(self):
|
2005-12-30 09:27:31 +05:30
|
|
|
return unicode(time.strftime('%x %X',time.localtime(time.time())))
|
2005-06-05 09:31:56 +05:30
|
|
|
|
2005-12-06 12:08:09 +05:30
|
|
|
def custom(self,cmd,checkin,cli):
|
2005-06-05 09:31:56 +05:30
|
|
|
"""
|
|
|
|
Passed the generated XML file to the specified command.
|
|
|
|
"""
|
2007-04-05 08:28:54 +05:30
|
|
|
proc = subprocess.Popen(
|
|
|
|
cmd,
|
|
|
|
stderr = subprocess.PIPE,
|
|
|
|
stdin = subprocess.PIPE )
|
2005-12-06 12:08:09 +05:30
|
|
|
if checkin:
|
2007-04-08 09:54:38 +05:30
|
|
|
xmlwrite = GrampsDbUtils.XmlWriter(self.db, self.callback,
|
|
|
|
False, False)
|
2007-04-05 08:28:54 +05:30
|
|
|
xmlwrite.write_handle(proc.stdin)
|
2005-12-06 12:08:09 +05:30
|
|
|
else:
|
|
|
|
pass
|
2007-04-05 08:28:54 +05:30
|
|
|
proc.stdin.close()
|
2005-06-05 09:31:56 +05:30
|
|
|
status = proc.wait()
|
2007-04-05 08:28:54 +05:30
|
|
|
message = "\n".join(proc.stderr.readlines())
|
|
|
|
proc.stderr.close()
|
2005-06-05 09:31:56 +05:30
|
|
|
del proc
|
2005-12-06 12:08:09 +05:30
|
|
|
|
|
|
|
if checkin:
|
|
|
|
if status:
|
|
|
|
msg1 = archive_failure_msg[0]
|
|
|
|
msg2 = archive_failure_msg[1] % message
|
|
|
|
dialog = ErrorDialog
|
|
|
|
else:
|
|
|
|
msg1 = archive_success_msg[0]
|
|
|
|
msg2 = archive_success_msg[1]
|
|
|
|
dialog = OkDialog
|
|
|
|
else:
|
|
|
|
if status:
|
|
|
|
msg1 = retrieve_failure_msg[0]
|
|
|
|
msg2 = retrieve_failure_msg[1] % message
|
|
|
|
dialog = ErrorDialog
|
|
|
|
else:
|
|
|
|
msg1 = retrieve_success_msg[0]
|
|
|
|
msg2 = retrieve_success_msg[1]
|
|
|
|
dialog = OkDialog
|
2005-06-05 09:31:56 +05:30
|
|
|
|
2005-12-06 12:08:09 +05:30
|
|
|
if cli:
|
|
|
|
print msg1
|
|
|
|
print msg2
|
|
|
|
else:
|
|
|
|
dialog(msg1,msg2)
|
|
|
|
|
2007-04-08 09:54:38 +05:30
|
|
|
def rcs(self, checkin, cli):
|
2005-06-05 09:31:56 +05:30
|
|
|
"""
|
|
|
|
Check the generated XML file into RCS. Initialize the RCS file if
|
|
|
|
it does not already exist.
|
|
|
|
"""
|
|
|
|
(archive_base,ext) = os.path.splitext(self.db.get_save_path())
|
|
|
|
|
2007-04-08 09:54:38 +05:30
|
|
|
archive_base = os.path.join(archive_base, "archive")
|
2005-08-18 11:28:28 +05:30
|
|
|
comment = self.timestamp()
|
|
|
|
|
2005-06-05 09:31:56 +05:30
|
|
|
archive = archive_base + ",v"
|
2005-12-06 12:08:09 +05:30
|
|
|
|
|
|
|
# If the archive file does not exist, we either set it up
|
|
|
|
# or die trying
|
2005-06-05 09:31:56 +05:30
|
|
|
if not os.path.exists(archive):
|
2007-04-08 09:54:38 +05:30
|
|
|
cmd = [ 'rcs', '-i', '-U', '-q', '-t-"GRAMPS database"', archive ]
|
|
|
|
proc = subprocess.Popen(cmd, stderr = subprocess.PIPE )
|
2005-06-05 09:31:56 +05:30
|
|
|
status = proc.wait()
|
2007-04-05 08:28:54 +05:30
|
|
|
message = "\n".join(proc.stderr.readlines())
|
|
|
|
proc.stderr.close()
|
2005-12-06 12:08:09 +05:30
|
|
|
del proc
|
|
|
|
|
2005-06-05 09:31:56 +05:30
|
|
|
if status:
|
2005-12-06 12:08:09 +05:30
|
|
|
msg1 = rcs_setup_failure_msg[0]
|
|
|
|
msg2 = rcs_setup_failure_msg[1] % message
|
|
|
|
dialog = ErrorDialog
|
|
|
|
else:
|
|
|
|
msg1 = rcs_setup_success_msg[0]
|
|
|
|
msg2 = rcs_setup_success_msg[1] % archive
|
|
|
|
dialog = OkDialog
|
|
|
|
|
|
|
|
if cli:
|
|
|
|
print msg1
|
|
|
|
print msg2
|
|
|
|
else:
|
|
|
|
dialog(msg1,msg2)
|
|
|
|
|
|
|
|
if status:
|
|
|
|
return
|
|
|
|
|
|
|
|
if checkin:
|
|
|
|
# At this point, we have an existing archive file
|
2007-04-08 09:54:38 +05:30
|
|
|
xmlwrite = GrampsDbUtils.XmlWriter(self.db, self.callback,
|
|
|
|
False, False)
|
2005-12-06 12:08:09 +05:30
|
|
|
xmlwrite.write(archive_base)
|
2007-04-08 09:54:38 +05:30
|
|
|
|
|
|
|
cmd = ["ci", archive_base]
|
2005-12-06 12:08:09 +05:30
|
|
|
|
2007-04-05 08:28:54 +05:30
|
|
|
proc = subprocess.Popen(
|
2007-04-08 09:54:38 +05:30
|
|
|
cmd,
|
|
|
|
stdin = subprocess.PIPE,
|
|
|
|
stderr = subprocess.PIPE )
|
2007-04-05 08:28:54 +05:30
|
|
|
proc.stdin.write(comment)
|
|
|
|
proc.stdin.close()
|
|
|
|
message = "\n".join(proc.stderr.readlines())
|
|
|
|
proc.stderr.close()
|
2007-04-08 09:54:38 +05:30
|
|
|
status = proc.wait()
|
2005-06-05 09:31:56 +05:30
|
|
|
del proc
|
|
|
|
|
2005-12-06 12:08:09 +05:30
|
|
|
if status:
|
|
|
|
msg1 = archive_failure_msg[0]
|
|
|
|
msg2 = archive_failure_msg[1] % message
|
|
|
|
dialog = ErrorDialog
|
|
|
|
else:
|
|
|
|
msg1 = archive_success_msg[0]
|
|
|
|
msg2 = archive_success_msg[1]
|
|
|
|
dialog = OkDialog
|
|
|
|
|
|
|
|
if cli:
|
|
|
|
print msg1
|
|
|
|
print msg2
|
|
|
|
else:
|
|
|
|
dialog(msg1,msg2)
|
|
|
|
else:
|
2007-04-05 08:28:54 +05:30
|
|
|
proc = subprocess.Popen(
|
2007-04-08 09:54:38 +05:30
|
|
|
("co", "-p", archive_base), stdout=subprocess.PIPE,
|
2007-04-05 08:28:54 +05:30
|
|
|
stderr = subprocess.PIPE )
|
2005-12-06 12:08:09 +05:30
|
|
|
status = proc.wait()
|
2007-04-05 08:28:54 +05:30
|
|
|
message = "\n".join(proc.stderr.readlines())
|
|
|
|
proc.stderr.close()
|
2005-12-06 12:08:09 +05:30
|
|
|
del proc
|
2007-04-05 08:28:54 +05:30
|
|
|
|
2005-12-06 12:08:09 +05:30
|
|
|
if status:
|
|
|
|
msg1 = retrieve_failure_msg[0]
|
|
|
|
msg2 = retrieve_failure_msg[1] % message
|
|
|
|
dialog = ErrorDialog
|
|
|
|
else:
|
|
|
|
msg1 = retrieve_success_msg[0]
|
|
|
|
msg2 = retrieve_success_msg[1]
|
|
|
|
dialog = OkDialog
|
|
|
|
|
|
|
|
if cli:
|
|
|
|
print msg1
|
|
|
|
print msg2
|
|
|
|
else:
|
|
|
|
dialog(msg1,msg2)
|
2005-06-05 09:31:56 +05:30
|
|
|
|
2005-12-06 12:08:09 +05:30
|
|
|
def callback_real(self,value):
|
2005-06-05 09:31:56 +05:30
|
|
|
"""
|
|
|
|
Call back function for the WriteXML function that updates the
|
|
|
|
status progress bar.
|
|
|
|
"""
|
2006-04-10 04:23:53 +05:30
|
|
|
self.uistate.pulse_progressbar(value)
|
2005-06-05 09:31:56 +05:30
|
|
|
while(gtk.events_pending()):
|
|
|
|
gtk.main_iteration()
|
|
|
|
|
2005-12-06 12:08:09 +05:30
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
class CheckpointOptions(Tool.ToolOptions):
|
|
|
|
"""
|
|
|
|
Defines options and provides handling interface.
|
|
|
|
"""
|
|
|
|
|
|
|
|
def __init__(self,name,person_id=None):
|
|
|
|
Tool.ToolOptions.__init__(self,name,person_id)
|
|
|
|
|
|
|
|
def set_new_options(self):
|
|
|
|
# Options specific for this report
|
|
|
|
self.options_dict = {
|
|
|
|
'rcs' : 1,
|
|
|
|
'archive' : 1,
|
|
|
|
'cacmd' : '',
|
|
|
|
'crcmd' : '',
|
|
|
|
}
|
|
|
|
self.options_help = {
|
|
|
|
'rcs' : ("=0/1",
|
|
|
|
"Whether to use RCS (ignores custom commands).",
|
|
|
|
["Do not use RCS","Use RCS"],
|
|
|
|
True),
|
|
|
|
'archive' : ("=0/1",
|
|
|
|
"Whether to archive or retrieve.",
|
|
|
|
["Retrieve","Archive"],
|
|
|
|
True),
|
|
|
|
'cacmd' : ("=str","Custom command line for archiving",
|
|
|
|
"Custom command string"),
|
|
|
|
'crcmd' : ("=str","Custom command line for retrieval",
|
|
|
|
"Custom command string"),
|
|
|
|
}
|
|
|
|
|
2005-06-05 09:31:56 +05:30
|
|
|
#------------------------------------------------------------------------
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#
|
|
|
|
#------------------------------------------------------------------------
|
|
|
|
register_tool(
|
2005-12-06 12:08:09 +05:30
|
|
|
name = 'chkpoint',
|
|
|
|
category = Tool.TOOL_REVCTL,
|
|
|
|
tool_class = Checkpoint,
|
|
|
|
options_class = CheckpointOptions,
|
|
|
|
modes = Tool.MODE_GUI | Tool.MODE_CLI,
|
|
|
|
translated_name = _("Checkpoint the database"),
|
|
|
|
status = _("Stable"),
|
|
|
|
author_name = "Alex Roitman",
|
|
|
|
author_email = "shura@gramps-project.org",
|
|
|
|
description = _("Store a snapshot of the current database into "
|
|
|
|
"a revision control system")
|
|
|
|
)
|