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> 2008-02-17 Peter Landgren <peter.talken@telia.com>
* src/plugins/StatisticsChart.py: * src/plugins/StatisticsChart.py:
0001756: Very strange results with statistics report. 0001756: Very strange results with statistics report.

View File

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

View File

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

View File

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

View File

@ -62,7 +62,7 @@ import pango
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import const import const
import QuestionDialog from QuestionDialog import ErrorDialog, QuestionDialog
import gen.db import gen.db
import GrampsDbUtils import GrampsDbUtils
import Config import Config
@ -495,7 +495,7 @@ class DbManager(CLIDbManager):
path = store.get_path(node) path = store.get_path(node)
self.lock_file = store[path][PATH_COL] self.lock_file = store[path][PATH_COL]
QuestionDialog.QuestionDialog( QuestionDialog(
_("Break the lock on the '%s' database?") % store[path][0], _("Break the lock on the '%s' database?") % store[path][0],
_("GRAMPS believes that someone else is actively editing " _("GRAMPS believes that someone else is actively editing "
"this database. You cannot edit this database while it " "this database. You cannot edit this database while it "
@ -574,8 +574,6 @@ class DbManager(CLIDbManager):
del proc del proc
if status != 0: if status != 0:
from QuestionDialog import ErrorDialog
ErrorDialog( ErrorDialog(
_("Rename failed"), _("Rename failed"),
_("An attempt to rename a version failed " _("An attempt to rename a version failed "
@ -592,7 +590,7 @@ class DbManager(CLIDbManager):
node = self.model.get_iter(path) node = self.model.get_iter(path)
filename = self.model.get_value(node, FILE_COL) filename = self.model.get_value(node, FILE_COL)
if self.existing_name(new_text, skippath=path): if self.existing_name(new_text, skippath=path):
QuestionDialog.ErrorDialog( ErrorDialog(
_("Could not rename the Family Tree."), _("Could not rename the Family Tree."),
_("Family Tree already exists, choose a unique name.")) _("Family Tree already exists, choose a unique name."))
return return
@ -606,7 +604,7 @@ class DbManager(CLIDbManager):
RecentFiles.rename_filename(old_text, new_text) RecentFiles.rename_filename(old_text, new_text)
self.model.set_value(node, NAME_COL, new_text) self.model.set_value(node, NAME_COL, new_text)
except (OSError, IOError), msg: except (OSError, IOError), msg:
QuestionDialog.ErrorDialog( ErrorDialog(
_("Could not rename family tree"), _("Could not rename family tree"),
str(msg)) str(msg))
@ -662,7 +660,7 @@ class DbManager(CLIDbManager):
self.data_to_delete = store[path] self.data_to_delete = store[path]
if len(path) == 1: if len(path) == 1:
QuestionDialog.QuestionDialog( QuestionDialog(
_("Remove the '%s' database?") % self.data_to_delete[0], _("Remove the '%s' database?") % self.data_to_delete[0],
_("Removing this database will permanently destroy the data."), _("Removing this database will permanently destroy the data."),
_("Remove database"), _("Remove database"),
@ -670,7 +668,7 @@ class DbManager(CLIDbManager):
else: else:
rev = self.data_to_delete[0] rev = self.data_to_delete[0]
parent = store[(path[0],)][0] parent = store[(path[0],)][0]
QuestionDialog.QuestionDialog( QuestionDialog(
_("Remove the '%(revision)s' version of '%(database)s'") % { _("Remove the '%(revision)s' version of '%(database)s'") % {
'revision' : rev, 'revision' : rev,
'database' : parent 'database' : parent
@ -706,7 +704,7 @@ class DbManager(CLIDbManager):
os.unlink(os.path.join(top, filename)) os.unlink(os.path.join(top, filename))
os.rmdir(self.data_to_delete[1]) os.rmdir(self.data_to_delete[1])
except (IOError, OSError), msg: except (IOError, OSError), msg:
QuestionDialog.ErrorDialog(_("Could not delete family tree"), ErrorDialog(_("Could not delete family tree"),
str(msg)) str(msg))
# rebuild the display # rebuild the display
self.__populate() self.__populate()
@ -730,8 +728,6 @@ class DbManager(CLIDbManager):
del proc del proc
if status != 0: if status != 0:
from QuestionDialog import ErrorDialog
ErrorDialog( ErrorDialog(
_("Deletion failed"), _("Deletion failed"),
_("An attempt to delete a version failed " _("An attempt to delete a version failed "
@ -808,7 +804,7 @@ class DbManager(CLIDbManager):
try: try:
self._create_new_db() self._create_new_db()
except (OSError, IOError), msg: except (OSError, IOError), msg:
QuestionDialog.ErrorDialog(_("Could not create family tree"), ErrorDialog(_("Could not create family tree"),
str(msg)) str(msg))
self.new.set_sensitive(True) self.new.set_sensitive(True)
@ -1003,8 +999,6 @@ def check_out(dbase, rev, path, callback):
del proc del proc
if status != 0: if status != 0:
from QuestionDialog import ErrorDialog
ErrorDialog( ErrorDialog(
_("Retrieve failed"), _("Retrieve failed"),
_("An attempt to retrieve the data failed " _("An attempt to retrieve the data failed "
@ -1057,8 +1051,6 @@ def check_in(dbase, filename, callback, cursor_func = None):
del proc del proc
if status != 0: if status != 0:
from QuestionDialog import ErrorDialog
ErrorDialog( ErrorDialog(
_("Archiving failed"), _("Archiving failed"),
_("An attempt to archive the data 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, from GrampsWidgets import (PrivacyButton, MonitoredEntry, MonitoredDataType,
IconButton, LinkBox, BasicLabel) IconButton, LinkBox, BasicLabel)
from ReportBase import CATEGORY_QR_FAMILY from ReportBase import CATEGORY_QR_FAMILY
import QuestionDialog from QuestionDialog import (ErrorDialog, RunDatabaseRepair, WarningDialog,
MessageHideDialog)
from Selectors import selector_factory from Selectors import selector_factory
SelectPerson = selector_factory('Person') SelectPerson = selector_factory('Person')
@ -419,7 +420,7 @@ class EditFamily(EditPrimary):
for i in self.hidden: for i in self.hidden:
i.set_sensitive(False) i.set_sensitive(False)
QuestionDialog.MessageHideDialog( MessageHideDialog(
_("Adding parents to a person"), _("Adding parents to a person"),
_("It is possible to accidentally create multiple " _("It is possible to accidentally create multiple "
"families with the same parents. To help avoid " "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.data = self.obj.get_lds_ord_list()
self.lds_embed.rebuild() self.lds_embed.rebuild()
QuestionDialog.WarningDialog( WarningDialog(
_("Family has changed"), _("Family has changed"),
_("The family you are editing has changed. To make sure that the " _("The family you are editing has changed. To make sure that the "
"database is not corrupted, GRAMPS has updated the family to " "database is not corrupted, GRAMPS has updated the family to "
@ -771,7 +772,7 @@ class EditFamily(EditPrimary):
common = list(mfam.intersection(ffam)) common = list(mfam.intersection(ffam))
if len(common) > 0: if len(common) > 0:
if self.add_parent or self.obj.handle not in common: if self.add_parent or self.obj.handle not in common:
QuestionDialog.WarningDialog( WarningDialog(
_('Duplicate Family'), _('Duplicate Family'),
_('A family with these parents already exists ' _('A family with these parents already exists '
'in the database. If you save, you will create ' 'in the database. If you save, you will create '
@ -862,7 +863,7 @@ class EditFamily(EditPrimary):
try: try:
self.__do_save() self.__do_save()
except bsddb_db.DBRunRecoveryError, msg: except bsddb_db.DBRunRecoveryError, msg:
QuestionDialog.RunDatabaseRepair(msg[1]) RunDatabaseRepair(msg[1])
def __do_save(self): def __do_save(self):
self.ok_button.set_sensitive(False) 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()) father = self.db.get_person_from_handle(self.obj.get_father_handle())
name = "%s [%s]" % (name_displayer.display(father), name = "%s [%s]" % (name_displayer.display(father),
father.gramps_id) 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 " _("%s is listed as both the father and child "
"of the family.") % name) "of the family.") % name)
self.ok_button.set_sensitive(True) 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()) mother = self.db.get_person_from_handle(self.obj.get_mother_handle())
name = "%s [%s]" % (name_displayer.display(mother), name = "%s [%s]" % (name_displayer.display(mother),
mother.gramps_id) 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 " _("%s is listed as both the mother and child "
"of the family.") % name) "of the family.") % name)
self.ok_button.set_sensitive(True) self.ok_button.set_sensitive(True)
return return
if not original and self.object_is_empty(): if not original and self.object_is_empty():
QuestionDialog.ErrorDialog( ErrorDialog(
_("Cannot save family"), _("Cannot save family"),
_("No data exists for this family. " _("No data exists for this family. "
"Please enter data or cancel the edit.")) "Please enter data or cancel the edit."))
self.ok_button.set_sensitive(True) self.ok_button.set_sensitive(True)
return 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. # We disconnect the callbacks to all signals we connected earlier.
# This prevents the signals originating in any of the following # This prevents the signals originating in any of the following

View File

@ -29,6 +29,7 @@ from BasicUtils import name_displayer
import Config import Config
import GrampsDisplay import GrampsDisplay
from QuestionDialog import SaveDialog from QuestionDialog import SaveDialog
import gen.lib
class EditPrimary(ManagedWindow.ManagedWindow): class EditPrimary(ManagedWindow.ManagedWindow):
@ -36,8 +37,12 @@ class EditPrimary(ManagedWindow.ManagedWindow):
def __init__(self, state, uistate, track, obj, get_from_handle, def __init__(self, state, uistate, track, obj, get_from_handle,
get_from_gramps_id, callback=None): 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.dp = DateHandler.parser
self.dd = DateHandler.displayer self.dd = DateHandler.displayer
self.name_displayer = name_displayer self.name_displayer = name_displayer
@ -166,7 +171,11 @@ class EditPrimary(ManagedWindow.ManagedWindow):
return False return False
def empty_object(self): 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): def data_has_changed(self):
@ -263,7 +272,17 @@ class EditPrimary(ManagedWindow.ManagedWindow):
def _uses_duplicate_id(self): 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 from gen.lib import Name
import ManagedWindow import ManagedWindow
from GrampsWidgets import * from GrampsWidgets import *
import QuestionDialog from QuestionDialog import ErrorDialog, QuestionDialog2
from Errors import NameDisplayError from Errors import NameDisplayError
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -404,7 +404,7 @@ class GrampsPreferences(ManagedWindow.ManagedWindow):
oldname = self.fmt_model.get_value(node, COL_NAME) oldname = self.fmt_model.get_value(node, COL_NAME)
# check to see if this pattern already exists # check to see if this pattern already exists
if self.__check_for_name(translation, node): if self.__check_for_name(translation, node):
QuestionDialog.ErrorDialog(_("This format exists already"), ErrorDialog(_("This format exists already"),
translation) translation)
self.edit_button.emit('clicked') self.edit_button.emit('clicked')
return return
@ -928,7 +928,7 @@ class NameFormatEditDlg:
if self.response == gtk.RESPONSE_OK: if self.response == gtk.RESPONSE_OK:
if not self.valid: if not self.valid:
q = QuestionDialog.QuestionDialog2( q = QuestionDialog2(
_('The format definition is invalid'), _('The format definition is invalid'),
_('What would you like to do?'), _('What would you like to do?'),
_('_Continue anyway'), _('_Modify format'), _('_Continue anyway'), _('_Modify format'),
@ -938,7 +938,7 @@ class NameFormatEditDlg:
elif self.fmt_name == '' and self.fmt_str == '': elif self.fmt_name == '' and self.fmt_str == '':
self.response = gtk.RESPONSE_CANCEL self.response = gtk.RESPONSE_CANCEL
elif (self.fmt_name == '') ^ (self.fmt_str == ''): elif (self.fmt_name == '') ^ (self.fmt_str == ''):
QuestionDialog.ErrorDialog( ErrorDialog(
_('Both Format name and definition have to be defined'), _('Both Format name and definition have to be defined'),
parent=self.dlg) parent=self.dlg)
running = True running = True

View File

@ -18,7 +18,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # 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 from BasicUtils import name_displayer
import const import const
import DateHandler import DateHandler
import QuestionDialog from QuestionDialog import ErrorDialog
import GrampsDisplay import GrampsDisplay
import ManagedWindow import ManagedWindow
import gen.utils import gen.utils
@ -83,12 +83,12 @@ class PersonCompare(ManagedWindow.ManagedWindow):
def merge(self, obj): def merge(self, obj):
if check_for_spouse(self.p1, self.p2): if check_for_spouse(self.p1, self.p2):
QuestionDialog.ErrorDialog( ErrorDialog(
_("Cannot merge people"), _("Cannot merge people"),
_("Spouses cannot be merged. To merge these people, " _("Spouses cannot be merged. To merge these people, "
"you must first break the relationship between them.")) "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( ErrorDialog(
_("Cannot merge people"), _("Cannot merge people"),
_("A parent and child cannot be merged. To merge these " _("A parent and child cannot be merged. To merge these "
"people, you must first break the relationship between " "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): def __init__(self, dbstate, uistate, person1, person2, update=None):
if check_for_spouse(person1, person2): if check_for_spouse(person1, person2):
QuestionDialog.ErrorDialog( ErrorDialog(
_("Cannot merge people"), _("Cannot merge people"),
_("Spouses cannot be merged. To merge these people, " _("Spouses cannot be merged. To merge these people, "
"you must first break the relationship between them.")) "you must first break the relationship between them."))
return return
if check_for_child(person1, person2): if check_for_child(person1, person2):
QuestionDialog.ErrorDialog( ErrorDialog(
_("Cannot merge people"), _("Cannot merge people"),
_("A parent and child cannot be merged. To merge these " _("A parent and child cannot be merged. To merge these "
"people, you must first break the relationship between " "people, you must first break the relationship between "
@ -298,12 +298,12 @@ class MergePeopleUI(ManagedWindow.ManagedWindow):
if ret == gtk.RESPONSE_OK: if ret == gtk.RESPONSE_OK:
if check_for_spouse(person1, person2): if check_for_spouse(person1, person2):
QuestionDialog.ErrorDialog( ErrorDialog(
_("Cannot merge people"), _("Cannot merge people"),
_("Spouses cannot be merged. To merge these people, " _("Spouses cannot be merged. To merge these people, "
"you must first break the relationship between them.")) "you must first break the relationship between them."))
elif check_for_child(person1, person2): elif check_for_child(person1, person2):
QuestionDialog.ErrorDialog( ErrorDialog(
_("Cannot merge people"), _("Cannot merge people"),
_("A parent and child cannot be merged. To merge these " _("A parent and child cannot be merged. To merge these "
"people, you must first break the relationship between " "people, you must first break the relationship between "

View File

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

View File

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

View File

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

View File

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