2007-12-19 Douglas S. Blank <dblank@cs.brynmawr.edu>
* src/GrampsCfg.py: added a warning about duplicate pattern svn: r9539
This commit is contained in:
parent
67bce5fc94
commit
a3cc8799ae
@ -1,3 +1,6 @@
|
|||||||
|
2007-12-19 Douglas S. Blank <dblank@cs.brynmawr.edu>
|
||||||
|
* src/GrampsCfg.py: added a warning about duplicate pattern
|
||||||
|
|
||||||
2007-12-19 Peter Landgren <peter.talken@telai.com>
|
2007-12-19 Peter Landgren <peter.talken@telai.com>
|
||||||
* src/DbManager.py: fixed unique rename and new databases
|
* src/DbManager.py: fixed unique rename and new databases
|
||||||
* src/RecentFiles.py: fixed unique rename and new databases
|
* src/RecentFiles.py: fixed unique rename and new databases
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
# Standard python modules
|
# Standard python modules
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
import random
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
from xml.sax.saxutils import escape
|
from xml.sax.saxutils import escape
|
||||||
|
|
||||||
@ -322,10 +323,26 @@ class GrampsPreferences(ManagedWindow.ManagedWindow):
|
|||||||
return name_format_model, the_index
|
return name_format_model, the_index
|
||||||
|
|
||||||
def __new_name(self, obj):
|
def __new_name(self, obj):
|
||||||
f = _("%s, %s (%s)" % (_("Surname"),
|
lyst = ["%s, %s %s (%s)" % (_("Surname"), _("Given"), _("Suffix"),
|
||||||
_("Given"),
|
_("Common")),
|
||||||
_("Common"),
|
"%s, %s %s (%s)" % (_("Surname"), _("Given"), _("Suffix"),
|
||||||
))
|
_("Call")),
|
||||||
|
"%s, %s %s (%s)" % (_("SURNAME"), _("Given"), _("Suffix"),
|
||||||
|
_("Call")),
|
||||||
|
"%s, %s (%s)" % (_("Surname"), _("Given"), _("Common")),
|
||||||
|
"%s, %s (%s)" % (_("Surname"), _("Given"), _("Call")),
|
||||||
|
"%s %s" % (_("Given"), _("Surname")),
|
||||||
|
"%s %s, %s" % (_("Given"), _("Surname"), _("Suffix")),
|
||||||
|
"%s %s %s" % (_("Given"), _("Surname"), _("Patronymic")),
|
||||||
|
"%s, %s %s (%s)" % (_("SURNAME"), _("Given"), _("Suffix"),
|
||||||
|
_("Common")),
|
||||||
|
"%s, %s (%s)" % (_("SURNAME"), _("Given"), _("Common")),
|
||||||
|
"%s, %s (%s)" % (_("SURNAME"), _("Given"), _("Call")),
|
||||||
|
"%s %s" % (_("Given"), _("SURNAME")),
|
||||||
|
"%s %s, %s" % (_("Given"), _("SURNAME"), _("Suffix")),
|
||||||
|
"%s /%s/" % (_("Given"), _("SURNAME")),
|
||||||
|
]
|
||||||
|
f = lyst[int(random.random() * len(lyst))]
|
||||||
i = _nd.add_name_format(f, f.lower())
|
i = _nd.add_name_format(f, f.lower())
|
||||||
node = self.fmt_model.append(row=[i, f, f.lower(),
|
node = self.fmt_model.append(row=[i, f, f.lower(),
|
||||||
_nd.format_str(self.examplename, f)])
|
_nd.format_str(self.examplename, f)])
|
||||||
@ -341,6 +358,25 @@ class GrampsPreferences(ManagedWindow.ManagedWindow):
|
|||||||
focus_column=self.name_column,
|
focus_column=self.name_column,
|
||||||
start_editing=True)
|
start_editing=True)
|
||||||
|
|
||||||
|
def __check_for_name(self, name, oldnode):
|
||||||
|
"""
|
||||||
|
Check to see if there is another name the same as name
|
||||||
|
in the format list. Don't compare with self (oldnode).
|
||||||
|
"""
|
||||||
|
model = self.fmt_obox.get_model()
|
||||||
|
iter = model.get_iter_first()
|
||||||
|
while iter != None:
|
||||||
|
othernum = model.get_value(iter, COL_NUM)
|
||||||
|
oldnum = model.get_value(oldnode, COL_NUM)
|
||||||
|
if othernum == oldnum:
|
||||||
|
pass# skip comparison with self
|
||||||
|
else:
|
||||||
|
othername = model.get_value(iter, COL_NAME)
|
||||||
|
if othername == name:
|
||||||
|
return True
|
||||||
|
iter = model.iter_next(iter)
|
||||||
|
return False
|
||||||
|
|
||||||
def __change_name(self, text, path, new_text):
|
def __change_name(self, text, path, new_text):
|
||||||
"""
|
"""
|
||||||
If the new string is empty, do nothing. Otherwise, renaming the
|
If the new string is empty, do nothing. Otherwise, renaming the
|
||||||
@ -360,6 +396,13 @@ class GrampsPreferences(ManagedWindow.ManagedWindow):
|
|||||||
num, name, fmt = self.selected_fmt[COL_NUM:COL_EXPL]
|
num, name, fmt = self.selected_fmt[COL_NUM:COL_EXPL]
|
||||||
node = self.fmt_model.get_iter(path)
|
node = self.fmt_model.get_iter(path)
|
||||||
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
|
||||||
|
if self.__check_for_name(translation, node):
|
||||||
|
QuestionDialog.ErrorDialog(_("This format exists already"),
|
||||||
|
translation)
|
||||||
|
self.edit_button.emit('clicked')
|
||||||
|
return
|
||||||
|
# else, change the name
|
||||||
exmpl = _nd.format_str(self.examplename, pattern)
|
exmpl = _nd.format_str(self.examplename, pattern)
|
||||||
self.fmt_model.set(self.iter, COL_NAME, translation,
|
self.fmt_model.set(self.iter, COL_NAME, translation,
|
||||||
COL_FMT, pattern,
|
COL_FMT, pattern,
|
||||||
|
Loading…
Reference in New Issue
Block a user