2008-02-18 Raphael Ackermann <raphael.ackermann@gmail.com>

* src/DataViews/PersonView.py
	* src/ViewManager.py
	* src/GrampsCfg.py
	* src/plugins/WriteCD.py
	* src/plugins/FindDupes.py
	* src/Merge/_MergePerson.py
	* src/DbManager.py
	* src/ArgHandler.py
	* src/docgen/HtmlDoc.py
	* src/DbLoader.py
	use from QuestionDialog import ErrorDialog etc to bring in line with
	rest of gramps
	* src/Editors/_EditPrimary.py: EditPrimary._uses_duplicate_id() check
	for duplicates and give error dialog if id is already used. #0001347
	* src/Editors/_EditFamily.py: EditFamily.__do_save(), add call to 
	_uses_duplicate_id(). #0001347 

svn: r10046
This commit is contained in:
Raphael Ackermann 2008-02-18 10:09:50 +00:00
parent 347cb51593
commit de5edf9f29
13 changed files with 126 additions and 90 deletions

View File

@ -1,3 +1,21 @@
2008-02-18 Raphael Ackermann <raphael.ackermann@gmail.com>
* src/DataViews/PersonView.py
* src/ViewManager.py
* src/GrampsCfg.py
* src/plugins/WriteCD.py
* src/plugins/FindDupes.py
* src/Merge/_MergePerson.py
* src/DbManager.py
* src/ArgHandler.py
* src/docgen/HtmlDoc.py
* src/DbLoader.py
use from QuestionDialog import ErrorDialog etc to bring in line with
rest of gramps
* src/Editors/_EditPrimary.py: EditPrimary._uses_duplicate_id() check
for duplicates and give error dialog if id is already used. #0001347
* src/Editors/_EditFamily.py: EditFamily.__do_save(), add call to
_uses_duplicate_id(). #0001347
2008-02-17 Peter Landgren <peter.talken@telia.com>
* src/plugins/StatisticsChart.py:
0001756: Very strange results with statistics report.

View File

@ -52,7 +52,7 @@ import glob
import const
import GrampsDbUtils
import Mime
import QuestionDialog
from QuestionDialog import ErrorDialog
import Config
import RecentFiles
import Utils
@ -398,7 +398,7 @@ class ArgHandler:
filename, filetype= data[0], data[1]
success = True
else:
QuestionDialog.ErrorDialog(
ErrorDialog(
_("Could not open file: %s") % filename,
_('Not a valid Family tree given to open\n\n'
))

View File

@ -51,7 +51,7 @@ from DisplayModels import PeopleModel
import PageView
from BasicUtils import name_displayer
import Utils
import QuestionDialog
from QuestionDialog import ErrorDialog, QuestionDialog
import TreeTips
import Errors
import Config
@ -186,7 +186,7 @@ class PersonView(PageView.PersonNavView):
mlist = self.get_selected_objects()
if len(mlist) != 2:
QuestionDialog.ErrorDialog(
ErrorDialog(
_("Cannot merge people"),
_("Exactly two people must be selected to perform a merge. "
"A second person can be selected by holding down the "
@ -199,7 +199,7 @@ class PersonView(PageView.PersonNavView):
Merge.PersonCompare(self.dbstate, self.uistate, person1,
person2, self.build_tree)
else:
QuestionDialog.ErrorDialog(
ErrorDialog(
_("Cannot merge people"),
_("Exactly two people must be selected to perform a "
"merge. A second person can be selected by holding "
@ -210,7 +210,7 @@ class PersonView(PageView.PersonNavView):
mlist = self.get_selected_objects()
if len(mlist) != 2:
QuestionDialog.ErrorDialog(
ErrorDialog(
_("Cannot merge people"),
_("Exactly two people must be selected to perform a merge. "
"A second person can be selected by holding down the "
@ -224,7 +224,7 @@ class PersonView(PageView.PersonNavView):
Merge.MergePeopleUI(self.dbstate, self.uistate, person1,
person2, self.build_tree)
else:
QuestionDialog.ErrorDialog(
ErrorDialog(
_("Cannot merge people"),
_("Exactly two people must be selected to perform a merge. "
"A second person can be selected by holding down the "
@ -603,7 +603,7 @@ class PersonView(PageView.PersonNavView):
msg = _('Deleting the person will remove the person '
'from the database.')
msg = "%s %s" % (msg, Utils.data_recover_msg)
QuestionDialog.QuestionDialog(_('Delete %s?') % name,
QuestionDialog(_('Delete %s?') % name,
msg,
_('_Delete Person'),
self.delete_person_response)

View File

@ -18,7 +18,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
# $Id:DbLoader.py 9912 2008-01-22 09:17:46Z acraphae $
"""
Handling of loading new/existing databases.
@ -61,7 +61,8 @@ import gen.db
import GrampsDbUtils
import Utils
from PluginUtils import import_list
import QuestionDialog
from QuestionDialog import (DBErrorDialog, ErrorDialog, QuestionDialog2,
WarningDialog)
import Errors
#-------------------------------------------------------------------------
@ -92,7 +93,7 @@ class DbLoader:
# so we will lose the undo history. Warn the user.
if self.dbstate.db.get_number_of_people() > 0:
warn_dialog = QuestionDialog.QuestionDialog2(
warn_dialog = QuestionDialog2(
_('Undo history warning'),
_('Proceeding with import will erase the undo history '
'for this session. In particular, you will not be able '
@ -157,7 +158,7 @@ class DbLoader:
try:
filetype = Mime.get_type(filename)
except RuntimeError, msg:
QuestionDialog.ErrorDialog(
ErrorDialog(
_("Could not open file: %s") % filename,
str(msg))
return False
@ -178,7 +179,7 @@ class DbLoader:
return True
# Finally, we give up and declare this an unknown format
QuestionDialog.ErrorDialog(
ErrorDialog(
_("Could not open file: %s") % filename,
_('File type "%s" is unknown to GRAMPS.\n\n'
'Valid types are: GRAMPS database, GRAMPS XML, '
@ -201,14 +202,14 @@ class DbLoader:
if len(filename) == 0:
return True
elif os.path.isdir(filename):
QuestionDialog.ErrorDialog(
ErrorDialog(
_('Cannot open database'),
_('The selected file is a directory, not '
'a file.\nA GRAMPS database must be a file.'))
return True
elif os.path.exists(filename):
if not os.access(filename, os.R_OK):
QuestionDialog.ErrorDialog(
ErrorDialog(
_('Cannot open database'),
_('You do not have read access to the selected '
'file.'))
@ -219,7 +220,7 @@ class DbLoader:
f.close()
os.remove(filename)
except IOError:
QuestionDialog.ErrorDialog(
ErrorDialog(
_('Cannot create database'),
_('You do not have write access to the selected file.'))
return True
@ -244,7 +245,7 @@ class DbLoader:
if os.path.exists(filename):
if not os.access(filename, os.W_OK):
mode = "r"
QuestionDialog.WarningDialog(_('Read only database'),
WarningDialog(_('Read only database'),
_('You do not have write access '
'to the selected file.'))
else:
@ -268,10 +269,10 @@ class DbLoader:
except (OSError, IOError):
print "could not change directory"
except OSError, msg:
QuestionDialog.ErrorDialog(
ErrorDialog(
_("Could not open file: %s") % filename, str(msg))
except Errors.DbError, msg:
QuestionDialog.DBErrorDialog(str(msg.value))
DBErrorDialog(str(msg.value))
self.dbstate.no_database()
except Exception:
_LOG.error("Failed to open database.", exc_info=True)
@ -289,7 +290,7 @@ class DbLoader:
dirname = os.path.dirname(filename) + os.path.sep
Config.set(Config.RECENT_IMPORT_DIR, dirname)
except UnicodeError, msg:
QuestionDialog.ErrorDialog(
ErrorDialog(
_("Could not import file: %s") % filename,
_("This GEDCOM file incorrectly identifies its character "
"set, so it cannot be accurately imported. Please fix the "

View File

@ -62,7 +62,7 @@ import pango
#
#-------------------------------------------------------------------------
import const
import QuestionDialog
from QuestionDialog import ErrorDialog, QuestionDialog
import gen.db
import GrampsDbUtils
import Config
@ -495,7 +495,7 @@ class DbManager(CLIDbManager):
path = store.get_path(node)
self.lock_file = store[path][PATH_COL]
QuestionDialog.QuestionDialog(
QuestionDialog(
_("Break the lock on the '%s' database?") % store[path][0],
_("GRAMPS believes that someone else is actively editing "
"this database. You cannot edit this database while it "
@ -574,8 +574,6 @@ class DbManager(CLIDbManager):
del proc
if status != 0:
from QuestionDialog import ErrorDialog
ErrorDialog(
_("Rename failed"),
_("An attempt to rename a version failed "
@ -592,7 +590,7 @@ class DbManager(CLIDbManager):
node = self.model.get_iter(path)
filename = self.model.get_value(node, FILE_COL)
if self.existing_name(new_text, skippath=path):
QuestionDialog.ErrorDialog(
ErrorDialog(
_("Could not rename the Family Tree."),
_("Family Tree already exists, choose a unique name."))
return
@ -606,7 +604,7 @@ class DbManager(CLIDbManager):
RecentFiles.rename_filename(old_text, new_text)
self.model.set_value(node, NAME_COL, new_text)
except (OSError, IOError), msg:
QuestionDialog.ErrorDialog(
ErrorDialog(
_("Could not rename family tree"),
str(msg))
@ -662,7 +660,7 @@ class DbManager(CLIDbManager):
self.data_to_delete = store[path]
if len(path) == 1:
QuestionDialog.QuestionDialog(
QuestionDialog(
_("Remove the '%s' database?") % self.data_to_delete[0],
_("Removing this database will permanently destroy the data."),
_("Remove database"),
@ -670,7 +668,7 @@ class DbManager(CLIDbManager):
else:
rev = self.data_to_delete[0]
parent = store[(path[0],)][0]
QuestionDialog.QuestionDialog(
QuestionDialog(
_("Remove the '%(revision)s' version of '%(database)s'") % {
'revision' : rev,
'database' : parent
@ -706,7 +704,7 @@ class DbManager(CLIDbManager):
os.unlink(os.path.join(top, filename))
os.rmdir(self.data_to_delete[1])
except (IOError, OSError), msg:
QuestionDialog.ErrorDialog(_("Could not delete family tree"),
ErrorDialog(_("Could not delete family tree"),
str(msg))
# rebuild the display
self.__populate()
@ -730,8 +728,6 @@ class DbManager(CLIDbManager):
del proc
if status != 0:
from QuestionDialog import ErrorDialog
ErrorDialog(
_("Deletion failed"),
_("An attempt to delete a version failed "
@ -808,7 +804,7 @@ class DbManager(CLIDbManager):
try:
self._create_new_db()
except (OSError, IOError), msg:
QuestionDialog.ErrorDialog(_("Could not create family tree"),
ErrorDialog(_("Could not create family tree"),
str(msg))
self.new.set_sensitive(True)
@ -1003,8 +999,6 @@ def check_out(dbase, rev, path, callback):
del proc
if status != 0:
from QuestionDialog import ErrorDialog
ErrorDialog(
_("Retrieve failed"),
_("An attempt to retrieve the data failed "
@ -1057,8 +1051,6 @@ def check_in(dbase, filename, callback, cursor_func = None):
del proc
if status != 0:
from QuestionDialog import ErrorDialog
ErrorDialog(
_("Archiving failed"),
_("An attempt to archive the data failed "

View File

@ -66,7 +66,8 @@ from DisplayTabs import (EmbeddedList, EventEmbedList, SourceEmbedList,
from GrampsWidgets import (PrivacyButton, MonitoredEntry, MonitoredDataType,
IconButton, LinkBox, BasicLabel)
from ReportBase import CATEGORY_QR_FAMILY
import QuestionDialog
from QuestionDialog import (ErrorDialog, RunDatabaseRepair, WarningDialog,
MessageHideDialog)
from Selectors import selector_factory
SelectPerson = selector_factory('Person')
@ -419,7 +420,7 @@ class EditFamily(EditPrimary):
for i in self.hidden:
i.set_sensitive(False)
QuestionDialog.MessageHideDialog(
MessageHideDialog(
_("Adding parents to a person"),
_("It is possible to accidentally create multiple "
"families with the same parents. To help avoid "
@ -470,7 +471,7 @@ class EditFamily(EditPrimary):
self.lds_embed.data = self.obj.get_lds_ord_list()
self.lds_embed.rebuild()
QuestionDialog.WarningDialog(
WarningDialog(
_("Family has changed"),
_("The family you are editing has changed. To make sure that the "
"database is not corrupted, GRAMPS has updated the family to "
@ -771,7 +772,7 @@ class EditFamily(EditPrimary):
common = list(mfam.intersection(ffam))
if len(common) > 0:
if self.add_parent or self.obj.handle not in common:
QuestionDialog.WarningDialog(
WarningDialog(
_('Duplicate Family'),
_('A family with these parents already exists '
'in the database. If you save, you will create '
@ -862,7 +863,7 @@ class EditFamily(EditPrimary):
try:
self.__do_save()
except bsddb_db.DBRunRecoveryError, msg:
QuestionDialog.RunDatabaseRepair(msg[1])
RunDatabaseRepair(msg[1])
def __do_save(self):
self.ok_button.set_sensitive(False)
@ -881,7 +882,7 @@ class EditFamily(EditPrimary):
father = self.db.get_person_from_handle(self.obj.get_father_handle())
name = "%s [%s]" % (name_displayer.display(father),
father.gramps_id)
QuestionDialog.ErrorDialog(_("A father cannot be his own child"),
ErrorDialog(_("A father cannot be his own child"),
_("%s is listed as both the father and child "
"of the family.") % name)
self.ok_button.set_sensitive(True)
@ -891,19 +892,31 @@ class EditFamily(EditPrimary):
mother = self.db.get_person_from_handle(self.obj.get_mother_handle())
name = "%s [%s]" % (name_displayer.display(mother),
mother.gramps_id)
QuestionDialog.ErrorDialog(_("A mother cannot be her own child"),
ErrorDialog(_("A mother cannot be her own child"),
_("%s is listed as both the mother and child "
"of the family.") % name)
self.ok_button.set_sensitive(True)
return
if not original and self.object_is_empty():
QuestionDialog.ErrorDialog(
ErrorDialog(
_("Cannot save family"),
_("No data exists for this family. "
"Please enter data or cancel the edit."))
self.ok_button.set_sensitive(True)
return
(uses_dupe_id, id) = self._uses_duplicate_id()
if uses_dupe_id:
msg1 = _("Cannot save family. ID already exists.")
msg2 = _("You have attempted to use the existing GRAMPS ID with "
"value %(id)s. This value is already used. Please "
"enter a different ID or leave "
"blank to get the next available ID value.") % {
'id' : id}
ErrorDialog(msg1, msg2)
self.ok_button.set_sensitive(True)
return
# We disconnect the callbacks to all signals we connected earlier.
# This prevents the signals originating in any of the following

View File

@ -29,6 +29,7 @@ from BasicUtils import name_displayer
import Config
import GrampsDisplay
from QuestionDialog import SaveDialog
import gen.lib
class EditPrimary(ManagedWindow.ManagedWindow):
@ -36,8 +37,12 @@ class EditPrimary(ManagedWindow.ManagedWindow):
def __init__(self, state, uistate, track, obj, get_from_handle,
get_from_gramps_id, callback=None):
"""Creates an edit window. Associates a person with the window."""
"""
Create an edit window.
Associate a person with the window.
"""
self.dp = DateHandler.parser
self.dd = DateHandler.displayer
self.name_displayer = name_displayer
@ -166,7 +171,11 @@ class EditPrimary(ManagedWindow.ManagedWindow):
return False
def empty_object(self):
return None
#empty_object should be overridden in base class and will throw an
#exception if it is not because self.empty_object().serialize() is
#called and PrimaryObject does not implement serialize(). See
#BaseObject.serialize()
return gen.lib.PrimaryObject
def data_has_changed(self):
@ -263,7 +272,17 @@ class EditPrimary(ManagedWindow.ManagedWindow):
def _uses_duplicate_id(self):
"""
Fix problem for now
Check whether a changed or added GRAMPS ID already exists in the DB.
Return True if a duplicate GRAMPS ID has been detected.
"""
return (False, 0)
original = self.get_from_handle(self.obj.get_handle())
if original and original.get_gramps_id() == self.obj.get_gramps_id():
return (False, 0)
else:
idval = self.obj.get_gramps_id()
if self.get_from_gramps_id(idval):
return (True, idval)
return (False, 0)

View File

@ -49,7 +49,7 @@ import Utils
from gen.lib import Name
import ManagedWindow
from GrampsWidgets import *
import QuestionDialog
from QuestionDialog import ErrorDialog, QuestionDialog2
from Errors import NameDisplayError
#-------------------------------------------------------------------------
@ -404,7 +404,7 @@ class GrampsPreferences(ManagedWindow.ManagedWindow):
oldname = self.fmt_model.get_value(node, COL_NAME)
# check to see if this pattern already exists
if self.__check_for_name(translation, node):
QuestionDialog.ErrorDialog(_("This format exists already"),
ErrorDialog(_("This format exists already"),
translation)
self.edit_button.emit('clicked')
return
@ -928,7 +928,7 @@ class NameFormatEditDlg:
if self.response == gtk.RESPONSE_OK:
if not self.valid:
q = QuestionDialog.QuestionDialog2(
q = QuestionDialog2(
_('The format definition is invalid'),
_('What would you like to do?'),
_('_Continue anyway'), _('_Modify format'),
@ -938,7 +938,7 @@ class NameFormatEditDlg:
elif self.fmt_name == '' and self.fmt_str == '':
self.response = gtk.RESPONSE_CANCEL
elif (self.fmt_name == '') ^ (self.fmt_str == ''):
QuestionDialog.ErrorDialog(
ErrorDialog(
_('Both Format name and definition have to be defined'),
parent=self.dlg)
running = True

View File

@ -18,7 +18,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
# $Id:_MergePerson.py 9912 2008-01-22 09:17:46Z acraphae $
#-------------------------------------------------------------------------
#
@ -45,7 +45,7 @@ from ReportBase import ReportUtils
from BasicUtils import name_displayer
import const
import DateHandler
import QuestionDialog
from QuestionDialog import ErrorDialog
import GrampsDisplay
import ManagedWindow
import gen.utils
@ -83,12 +83,12 @@ class PersonCompare(ManagedWindow.ManagedWindow):
def merge(self, obj):
if check_for_spouse(self.p1, self.p2):
QuestionDialog.ErrorDialog(
ErrorDialog(
_("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):
QuestionDialog.ErrorDialog(
ErrorDialog(
_("Cannot merge people"),
_("A parent and child cannot be merged. To merge these "
"people, you must first break the relationship between "
@ -260,14 +260,14 @@ class MergePeopleUI(ManagedWindow.ManagedWindow):
def __init__(self, dbstate, uistate, person1, person2, update=None):
if check_for_spouse(person1, person2):
QuestionDialog.ErrorDialog(
ErrorDialog(
_("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(
ErrorDialog(
_("Cannot merge people"),
_("A parent and child cannot be merged. To merge these "
"people, you must first break the relationship between "
@ -298,12 +298,12 @@ class MergePeopleUI(ManagedWindow.ManagedWindow):
if ret == gtk.RESPONSE_OK:
if check_for_spouse(person1, person2):
QuestionDialog.ErrorDialog(
ErrorDialog(
_("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):
QuestionDialog.ErrorDialog(
ErrorDialog(
_("Cannot merge people"),
_("A parent and child cannot be merged. To merge these "
"people, you must first break the relationship between "

View File

@ -64,7 +64,7 @@ import const
import Config
import GrampsCfg
import Errors
import QuestionDialog
from QuestionDialog import ErrorDialog, WarningDialog, QuestionDialog2
import PageView
import Navigation
import RecentFiles
@ -74,7 +74,6 @@ import UndoHistory
from DbLoader import DbLoader
import GrampsDisplay
from gen.utils import ProgressMonitor
#import gen.db
import ProgressDialog
@ -655,8 +654,6 @@ class ViewManager:
"""
Abandon changes and quit.
"""
from QuestionDialog import QuestionDialog2, WarningDialog
if self.state.db.abort_possible:
dialog = QuestionDialog2(
@ -1068,7 +1065,7 @@ class ViewManager:
# If not, do nothing, just return. This can be handled better if family tree
# delete/rename also updated the recent file menu info in DisplayState.py
if not os.path.isdir(filename):
QuestionDialog.ErrorDialog(
ErrorDialog(
_("Could not load a recent Family Tree."),
_("Family Tree does not exists, as it has been deleted."))
return
@ -1246,7 +1243,7 @@ class ViewManager:
self.uistate.push_message(self.state,
_("%s has been bookmarked") % name)
else:
QuestionDialog.WarningDialog(
WarningDialog(
_("Could Not Set a Bookmark"),
_("A bookmark could not be set because "
"no one was selected."))

View File

@ -19,7 +19,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
# $Id:HtmlDoc.py 9912 2008-01-22 09:17:46Z acraphae $
#------------------------------------------------------------------------
#
@ -42,7 +42,7 @@ import tarfile
import const
import Errors
import BaseDoc
import QuestionDialog
from QuestionDialog import ErrorDialog, WarningDialog
import Mime
import Utils
@ -156,7 +156,7 @@ class HtmlDoc(BaseDoc.BaseDoc,BaseDoc.TextDoc):
if top_add == 1:
mymsg = _("The marker '<!-- START -->' was not in the template")
QuestionDialog.ErrorDialog(_("Template Error"),mymsg)
ErrorDialog(_("Template Error"),mymsg)
def load_html(self):
start = re.compile(r"<!--\s*START\s*-->")
@ -181,7 +181,7 @@ class HtmlDoc(BaseDoc.BaseDoc,BaseDoc.TextDoc):
if top_add == 1:
mymsg = _("The marker '<!-- START -->' was not in the template")
QuestionDialog.ErrorDialog(_("Template Error"),mymsg)
ErrorDialog(_("Template Error"),mymsg)
def load_template(self):
if self.template:
@ -193,13 +193,13 @@ class HtmlDoc(BaseDoc.BaseDoc,BaseDoc.TextDoc):
except IOError,msg:
mymsg = _("Could not open %s\nUsing the default template") % \
self.template
QuestionDialog.WarningDialog(mymsg,str(msg))
WarningDialog(mymsg,str(msg))
self.bottom = _bottom
self.top = _top
except:
mymsg = _("Could not open %s\nUsing the default template") % \
self.template
QuestionDialog.WarningDialog(mymsg)
WarningDialog(mymsg)
self.bottom = _bottom
self.top = _top
else:

View File

@ -52,6 +52,7 @@ from Merge import PersonCompare
import GrampsDisplay
import ManagedWindow
from PluginUtils import Tool, register_tool
from QuestionDialog import ErrorDialog, RunDatabaseRepair
#-------------------------------------------------------------------------
#
@ -163,8 +164,7 @@ class Merge(Tool.Tool,ManagedWindow.ManagedWindow):
try:
self.find_potentials(threshold)
except AttributeError, msg:
import QuestionDialog
QuestionDialog.RunDatabaseRepair(str(msg))
RunDatabaseRepair(str(msg))
return
self.options.handler.options_dict['threshold'] = threshold
@ -173,8 +173,7 @@ class Merge(Tool.Tool,ManagedWindow.ManagedWindow):
self.options.handler.save_options()
if len(self.map) == 0:
import QuestionDialog
QuestionDialog.ErrorDialog(
ErrorDialog(
_("No matches found"),
_("No potential duplicate people were found"))
else:

View File

@ -18,7 +18,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
# $Id:WriteCD.py 9912 2008-01-22 09:17:46Z acraphae $
"Export to CD (nautilus)."
@ -29,7 +29,6 @@
#-------------------------------------------------------------------------
import os
import sys
#from cStringIO import StringIO
from gettext import gettext as _
#------------------------------------------------------------------------
@ -75,9 +74,7 @@ except:
#
#-------------------------------------------------------------------------
from GrampsDbUtils import XmlWriter
#import Mime
#import const
import QuestionDialog
from QuestionDialog import ErrorDialog, MissingMediaDialog
from PluginUtils import register_export
_title_string = _("Export to CD")
@ -117,12 +114,12 @@ class PackageWriter:
uri = URI('burn:///%s' % base)
make_directory(uri, OPEN_WRITE)
except FileExistsError, msg:
QuestionDialog.ErrorDialog(_("CD export preparation failed"),
ErrorDialog(_("CD export preparation failed"),
"1 %s " % str(msg))
return False
except:
uri_name = "burn:///" + base
QuestionDialog.ErrorDialog("CD export preparation failed",
ErrorDialog("CD export preparation failed",
'Could not create %s' % uri_name)
return False
@ -152,12 +149,12 @@ class PackageWriter:
uri = URI('burn:///%s' % base)
make_directory(uri, OPEN_WRITE)
except FileExistsError:
QuestionDialog.ErrorDialog(_("CD export preparation failed"),
ErrorDialog(_("CD export preparation failed"),
"File already exists")
return False
except:
uri_name = "burn:///" + base
QuestionDialog.ErrorDialog(_("CD export preparation failed"),
ErrorDialog(_("CD export preparation failed"),
_('Could not create %s') % uri_name)
return False
@ -165,12 +162,12 @@ class PackageWriter:
uri = URI('burn:///%s/.thumb' % base)
make_directory(uri, OPEN_WRITE)
except FileExistsError, msg:
QuestionDialog.ErrorDialog("CD export preparation failed",
ErrorDialog("CD export preparation failed",
"4 %s " % str(msg))
return False
except:
uri_name = "burn:///" + base + "/.thumb"
QuestionDialog.ErrorDialog(_("CD export preparation failed"),
ErrorDialog(_("CD export preparation failed"),
_('Could not create %s') % uri_name)
return False
@ -257,7 +254,7 @@ class PackageWriter:
# File is lost => ask what to do
self.object_handle = obj.get_handle()
if missmedia_action == 0:
mmd = QuestionDialog.MissingMediaDialog(_("Media object could not be found"),
mmd = MissingMediaDialog(_("Media object could not be found"),
_("%(file_name)s is referenced in the database, but no longer exists. "
"The file may have been deleted or moved to a different location. "
"You may choose to either remove the reference from the database, "