2007-10-06 Don Allingham <don@gramps-project.org>
* various: creation of gen.db package svn: r9091
This commit is contained in:
parent
e7f02d1855
commit
32d7968365
@ -1,3 +1,6 @@
|
||||
2007-10-06 Don Allingham <don@gramps-project.org>
|
||||
* various: creation of gen.db package
|
||||
|
||||
2007-10-06 Benny Malengier <benny.malengier@gramps-project.org>
|
||||
* src/DataViews/_RelationView.py: don't crash on missing media ref
|
||||
* src/DisplayTabs/_GalleryTab.py: on missing media ref, notify to run check tool
|
||||
|
@ -179,6 +179,7 @@ src/plugins/Makefile
|
||||
src/DateHandler/Makefile
|
||||
src/gen/Makefile
|
||||
src/gen/proxy/Makefile
|
||||
src/gen/db/Makefile
|
||||
src/data/Makefile
|
||||
src/data/templates/Makefile
|
||||
src/glade/Makefile
|
||||
|
@ -8,7 +8,7 @@
|
||||
# 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,
|
||||
# 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.
|
||||
@ -68,15 +68,15 @@ from Filters.SideBar import PersonSidebarFilter
|
||||
from DdTargets import DdTargets
|
||||
|
||||
column_names = [
|
||||
_('Name'),
|
||||
_('ID') ,
|
||||
_('Gender'),
|
||||
_('Birth Date'),
|
||||
_('Birth Place'),
|
||||
_('Death Date'),
|
||||
_('Death Place'),
|
||||
_('Spouse'),
|
||||
_('Last Change'),
|
||||
_('Name'),
|
||||
_('ID') ,
|
||||
_('Gender'),
|
||||
_('Birth Date'),
|
||||
_('Birth Place'),
|
||||
_('Death Date'),
|
||||
_('Death Place'),
|
||||
_('Spouse'),
|
||||
_('Last Change'),
|
||||
]
|
||||
|
||||
class PersonView(PageView.PersonNavView):
|
||||
@ -97,27 +97,27 @@ class PersonView(PageView.PersonNavView):
|
||||
self.generic_filter = None
|
||||
|
||||
self.func_list = {
|
||||
'F2' : self.key_goto_home_person,
|
||||
'F3' : self.key_edit_selected_person,
|
||||
'<CONTROL>BackSpace' : self.key_delete_selected_person,
|
||||
'<CONTROL>J' : self.jump,
|
||||
'F2' : self.key_goto_home_person,
|
||||
'F3' : self.key_edit_selected_person,
|
||||
'<CONTROL>BackSpace' : self.key_delete_selected_person,
|
||||
'<CONTROL>J' : self.jump,
|
||||
}
|
||||
self.dirty = True
|
||||
|
||||
Config.client.notify_add("/apps/gramps/interface/filter",
|
||||
Config.client.notify_add("/apps/gramps/interface/filter",
|
||||
self.filter_toggle)
|
||||
|
||||
def change_page(self):
|
||||
PageView.PersonNavView.change_page(self)
|
||||
self.edit_action.set_visible(True)
|
||||
self.edit_action.set_sensitive(not self.dbstate.db.readonly)
|
||||
self.uistate.show_filter_results(self.dbstate,
|
||||
self.model.displayed,
|
||||
self.uistate.show_filter_results(self.dbstate,
|
||||
self.model.displayed,
|
||||
self.model.total)
|
||||
|
||||
def set_active(self):
|
||||
PageView.PersonNavView.set_active(self)
|
||||
self.key_active_changed = self.dbstate.connect('active-changed',
|
||||
self.key_active_changed = self.dbstate.connect('active-changed',
|
||||
self.goto_active_person)
|
||||
self.goto_active_person()
|
||||
|
||||
@ -129,7 +129,7 @@ class PersonView(PageView.PersonNavView):
|
||||
def define_actions(self):
|
||||
"""
|
||||
Required define_actions function for PageView. Builds the action
|
||||
group information required. We extend beyond the normal here,
|
||||
group information required. We extend beyond the normal here,
|
||||
since we want to have more than one action group for the PersonView.
|
||||
Most PageViews really won't care about this.
|
||||
|
||||
@ -147,28 +147,28 @@ class PersonView(PageView.PersonNavView):
|
||||
|
||||
self.all_action.add_actions([
|
||||
('OpenAllNodes', None, _("Expand all nodes"), None, None,
|
||||
self.open_all_nodes),
|
||||
self.open_all_nodes),
|
||||
('Edit', gtk.STOCK_EDIT, _("_Edit"), "<control>Return",
|
||||
_("Edit the selected person"), self.edit),
|
||||
_("Edit the selected person"), self.edit),
|
||||
('CloseAllNodes', None, _("Collapse all nodes"), None, None,
|
||||
self.close_all_nodes),
|
||||
('QuickReport', None, _("Quick Report"), None, None, None),
|
||||
('Dummy', None, ' ', None, None, self.dummy_report),
|
||||
self.close_all_nodes),
|
||||
('QuickReport', None, _("Quick Report"), None, None, None),
|
||||
('Dummy', None, ' ', None, None, self.dummy_report),
|
||||
])
|
||||
|
||||
self.edit_action.add_actions(
|
||||
[
|
||||
('Add', gtk.STOCK_ADD, _("_Add"), "<control>Insert",
|
||||
_("Add a new person"), self.add),
|
||||
_("Add a new person"), self.add),
|
||||
('Remove', gtk.STOCK_REMOVE, _("_Remove"), "<control>Delete",
|
||||
_("Remove the selected person"), self.remove),
|
||||
_("Remove the selected person"), self.remove),
|
||||
('ColumnEdit', gtk.STOCK_PROPERTIES, _('_Column Editor'), None,
|
||||
None, self._column_editor),
|
||||
None, self._column_editor),
|
||||
('CmpMerge', None, _('_Compare and merge'), None, None,
|
||||
self.cmp_merge),
|
||||
self.cmp_merge),
|
||||
('FastMerge', None, _('_Fast merge'), None, None,
|
||||
self.fast_merge),
|
||||
('ExportTab', None, _('Export view'), None, None, self.export),
|
||||
self.fast_merge),
|
||||
('ExportTab', None, _('Export view'), None, None, self.export),
|
||||
])
|
||||
|
||||
self._add_action_group(self.edit_action)
|
||||
@ -191,7 +191,7 @@ class PersonView(PageView.PersonNavView):
|
||||
|
||||
if len(mlist) != 2:
|
||||
QuestionDialog.ErrorDialog(
|
||||
_("Cannot merge people"),
|
||||
_("Cannot merge people"),
|
||||
_("Exactly two people must be selected to perform a merge. "
|
||||
"A second person can be selected by holding down the "
|
||||
"control key while clicking on the desired person."))
|
||||
@ -204,7 +204,7 @@ class PersonView(PageView.PersonNavView):
|
||||
person2, self.build_tree)
|
||||
else:
|
||||
QuestionDialog.ErrorDialog(
|
||||
_("Cannot merge people"),
|
||||
_("Cannot merge people"),
|
||||
_("Exactly two people must be selected to perform a "
|
||||
"merge. A second person can be selected by holding "
|
||||
"down the control key while clicking on the desired "
|
||||
@ -215,7 +215,7 @@ class PersonView(PageView.PersonNavView):
|
||||
|
||||
if len(mlist) != 2:
|
||||
QuestionDialog.ErrorDialog(
|
||||
_("Cannot merge people"),
|
||||
_("Cannot merge people"),
|
||||
_("Exactly two people must be selected to perform a merge. "
|
||||
"A second person can be selected by holding down the "
|
||||
"control key while clicking on the desired person."))
|
||||
@ -229,7 +229,7 @@ class PersonView(PageView.PersonNavView):
|
||||
person2, self.build_tree)
|
||||
else:
|
||||
QuestionDialog.ErrorDialog(
|
||||
_("Cannot merge people"),
|
||||
_("Cannot merge people"),
|
||||
_("Exactly two people must be selected to perform a merge. "
|
||||
"A second person can be selected by holding down the "
|
||||
"control key while clicking on the desired person."))
|
||||
@ -238,10 +238,10 @@ class PersonView(PageView.PersonNavView):
|
||||
import ColumnOrder
|
||||
|
||||
ColumnOrder.ColumnOrder(
|
||||
_('Select Person Columns'),
|
||||
self.uistate,
|
||||
self.dbstate.db.get_person_column_order(),
|
||||
column_names,
|
||||
_('Select Person Columns'),
|
||||
self.uistate,
|
||||
self.dbstate.db.get_person_column_order(),
|
||||
column_names,
|
||||
self.set_column_order)
|
||||
|
||||
def set_column_order(self, column_list):
|
||||
@ -274,7 +274,7 @@ class PersonView(PageView.PersonNavView):
|
||||
self.vbox.set_border_width(4)
|
||||
self.vbox.set_spacing(4)
|
||||
|
||||
self.search_bar = SearchBar(self.dbstate, self.uistate,
|
||||
self.search_bar = SearchBar(self.dbstate, self.uistate,
|
||||
self.build_tree, self.goto_active_person)
|
||||
filter_box = self.search_bar.build()
|
||||
|
||||
@ -283,7 +283,7 @@ class PersonView(PageView.PersonNavView):
|
||||
self.tree.set_headers_visible(True)
|
||||
self.tree.set_fixed_height_mode(True)
|
||||
self.tree.connect('key-press-event', self._key_press)
|
||||
self.tree.connect('start-interactive-search',self.open_all_nodes)
|
||||
self.tree.connect('start-interactive-search', self.open_all_nodes)
|
||||
|
||||
scrollwindow = gtk.ScrolledWindow()
|
||||
scrollwindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
|
||||
@ -310,7 +310,7 @@ class PersonView(PageView.PersonNavView):
|
||||
self.selection.set_mode(gtk.SELECTION_MULTIPLE)
|
||||
self.selection.connect('changed', self.row_changed)
|
||||
|
||||
self.filter_sidebar = PersonSidebarFilter(self.dbstate, self.uistate,
|
||||
self.filter_sidebar = PersonSidebarFilter(self.dbstate, self.uistate,
|
||||
self.filter_clicked)
|
||||
self.filter_pane = self.filter_sidebar.get_widget()
|
||||
|
||||
@ -448,19 +448,19 @@ class PersonView(PageView.PersonNavView):
|
||||
in the display tree.
|
||||
|
||||
We have a bit of a problem due to the nature of how GTK works.
|
||||
We have unselect the previous path and select the new path. However,
|
||||
We have unselect the previous path and select the new path. However,
|
||||
these cause a row change, which calls the row_change callback, which
|
||||
can end up calling change_active_person, which can call
|
||||
goto_active_person, causing a bit of recusion. Confusing, huh?
|
||||
|
||||
Unforunately, we row_change has to be able to call change_active_person,
|
||||
Unforunately, we row_change has to be able to call change_active_person,
|
||||
because the can occur from the interface in addition to programatically.
|
||||
|
||||
TO handle this, we set the self.inactive variable that we can check
|
||||
in row_change to look for this particular condition.
|
||||
"""
|
||||
|
||||
# if there is no active person, or if we have been marked inactive,
|
||||
# if there is no active person, or if we have been marked inactive,
|
||||
# simply return
|
||||
|
||||
if not self.dbstate.active or self.inactive:
|
||||
@ -500,7 +500,7 @@ class PersonView(PageView.PersonNavView):
|
||||
self.tree.scroll_to_cell(path, None, 1, 0.5, 0)
|
||||
except KeyError:
|
||||
self.selection.unselect_all()
|
||||
self.uistate.push_message(self.dbstate,
|
||||
self.uistate.push_message(self.dbstate,
|
||||
_("Active person not visible"))
|
||||
self.dbstate.active = person
|
||||
|
||||
@ -521,7 +521,7 @@ class PersonView(PageView.PersonNavView):
|
||||
def build_tree(self, skip=[]):
|
||||
"""
|
||||
Creates a new PeopleModel instance. Essentially creates a complete
|
||||
rebuild of the data. We need to temporarily store the active person,
|
||||
rebuild of the data. We need to temporarily store the active person,
|
||||
since it can change when rows are unselected when the model is set.
|
||||
"""
|
||||
if self.active:
|
||||
@ -535,8 +535,8 @@ class PersonView(PageView.PersonNavView):
|
||||
self.tree.set_model(self.model)
|
||||
|
||||
if const.USE_TIPS and self.model.tooltip_column != None:
|
||||
self.tooltips = TreeTips.TreeTips(self.tree,
|
||||
self.model.tooltip_column,
|
||||
self.tooltips = TreeTips.TreeTips(self.tree,
|
||||
self.model.tooltip_column,
|
||||
True)
|
||||
|
||||
self.build_columns()
|
||||
@ -544,8 +544,8 @@ class PersonView(PageView.PersonNavView):
|
||||
self.dbstate.change_active_person(active)
|
||||
self._goto()
|
||||
self.dirty = False
|
||||
self.uistate.show_filter_results(self.dbstate,
|
||||
self.model.displayed,
|
||||
self.uistate.show_filter_results(self.dbstate,
|
||||
self.model.displayed,
|
||||
self.model.total)
|
||||
else:
|
||||
self.dirty = True
|
||||
@ -610,8 +610,8 @@ class PersonView(PageView.PersonNavView):
|
||||
'from the database.')
|
||||
msg = "%s %s" % (msg, Utils.data_recover_msg)
|
||||
QuestionDialog.QuestionDialog(_('Delete %s?') % name,
|
||||
msg,
|
||||
_('_Delete Person'),
|
||||
msg,
|
||||
_('_Delete Person'),
|
||||
self.delete_person_response)
|
||||
|
||||
def delete_person_response(self):
|
||||
@ -646,9 +646,9 @@ class PersonView(PageView.PersonNavView):
|
||||
self.tree.remove_column(column)
|
||||
try:
|
||||
column = gtk.TreeViewColumn(
|
||||
_('Name'),
|
||||
self.renderer,
|
||||
text=0,
|
||||
_('Name'),
|
||||
self.renderer,
|
||||
text=0,
|
||||
foreground=self.model.marker_color_column)
|
||||
|
||||
except AttributeError:
|
||||
@ -666,7 +666,7 @@ class PersonView(PageView.PersonNavView):
|
||||
name = column_names[pair[1]]
|
||||
try:
|
||||
column = gtk.TreeViewColumn(
|
||||
name, self.renderer, markup=pair[1],
|
||||
name, self.renderer, markup=pair[1],
|
||||
foreground=self.model.marker_color_column)
|
||||
except AttributeError:
|
||||
column = gtk.TreeViewColumn(
|
||||
@ -697,12 +697,12 @@ class PersonView(PageView.PersonNavView):
|
||||
pass
|
||||
|
||||
if len(selected_ids) == 1:
|
||||
self.tree.drag_source_set(BUTTON1_MASK,
|
||||
[DdTargets.PERSON_LINK.target()],
|
||||
self.tree.drag_source_set(BUTTON1_MASK,
|
||||
[DdTargets.PERSON_LINK.target()],
|
||||
ACTION_COPY)
|
||||
elif len(selected_ids) > 1:
|
||||
self.tree.drag_source_set(BUTTON1_MASK,
|
||||
[DdTargets.PERSON_LINK_LIST.target()],
|
||||
self.tree.drag_source_set(BUTTON1_MASK,
|
||||
[DdTargets.PERSON_LINK_LIST.target()],
|
||||
ACTION_COPY)
|
||||
self.uistate.modify_statusbar(self.dbstate)
|
||||
|
||||
@ -852,7 +852,7 @@ class PersonView(PageView.PersonNavView):
|
||||
reportactions = []
|
||||
if menu and self.dbstate.active:
|
||||
(ui, reportactions) = create_quickreport_menu(
|
||||
CATEGORY_QR_PERSON,
|
||||
CATEGORY_QR_PERSON,
|
||||
self.dbstate,
|
||||
self.dbstate.active.handle)
|
||||
if len(reportactions) > 1 :
|
||||
@ -866,8 +866,8 @@ class PersonView(PageView.PersonNavView):
|
||||
return True
|
||||
return False
|
||||
|
||||
def _key_press(self,obj,event):
|
||||
if not event.state or event.state in (gtk.gdk.MOD2_MASK,):
|
||||
def _key_press(self, obj, event):
|
||||
if not event.state or event.state in (gtk.gdk.MOD2_MASK, ):
|
||||
if event.keyval in (gtk.keysyms.Return, gtk.keysyms.KP_Enter):
|
||||
if self.dbstate.active:
|
||||
self.edit(obj)
|
||||
@ -884,25 +884,25 @@ class PersonView(PageView.PersonNavView):
|
||||
|
||||
def key_goto_home_person(self):
|
||||
self.home(None)
|
||||
self.uistate.push_message(self.dbstate,
|
||||
self.uistate.push_message(self.dbstate,
|
||||
_("Go to default person"))
|
||||
|
||||
def key_edit_selected_person(self):
|
||||
self.edit(None)
|
||||
self.uistate.push_message(self.dbstate,
|
||||
self.uistate.push_message(self.dbstate,
|
||||
_("Edit selected person"))
|
||||
|
||||
|
||||
def key_delete_selected_person(self):
|
||||
self.remove(None)
|
||||
self.uistate.push_message(self.dbstate,
|
||||
self.uistate.push_message(self.dbstate,
|
||||
_("Delete selected person"))
|
||||
|
||||
def export(self, obj):
|
||||
chooser = gtk.FileChooserDialog(
|
||||
_("Export view as spreadsheet"),
|
||||
_("Export view as spreadsheet"),
|
||||
self.uistate.window,
|
||||
gtk.FILE_CHOOSER_ACTION_SAVE,
|
||||
gtk.FILE_CHOOSER_ACTION_SAVE,
|
||||
(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
|
||||
gtk.STOCK_OPEN, gtk.RESPONSE_OK))
|
||||
chooser.set_do_overwrite_confirmation(True)
|
||||
@ -967,23 +967,23 @@ class PersonView(PageView.PersonNavView):
|
||||
ofile.write_cell(name)
|
||||
ofile.end_row()
|
||||
|
||||
# The tree model works different from the rest of the list-based models,
|
||||
# The tree model works different from the rest of the list-based models,
|
||||
# since the iterator method only works on top level nodes. So we must
|
||||
# loop through based off of paths
|
||||
|
||||
path = (0,)
|
||||
path = (0, )
|
||||
node = self.model.on_get_iter(path)
|
||||
while node:
|
||||
real_iter = self.model.get_iter(path)
|
||||
for subindex in range(0, self.model.iter_n_children(real_iter)):
|
||||
subpath = ((path[0],subindex))
|
||||
subpath = ((path[0], subindex))
|
||||
row = self.model[subpath]
|
||||
ofile.start_row()
|
||||
for index in data_cols:
|
||||
ofile.write_cell(row[index])
|
||||
ofile.end_row()
|
||||
node = self.model.on_iter_next(node)
|
||||
path = (path[0]+1,)
|
||||
path = (path[0]+1, )
|
||||
ofile.end_page()
|
||||
ofile.close()
|
||||
|
||||
|
@ -57,6 +57,7 @@ import const
|
||||
import Config
|
||||
import Mime
|
||||
import GrampsDb
|
||||
import gen.db
|
||||
import GrampsDbUtils
|
||||
import Utils
|
||||
from PluginUtils import import_list
|
||||
@ -117,7 +118,7 @@ class DbLoader:
|
||||
filetype = type_selector.get_value()
|
||||
if filetype == 'auto':
|
||||
filetype = Mime.get_type(filename)
|
||||
(the_path, the_file) = os.path.split(filename)
|
||||
# (the_path, the_file) = os.path.split(filename)
|
||||
choose.destroy()
|
||||
if filetype in OPEN_FORMATS:
|
||||
self.read_file(filename, filetype)
|
||||
@ -376,8 +377,9 @@ class DbLoader:
|
||||
mode = 'w'
|
||||
|
||||
try:
|
||||
dbclass = GrampsDb.gramps_db_factory(db_type = filetype)
|
||||
except GrampsDb.GrampsDbException, msg:
|
||||
#dbclass = GrampsDb.gramps_db_factory(db_type = filetype)
|
||||
dbclass = gen.db.GrampsDBDir
|
||||
except gen.db.GrampsDbException, msg:
|
||||
QuestionDialog.ErrorDialog(
|
||||
_("Could not open file: %s") % filename,
|
||||
_("This may be caused by an improper installation of GRAMPS.") +
|
||||
|
@ -25,7 +25,7 @@ Provides the database state class
|
||||
__author__ = "Donald N. Allingham"
|
||||
__revision__ = "$Revision: 8032 $"
|
||||
|
||||
from GrampsDb import GrampsDBCallback, GrampsDbBase
|
||||
from gen.db import GrampsDBCallback, GrampsDbBase
|
||||
import Config
|
||||
|
||||
class DbState(GrampsDBCallback):
|
||||
|
@ -8,7 +8,7 @@
|
||||
# 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,
|
||||
# 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.
|
||||
@ -59,36 +59,36 @@ class FamilyModel(BaseModel):
|
||||
|
||||
_MARKER_COL = 13
|
||||
|
||||
def __init__(self, db, scol=0, order=gtk.SORT_ASCENDING, search=None,
|
||||
def __init__(self, db, scol=0, order=gtk.SORT_ASCENDING, search=None,
|
||||
skip=set(), sort_map=None):
|
||||
self.gen_cursor = db.get_family_cursor
|
||||
self.map = db.get_raw_family_data
|
||||
self.fmap = [
|
||||
self.column_id,
|
||||
self.column_father,
|
||||
self.column_mother,
|
||||
self.column_type,
|
||||
self.column_marriage,
|
||||
self.column_change,
|
||||
self.column_handle,
|
||||
self.column_tooltip,
|
||||
self.column_marker_text,
|
||||
self.column_marker_color,
|
||||
self.column_id,
|
||||
self.column_father,
|
||||
self.column_mother,
|
||||
self.column_type,
|
||||
self.column_marriage,
|
||||
self.column_change,
|
||||
self.column_handle,
|
||||
self.column_tooltip,
|
||||
self.column_marker_text,
|
||||
self.column_marker_color,
|
||||
]
|
||||
self.smap = [
|
||||
self.column_id,
|
||||
self.sort_father,
|
||||
self.sort_mother,
|
||||
self.column_type,
|
||||
self.sort_marriage,
|
||||
self.sort_change,
|
||||
self.column_handle,
|
||||
self.column_tooltip,
|
||||
self.column_marker_text,
|
||||
self.column_marker_color,
|
||||
self.column_id,
|
||||
self.sort_father,
|
||||
self.sort_mother,
|
||||
self.column_type,
|
||||
self.sort_marriage,
|
||||
self.sort_change,
|
||||
self.column_handle,
|
||||
self.column_tooltip,
|
||||
self.column_marker_text,
|
||||
self.column_marker_color,
|
||||
]
|
||||
self.marker_color_column = 9
|
||||
BaseModel.__init__(self, db, scol, order, tooltip_column=6,
|
||||
BaseModel.__init__(self, db, scol, order, tooltip_column=6,
|
||||
search=search, skip=skip, sort_map=sort_map)
|
||||
|
||||
def on_get_n_columns(self):
|
||||
@ -151,7 +151,7 @@ class FamilyModel(BaseModel):
|
||||
return "%012x" % data[13]
|
||||
|
||||
def column_change(self, data):
|
||||
return unicode(time.strftime('%x %X',time.localtime(data[13])),
|
||||
return unicode(time.strftime('%x %X', time.localtime(data[13])),
|
||||
GrampsLocale.codeset)
|
||||
|
||||
def column_marker_text(self, data):
|
||||
@ -175,11 +175,12 @@ class FamilyModel(BaseModel):
|
||||
pass
|
||||
return None
|
||||
|
||||
def column_tooltip(self,data):
|
||||
def column_tooltip(self, data):
|
||||
if const.USE_TIPS:
|
||||
try:
|
||||
t = ToolTips.TipFromFunction(self.db, lambda:
|
||||
self.db.get_family_from_handle(data[0]))
|
||||
t = ToolTips.TipFromFunction(
|
||||
self.db, lambda:
|
||||
self.db.get_family_from_handle(data[0]))
|
||||
except:
|
||||
log.error("Failed to create tooltip.", exc_info=True)
|
||||
return t
|
||||
|
@ -65,7 +65,7 @@ import DateHandler
|
||||
import ToolTips
|
||||
import GrampsLocale
|
||||
import Config
|
||||
from GrampsDb import LongOpStatus
|
||||
from gen.db.longop import LongOpStatus
|
||||
from Filters import SearchFilter, ExactSearchFilter
|
||||
from Lru import LRU
|
||||
|
||||
|
@ -49,7 +49,7 @@ import gtk
|
||||
# GRAMPS modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import GrampsDb
|
||||
import gen.db
|
||||
import Config
|
||||
from BasicUtils import name_displayer
|
||||
import const
|
||||
@ -63,7 +63,7 @@ DISABLED = -1
|
||||
# History manager
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class History(GrampsDb.GrampsDBCallback):
|
||||
class History(gen.db.GrampsDBCallback):
|
||||
""" History manages the objects of a certain type that have been viewed,
|
||||
with ability to go back, or forward.
|
||||
When accessing an object, it should be pushed on the History.
|
||||
@ -75,7 +75,7 @@ class History(GrampsDb.GrampsDBCallback):
|
||||
}
|
||||
|
||||
def __init__(self):
|
||||
GrampsDb.GrampsDBCallback.__init__(self)
|
||||
gen.db.GrampsDBCallback.__init__(self)
|
||||
self.clear()
|
||||
|
||||
def clear(self):
|
||||
@ -290,7 +290,7 @@ class WarnHandler(RotateHandler):
|
||||
top.run()
|
||||
top.destroy()
|
||||
|
||||
class DisplayState(GrampsDb.GrampsDBCallback):
|
||||
class DisplayState(gen.db.GrampsDBCallback):
|
||||
|
||||
__signals__ = {
|
||||
'filters-changed' : (str, ),
|
||||
@ -306,7 +306,7 @@ class DisplayState(GrampsDb.GrampsDBCallback):
|
||||
self.uimanager = uimanager
|
||||
self.progress_monitor = progress_monitor
|
||||
self.window = window
|
||||
GrampsDb.GrampsDBCallback.__init__(self)
|
||||
gen.db.GrampsDBCallback.__init__(self)
|
||||
self.status = status
|
||||
self.status_id = status.get_context_id('GRAMPS')
|
||||
self.progress = progress
|
||||
|
@ -45,13 +45,13 @@ __LOG = logging.getLogger(".GrampsDb")
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from RelLib import *
|
||||
from _GrampsDbBase import *
|
||||
from gen.db.base import *
|
||||
from _DbUtils import db_copy
|
||||
import _GrampsDbConst as const
|
||||
import gen.db.const as const
|
||||
from _GrampsDbExceptions import FileVersionError
|
||||
from BasicUtils import UpdateCallback
|
||||
|
||||
from _GrampsCursor import GrampsCursor
|
||||
from gen.db.cursor import GrampsCursor
|
||||
|
||||
_MINVERSION = 9
|
||||
_DBVERSION = 13
|
||||
|
@ -38,7 +38,8 @@ required e.g.:
|
||||
> GrampsDb.gramps_db_reader_factory(db_type = const.APP_GEDCOM)
|
||||
|
||||
"""
|
||||
import _GrampsDbConst as const
|
||||
import gen.db.dbconst as const
|
||||
from gen.db.exceptions import GrampsDbException
|
||||
|
||||
import logging
|
||||
log = logging.getLogger(".GrampDb")
|
||||
@ -50,7 +51,6 @@ except:
|
||||
log.warn("No Config module available, using defaults.")
|
||||
config = None
|
||||
|
||||
from _GrampsDbExceptions import GrampsDbException
|
||||
|
||||
def gramps_db_factory(db_type):
|
||||
"""Factory class for obtaining a Gramps database backend.
|
||||
|
@ -54,12 +54,12 @@ log = logging.getLogger(".WriteXML")
|
||||
import RelLib
|
||||
from BasicUtils import UpdateCallback
|
||||
|
||||
from _GrampsDbConst import \
|
||||
from gen.db.dbconst import \
|
||||
PERSON_KEY,FAMILY_KEY,SOURCE_KEY,EVENT_KEY,\
|
||||
MEDIA_KEY,PLACE_KEY,REPOSITORY_KEY,NOTE_KEY
|
||||
|
||||
from _GrampsDbExceptions import *
|
||||
from _LongOpStatus import LongOpStatus
|
||||
from gen.db.exceptions import *
|
||||
from gen.db.longop import LongOpStatus
|
||||
|
||||
import gen.proxy
|
||||
|
||||
|
@ -38,22 +38,21 @@ the database objects. Read the comments in _GrampsDBCallback.py for more
|
||||
information.
|
||||
"""
|
||||
|
||||
from _GrampsDbBase import GrampsDbBase
|
||||
#from _GrampsDbBase import GrampsDbBase
|
||||
|
||||
from _GrampsDbFactories import \
|
||||
gramps_db_factory
|
||||
from _GrampsDbFactories import gramps_db_factory
|
||||
|
||||
from _GrampsDbExceptions import *
|
||||
#from _GrampsDbExceptions import *
|
||||
|
||||
from _GrampsDBCallback import GrampsDBCallback
|
||||
#from _GrampsDBCallback import GrampsDBCallback
|
||||
|
||||
from _DbUtils import *
|
||||
|
||||
import _GrampsDbConst as GrampsDbConst
|
||||
#import _GrampsDbConst as GrampsDbConst
|
||||
|
||||
from _GrampsDbWriteXML import GrampsDbXmlWriter, \
|
||||
exportData, quick_write
|
||||
|
||||
from _LongOpStatus import LongOpStatus
|
||||
#from _LongOpStatus import LongOpStatus
|
||||
from _ProgressMonitor import ProgressMonitor
|
||||
|
||||
|
@ -66,7 +66,7 @@ from QuestionDialog import ErrorDialog
|
||||
#------------------------------------------------------------------------
|
||||
import logging
|
||||
import os
|
||||
from GrampsDb import _GrampsDBDir as GrampsDBDir
|
||||
from gen.db.dbdir import GrampsDBDir
|
||||
import cPickle as pickle
|
||||
|
||||
LOG = logging.getLogger(".Backup")
|
||||
|
@ -122,7 +122,7 @@ import _GedcomUtils as GedcomUtils
|
||||
import _GedcomLex as GedcomLex
|
||||
import _GedcomChar as GedcomChar
|
||||
|
||||
from GrampsDb._GrampsDbConst import EVENT_KEY
|
||||
from gen.db.dbconst import EVENT_KEY
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
@ -41,7 +41,7 @@ import logging
|
||||
log = logging.getLogger(".GrampDb")
|
||||
|
||||
|
||||
from GrampsDb import GrampsDbException
|
||||
from gen.db import GrampsDbException
|
||||
|
||||
|
||||
def gramps_db_writer_factory(db_type):
|
||||
|
@ -8,7 +8,7 @@
|
||||
# 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,
|
||||
# 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.
|
||||
@ -26,7 +26,6 @@
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gettext import gettext as _
|
||||
import sets
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -57,7 +56,7 @@ class PersonCompare(ManagedWindow.ManagedWindow):
|
||||
|
||||
def __init__(self, dbstate, uistate, person1, person2, update=None) :
|
||||
|
||||
ManagedWindow.ManagedWindow.__init__(self,uistate,[],self.__class__)
|
||||
ManagedWindow.ManagedWindow.__init__(self, uistate, [], self.__class__)
|
||||
|
||||
self.glade = gtk.glade.XML(const.MERGE_GLADE, "merge")
|
||||
window = self.glade.get_widget('merge')
|
||||
@ -69,36 +68,36 @@ class PersonCompare(ManagedWindow.ManagedWindow):
|
||||
self.p2 = person2
|
||||
self.update = update
|
||||
|
||||
self.set_window(window,self.glade.get_widget('title'),
|
||||
self.set_window(window, self.glade.get_widget('title'),
|
||||
_("Compare People"))
|
||||
self.display(self.text1.get_buffer(), person1)
|
||||
self.display(self.text2.get_buffer(), person2)
|
||||
|
||||
self.glade.get_widget('cancel').connect('clicked',self.close)
|
||||
self.glade.get_widget('close').connect('clicked',self.merge)
|
||||
self.glade.get_widget('help').connect('clicked',self.help)
|
||||
self.glade.get_widget('cancel').connect('clicked', self.close)
|
||||
self.glade.get_widget('close').connect('clicked', self.merge)
|
||||
self.glade.get_widget('help').connect('clicked', self.help)
|
||||
|
||||
def help(self,obj):
|
||||
def help(self, obj):
|
||||
"""Display the relevant portion of GRAMPS manual"""
|
||||
GrampsDisplay.help('adv-merge-people')
|
||||
|
||||
def merge(self,obj):
|
||||
if check_for_spouse(self.p1,self.p2):
|
||||
def merge(self, obj):
|
||||
if check_for_spouse(self.p1, self.p2):
|
||||
QuestionDialog.ErrorDialog(
|
||||
_("Cannot merge people"),
|
||||
_("Cannot merge people"),
|
||||
_("Spouses cannot be merged. To merge these people, "
|
||||
"you must first break the relationship between them."))
|
||||
elif check_for_child(self.p1,self.p2):
|
||||
elif check_for_child(self.p1, self.p2):
|
||||
QuestionDialog.ErrorDialog(
|
||||
_("Cannot merge people"),
|
||||
_("Cannot merge people"),
|
||||
_("A parent and child cannot be merged. To merge these "
|
||||
"people, you must first break the relationship between "
|
||||
"them."))
|
||||
else:
|
||||
if self.glade.get_widget('select1').get_active():
|
||||
merge = MergePeople(self.db,self.p1,self.p2)
|
||||
merge = MergePeople(self.db, self.p1, self.p2)
|
||||
else:
|
||||
merge = MergePeople(self.db,self.p2,self.p1)
|
||||
merge = MergePeople(self.db, self.p2, self.p1)
|
||||
self.close()
|
||||
merge.merge()
|
||||
if self.update:
|
||||
@ -106,90 +105,90 @@ class PersonCompare(ManagedWindow.ManagedWindow):
|
||||
|
||||
def add(self, tobj, tag, text):
|
||||
text += "\n"
|
||||
tobj.insert_with_tags(tobj.get_end_iter(),text,tag)
|
||||
tobj.insert_with_tags(tobj.get_end_iter(), text, tag)
|
||||
|
||||
def display(self, tobj, person):
|
||||
normal = tobj.create_tag()
|
||||
normal.set_property('indent',10)
|
||||
normal.set_property('pixels-above-lines',1)
|
||||
normal.set_property('pixels-below-lines',1)
|
||||
normal.set_property('indent', 10)
|
||||
normal.set_property('pixels-above-lines', 1)
|
||||
normal.set_property('pixels-below-lines', 1)
|
||||
indent = tobj.create_tag()
|
||||
indent.set_property('indent',30)
|
||||
indent.set_property('pixels-above-lines',1)
|
||||
indent.set_property('pixels-below-lines',1)
|
||||
indent.set_property('indent', 30)
|
||||
indent.set_property('pixels-above-lines', 1)
|
||||
indent.set_property('pixels-below-lines', 1)
|
||||
title = tobj.create_tag()
|
||||
title.set_property('weight',pango.WEIGHT_BOLD)
|
||||
title.set_property('scale',pango.SCALE_LARGE)
|
||||
self.add(tobj,title,name_displayer.display(person))
|
||||
self.add(tobj,normal,"%s:\t%s" % (_('ID'),person.get_gramps_id()))
|
||||
self.add(tobj,normal,"%s:\t%s" % (_('Gender'),sex[person.get_gender()]))
|
||||
title.set_property('weight', pango.WEIGHT_BOLD)
|
||||
title.set_property('scale', pango.SCALE_LARGE)
|
||||
self.add(tobj, title, name_displayer.display(person))
|
||||
self.add(tobj, normal, "%s:\t%s" % (_('ID'), person.get_gramps_id()))
|
||||
self.add(tobj, normal, "%s:\t%s" % (_('Gender'), sex[person.get_gender()]))
|
||||
bref = person.get_birth_ref()
|
||||
if bref:
|
||||
self.add(tobj,normal,"%s:\t%s" % (_('Birth'),self.get_event_info(bref.ref)))
|
||||
self.add(tobj, normal, "%s:\t%s" % (_('Birth'), self.get_event_info(bref.ref)))
|
||||
dref = person.get_death_ref()
|
||||
if dref:
|
||||
self.add(tobj,normal,"%s:\t%s" % (_('Death'),self.get_event_info(dref.ref)))
|
||||
self.add(tobj, normal, "%s:\t%s" % (_('Death'), self.get_event_info(dref.ref)))
|
||||
|
||||
nlist = person.get_alternate_names()
|
||||
if len(nlist) > 0:
|
||||
self.add(tobj,title,_("Alternate Names"))
|
||||
self.add(tobj, title, _("Alternate Names"))
|
||||
for name in nlist:
|
||||
self.add(tobj,normal,name_displayer.display_name(name))
|
||||
self.add(tobj, normal, name_displayer.display_name(name))
|
||||
|
||||
elist = person.get_event_ref_list()
|
||||
if len(elist) > 0:
|
||||
self.add(tobj,title,_("Events"))
|
||||
self.add(tobj, title, _("Events"))
|
||||
for event_ref in person.get_event_ref_list():
|
||||
event_handle = event_ref.ref
|
||||
name = str(
|
||||
self.db.get_event_from_handle(event_handle).get_type())
|
||||
self.add(tobj,normal,"%s:\t%s" % (name,self.get_event_info(event_handle)))
|
||||
self.add(tobj, normal, "%s:\t%s" % (name, self.get_event_info(event_handle)))
|
||||
plist = person.get_parent_family_handle_list()
|
||||
|
||||
if len(plist) > 0:
|
||||
self.add(tobj,title,_("Parents"))
|
||||
self.add(tobj, title, _("Parents"))
|
||||
for fid in person.get_parent_family_handle_list():
|
||||
(fn,mn,gid) = self.get_parent_info(fid)
|
||||
self.add(tobj,normal,"%s:\t%s" % (_('Family ID'),gid))
|
||||
(fn, mn, gid) = self.get_parent_info(fid)
|
||||
self.add(tobj, normal, "%s:\t%s" % (_('Family ID'), gid))
|
||||
if fn:
|
||||
self.add(tobj,indent,"%s:\t%s" % (_('Father'),fn))
|
||||
self.add(tobj, indent, "%s:\t%s" % (_('Father'), fn))
|
||||
if mn:
|
||||
self.add(tobj,indent,"%s:\t%s" % (_('Mother'),mn))
|
||||
self.add(tobj, indent, "%s:\t%s" % (_('Mother'), mn))
|
||||
else:
|
||||
self.add(tobj,normal,_("No parents found"))
|
||||
self.add(tobj, normal, _("No parents found"))
|
||||
|
||||
self.add(tobj,title,_("Spouses"))
|
||||
self.add(tobj, title, _("Spouses"))
|
||||
slist = person.get_family_handle_list()
|
||||
if len(slist) > 0:
|
||||
for fid in slist:
|
||||
(fn,mn,pid) = self.get_parent_info(fid)
|
||||
(fn, mn, pid) = self.get_parent_info(fid)
|
||||
family = self.db.get_family_from_handle(fid)
|
||||
self.add(tobj,normal,"%s:\t%s" % (_('Family ID'),pid))
|
||||
spouse_id = ReportUtils.find_spouse(person,family)
|
||||
self.add(tobj, normal, "%s:\t%s" % (_('Family ID'), pid))
|
||||
spouse_id = ReportUtils.find_spouse(person, family)
|
||||
if spouse_id:
|
||||
spouse = self.db.get_person_from_handle(spouse_id)
|
||||
self.add(tobj,indent,"%s:\t%s" % (_('Spouse'),name_of(spouse)))
|
||||
self.add(tobj, indent, "%s:\t%s" % (_('Spouse'), name_of(spouse)))
|
||||
relstr = str(family.get_relationship())
|
||||
self.add(tobj,indent,"%s:\t%s" % (_('Type'),relstr))
|
||||
event = ReportUtils.find_marriage(self.db,family)
|
||||
self.add(tobj, indent, "%s:\t%s" % (_('Type'), relstr))
|
||||
event = ReportUtils.find_marriage(self.db, family)
|
||||
if event:
|
||||
self.add(tobj,indent,"%s:\t%s" % (
|
||||
self.add(tobj, indent, "%s:\t%s" % (
|
||||
_('Marriage'), self.get_event_info(event.get_handle())))
|
||||
for child_ref in family.get_child_ref_list():
|
||||
child = self.db.get_person_from_handle(child_ref.ref)
|
||||
self.add(tobj,indent,"%s:\t%s" % (_('Child'),name_of(child)))
|
||||
self.add(tobj, indent, "%s:\t%s" % (_('Child'), name_of(child)))
|
||||
else:
|
||||
self.add(tobj,normal,_("No spouses or children found"))
|
||||
self.add(tobj, normal, _("No spouses or children found"))
|
||||
|
||||
alist = person.get_address_list()
|
||||
if len(alist) > 0:
|
||||
self.add(tobj,title,_("Addresses"))
|
||||
self.add(tobj, title, _("Addresses"))
|
||||
for addr in alist:
|
||||
location = ", ".join([addr.get_street(),addr.get_city(),
|
||||
addr.get_state(),addr.get_country()])
|
||||
self.add(tobj,normal,location.strip())
|
||||
location = ", ".join([addr.get_street(), addr.get_city(),
|
||||
addr.get_state(), addr.get_country()])
|
||||
self.add(tobj, normal, location.strip())
|
||||
|
||||
def get_parent_info(self,fid):
|
||||
def get_parent_info(self, fid):
|
||||
family = self.db.get_family_from_handle(fid)
|
||||
father_id = family.get_father_handle()
|
||||
mother_id = family.get_mother_handle()
|
||||
@ -203,9 +202,9 @@ class PersonCompare(ManagedWindow.ManagedWindow):
|
||||
mname = name_of(mother)
|
||||
else:
|
||||
mname = u""
|
||||
return (fname,mname,family.get_gramps_id())
|
||||
return (fname, mname, family.get_gramps_id())
|
||||
|
||||
def get_event_info(self,handle):
|
||||
def get_event_info(self, handle):
|
||||
date = ""
|
||||
place = ""
|
||||
if handle:
|
||||
@ -214,7 +213,7 @@ class PersonCompare(ManagedWindow.ManagedWindow):
|
||||
place = self.place_name(event)
|
||||
if date:
|
||||
if place:
|
||||
return "%s, %s" % (date,place)
|
||||
return "%s, %s" % (date, place)
|
||||
else:
|
||||
return date
|
||||
else:
|
||||
@ -225,7 +224,7 @@ class PersonCompare(ManagedWindow.ManagedWindow):
|
||||
else:
|
||||
return ""
|
||||
|
||||
def place_name(self,event):
|
||||
def place_name(self, event):
|
||||
place_id = event.get_place_handle()
|
||||
if place_id:
|
||||
place = self.db.get_place_from_handle(place_id)
|
||||
@ -236,18 +235,18 @@ class PersonCompare(ManagedWindow.ManagedWindow):
|
||||
|
||||
def check_for_spouse(p1, p2):
|
||||
|
||||
f1 = sets.Set(p1.get_family_handle_list())
|
||||
f2 = sets.Set(p2.get_family_handle_list())
|
||||
f1 = set(p1.get_family_handle_list())
|
||||
f2 = set(p2.get_family_handle_list())
|
||||
|
||||
return len(f1.intersection(f2)) != 0
|
||||
|
||||
def check_for_child(p1, p2):
|
||||
|
||||
fs1 = sets.Set(p1.get_family_handle_list())
|
||||
fp1 = sets.Set(p1.get_parent_family_handle_list())
|
||||
fs1 = set(p1.get_family_handle_list())
|
||||
fp1 = set(p1.get_parent_family_handle_list())
|
||||
|
||||
fs2 = sets.Set(p2.get_family_handle_list())
|
||||
fp2 = sets.Set(p2.get_parent_family_handle_list())
|
||||
fs2 = set(p2.get_family_handle_list())
|
||||
fp2 = set(p2.get_parent_family_handle_list())
|
||||
|
||||
return len(fs1.intersection(fp2)) != 0 or len(fs2.intersection(fp1))
|
||||
|
||||
@ -262,20 +261,20 @@ class MergePeopleUI(ManagedWindow.ManagedWindow):
|
||||
|
||||
if check_for_spouse(person1, person2):
|
||||
QuestionDialog.ErrorDialog(
|
||||
_("Cannot merge people"),
|
||||
_("Cannot merge people"),
|
||||
_("Spouses cannot be merged. To merge these people, "
|
||||
"you must first break the relationship between them."))
|
||||
return
|
||||
|
||||
if check_for_child(person1, person2):
|
||||
QuestionDialog.ErrorDialog(
|
||||
_("Cannot merge people"),
|
||||
_("Cannot merge people"),
|
||||
_("A parent and child cannot be merged. To merge these "
|
||||
"people, you must first break the relationship between "
|
||||
"them."))
|
||||
return
|
||||
|
||||
ManagedWindow.ManagedWindow.__init__(self,uistate,[],self.__class__)
|
||||
ManagedWindow.ManagedWindow.__init__(self, uistate, [], self.__class__)
|
||||
|
||||
glade = gtk.glade.XML(const.MERGE_GLADE, 'merge_people')
|
||||
window = glade.get_widget('merge_people')
|
||||
@ -290,7 +289,7 @@ class MergePeopleUI(ManagedWindow.ManagedWindow):
|
||||
p1.set_label(n1)
|
||||
p2.set_label(n2)
|
||||
|
||||
glade.get_widget('help').connect('clicked',self.help)
|
||||
glade.get_widget('help').connect('clicked', self.help)
|
||||
|
||||
ret = gtk.RESPONSE_HELP
|
||||
while ret == gtk.RESPONSE_HELP:
|
||||
@ -298,31 +297,31 @@ class MergePeopleUI(ManagedWindow.ManagedWindow):
|
||||
|
||||
if ret == gtk.RESPONSE_OK:
|
||||
|
||||
if check_for_spouse(person1,person2):
|
||||
if check_for_spouse(person1, person2):
|
||||
QuestionDialog.ErrorDialog(
|
||||
_("Cannot merge people"),
|
||||
_("Cannot merge people"),
|
||||
_("Spouses cannot be merged. To merge these people, "
|
||||
"you must first break the relationship between them."))
|
||||
elif check_for_child(person1,person2):
|
||||
elif check_for_child(person1, person2):
|
||||
QuestionDialog.ErrorDialog(
|
||||
_("Cannot merge people"),
|
||||
_("Cannot merge people"),
|
||||
_("A parent and child cannot be merged. To merge these "
|
||||
"people, you must first break the relationship between "
|
||||
"them."))
|
||||
else:
|
||||
if p1.get_active():
|
||||
merge = MergePeople(dbstate.db,person1,person2)
|
||||
merge = MergePeople(dbstate.db, person1, person2)
|
||||
else:
|
||||
merge = MergePeople(dbstate.db,person2,person1)
|
||||
merge = MergePeople(dbstate.db, person2, person1)
|
||||
merge.merge()
|
||||
if update:
|
||||
update()
|
||||
self.close()
|
||||
|
||||
def build_menu_names(self,obj):
|
||||
return (_('Merge People'),None)
|
||||
def build_menu_names(self, obj):
|
||||
return (_('Merge People'), None)
|
||||
|
||||
def help(self,obj):
|
||||
def help(self, obj):
|
||||
"""Display the relevant portion of GRAMPS manual"""
|
||||
GrampsDisplay.help('adv-merge-people')
|
||||
|
||||
@ -330,7 +329,7 @@ class MergePeopleUI(ManagedWindow.ManagedWindow):
|
||||
def name_of(p):
|
||||
if not p:
|
||||
return ""
|
||||
return "%s [%s]" % (name_displayer.display(p),p.get_gramps_id())
|
||||
return "%s [%s]" % (name_displayer.display(p), p.get_gramps_id())
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -339,15 +338,15 @@ def name_of(p):
|
||||
#-------------------------------------------------------------------------
|
||||
class MergePeople:
|
||||
|
||||
def __init__(self,db,person1,person2):
|
||||
def __init__(self, db, person1, person2):
|
||||
self.db = db
|
||||
self.p1 = person1
|
||||
self.p2 = person2
|
||||
|
||||
def copy_note(self,one,two):
|
||||
def copy_note(self, one, two):
|
||||
one.set_note_list(one.get_note_list() + two.get_note_list())
|
||||
|
||||
def copy_sources(self,one,two):
|
||||
def copy_sources(self, one, two):
|
||||
slist = one.get_source_references()[:]
|
||||
for xsrc in two.get_source_references():
|
||||
for src in slist:
|
||||
@ -356,13 +355,13 @@ class MergePeople:
|
||||
else:
|
||||
one.add_source_reference(xsrc)
|
||||
|
||||
def debug_person(self,person, msg=""):
|
||||
def debug_person(self, person, msg=""):
|
||||
if __debug__:
|
||||
print "## %s person handle %s" % (msg,person.get_handle())
|
||||
print "## %s person handle %s" % (msg, person.get_handle())
|
||||
for h in person.get_family_handle_list():
|
||||
fam = self.db.get_family_from_handle(h)
|
||||
print " - family %s has father: %s, mother: %s" % \
|
||||
(h,fam.get_father_handle(),fam.get_mother_handle())
|
||||
(h, fam.get_father_handle(), fam.get_mother_handle())
|
||||
for h in person.get_parent_family_handle_list():
|
||||
print " - parent family %s" % h
|
||||
|
||||
@ -384,18 +383,18 @@ class MergePeople:
|
||||
new = RelLib.Person()
|
||||
trans = self.db.transaction_begin()
|
||||
|
||||
self.merge_person_information(new,trans)
|
||||
self.merge_person_information(new, trans)
|
||||
self.debug_person(new, "NEW")
|
||||
|
||||
self.merge_family_information(new,trans)
|
||||
self.merge_family_information(new, trans)
|
||||
self.debug_person(new, "NEW")
|
||||
|
||||
self.db.commit_person(new,trans)
|
||||
self.db.commit_person(new, trans)
|
||||
self.debug_person(new, "NEW")
|
||||
self.db.remove_person(self.old_handle,trans)
|
||||
self.db.transaction_commit(trans,"Merge Person")
|
||||
self.db.remove_person(self.old_handle, trans)
|
||||
self.db.transaction_commit(trans, "Merge Person")
|
||||
|
||||
def merge_person_information(self,new,trans):
|
||||
def merge_person_information(self, new, trans):
|
||||
"""
|
||||
Merging the person's individual information is pretty simple. The
|
||||
person 'new' is a new, empty person. The data is loaded in this
|
||||
@ -454,7 +453,7 @@ class MergePeople:
|
||||
# note
|
||||
new.set_note_list(self.p1.get_note_list() + self.p2.get_note_list())
|
||||
|
||||
def merge_gramps_ids(self,new):
|
||||
def merge_gramps_ids(self, new):
|
||||
"""
|
||||
Merges the GRAMPS IDs. The new GRAMPS ID is taken from
|
||||
destination person. The GRAMPS ID of the other person is added
|
||||
@ -497,7 +496,7 @@ class MergePeople:
|
||||
else:
|
||||
new.add_alternate_name(name)
|
||||
|
||||
def merge_birth(self, new,trans):
|
||||
def merge_birth(self, new, trans):
|
||||
"""
|
||||
Merges the birth events of the two people. If the primary
|
||||
person does not have a birth event, then the birth event from
|
||||
@ -560,7 +559,7 @@ class MergePeople:
|
||||
list any parents that are not already there. This eliminates
|
||||
any duplicates.
|
||||
|
||||
Once this has been completed, we loop through each family,
|
||||
Once this has been completed, we loop through each family,
|
||||
converting any child handles referring to the secondary person
|
||||
to the destination person.
|
||||
"""
|
||||
@ -579,7 +578,7 @@ class MergePeople:
|
||||
# person
|
||||
|
||||
for family_handle in parent_list:
|
||||
self.convert_child_ids(family_handle, self.new_handle,
|
||||
self.convert_child_ids(family_handle, self.new_handle,
|
||||
self.old_handle, trans)
|
||||
new.add_parent_family_handle(family_handle)
|
||||
|
||||
@ -610,9 +609,9 @@ class MergePeople:
|
||||
if [ref.ref for ref in new_ref_list] \
|
||||
!= [ref.ref for ref in orig_ref_list]:
|
||||
family.set_child_ref_list(new_ref_list)
|
||||
self.db.commit_family(family,trans)
|
||||
self.db.commit_family(family, trans)
|
||||
|
||||
def merge_relationships(self,new,trans):
|
||||
def merge_relationships(self, new, trans):
|
||||
"""
|
||||
Merges the relationships associated with the merged people.
|
||||
"""
|
||||
@ -649,14 +648,14 @@ class MergePeople:
|
||||
else:
|
||||
if __debug__:
|
||||
print "Merging family pair"
|
||||
self.merge_family_pair(tgt_family,src_family,trans)
|
||||
self.merge_family_pair(tgt_family, src_family, trans)
|
||||
|
||||
# change parents of the family to point to the new
|
||||
# family
|
||||
self.adjust_family_pointers(tgt_family, src_family, trans)
|
||||
|
||||
new.remove_family_handle(src_handle)
|
||||
self.db.remove_family(src_handle,trans)
|
||||
self.db.remove_family(src_handle, trans)
|
||||
if __debug__:
|
||||
print "Deleted src_family %s" % src_handle
|
||||
else:
|
||||
@ -680,7 +679,7 @@ class MergePeople:
|
||||
if __debug__:
|
||||
print "Family %s now has mother %s" % (
|
||||
src_handle, self.new_handle)
|
||||
self.db.commit_family(src_family,trans)
|
||||
self.db.commit_family(src_family, trans)
|
||||
|
||||
# a little debugging here
|
||||
|
||||
@ -697,10 +696,10 @@ class MergePeople:
|
||||
## if self.p2 == fam.get_mother_handle():
|
||||
## fam.set_mother_handle(self.p1)
|
||||
## if fam.get_father_handle() == None and fam.get_mother_handle() == None:
|
||||
## self.delete_empty_family(fam,trans)
|
||||
## self.delete_empty_family(fam, trans)
|
||||
## data = cursor.next()
|
||||
|
||||
def find_modified_family(self,family):
|
||||
def find_modified_family(self, family):
|
||||
"""
|
||||
Look for a existing family that matches the merged person. This means
|
||||
looking at the current family, and replacing the secondary person's
|
||||
@ -736,7 +735,7 @@ class MergePeople:
|
||||
myfamily = None
|
||||
while node:
|
||||
# data[2] == father_handle field, data[2] == mother_handle field
|
||||
(thandle,data) = node
|
||||
(thandle, data) = node
|
||||
if data[2] == fhandle and data[3] == mhandle and thandle != family_handle:
|
||||
myfamily = RelLib.Family()
|
||||
myfamily.unserialize(data)
|
||||
@ -766,14 +765,14 @@ class MergePeople:
|
||||
father.remove_family_handle(src_family_handle)
|
||||
if __debug__:
|
||||
print "Removed family %s from father %s" % (src_family_handle, father_id)
|
||||
self.db.commit_person(father,trans)
|
||||
self.db.commit_person(father, trans)
|
||||
if mother and src_family_handle in mother.get_family_handle_list():
|
||||
mother.remove_family_handle(src_family_handle)
|
||||
if __debug__:
|
||||
print "Removed family %s from mother %s" % (src_family_handle, mother_id)
|
||||
self.db.commit_person(mother,trans)
|
||||
self.db.commit_person(mother, trans)
|
||||
|
||||
self.merge_family_pair(tgt_family,src_family,trans)
|
||||
self.merge_family_pair(tgt_family, src_family, trans)
|
||||
|
||||
for child_ref in src_family.get_child_ref_list():
|
||||
child_handle = child_ref.ref
|
||||
@ -782,19 +781,19 @@ class MergePeople:
|
||||
if child.remove_parent_family_handle(src_family_handle):
|
||||
if __debug__:
|
||||
print "Remove parent family %s from %s" \
|
||||
% (src_family_handle,child_handle)
|
||||
% (src_family_handle, child_handle)
|
||||
child.add_parent_family_handle(tgt_family.handle)
|
||||
self.db.commit_person(child,trans)
|
||||
self.db.commit_person(child, trans)
|
||||
|
||||
# delete the old source family
|
||||
self.db.remove_family(src_family_handle,trans)
|
||||
self.db.remove_family(src_family_handle, trans)
|
||||
if __debug__:
|
||||
print "Deleted src_family %s" % src_family_handle
|
||||
self.db.commit_family(tgt_family,trans)
|
||||
self.db.commit_family(tgt_family, trans)
|
||||
if tgt_family.get_handle() not in new.get_family_handle_list():
|
||||
new.add_family_handle(tgt_family.get_handle())
|
||||
|
||||
def merge_family_pair(self,tgt_family,src_family,trans):
|
||||
def merge_family_pair(self, tgt_family, src_family, trans):
|
||||
|
||||
tgt_family_child_handles = [ref.ref
|
||||
for ref in tgt_family.get_child_ref_list()]
|
||||
@ -810,9 +809,9 @@ class MergePeople:
|
||||
i = 0
|
||||
for fam in parents[:]:
|
||||
if fam[0] == src_family.get_handle():
|
||||
parents[i] = (tgt_family.get_handle(),fam[1],fam[2])
|
||||
parents[i] = (tgt_family.get_handle(), fam[1], fam[2])
|
||||
i += 1
|
||||
self.db.commit_person(child,trans)
|
||||
self.db.commit_person(child, trans)
|
||||
|
||||
# merge family events
|
||||
|
||||
@ -834,7 +833,7 @@ class MergePeople:
|
||||
|
||||
# merge family top-level sources
|
||||
|
||||
self.copy_sources(tgt_family,src_family)
|
||||
self.copy_sources(tgt_family, src_family)
|
||||
|
||||
# merge multimedia objects
|
||||
|
||||
@ -861,7 +860,7 @@ class MergePeople:
|
||||
tgt_family_handle, father_handle)
|
||||
|
||||
# commit the change
|
||||
self.db.commit_person(father,trans)
|
||||
self.db.commit_person(father, trans)
|
||||
|
||||
mother_handle = src_family.get_mother_handle()
|
||||
if mother_handle:
|
||||
@ -874,7 +873,7 @@ class MergePeople:
|
||||
tgt_family_handle, mother_handle)
|
||||
|
||||
# commit the change
|
||||
self.db.commit_person(mother,trans)
|
||||
self.db.commit_person(mother, trans)
|
||||
|
||||
# remove the children from the old family
|
||||
for child_ref in src_family.get_child_ref_list():
|
||||
@ -882,16 +881,16 @@ class MergePeople:
|
||||
if child_handle != self.new_handle:
|
||||
child = self.db.get_person_from_handle(child_handle)
|
||||
if child.remove_parent_family_handle(src_family_handle):
|
||||
self.db.commit_person(child,trans)
|
||||
self.db.commit_person(child, trans)
|
||||
|
||||
|
||||
def remove_marriage(self,family,person,trans):
|
||||
def remove_marriage(self, family, person, trans):
|
||||
if person:
|
||||
person.remove_family_handle(family.get_handle())
|
||||
if family.get_father_handle() == None and family.get_mother_handle() == None:
|
||||
self.delete_empty_family(family,trans)
|
||||
if family.get_father_handle() is None and family.get_mother_handle() is None:
|
||||
self.delete_empty_family(family, trans)
|
||||
|
||||
def delete_empty_family(self,family,trans):
|
||||
def delete_empty_family(self, family, trans):
|
||||
family_handle = family.get_handle()
|
||||
for child_ref in family.get_child_ref_list():
|
||||
child_handle = child_ref.ref
|
||||
@ -900,8 +899,8 @@ class MergePeople:
|
||||
child.set_main_parent_family_handle(None)
|
||||
else:
|
||||
child.remove_parent_family_handle(family_handle)
|
||||
self.db.commit_person(child,trans)
|
||||
self.db.remove_family(family_handle,trans)
|
||||
self.db.commit_person(child, trans)
|
||||
self.db.remove_family(family_handle, trans)
|
||||
if __debug__:
|
||||
print "Deleted empty family %s" % family_handle
|
||||
|
||||
|
@ -87,7 +87,7 @@ class GtkProgressDialog(gtk.Dialog):
|
||||
|
||||
self._progress_bars = []
|
||||
|
||||
def add(self,long_op_status):
|
||||
def add(self, long_op_status):
|
||||
"""Add a new status object to the progress dialog.
|
||||
|
||||
@param long_op_status: the status object.
|
||||
@ -145,7 +145,7 @@ class GtkProgressDialog(gtk.Dialog):
|
||||
gtk.Dialog.hide(self)
|
||||
self._process_events()
|
||||
|
||||
def _warn(self,x,y):
|
||||
def _warn(self, x, y):
|
||||
return True
|
||||
|
||||
def close(self):
|
||||
@ -155,7 +155,7 @@ if __name__ == '__main__':
|
||||
import time
|
||||
from GrampsDb import LongOpStatus, ProgressMonitor
|
||||
|
||||
def test(a,b):
|
||||
def test(a, b):
|
||||
d = ProgressMonitor(GtkProgressDialog)
|
||||
|
||||
s = LongOpStatus("Doing very long operation", 100, 10)
|
||||
@ -165,7 +165,7 @@ if __name__ == '__main__':
|
||||
for i in xrange(0, 99):
|
||||
time.sleep(0.1)
|
||||
if i == 30:
|
||||
t = LongOpStatus("doing a shorter one", 100, 10,
|
||||
t = LongOpStatus("doing a shorter one", 100, 10,
|
||||
can_cancel=True)
|
||||
d.add_op(t)
|
||||
for j in xrange(0, 99):
|
||||
@ -193,4 +193,4 @@ if __name__ == '__main__':
|
||||
w.show()
|
||||
gtk.main()
|
||||
print 'done'
|
||||
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
# 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,
|
||||
# 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.
|
||||
@ -24,6 +24,7 @@ Provide utilities for printing endnotes in text reports.
|
||||
"""
|
||||
|
||||
import BaseDoc
|
||||
from gettext import gettext as _
|
||||
|
||||
def add_endnote_styles(style_sheet):
|
||||
"""
|
||||
@ -33,30 +34,30 @@ def add_endnote_styles(style_sheet):
|
||||
@type style_sheet: L{Basedoc.StyleSheet}
|
||||
"""
|
||||
font = BaseDoc.FontStyle()
|
||||
font.set(face=BaseDoc.FONT_SANS_SERIF,size=14,italic=1)
|
||||
font.set(face=BaseDoc.FONT_SANS_SERIF, size=14, italic=1)
|
||||
para = BaseDoc.ParagraphStyle()
|
||||
para.set_font(font)
|
||||
para.set_header_level(2)
|
||||
para.set_top_margin(0.25)
|
||||
para.set_bottom_margin(0.25)
|
||||
para.set_description(_('The style used for the generation header.'))
|
||||
style_sheet.add_paragraph_style("Endnotes-Header",para)
|
||||
style_sheet.add_paragraph_style("Endnotes-Header", para)
|
||||
|
||||
para = BaseDoc.ParagraphStyle()
|
||||
para.set(first_indent=-0.75,lmargin=.75)
|
||||
para.set(first_indent=-0.75, lmargin=.75)
|
||||
para.set_top_margin(0.25)
|
||||
para.set_bottom_margin(0.25)
|
||||
para.set_description(_('The basic style used for the endnotes source display.'))
|
||||
style_sheet.add_paragraph_style("Endnotes-Source",para)
|
||||
style_sheet.add_paragraph_style("Endnotes-Source", para)
|
||||
|
||||
para = BaseDoc.ParagraphStyle()
|
||||
para.set(lmargin=1.5)
|
||||
para.set_top_margin(0.25)
|
||||
para.set_bottom_margin(0.25)
|
||||
para.set_description(_('The basic style used for the endnotes reference display.'))
|
||||
style_sheet.add_paragraph_style("Endnotes-Ref",para)
|
||||
style_sheet.add_paragraph_style("Endnotes-Ref", para)
|
||||
|
||||
def cite_source(bibliography,obj):
|
||||
def cite_source(bibliography, obj):
|
||||
"""
|
||||
Cite any sources for the object and add them to the bibliography.
|
||||
|
||||
@ -71,15 +72,15 @@ def cite_source(bibliography,obj):
|
||||
first = 1
|
||||
for ref in slist:
|
||||
if not first:
|
||||
txt += ','
|
||||
txt += ', '
|
||||
first = 0
|
||||
(cindex,key) = bibliography.add_reference(ref)
|
||||
(cindex, key) = bibliography.add_reference(ref)
|
||||
txt += "%d" % (cindex + 1)
|
||||
if key != None:
|
||||
txt += key
|
||||
return txt
|
||||
|
||||
def write_endnotes(bibliography,database,doc):
|
||||
def write_endnotes(bibliography, database, doc):
|
||||
"""
|
||||
Write all the entries in the bibliography as endnotes.
|
||||
|
||||
@ -103,7 +104,7 @@ def write_endnotes(bibliography,database,doc):
|
||||
source = database.get_source_from_handle(citation.get_source_handle())
|
||||
first = True
|
||||
|
||||
doc.start_paragraph('Endnotes-Source',"%d." % cindex)
|
||||
doc.start_paragraph('Endnotes-Source', "%d." % cindex)
|
||||
|
||||
src_txt = _format_source_text(source)
|
||||
|
||||
@ -117,8 +118,8 @@ def write_endnotes(bibliography,database,doc):
|
||||
|
||||
first = True
|
||||
rindex = 0
|
||||
for key,ref in ref_list:
|
||||
txt = "%s: %s" % (key,ref.get_page())
|
||||
for key, ref in ref_list:
|
||||
txt = "%s: %s" % (key, ref.get_page())
|
||||
if first:
|
||||
doc.write_text(txt)
|
||||
first = False
|
||||
@ -149,4 +150,4 @@ def _format_source_text(source):
|
||||
src_txt += ", "
|
||||
src_txt += "(%s)" % source.get_abbreviation()
|
||||
|
||||
return src_txt
|
||||
return src_txt
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -77,6 +77,8 @@ import UndoHistory
|
||||
from DbLoader import DbLoader
|
||||
import GrampsDisplay
|
||||
from GrampsDb import ProgressMonitor
|
||||
import gen.db
|
||||
|
||||
import ProgressDialog
|
||||
|
||||
def show_url(dialog, link, user_data):
|
||||
@ -1050,8 +1052,6 @@ class ViewManager:
|
||||
should enable signals, as well as finish up with other UI goodies.
|
||||
"""
|
||||
|
||||
import GrampsDb
|
||||
|
||||
if os.path.exists(filename):
|
||||
if not os.access(filename, os.W_OK):
|
||||
mode = "r"
|
||||
@ -1071,8 +1071,8 @@ class ViewManager:
|
||||
mode = 'w'
|
||||
|
||||
try:
|
||||
dbclass = GrampsDb.gramps_db_factory(db_type = filetype)
|
||||
except GrampsDb.GrampsDbException, msg:
|
||||
dbclass = gen.db.dbdir.GrampsDBDir
|
||||
except gen.db.exceptions.GrampsDbException, msg:
|
||||
QuestionDialog.ErrorDialog(
|
||||
_("Could not open file: %s") % filename,
|
||||
_("This may be caused by an improper installation of GRAMPS.") +
|
||||
|
@ -19,4 +19,4 @@
|
||||
#
|
||||
|
||||
__version__ = "$Revision: $"
|
||||
__all__ = [ "proxy" ]
|
||||
__all__ = [ "proxy", "db" ]
|
||||
|
30
src/gen/db/Makefile.am
Normal file
30
src/gen/db/Makefile.am
Normal file
@ -0,0 +1,30 @@
|
||||
# This is the src/RelLib level Makefile for Gramps
|
||||
# We could use GNU make's ':=' syntax for nice wildcard use,
|
||||
# but that is not necessarily portable.
|
||||
# If not using GNU make, then list all .py files individually
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@/db
|
||||
|
||||
pkgdata_PYTHON = \
|
||||
__init__.py\
|
||||
base.py \
|
||||
callback.py \
|
||||
cursor.py \
|
||||
dbconst.py \
|
||||
dbdir.py \
|
||||
exceptions.py \
|
||||
iterator.py \
|
||||
longop.py
|
||||
|
||||
pkgpyexecdir = @pkgpyexecdir@/db
|
||||
pkgpythondir = @pkgpythondir@/db
|
||||
|
||||
|
||||
# Clean up all the byte-compiled files
|
||||
MOSTLYCLEANFILES = *pyc *pyo
|
||||
|
||||
GRAMPS_PY_MODPATH = "../"
|
||||
|
||||
pycheck:
|
||||
(export PYTHONPATH=$(GRAMPS_PY_MODPATH); \
|
||||
pychecker $(pkgdata_PYTHON));
|
@ -51,16 +51,16 @@ LOG = logging.getLogger(".GrampsDb")
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from RelLib import *
|
||||
from _GrampsDBCallback import GrampsDBCallback
|
||||
from _CursorIterator import CursorIterator
|
||||
from callback import GrampsDBCallback
|
||||
from iterator import CursorIterator
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# constants
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from _GrampsDbConst import *
|
||||
from _GrampsCursor import GrampsCursor
|
||||
from dbconst import *
|
||||
from cursor import GrampsCursor
|
||||
|
||||
_UNDO_SIZE = 1000
|
||||
|
@ -48,12 +48,11 @@ log = logging.getLogger(".GrampsDb")
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from RelLib import *
|
||||
from _GrampsDbBase import *
|
||||
from _DbUtils import db_copy
|
||||
import _GrampsDbConst as const
|
||||
from _GrampsDbExceptions import FileVersionError
|
||||
from base import *
|
||||
import dbconst as const
|
||||
from exceptions import FileVersionError
|
||||
from BasicUtils import UpdateCallback
|
||||
from _GrampsCursor import GrampsCursor
|
||||
from cursor import GrampsCursor
|
||||
import Errors
|
||||
|
||||
_MINVERSION = 9
|
||||
@ -172,7 +171,7 @@ class GrampsDBDirDupCursor(GrampsDBDirAssocCursor):
|
||||
# GrampsDBDir
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class GrampsDBDir(GrampsDbBase,UpdateCallback):
|
||||
class GrampsDBDir(GrampsDbBase, UpdateCallback):
|
||||
"""GRAMPS database object. This object is a base class for other
|
||||
objects."""
|
||||
|
||||
@ -590,6 +589,7 @@ class GrampsDBDir(GrampsDbBase,UpdateCallback):
|
||||
def load_from(self, other_database, filename, callback):
|
||||
try:
|
||||
self.load(filename,callback)
|
||||
from GrampsDb import db_copy
|
||||
db_copy(other_database,self,callback)
|
||||
return 1
|
||||
except DBERRS, msg:
|
@ -1,4 +1,4 @@
|
||||
from _LongOpStatus import LongOpStatus
|
||||
from longop import LongOpStatus
|
||||
|
||||
class CursorIterator(object):
|
||||
|
@ -1,6 +1,6 @@
|
||||
import time
|
||||
|
||||
from _GrampsDBCallback import GrampsDBCallback
|
||||
from callback import GrampsDBCallback
|
||||
|
||||
class LongOpStatus(GrampsDBCallback):
|
||||
"""LongOpStatus provides a way of communicating the status of a long
|
@ -8,7 +8,7 @@
|
||||
# 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,
|
||||
# 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.
|
||||
@ -72,70 +72,70 @@ def register_stock_icons ():
|
||||
#iconpath to the base image. The front of the list has highest priority
|
||||
if platform.system() == "Windows":
|
||||
iconpaths = [
|
||||
(os.path.join(const.IMAGE_DIR,'48x48'),'.png'),
|
||||
(const.IMAGE_DIR,'.png'),
|
||||
(os.path.join(const.IMAGE_DIR, '48x48'), '.png'),
|
||||
(const.IMAGE_DIR, '.png'),
|
||||
]
|
||||
else :
|
||||
iconpaths = [
|
||||
(os.path.join(const.IMAGE_DIR,'scalable'),'.svg'),
|
||||
(const.IMAGE_DIR,'.svg'), (const.IMAGE_DIR,'.png'),
|
||||
(os.path.join(const.IMAGE_DIR, 'scalable'), '.svg'),
|
||||
(const.IMAGE_DIR, '.svg'), (const.IMAGE_DIR, '.png'),
|
||||
]
|
||||
|
||||
#sizes: menu=16, small_toolbar=18, large_toolbar=24,
|
||||
#sizes: menu=16, small_toolbar=18, large_toolbar=24,
|
||||
# button=20, dnd=32, dialog=48
|
||||
#add to the back of this list to overrule images set at beginning of list
|
||||
extraiconsize = [
|
||||
(os.path.join(const.IMAGE_DIR, '22x22'),
|
||||
gtk.ICON_SIZE_LARGE_TOOLBAR),
|
||||
(os.path.join(const.IMAGE_DIR, '16x16'),
|
||||
gtk.ICON_SIZE_MENU),
|
||||
(os.path.join(const.IMAGE_DIR, '22x22'),
|
||||
gtk.ICON_SIZE_BUTTON),
|
||||
(os.path.join(const.IMAGE_DIR, '22x22'),
|
||||
gtk.ICON_SIZE_LARGE_TOOLBAR),
|
||||
(os.path.join(const.IMAGE_DIR, '16x16'),
|
||||
gtk.ICON_SIZE_MENU),
|
||||
(os.path.join(const.IMAGE_DIR, '22x22'),
|
||||
gtk.ICON_SIZE_BUTTON),
|
||||
]
|
||||
|
||||
items = [
|
||||
('gramps-db',_('Family Trees'),gtk.gdk.CONTROL_MASK,0,''),
|
||||
('gramps-address',_('Address'),gtk.gdk.CONTROL_MASK,0,''),
|
||||
('gramps-attribute',_('Attribute'),gtk.gdk.CONTROL_MASK,0,''),
|
||||
#('gramps-bookmark',_('Bookmarks'),gtk.gdk.CONTROL_MASK,0,''),
|
||||
#('gramps-bookmark-delete',_('Delete bookmark'),gtk.gdk.CONTROL_MASK,0,''),
|
||||
('gramps-bookmark-edit',_('Edit Bookmarks'),gtk.gdk.CONTROL_MASK,0,''),
|
||||
('gramps-bookmark-new',_('Add Bookmark'),gtk.gdk.CONTROL_MASK,0,''),
|
||||
('gramps-date',_('Date'),gtk.gdk.CONTROL_MASK,0,''),
|
||||
('gramps-date-edit',_('Edit Date'),gtk.gdk.CONTROL_MASK,0,''),
|
||||
('gramps-event',_('Events'),gtk.gdk.CONTROL_MASK,0,''),
|
||||
('gramps-family',_('Family'),gtk.gdk.CONTROL_MASK,0,''),
|
||||
('gramps-font',_('Font'),gtk.gdk.CONTROL_MASK,0,''),
|
||||
('gramps-font-color',_('Font Color'),gtk.gdk.CONTROL_MASK,0,''),
|
||||
('gramps-font-bgcolor',_('Font Background Color'),gtk.gdk.CONTROL_MASK,0,''),
|
||||
('gramps-lock',_('Public'),gtk.gdk.CONTROL_MASK,0,''),
|
||||
('gramps-media',_('Media'),gtk.gdk.CONTROL_MASK,0,''),
|
||||
('gramps-notes',_('Notes'),gtk.gdk.CONTROL_MASK,0,''),
|
||||
('gramps-parents',_('Parents'),gtk.gdk.CONTROL_MASK,0,''),
|
||||
('gramps-parents-add',_('Add Parents'),gtk.gdk.CONTROL_MASK,0,''),
|
||||
('gramps-parents-open',_('Select Parents'),gtk.gdk.CONTROL_MASK,0,''),
|
||||
('gramps-pedigree',_('Pedigree'),gtk.gdk.CONTROL_MASK,0,''),
|
||||
('gramps-person',_('Person'),gtk.gdk.CONTROL_MASK,0,''),
|
||||
('gramps-place',_('Places'),gtk.gdk.CONTROL_MASK,0,''),
|
||||
('gramps-relation',_('Relationships'),gtk.gdk.CONTROL_MASK,0,''),
|
||||
('gramps-reports',_('Reports'),gtk.gdk.CONTROL_MASK,0,''),
|
||||
('gramps-repository',_('Repositories'),gtk.gdk.CONTROL_MASK,0,''),
|
||||
('gramps-source',_('Sources'),gtk.gdk.CONTROL_MASK,0,''),
|
||||
('gramps-spouse',_('Add Spouse'),gtk.gdk.CONTROL_MASK,0,''),
|
||||
('gramps-tools',_('Tools'),gtk.gdk.CONTROL_MASK,0,''),
|
||||
('gramps-unlock',_('Private'),gtk.gdk.CONTROL_MASK,0,''),
|
||||
('gramps-viewmedia',_('View'),gtk.gdk.CONTROL_MASK,0,''),
|
||||
('gramps-zoom-in',_('Zoom In'),gtk.gdk.CONTROL_MASK,0,''),
|
||||
('gramps-zoom-out',_('Zoom Out'),gtk.gdk.CONTROL_MASK,0,''),
|
||||
('gramps-zoom-fit-width',_('Fit Width'),gtk.gdk.CONTROL_MASK,0,''),
|
||||
('gramps-zoom-best-fit',_('Fit Page'),gtk.gdk.CONTROL_MASK,0,''),
|
||||
('gramps-db', _('Family Trees'), gtk.gdk.CONTROL_MASK, 0, ''),
|
||||
('gramps-address', _('Address'), gtk.gdk.CONTROL_MASK, 0, ''),
|
||||
('gramps-attribute', _('Attribute'), gtk.gdk.CONTROL_MASK, 0, ''),
|
||||
#('gramps-bookmark', _('Bookmarks'), gtk.gdk.CONTROL_MASK, 0, ''),
|
||||
#('gramps-bookmark-delete', _('Delete bookmark'), gtk.gdk.CONTROL_MASK, 0, ''),
|
||||
('gramps-bookmark-edit', _('Edit Bookmarks'), gtk.gdk.CONTROL_MASK, 0, ''),
|
||||
('gramps-bookmark-new', _('Add Bookmark'), gtk.gdk.CONTROL_MASK, 0, ''),
|
||||
('gramps-date', _('Date'), gtk.gdk.CONTROL_MASK, 0, ''),
|
||||
('gramps-date-edit', _('Edit Date'), gtk.gdk.CONTROL_MASK, 0, ''),
|
||||
('gramps-event', _('Events'), gtk.gdk.CONTROL_MASK, 0, ''),
|
||||
('gramps-family', _('Family'), gtk.gdk.CONTROL_MASK, 0, ''),
|
||||
('gramps-font', _('Font'), gtk.gdk.CONTROL_MASK, 0, ''),
|
||||
('gramps-font-color', _('Font Color'), gtk.gdk.CONTROL_MASK, 0, ''),
|
||||
('gramps-font-bgcolor', _('Font Background Color'), gtk.gdk.CONTROL_MASK, 0, ''),
|
||||
('gramps-lock', _('Public'), gtk.gdk.CONTROL_MASK, 0, ''),
|
||||
('gramps-media', _('Media'), gtk.gdk.CONTROL_MASK, 0, ''),
|
||||
('gramps-notes', _('Notes'), gtk.gdk.CONTROL_MASK, 0, ''),
|
||||
('gramps-parents', _('Parents'), gtk.gdk.CONTROL_MASK, 0, ''),
|
||||
('gramps-parents-add', _('Add Parents'), gtk.gdk.CONTROL_MASK, 0, ''),
|
||||
('gramps-parents-open', _('Select Parents'), gtk.gdk.CONTROL_MASK, 0, ''),
|
||||
('gramps-pedigree', _('Pedigree'), gtk.gdk.CONTROL_MASK, 0, ''),
|
||||
('gramps-person', _('Person'), gtk.gdk.CONTROL_MASK, 0, ''),
|
||||
('gramps-place', _('Places'), gtk.gdk.CONTROL_MASK, 0, ''),
|
||||
('gramps-relation', _('Relationships'), gtk.gdk.CONTROL_MASK, 0, ''),
|
||||
('gramps-reports', _('Reports'), gtk.gdk.CONTROL_MASK, 0, ''),
|
||||
('gramps-repository', _('Repositories'), gtk.gdk.CONTROL_MASK, 0, ''),
|
||||
('gramps-source', _('Sources'), gtk.gdk.CONTROL_MASK, 0, ''),
|
||||
('gramps-spouse', _('Add Spouse'), gtk.gdk.CONTROL_MASK, 0, ''),
|
||||
('gramps-tools', _('Tools'), gtk.gdk.CONTROL_MASK, 0, ''),
|
||||
('gramps-unlock', _('Private'), gtk.gdk.CONTROL_MASK, 0, ''),
|
||||
('gramps-viewmedia', _('View'), gtk.gdk.CONTROL_MASK, 0, ''),
|
||||
('gramps-zoom-in', _('Zoom In'), gtk.gdk.CONTROL_MASK, 0, ''),
|
||||
('gramps-zoom-out', _('Zoom Out'), gtk.gdk.CONTROL_MASK, 0, ''),
|
||||
('gramps-zoom-fit-width', _('Fit Width'), gtk.gdk.CONTROL_MASK, 0, ''),
|
||||
('gramps-zoom-best-fit', _('Fit Page'), gtk.gdk.CONTROL_MASK, 0, ''),
|
||||
]
|
||||
# the following icons are not yet in new directory structure
|
||||
# they should be ported in the near future
|
||||
items_legacy = [
|
||||
('gramps-export',_('Export'),gtk.gdk.CONTROL_MASK,0,''),
|
||||
('gramps-undo-history',_('Undo History'),gtk.gdk.CONTROL_MASK,0,''),
|
||||
('gramps-url',_('URL'),gtk.gdk.CONTROL_MASK,0,''),
|
||||
('gramps-export', _('Export'), gtk.gdk.CONTROL_MASK, 0, ''),
|
||||
('gramps-undo-history', _('Undo History'), gtk.gdk.CONTROL_MASK, 0, ''),
|
||||
('gramps-url', _('URL'), gtk.gdk.CONTROL_MASK, 0, ''),
|
||||
]
|
||||
|
||||
# Register our stock items
|
||||
@ -147,8 +147,8 @@ def register_stock_icons ():
|
||||
|
||||
for data in items+items_legacy:
|
||||
pixbuf = 0
|
||||
for (dirname,ext) in iconpaths:
|
||||
icon_file = os.path.expanduser(os.path.join(dirname,data[0]+ext))
|
||||
for (dirname, ext) in iconpaths:
|
||||
icon_file = os.path.expanduser(os.path.join(dirname, data[0]+ext))
|
||||
if os.path.isfile(icon_file):
|
||||
try:
|
||||
pixbuf = gtk.gdk.pixbuf_new_from_file (icon_file)
|
||||
@ -157,7 +157,7 @@ def register_stock_icons ():
|
||||
pass
|
||||
|
||||
if not pixbuf :
|
||||
icon_file = os.path.join(const.IMAGE_DIR,'gramps.png')
|
||||
icon_file = os.path.join(const.IMAGE_DIR, 'gramps.png')
|
||||
pixbuf = gtk.gdk.pixbuf_new_from_file (icon_file)
|
||||
|
||||
pixbuf = pixbuf.add_alpha(True, chr(0xff), chr(0xff), chr(0xff))
|
||||
@ -184,12 +184,12 @@ def register_stock_icons ():
|
||||
|
||||
|
||||
def build_user_paths():
|
||||
user_paths = [const.HOME_DIR,
|
||||
os.path.join(const.HOME_DIR,"filters"),
|
||||
os.path.join(const.HOME_DIR,"plugins"),
|
||||
os.path.join(const.HOME_DIR,"docgen"),
|
||||
os.path.join(const.HOME_DIR,"templates"),
|
||||
os.path.join(const.HOME_DIR,"thumb")]
|
||||
user_paths = [const.HOME_DIR,
|
||||
os.path.join(const.HOME_DIR, "filters"),
|
||||
os.path.join(const.HOME_DIR, "plugins"),
|
||||
os.path.join(const.HOME_DIR, "docgen"),
|
||||
os.path.join(const.HOME_DIR, "templates"),
|
||||
os.path.join(const.HOME_DIR, "thumb")]
|
||||
|
||||
for path in user_paths:
|
||||
if not os.path.isdir(path):
|
||||
@ -208,33 +208,29 @@ class Gramps:
|
||||
process. It may spawn several windows and control several databases.
|
||||
"""
|
||||
|
||||
def __init__(self,args):
|
||||
def __init__(self, args):
|
||||
try:
|
||||
build_user_paths()
|
||||
self.welcome()
|
||||
except OSError, msg:
|
||||
ErrorDialog(_("Configuration error"),str(msg))
|
||||
return
|
||||
ErrorDialog(_("Configuration error"), str(msg))
|
||||
except Errors.GConfSchemaError, val:
|
||||
ErrorDialog(_("Configuration error"),str(val) +
|
||||
ErrorDialog(_("Configuration error"), str(val) +
|
||||
_("\n\nPossibly the installation of GRAMPS "
|
||||
"was incomplete. Make sure the GConf schema "
|
||||
"of GRAMPS is properly installed."))
|
||||
gtk.main_quit()
|
||||
return
|
||||
except:
|
||||
log.error("Error reading configuration.", exc_info=True)
|
||||
return
|
||||
|
||||
if not mime_type_is_defined(const.APP_GRAMPS):
|
||||
ErrorDialog(_("Configuration error"),
|
||||
ErrorDialog(_("Configuration error"),
|
||||
_("A definition for the MIME-type %s could not "
|
||||
"be found \n\nPossibly the installation of GRAMPS "
|
||||
"was incomplete. Make sure the MIME-types "
|
||||
"of GRAMPS are properly installed.")
|
||||
% const.APP_GRAMPS)
|
||||
gtk.main_quit()
|
||||
return
|
||||
|
||||
register_stock_icons()
|
||||
|
||||
@ -245,9 +241,9 @@ class Gramps:
|
||||
|
||||
self.vm.init_interface()
|
||||
|
||||
# Depending on the nature of this session,
|
||||
# Depending on the nature of this session,
|
||||
# we may need to change the order of operation
|
||||
ah = ArgHandler.ArgHandler(state,self.vm,args)
|
||||
ah = ArgHandler.ArgHandler(state, self.vm, args)
|
||||
if ah.need_gui():
|
||||
ah.handle_args()
|
||||
self.vm.post_init_interface()
|
||||
@ -263,7 +259,7 @@ class Gramps:
|
||||
# if not Config.get(Config.BETAWARN):
|
||||
# from QuestionDialog import WarningDialog
|
||||
# WarningDialog(
|
||||
# _('Danger: This is unstable code!'),
|
||||
# _('Danger: This is unstable code!'),
|
||||
# _("The GRAMPS 2.1 release is an early, experimental "
|
||||
# "branch of the future 2.2 release. This version is "
|
||||
# "not meant for normal usage. Use at your own risk.\n\n"
|
||||
@ -275,6 +271,6 @@ class Gramps:
|
||||
# "releases of GRAMPS. <b>BACKUP</b> your existing databases "
|
||||
# "before opening them with this version, and make "
|
||||
# "sure to export your data to XML every now and then."))
|
||||
# Config.set(Config.AUTOLOAD,False)
|
||||
# Config.set(Config.BETAWARN,True)
|
||||
# Config.set(Config.AUTOLOAD, False)
|
||||
# Config.set(Config.BETAWARN, True)
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
# 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,
|
||||
# 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.
|
||||
@ -67,14 +67,14 @@ else:
|
||||
|
||||
# Some message strings
|
||||
rcs_setup_failure_msg = [
|
||||
_("Checkpoint Archive Creation Failed"),
|
||||
_("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"),
|
||||
_("Checkpoint Archive Created"),
|
||||
_("No checkpointing archive was found, "
|
||||
"so it was created to enable archiving.\n\n"
|
||||
"The archive file name is %s\n"
|
||||
@ -84,24 +84,24 @@ rcs_setup_success_msg = [
|
||||
]
|
||||
|
||||
archive_failure_msg = [
|
||||
_("Checkpoint Failed"),
|
||||
_("Checkpoint Failed"),
|
||||
_("An attempt to archive the data failed "
|
||||
"with the following message:\n\n%s")
|
||||
]
|
||||
|
||||
archive_success_msg = [
|
||||
_("Checkpoint Succeeded "),
|
||||
_("Checkpoint Succeeded "),
|
||||
_("The data was successfully archived.")
|
||||
]
|
||||
|
||||
retrieve_failure_msg = [
|
||||
_("Checkpoint Failed"),
|
||||
_("Checkpoint Failed"),
|
||||
_("An attempt to retrieve the data failed "
|
||||
"with the following message:\n\n%s")
|
||||
]
|
||||
|
||||
retrieve_success_msg = [
|
||||
_("Checkpoint Succeeded "),
|
||||
_("Checkpoint Succeeded "),
|
||||
_("The data was successfully retrieved.")
|
||||
]
|
||||
|
||||
@ -118,7 +118,7 @@ class Checkpoint(Tool.Tool, ManagedWindow.ManagedWindow):
|
||||
self.dbstate = dbstate
|
||||
|
||||
if uistate:
|
||||
ManagedWindow.ManagedWindow.__init__(self, uistate, [],
|
||||
ManagedWindow.ManagedWindow.__init__(self, uistate, [],
|
||||
Checkpoint)
|
||||
self.callback = self.callback_real
|
||||
self.init_gui()
|
||||
@ -130,8 +130,8 @@ class Checkpoint(Tool.Tool, ManagedWindow.ManagedWindow):
|
||||
# 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")
|
||||
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")
|
||||
@ -153,7 +153,7 @@ class Checkpoint(Tool.Tool, ManagedWindow.ManagedWindow):
|
||||
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)
|
||||
self.rcs_rb.connect('toggled', self.rcs_toggled)
|
||||
|
||||
# Disable RCS if the rcs binary is not available
|
||||
# and show the normally hidden warning
|
||||
@ -161,13 +161,13 @@ class Checkpoint(Tool.Tool, ManagedWindow.ManagedWindow):
|
||||
|
||||
self.title = _("Checkpoint Data")
|
||||
window = self.glade.get_widget('top')
|
||||
self.set_window(window,self.glade.get_widget('title'),self.title)
|
||||
self.set_window(window, self.glade.get_widget('title'), self.title)
|
||||
|
||||
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,
|
||||
"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,
|
||||
})
|
||||
|
||||
self.show()
|
||||
@ -179,38 +179,38 @@ class Checkpoint(Tool.Tool, ManagedWindow.ManagedWindow):
|
||||
else:
|
||||
warning_label.hide()
|
||||
|
||||
def build_menu_names(self,obj):
|
||||
return (_("Checkpoint tool"),None)
|
||||
def build_menu_names(self, obj):
|
||||
return (_("Checkpoint tool"), None)
|
||||
|
||||
def rcs_toggled(self,obj):
|
||||
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):
|
||||
def on_help_clicked(self, obj):
|
||||
"""Display the relevant portion of GRAMPS manual"""
|
||||
GrampsDisplay.help('index')
|
||||
|
||||
def on_archive_clicked(self,obj):
|
||||
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)
|
||||
self.run_tool(archive=True, cli=False)
|
||||
# Save options
|
||||
self.options.handler.save_options()
|
||||
|
||||
def on_retrieve_clicked(self,obj):
|
||||
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)
|
||||
self.run_tool(archive=False, cli=False)
|
||||
# Save options
|
||||
self.options.handler.save_options()
|
||||
|
||||
def run_tool(self,archive=True,cli=False):
|
||||
def run_tool(self, archive=True, cli=False):
|
||||
"""
|
||||
RCS will be a builtin command, since we can handle all
|
||||
configuration on our own. This isn't true for most versioning
|
||||
@ -237,15 +237,15 @@ class Checkpoint(Tool.Tool, ManagedWindow.ManagedWindow):
|
||||
self.uistate.modify_statusbar(self.dbstate)
|
||||
|
||||
def timestamp(self):
|
||||
return unicode(time.strftime('%x %X',time.localtime(time.time())))
|
||||
return unicode(time.strftime('%x %X', time.localtime(time.time())))
|
||||
|
||||
def custom(self,cmd,checkin,cli):
|
||||
def custom(self, cmd, checkin, cli):
|
||||
"""
|
||||
Passed the generated XML file to the specified command.
|
||||
"""
|
||||
proc = subprocess.Popen(
|
||||
cmd,
|
||||
stderr = subprocess.PIPE,
|
||||
cmd,
|
||||
stderr = subprocess.PIPE,
|
||||
stdin = subprocess.PIPE )
|
||||
if checkin:
|
||||
xmlwrite = GrampsDbUtils.XmlWriter(self.db, self.callback,
|
||||
@ -282,19 +282,19 @@ class Checkpoint(Tool.Tool, ManagedWindow.ManagedWindow):
|
||||
print msg1
|
||||
print msg2
|
||||
else:
|
||||
dialog(msg1,msg2)
|
||||
dialog(msg1, msg2)
|
||||
|
||||
def rcs(self, checkin, cli):
|
||||
"""
|
||||
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())
|
||||
(archive_base, ext) = os.path.splitext(self.db.get_save_path())
|
||||
|
||||
archive_base = os.path.join(archive_base, "archive")
|
||||
comment = self.timestamp()
|
||||
|
||||
archive = archive_base + ",v"
|
||||
archive = archive_base + ", v"
|
||||
|
||||
# If the archive file does not exist, we either set it up
|
||||
# or die trying
|
||||
@ -319,7 +319,7 @@ class Checkpoint(Tool.Tool, ManagedWindow.ManagedWindow):
|
||||
print msg1
|
||||
print msg2
|
||||
else:
|
||||
dialog(msg1,msg2)
|
||||
dialog(msg1, msg2)
|
||||
|
||||
if status:
|
||||
return
|
||||
@ -333,8 +333,8 @@ class Checkpoint(Tool.Tool, ManagedWindow.ManagedWindow):
|
||||
cmd = ["ci", archive_base]
|
||||
|
||||
proc = subprocess.Popen(
|
||||
cmd,
|
||||
stdin = subprocess.PIPE,
|
||||
cmd,
|
||||
stdin = subprocess.PIPE,
|
||||
stderr = subprocess.PIPE )
|
||||
proc.stdin.write(comment)
|
||||
proc.stdin.close()
|
||||
@ -356,10 +356,10 @@ class Checkpoint(Tool.Tool, ManagedWindow.ManagedWindow):
|
||||
print msg1
|
||||
print msg2
|
||||
else:
|
||||
dialog(msg1,msg2)
|
||||
dialog(msg1, msg2)
|
||||
else:
|
||||
proc = subprocess.Popen(
|
||||
("co", "-p", archive_base), stdout=subprocess.PIPE,
|
||||
("co", "-p", archive_base), stdout=subprocess.PIPE,
|
||||
stderr = subprocess.PIPE )
|
||||
status = proc.wait()
|
||||
message = "\n".join(proc.stderr.readlines())
|
||||
@ -379,9 +379,9 @@ class Checkpoint(Tool.Tool, ManagedWindow.ManagedWindow):
|
||||
print msg1
|
||||
print msg2
|
||||
else:
|
||||
dialog(msg1,msg2)
|
||||
dialog(msg1, msg2)
|
||||
|
||||
def callback_real(self,value):
|
||||
def callback_real(self, value):
|
||||
"""
|
||||
Call back function for the WriteXML function that updates the
|
||||
status progress bar.
|
||||
@ -400,30 +400,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 __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' : '',
|
||||
'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"),
|
||||
'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"),
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
@ -432,15 +432,15 @@ class CheckpointOptions(Tool.ToolOptions):
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
register_tool(
|
||||
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",
|
||||
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")
|
||||
)
|
||||
|
@ -8,7 +8,7 @@
|
||||
# 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,
|
||||
# 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.
|
||||
@ -20,7 +20,7 @@
|
||||
|
||||
# $Id$
|
||||
|
||||
# Written by Alex Roitman,
|
||||
# Written by Alex Roitman,
|
||||
# largely based on ReadXML by Don Allingham
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -57,11 +57,11 @@ from PluginUtils import register_import
|
||||
# Importing data into the currently open database.
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def importData(database, filename, callback=None,cl=0,use_trans=True):
|
||||
def importData(database, filename, callback=None, cl=0, use_trans=True):
|
||||
|
||||
other_database = GrampsBSDDB()
|
||||
|
||||
# Since we don't want to modify the file being imported,
|
||||
# Since we don't want to modify the file being imported,
|
||||
# we create new temp file into which we will copy the imported file
|
||||
orig_filename = os.path.normpath(filename)
|
||||
new_filename = tempfile.mkstemp()[1]
|
||||
@ -72,14 +72,14 @@ def importData(database, filename, callback=None,cl=0,use_trans=True):
|
||||
other_database.make_env_name = lambda x: new_env_name
|
||||
|
||||
# Copy data
|
||||
shutil.copyfile(orig_filename,new_filename)
|
||||
shutil.copyfile(orig_filename, new_filename)
|
||||
# Copy env if we need and if it exists
|
||||
if other_database.UseTXN and os.path.isdir(orig_env_name):
|
||||
shutil.rmtree(new_env_name)
|
||||
shutil.copytree(orig_env_name,new_env_name)
|
||||
shutil.copytree(orig_env_name, new_env_name)
|
||||
|
||||
try:
|
||||
other_database.load(new_filename,callback)
|
||||
other_database.load(new_filename, callback)
|
||||
except:
|
||||
if cl:
|
||||
print "Error: %s could not be opened. Exiting." % new_filename
|
||||
@ -90,96 +90,96 @@ def importData(database, filename, callback=None,cl=0,use_trans=True):
|
||||
if not other_database.version_supported():
|
||||
if cl:
|
||||
print "Error: %s could not be opened.\n%s Exiting." \
|
||||
% (filename,
|
||||
% (filename,
|
||||
_("The database version is not supported "
|
||||
"by this version of GRAMPS.\n"\
|
||||
"Please upgrade to the corresponding version "
|
||||
"or use XML for porting data between different "
|
||||
"database versions."))
|
||||
else:
|
||||
ErrorDialog(_("%s could not be opened") % filename,
|
||||
ErrorDialog(_("%s could not be opened") % filename,
|
||||
_("The Database version is not supported "
|
||||
"by this version of GRAMPS."))
|
||||
return
|
||||
|
||||
# If other_database contains its custom name formats,
|
||||
# If other_database contains its custom name formats,
|
||||
# we need to do tricks to remap the format numbers
|
||||
if len(other_database.name_formats) > 0:
|
||||
formats_map = remap_name_formats(database,other_database)
|
||||
formats_map = remap_name_formats(database, other_database)
|
||||
name_displayer.set_name_format(database.name_formats)
|
||||
get_person = make_peron_name_remapper(other_database,formats_map)
|
||||
get_person = make_peron_name_remapper(other_database, formats_map)
|
||||
else:
|
||||
# No remapping necessary, proceed as usual
|
||||
get_person = other_database.get_person_from_handle
|
||||
|
||||
# Prepare table and method definitions
|
||||
tables = {
|
||||
'Person' : {'table' : database.person_map,
|
||||
'id_table' : database.id_trans,
|
||||
'add_obj' : database.add_person,
|
||||
'find_next_gramps_id' :database.find_next_person_gramps_id,
|
||||
'Person' : {'table' : database.person_map,
|
||||
'id_table' : database.id_trans,
|
||||
'add_obj' : database.add_person,
|
||||
'find_next_gramps_id' :database.find_next_person_gramps_id,
|
||||
'other_get_from_handle':
|
||||
get_person,
|
||||
get_person,
|
||||
'other_table': other_database.person_map,
|
||||
},
|
||||
'Family' : {'table' : database.family_map,
|
||||
'id_table' : database.fid_trans,
|
||||
'add_obj' : database.add_family,
|
||||
'find_next_gramps_id' :database.find_next_family_gramps_id,
|
||||
},
|
||||
'Family' : {'table' : database.family_map,
|
||||
'id_table' : database.fid_trans,
|
||||
'add_obj' : database.add_family,
|
||||
'find_next_gramps_id' :database.find_next_family_gramps_id,
|
||||
'other_get_from_handle':
|
||||
other_database.get_family_from_handle,
|
||||
other_database.get_family_from_handle,
|
||||
'other_table': other_database.family_map,
|
||||
},
|
||||
},
|
||||
|
||||
'Event' : {'table' : database.event_map,
|
||||
'id_table' : database.eid_trans,
|
||||
'add_obj' : database.add_event,
|
||||
'find_next_gramps_id' : database.find_next_event_gramps_id,
|
||||
'Event' : {'table' : database.event_map,
|
||||
'id_table' : database.eid_trans,
|
||||
'add_obj' : database.add_event,
|
||||
'find_next_gramps_id' : database.find_next_event_gramps_id,
|
||||
'other_get_from_handle':
|
||||
other_database.get_event_from_handle,
|
||||
other_database.get_event_from_handle,
|
||||
'other_table': other_database.event_map,
|
||||
},
|
||||
'Source' : {'table' : database.source_map,
|
||||
'id_table' : database.sid_trans,
|
||||
'add_obj' : database.add_source,
|
||||
'find_next_gramps_id': database.find_next_source_gramps_id,
|
||||
},
|
||||
'Source' : {'table' : database.source_map,
|
||||
'id_table' : database.sid_trans,
|
||||
'add_obj' : database.add_source,
|
||||
'find_next_gramps_id': database.find_next_source_gramps_id,
|
||||
'other_get_from_handle':
|
||||
other_database.get_source_from_handle,
|
||||
other_database.get_source_from_handle,
|
||||
'other_table': other_database.source_map,
|
||||
},
|
||||
'Place' : {'table' : database.place_map,
|
||||
'id_table' : database.pid_trans,
|
||||
'add_obj' : database.add_place,
|
||||
'find_next_gramps_id' :database.find_next_place_gramps_id,
|
||||
},
|
||||
'Place' : {'table' : database.place_map,
|
||||
'id_table' : database.pid_trans,
|
||||
'add_obj' : database.add_place,
|
||||
'find_next_gramps_id' :database.find_next_place_gramps_id,
|
||||
'other_get_from_handle':
|
||||
other_database.get_place_from_handle,
|
||||
other_database.get_place_from_handle,
|
||||
'other_table': other_database.place_map,
|
||||
},
|
||||
'Media' : {'table' : database.media_map,
|
||||
'id_table' : database.oid_trans,
|
||||
'add_obj' : database.add_object,
|
||||
'find_next_gramps_id' : database.find_next_object_gramps_id,
|
||||
},
|
||||
'Media' : {'table' : database.media_map,
|
||||
'id_table' : database.oid_trans,
|
||||
'add_obj' : database.add_object,
|
||||
'find_next_gramps_id' : database.find_next_object_gramps_id,
|
||||
'other_get_from_handle':
|
||||
other_database.get_object_from_handle,
|
||||
other_database.get_object_from_handle,
|
||||
'other_table': other_database.media_map,
|
||||
},
|
||||
'Repository' : {'table' : database.repository_map,
|
||||
'id_table' : database.rid_trans,
|
||||
'add_obj' : database.add_repository,
|
||||
},
|
||||
'Repository' : {'table' : database.repository_map,
|
||||
'id_table' : database.rid_trans,
|
||||
'add_obj' : database.add_repository,
|
||||
'find_next_gramps_id' :
|
||||
database.find_next_repository_gramps_id,
|
||||
database.find_next_repository_gramps_id,
|
||||
'other_get_from_handle':
|
||||
other_database.get_repository_from_handle,
|
||||
'other_table': other_database.repository_map,
|
||||
},
|
||||
'Note' : {'table': database.note_map,
|
||||
'id_table': database.nid_trans,
|
||||
'add_obj': database.add_note,
|
||||
'find_next_gramps_id': database.find_next_note_gramps_id,
|
||||
'other_get_from_handle':
|
||||
other_database.get_note_from_handle,
|
||||
'other_table': other_database.note_map,
|
||||
},
|
||||
other_database.get_repository_from_handle,
|
||||
'other_table': other_database.repository_map,
|
||||
},
|
||||
'Note' : {'table': database.note_map,
|
||||
'id_table': database.nid_trans,
|
||||
'add_obj': database.add_note,
|
||||
'find_next_gramps_id': database.find_next_note_gramps_id,
|
||||
'other_get_from_handle':
|
||||
other_database.get_note_from_handle,
|
||||
'other_table': other_database.note_map,
|
||||
},
|
||||
}
|
||||
|
||||
uc = UpdateCallback(callback)
|
||||
@ -193,19 +193,19 @@ def importData(database, filename, callback=None,cl=0,use_trans=True):
|
||||
table = table_dict['table']
|
||||
other_table = table_dict['other_table']
|
||||
msg = '%s handles in two databases overlap.' % key
|
||||
the_len += check_common_handles(table,other_table,msg)
|
||||
the_len += check_common_handles(table, other_table, msg)
|
||||
uc.update()
|
||||
|
||||
# Proceed with preparing for import
|
||||
if use_trans:
|
||||
trans = database.transaction_begin("",batch=True)
|
||||
trans = database.transaction_begin("", batch=True)
|
||||
else:
|
||||
print "Transaction is None! This is no way to go!"
|
||||
trans = None
|
||||
|
||||
database.disable_signals()
|
||||
|
||||
# copy all data from new_database to database,
|
||||
# copy all data from new_database to database,
|
||||
# rename gramps IDs of first-class objects when conflicts are found
|
||||
uc.set_total(the_len)
|
||||
|
||||
@ -216,8 +216,8 @@ def importData(database, filename, callback=None,cl=0,use_trans=True):
|
||||
find_next_gramps_id = table_dict['find_next_gramps_id']
|
||||
other_table = table_dict['other_table']
|
||||
other_get_from_handle = table_dict['other_get_from_handle']
|
||||
import_table(id_table,add_obj,find_next_gramps_id,
|
||||
other_table,other_get_from_handle,trans,uc)
|
||||
import_table(id_table, add_obj, find_next_gramps_id,
|
||||
other_table, other_get_from_handle, trans, uc)
|
||||
|
||||
# Copy bookmarks over:
|
||||
# we already know that there's no overlap in handles anywhere
|
||||
@ -237,12 +237,12 @@ def importData(database, filename, callback=None,cl=0,use_trans=True):
|
||||
os.unlink(new_filename)
|
||||
shutil.rmtree(new_env_name)
|
||||
|
||||
database.transaction_commit(trans,_("Import database"))
|
||||
database.transaction_commit(trans, _("Import database"))
|
||||
database.enable_signals()
|
||||
database.request_rebuild()
|
||||
|
||||
def check_common_handles(table,other_table,msg):
|
||||
# Check for duplicate handles. At the moment we simply exit here,
|
||||
def check_common_handles(table, other_table, msg):
|
||||
# Check for duplicate handles. At the moment we simply exit here,
|
||||
# before modifying any data. In the future we will need to handle
|
||||
# this better. How?
|
||||
handles = set(table.keys())
|
||||
@ -251,8 +251,8 @@ def check_common_handles(table,other_table,msg):
|
||||
raise HandleError(msg)
|
||||
return len(other_handles)
|
||||
|
||||
def import_table(id_table,add_obj,find_next_gramps_id,
|
||||
other_table,other_get_from_handle,trans,uc):
|
||||
def import_table(id_table, add_obj, find_next_gramps_id,
|
||||
other_table, other_get_from_handle, trans, uc):
|
||||
|
||||
for handle in other_table.keys():
|
||||
obj = other_get_from_handle(handle)
|
||||
@ -262,14 +262,14 @@ def import_table(id_table,add_obj,find_next_gramps_id,
|
||||
if id_table.has_key(gramps_id):
|
||||
gramps_id = find_next_gramps_id()
|
||||
obj.gramps_id = gramps_id
|
||||
add_obj(obj,trans)
|
||||
add_obj(obj, trans)
|
||||
uc.update()
|
||||
|
||||
def remap_name_formats(database,other_database):
|
||||
def remap_name_formats(database, other_database):
|
||||
formats_map = {}
|
||||
taken_numbers = [num for (num,name,fmt_str,active)
|
||||
taken_numbers = [num for (num, name, fmt_str, active)
|
||||
in database.name_formats]
|
||||
for (number,name,fmt_str,act) in other_database.name_formats:
|
||||
for (number, name, fmt_str, act) in other_database.name_formats:
|
||||
if number in taken_numbers:
|
||||
new_number = -1
|
||||
while new_number in taken_numbers:
|
||||
@ -278,10 +278,10 @@ def remap_name_formats(database,other_database):
|
||||
formats_map[number] = new_number
|
||||
else:
|
||||
new_number = number
|
||||
database.name_formats.append((new_number,name,fmt_str,act))
|
||||
database.name_formats.append((new_number, name, fmt_str, act))
|
||||
return formats_map
|
||||
|
||||
def remap_name(person,formats_map):
|
||||
def remap_name(person, formats_map):
|
||||
for name in [person.primary_name] + person.alternate_names:
|
||||
try:
|
||||
name.sort_as = formats_map[name.sort_as]
|
||||
@ -292,10 +292,10 @@ def remap_name(person,formats_map):
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
def make_peron_name_remapper(other_database,formats_map):
|
||||
def make_peron_name_remapper(other_database, formats_map):
|
||||
def new_get_person(handle):
|
||||
person = other_database.get_person_from_handle(handle)
|
||||
remap_name(person,formats_map)
|
||||
remap_name(person, formats_map)
|
||||
return person
|
||||
return new_get_person
|
||||
|
||||
@ -310,4 +310,4 @@ _filter.set_name(_('GRAMPS 2.x database'))
|
||||
_filter.add_mime_type(_mime_type)
|
||||
_format_name = _('GRAMPS 2.x database')
|
||||
|
||||
register_import(importData,_filter,_mime_type,0,_format_name)
|
||||
register_import(importData, _filter, _mime_type, 0, _format_name)
|
||||
|
@ -5,10 +5,10 @@
|
||||
#
|
||||
# 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
|
||||
# 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,
|
||||
# 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.
|
||||
@ -62,41 +62,41 @@ from PluginUtils import register_import
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def impData(database, name,cb=None,cl=0):
|
||||
def impData(database, name, cb=None, cl=0):
|
||||
# Create tempdir, if it does not exist, then check for writability
|
||||
# THE TEMP DIR is named as the filname.gpkg.media and is created
|
||||
# in the same dir as the database that we are importing into.
|
||||
db_path = os.path.dirname(database.get_save_path())
|
||||
media_dir = "%s.media" % os.path.basename(name)
|
||||
tmpdir_path = os.path.join(db_path,media_dir)
|
||||
tmpdir_path = os.path.join(db_path, media_dir)
|
||||
if not os.path.isdir(tmpdir_path):
|
||||
try:
|
||||
os.mkdir(tmpdir_path,0700)
|
||||
os.mkdir(tmpdir_path, 0700)
|
||||
except:
|
||||
ErrorDialog( _("Could not create temporary directory %s") %
|
||||
tmpdir_path )
|
||||
return
|
||||
elif not os.access(tmpdir_path,os.W_OK):
|
||||
elif not os.access(tmpdir_path, os.W_OK):
|
||||
ErrorDialog(_("Temporary directory %s is not writable") % tmpdir_path)
|
||||
return
|
||||
else: # tempdir exists and writable -- clean it up if not empty
|
||||
files = os.listdir(tmpdir_path) ;
|
||||
for filename in files:
|
||||
os.remove(os.path.join(tmpdir_path,filename))
|
||||
os.remove(os.path.join(tmpdir_path, filename))
|
||||
|
||||
try:
|
||||
archive = tarfile.open(name)
|
||||
for tarinfo in archive:
|
||||
archive.extract(tarinfo,tmpdir_path)
|
||||
archive.extract(tarinfo, tmpdir_path)
|
||||
archive.close()
|
||||
except:
|
||||
ErrorDialog(_("Error extracting into %s") % tmpdir_path)
|
||||
return
|
||||
|
||||
imp_db_name = os.path.join(tmpdir_path,const.XMLFILE)
|
||||
imp_db_name = os.path.join(tmpdir_path, const.XMLFILE)
|
||||
|
||||
importer = gramps_db_reader_factory(const.APP_GRAMPS_XML)
|
||||
importer(database,imp_db_name,cb)
|
||||
importer(database, imp_db_name, cb)
|
||||
|
||||
# Clean up tempdir after ourselves
|
||||
# THIS HAS BEEN CHANGED, because now we want to keep images
|
||||
@ -105,7 +105,7 @@ def impData(database, name,cb=None,cl=0):
|
||||
|
||||
## files = os.listdir(tmpdir_path)
|
||||
## for filename in files:
|
||||
## os.remove(os.path.join(tmpdir_path,filename))
|
||||
## os.remove(os.path.join(tmpdir_path, filename))
|
||||
## os.rmdir(tmpdir_path)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
@ -119,4 +119,4 @@ _filter.set_name(_('GRAMPS packages'))
|
||||
_filter.add_mime_type(_mime_type)
|
||||
_format_name = _('GRAMPS package')
|
||||
|
||||
register_import(impData,_filter,_mime_type,0,_format_name)
|
||||
register_import(impData, _filter, _mime_type, 0, _format_name)
|
||||
|
@ -82,8 +82,7 @@ _title_string = _("Export to CD")
|
||||
def writeData(database, filename, person, option_box=None, callback=None):
|
||||
ret = 0
|
||||
writer = PackageWriter(database, filename, callback)
|
||||
ret = writer.export()
|
||||
return ret
|
||||
writer.export()
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
Loading…
x
Reference in New Issue
Block a user