Replace cuni with str
This commit is contained in:
parent
c9fd339289
commit
5da10c5a80
@ -26,7 +26,6 @@ import re
|
||||
import io
|
||||
import subprocess
|
||||
|
||||
from gramps.gen.constfunc import cuni
|
||||
from gramps.gen.const import TEMP_DIR
|
||||
|
||||
test_ged = """0 HEAD
|
||||
@ -126,8 +125,8 @@ class UnicodeTest(unittest.TestCase):
|
||||
from gramps.gen.config import set as setconfig, get as getconfig
|
||||
from gramps.gen.dbstate import DbState
|
||||
self.newpath = os.path.join(os.path.dirname(__file__),
|
||||
cuni('\u0393\u03c1\u03b1\u03bc\u03c3\u03c0'))
|
||||
self.newtitle = cuni('Gr\u00e4mps T\u00e9st')
|
||||
'\u0393\u03c1\u03b1\u03bc\u03c3\u03c0')
|
||||
self.newtitle = 'Gr\u00e4mps T\u00e9st'
|
||||
os.makedirs(self.newpath)
|
||||
self.old_path = getconfig('behavior.database-path')
|
||||
setconfig('behavior.database-path', self.newpath)
|
||||
|
@ -50,10 +50,8 @@ WINDOWS = ["Windows", "win32"]
|
||||
# Public Functions
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
cuni = str
|
||||
def conv_to_unicode(x, y='utf8'):
|
||||
return x if x is None or isinstance(x, str) else cuni(x, y) if y else cuni(x)
|
||||
return x if x is None or isinstance(x, str) else str(x, y) if y else str(x)
|
||||
|
||||
# handle in database is bytes, while internally Gramps wants unicode for py3
|
||||
handle2internal = lambda x: conv_to_unicode(x, 'utf-8')
|
||||
|
@ -44,7 +44,7 @@ log = logging.getLogger(".gen.datehandler")
|
||||
#-------------------------------------------------------------------------
|
||||
from ._dateparser import DateParser
|
||||
from ._datedisplay import DateDisplay, DateDisplayEn
|
||||
from ..constfunc import win, cuni
|
||||
from ..constfunc import win
|
||||
from ..const import GRAMPS_LOCALE as glocale
|
||||
from gramps.gen.utils.grampslocale import GrampsLocale
|
||||
|
||||
@ -69,8 +69,8 @@ if LANG:
|
||||
else:
|
||||
LANG_SHORT = "C"
|
||||
|
||||
LANG = cuni(LANG)
|
||||
LANG_SHORT = cuni(LANG_SHORT)
|
||||
LANG = str(LANG)
|
||||
LANG_SHORT = str(LANG_SHORT)
|
||||
|
||||
LANG_TO_PARSER = {
|
||||
'C' : DateParser,
|
||||
|
@ -73,7 +73,7 @@ from ..utils.cast import conv_dbstr_to_unicode
|
||||
from . import (BsddbBaseCursor, DbReadBase)
|
||||
from ..utils.id import create_id
|
||||
from ..errors import DbError
|
||||
from ..constfunc import cuni, handle2internal, get_env_var
|
||||
from ..constfunc import handle2internal, get_env_var
|
||||
from ..const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
|
||||
@ -1307,7 +1307,7 @@ class DbBsddbRead(DbReadBase, Callback):
|
||||
if id_number.isdigit():
|
||||
id_value = int(id_number, 10)
|
||||
## this code never ran, as an int compared to str with > is False!
|
||||
## if len(cuni(id_value)) > nr_width:
|
||||
## if len(str(id_value)) > nr_width:
|
||||
## # The ID to be imported is too large to fit in the
|
||||
## # users format. For now just create a new ID,
|
||||
## # because that is also what happens with IDs that
|
||||
@ -1784,14 +1784,14 @@ class DbBsddbRead(DbReadBase, Callback):
|
||||
first = first.encode('utf-8')
|
||||
if isinstance(second, str):
|
||||
second = second.encode('utf-8')
|
||||
source1 = cuni(self.source_map[first][2])
|
||||
source2 = cuni(self.source_map[second][2])
|
||||
source1 = str(self.source_map[first][2])
|
||||
source2 = str(self.source_map[second][2])
|
||||
return glocale.strcoll(source1, source2)
|
||||
|
||||
def __sortbysource_key(self, key):
|
||||
if isinstance(key, str):
|
||||
key = key.encode('utf-8')
|
||||
source = cuni(self.source_map[key][2])
|
||||
source = str(self.source_map[key][2])
|
||||
return glocale.sort_key(source)
|
||||
|
||||
def __sortbycitation(self, first, second):
|
||||
@ -1799,14 +1799,14 @@ class DbBsddbRead(DbReadBase, Callback):
|
||||
first = first.encode('utf-8')
|
||||
if isinstance(second, str):
|
||||
second = second.encode('utf-8')
|
||||
citation1 = cuni(self.citation_map[first][3])
|
||||
citation2 = cuni(self.citation_map[second][3])
|
||||
citation1 = str(self.citation_map[first][3])
|
||||
citation2 = str(self.citation_map[second][3])
|
||||
return glocale.strcoll(citation1, citation2)
|
||||
|
||||
def __sortbycitation_key(self, key):
|
||||
if isinstance(key, str):
|
||||
key = key.encode('utf-8')
|
||||
citation = cuni(self.citation_map[key][3])
|
||||
citation = str(self.citation_map[key][3])
|
||||
return glocale.sort_key(citation)
|
||||
|
||||
def __sortbymedia(self, first, second):
|
||||
|
@ -27,8 +27,6 @@ from gramps.cli.clidbman import CLIDbManager
|
||||
from gramps.gen.lib import (Source, RepoRef, Citation, Repository, Person,
|
||||
Family, Event, Place, MediaObject)
|
||||
|
||||
from gramps.gen.constfunc import cuni
|
||||
|
||||
class GrampsDbBaseTest(unittest.TestCase):
|
||||
"""Base class for unittest that need to be able to create
|
||||
test databases."""
|
||||
@ -40,7 +38,7 @@ class GrampsDbBaseTest(unittest.TestCase):
|
||||
|
||||
self._db = DbBsddb()
|
||||
dbman = CLIDbManager(None)
|
||||
self._filename, title = dbman.create_new_db_cli(title=cuni("Test"))
|
||||
self._filename, title = dbman.create_new_db_cli(title="Test")
|
||||
self._db.load(self._filename, dummy_callback, "w")
|
||||
|
||||
def tearDown(self):
|
||||
|
@ -41,7 +41,7 @@ from bsddb3 import db
|
||||
#-------------------------------------------------------------------------
|
||||
from ..const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
from ..constfunc import cuni, handle2internal
|
||||
from ..constfunc import handle2internal
|
||||
from ..lib.markertype import MarkerType
|
||||
from ..lib.nameorigintype import NameOriginType
|
||||
from ..lib.place import Place
|
||||
@ -1103,7 +1103,7 @@ def convert_marker(self, marker_field):
|
||||
"""Convert a marker into a tag."""
|
||||
marker = MarkerType()
|
||||
marker.unserialize(marker_field)
|
||||
tag_name = cuni(marker)
|
||||
tag_name = str(marker)
|
||||
|
||||
if tag_name != '':
|
||||
if tag_name not in self.tags:
|
||||
|
@ -80,7 +80,7 @@ from ..utils.cast import conv_dbstr_to_unicode
|
||||
from ..utils.id import create_id
|
||||
from ..updatecallback import UpdateCallback
|
||||
from ..errors import DbError
|
||||
from ..constfunc import (win, conv_to_unicode, cuni, handle2internal,
|
||||
from ..constfunc import (win, conv_to_unicode, handle2internal,
|
||||
get_env_var)
|
||||
from ..const import HOME_DIR, GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
@ -551,7 +551,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
|
||||
"""Older version of Berkeley DB can't read data created by a newer
|
||||
version."""
|
||||
bdb_version = db.version()
|
||||
versionpath = os.path.join(self.path, cuni(BDBVERSFN))
|
||||
versionpath = os.path.join(self.path, str(BDBVERSFN))
|
||||
# Compare the current version of the database (bsddb_version) with the
|
||||
# version of the database code (env_version). If it is a downgrade,
|
||||
# raise an exception because we can't do anything. If they are the same,
|
||||
@ -721,7 +721,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
|
||||
self.__check_python_version(name, force_python_upgrade)
|
||||
|
||||
# Check for pickle upgrade
|
||||
versionpath = os.path.join(self.path, cuni(PCKVERSFN))
|
||||
versionpath = os.path.join(self.path, str(PCKVERSFN))
|
||||
if not os.path.isfile(versionpath) and \
|
||||
not self.readonly and not self.update_pickle_version:
|
||||
_LOG.debug("Make backup in case there is a pickle upgrade")
|
||||
@ -729,7 +729,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
|
||||
self.update_pickle_version = True
|
||||
|
||||
# Check for schema upgrade
|
||||
versionpath = os.path.join(self.path, cuni(SCHVERSFN))
|
||||
versionpath = os.path.join(self.path, str(SCHVERSFN))
|
||||
if os.path.isfile(versionpath):
|
||||
with open(versionpath, "r") as version_file:
|
||||
schema_version = int(version_file.read().strip())
|
||||
@ -864,7 +864,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
|
||||
from . import upgrade
|
||||
UpdateCallback.__init__(self, callback)
|
||||
upgrade.gramps_upgrade_pickle(self)
|
||||
versionpath = os.path.join(name, cuni(PCKVERSFN))
|
||||
versionpath = os.path.join(name, str(PCKVERSFN))
|
||||
with open(versionpath, "w") as version_file:
|
||||
version = "Yes"
|
||||
version_file.write(version)
|
||||
@ -879,7 +879,7 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
|
||||
(oldschema, newschema))
|
||||
if force_schema_upgrade == True:
|
||||
self.gramps_upgrade(callback)
|
||||
versionpath = os.path.join(name, cuni(SCHVERSFN))
|
||||
versionpath = os.path.join(name, str(SCHVERSFN))
|
||||
with open(versionpath, "w") as version_file:
|
||||
version = str(_DBVERSION)
|
||||
version_file.write(version)
|
||||
@ -2419,13 +2419,13 @@ class DbBsddb(DbBsddbRead, DbWriteBase, UpdateCallback):
|
||||
with open(versionpath, "w") as version_file:
|
||||
version_file.write(version)
|
||||
|
||||
versionpath = os.path.join(name, cuni(PCKVERSFN))
|
||||
versionpath = os.path.join(name, str(PCKVERSFN))
|
||||
_LOG.debug("Write pickle version file to %s" % "Yes")
|
||||
with open(versionpath, "w") as version_file:
|
||||
version = "Yes"
|
||||
version_file.write(version)
|
||||
|
||||
versionpath = os.path.join(name, cuni(SCHVERSFN))
|
||||
versionpath = os.path.join(name, str(SCHVERSFN))
|
||||
_LOG.debug("Write schema version file to %s" % str(_DBVERSION))
|
||||
with open(versionpath, "w") as version_file:
|
||||
version = str(_DBVERSION)
|
||||
|
@ -68,7 +68,7 @@ LOG = logging.getLogger(".gramps.gen")
|
||||
#-------------------------------------------------------------------------
|
||||
from ..const import ARABIC_COMMA, ARABIC_SEMICOLON, GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.sgettext
|
||||
from ..constfunc import cuni, conv_to_unicode
|
||||
from ..constfunc import conv_to_unicode
|
||||
from ..lib.name import Name
|
||||
from ..lib.nameorigintype import NameOriginType
|
||||
|
||||
@ -816,7 +816,7 @@ class NameDisplay(object):
|
||||
return sur.get_surname()
|
||||
|
||||
def sort_string(self, name):
|
||||
return cuni("%-25s%-30s%s") % (self.primary_surname(name),
|
||||
return "%-25s%-30s%s" % (self.primary_surname(name),
|
||||
name.first_name, name.suffix)
|
||||
|
||||
def sorted(self, person):
|
||||
|
@ -29,13 +29,6 @@ Base Object class for Gramps
|
||||
#-------------------------------------------------------------------------
|
||||
import re
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from ..constfunc import cuni
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Base Object
|
||||
@ -118,7 +111,7 @@ class BaseObject(object):
|
||||
for item in self.get_text_data_list():
|
||||
# Some items are strings, which will fail in item.upper(), and some items are unicode.
|
||||
# Convert all items to unicode and the item.upper().find(patern_upper) will work OK.
|
||||
item = cuni(item)
|
||||
item = str(item)
|
||||
if not item:
|
||||
continue
|
||||
if case_sensitive:
|
||||
|
@ -44,7 +44,6 @@ from .datebase import DateBase
|
||||
from .tagbase import TagBase
|
||||
from .attrbase import SrcAttributeBase
|
||||
from .citationbase import IndirectCitationBase
|
||||
from ..constfunc import cuni
|
||||
from .handle import Handle
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -86,7 +85,7 @@ class Citation(MediaBase, NoteBase, SrcAttributeBase, IndirectCitationBase,
|
||||
return (self.handle, # 0
|
||||
self.gramps_id, # 1
|
||||
DateBase.serialize(self, no_text_date),# 2
|
||||
cuni(self.page), # 3
|
||||
str(self.page), # 3
|
||||
self.confidence, # 4
|
||||
self.source_handle, # 5
|
||||
NoteBase.serialize(self), # 6
|
||||
@ -120,7 +119,7 @@ class Citation(MediaBase, NoteBase, SrcAttributeBase, IndirectCitationBase,
|
||||
"handle": Handle("Citation", self.handle), # 0
|
||||
"gramps_id": self.gramps_id, # 1
|
||||
"date": DateBase.to_struct(self), # 2
|
||||
"page": cuni(self.page), # 3
|
||||
"page": str(self.page), # 3
|
||||
"confidence": self.confidence, # 4
|
||||
"source_handle": Handle("Source", self.source_handle), # 5
|
||||
"note_list": NoteBase.to_struct(self), # 6
|
||||
|
@ -37,7 +37,6 @@ _ = glocale.translation.sgettext
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from .grampstype import GrampsType
|
||||
from ..constfunc import cuni
|
||||
|
||||
class EventType(GrampsType):
|
||||
"""
|
||||
@ -366,7 +365,7 @@ class EventType(GrampsType):
|
||||
if self.value in self._ABBREVIATIONS:
|
||||
return trans_text(self._ABBREVIATIONS[self.value])
|
||||
else:
|
||||
abbrev = cuni(self)
|
||||
abbrev = str(self)
|
||||
if " " in abbrev:
|
||||
return ".".join([letter[0].lower() for letter in abbrev.split()]) + "."
|
||||
else:
|
||||
|
@ -30,7 +30,6 @@ Base type for all gramps types.
|
||||
#-------------------------------------------------------------------------
|
||||
from ..const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
from ..constfunc import cuni
|
||||
|
||||
_UNKNOWN = _('Unknown')
|
||||
|
||||
@ -228,7 +227,7 @@ class GrampsType(GrampsTypeC):
|
||||
"""
|
||||
return {"_class": self.__class__.__name__,
|
||||
"value": self.__value,
|
||||
"string": cuni(self)}
|
||||
"string": str(self)}
|
||||
|
||||
@classmethod
|
||||
def from_struct(cls, struct):
|
||||
|
@ -34,7 +34,6 @@ from .tagbase import TagBase
|
||||
from .notetype import NoteType
|
||||
from .styledtext import StyledText
|
||||
from .styledtexttagtype import StyledTextTagType
|
||||
from ..constfunc import cuni
|
||||
from .handle import Handle
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -203,7 +202,7 @@ class Note(BasicPrimaryObject):
|
||||
:returns: The *clear* text of the note contents.
|
||||
:rtype: unicode
|
||||
"""
|
||||
return cuni(self.text)
|
||||
return str(self.text)
|
||||
|
||||
def set_styledtext(self, text):
|
||||
"""Set the text associated with the note to the passed string.
|
||||
|
@ -35,7 +35,6 @@ from .addressbase import AddressBase
|
||||
from .urlbase import UrlBase
|
||||
from .tagbase import TagBase
|
||||
from .repotype import RepositoryType
|
||||
from ..constfunc import cuni
|
||||
from .handle import Handle
|
||||
from .citationbase import IndirectCitationBase
|
||||
|
||||
@ -64,7 +63,7 @@ class Repository(NoteBase, AddressBase, UrlBase,
|
||||
Convert the object to a serialized tuple of data.
|
||||
"""
|
||||
return (self.handle, self.gramps_id, self.type.serialize(),
|
||||
cuni(self.name),
|
||||
str(self.name),
|
||||
NoteBase.serialize(self),
|
||||
AddressBase.serialize(self),
|
||||
UrlBase.serialize(self),
|
||||
@ -94,7 +93,7 @@ class Repository(NoteBase, AddressBase, UrlBase,
|
||||
"handle": Handle("Repository", self.handle),
|
||||
"gramps_id": self.gramps_id,
|
||||
"type": self.type.to_struct(),
|
||||
"name": cuni(self.name),
|
||||
"name": str(self.name),
|
||||
"note_list": NoteBase.to_struct(self),
|
||||
"address_list": AddressBase.to_struct(self),
|
||||
"urls": UrlBase.to_struct(self),
|
||||
|
@ -37,7 +37,6 @@ from .tagbase import TagBase
|
||||
from .attrbase import SrcAttributeBase
|
||||
from .reporef import RepoRef
|
||||
from .const import DIFFERENT, EQUAL, IDENTICAL
|
||||
from ..constfunc import cuni
|
||||
from .handle import Handle
|
||||
from .citationbase import IndirectCitationBase
|
||||
|
||||
@ -68,12 +67,12 @@ class Source(MediaBase, NoteBase, SrcAttributeBase, IndirectCitationBase,
|
||||
"""
|
||||
return (self.handle, # 0
|
||||
self.gramps_id, # 1
|
||||
cuni(self.title), # 2
|
||||
cuni(self.author), # 3
|
||||
cuni(self.pubinfo), # 4
|
||||
str(self.title), # 2
|
||||
str(self.author), # 3
|
||||
str(self.pubinfo), # 4
|
||||
NoteBase.serialize(self), # 5
|
||||
MediaBase.serialize(self), # 6
|
||||
cuni(self.abbrev), # 7
|
||||
str(self.abbrev), # 7
|
||||
self.change, # 8
|
||||
SrcAttributeBase.serialize(self), # 9
|
||||
[rr.serialize() for rr in self.reporef_list], # 10
|
||||
@ -103,12 +102,12 @@ class Source(MediaBase, NoteBase, SrcAttributeBase, IndirectCitationBase,
|
||||
return {"_class": "Source",
|
||||
"handle": Handle("Source", self.handle),
|
||||
"gramps_id": self.gramps_id,
|
||||
"title": cuni(self.title),
|
||||
"author": cuni(self.author),
|
||||
"pubinfo": cuni(self.pubinfo),
|
||||
"title": str(self.title),
|
||||
"author": str(self.author),
|
||||
"pubinfo": str(self.pubinfo),
|
||||
"note_list": NoteBase.to_struct(self),
|
||||
"media_list": MediaBase.to_struct(self),
|
||||
"abbrev": cuni(self.abbrev),
|
||||
"abbrev": str(self.abbrev),
|
||||
"change": self.change,
|
||||
"srcattr_list": SrcAttributeBase.to_struct(self),
|
||||
"reporef_list": [rr.to_struct() for rr in self.reporef_list],
|
||||
|
@ -27,7 +27,6 @@
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from .styledtexttag import StyledTextTag
|
||||
from ..constfunc import cuni
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
@ -36,7 +36,6 @@ import time
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from .baseobj import BaseObject
|
||||
from ..constfunc import cuni
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -112,7 +111,7 @@ class TableObject(BaseObject):
|
||||
|
||||
"""
|
||||
if self.change:
|
||||
return cuni(time.strftime('%x %X', time.localtime(self.change)),
|
||||
return str(time.strftime('%x %X', time.localtime(self.change)),
|
||||
CODESET)
|
||||
else:
|
||||
return ''
|
||||
|
@ -51,7 +51,6 @@ except:
|
||||
# gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from ..constfunc import cuni
|
||||
from ..utils.cast import get_type_converter
|
||||
from .menu import Menu
|
||||
from ..plug import BasePluginManager
|
||||
|
@ -30,19 +30,6 @@ from ...const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
import io
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GTK modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Gramps modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from ...constfunc import cuni
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Set up logging
|
||||
@ -290,7 +277,7 @@ class DocBackend(object):
|
||||
escape_func = self.ESCAPE_FUNC
|
||||
self.ESCAPE_FUNC = lambda: (lambda text: text)
|
||||
#unicode text must be sliced correctly
|
||||
text = cuni(text)
|
||||
text = str(text)
|
||||
FIRST = 0
|
||||
LAST = 1
|
||||
tagspos = {}
|
||||
@ -312,7 +299,7 @@ class DocBackend(object):
|
||||
keylist.sort()
|
||||
keylist = [x for x in keylist if x <= len(text)]
|
||||
opentags = []
|
||||
otext = cuni("") #the output, text with markup
|
||||
otext = "" #the output, text with markup
|
||||
lensplit = len(split)
|
||||
for pos in keylist:
|
||||
#write text up to tag
|
||||
|
@ -64,7 +64,6 @@ from ...utils.cast import get_type_converter_by_name, type_name
|
||||
from ..docgen import StyleSheet, StyleSheetList
|
||||
from .. import BasePluginManager
|
||||
from . import book_categories
|
||||
from ...constfunc import cuni
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
@ -478,7 +477,7 @@ class BookList(object):
|
||||
len(options[option_name]) ) )
|
||||
for list_index in range(len(option_value)):
|
||||
option_type = type_name(option_value[list_index])
|
||||
value = escape(cuni(option_value[list_index]))
|
||||
value = escape(str(option_value[list_index]))
|
||||
value = value.replace('"', '"')
|
||||
f.write(' <listitem number="%d" type="%s" '
|
||||
'value="%s"/>\n' % (
|
||||
@ -488,7 +487,7 @@ class BookList(object):
|
||||
f.write(' </option>\n')
|
||||
else:
|
||||
option_type = type_name(option_value)
|
||||
value = escape(cuni(option_value))
|
||||
value = escape(str(option_value))
|
||||
value = value.replace('"', '"')
|
||||
f.write(' <option name="%s" type="%s" '
|
||||
'value="%s"/>\n' % (
|
||||
|
@ -44,7 +44,6 @@ from ...datehandler import get_date
|
||||
from ...display.place import displayer as place_displayer
|
||||
from ...utils.file import media_path_full
|
||||
from ..docgen import IndexMark, INDEX_TYPE_ALP
|
||||
from ...constfunc import cuni
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -120,7 +119,7 @@ def place_name(db, place_handle):
|
||||
name = place_displayer.display(db, place)
|
||||
else:
|
||||
name = ""
|
||||
return cuni(name)
|
||||
return str(name)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
@ -40,7 +40,6 @@ from ..display.name import displayer as name_displayer
|
||||
from ..display.place import displayer as place_displayer
|
||||
from ..const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.sgettext
|
||||
from ..constfunc import cuni
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -372,7 +371,7 @@ def navigation_label(db, nav_type, handle):
|
||||
label = obj.get()
|
||||
# When strings are cut, make sure they are unicode
|
||||
#otherwise you may end of with cutting within an utf-8 sequence
|
||||
label = cuni(label)
|
||||
label = str(label)
|
||||
label = " ".join(label.split())
|
||||
if len(label) > 40:
|
||||
label = label[:40] + "..."
|
||||
|
@ -55,7 +55,6 @@ def format_exception(tb_type=None, tb_value=None, tb=None):
|
||||
"""
|
||||
import sys
|
||||
import traceback
|
||||
from gramps.gen.constfunc import cuni
|
||||
if tb_type is None:
|
||||
tb_type = sys.exc_type
|
||||
if tb_value is None:
|
||||
@ -83,7 +82,7 @@ def format_exception(tb_type=None, tb_value=None, tb=None):
|
||||
#handler! Calling str() on an unknown object could cause an
|
||||
#error we don't want.
|
||||
try:
|
||||
line = " %s = %s\n" % (key, cuni(value))
|
||||
line = " %s = %s\n" % (key, str(value))
|
||||
except:
|
||||
line = " %s = %s\n" % (key, "<ERROR PRINTING VALUE>")
|
||||
retval.append(line)
|
||||
|
@ -37,7 +37,6 @@ _ = glocale.translation.gettext
|
||||
from .tabbeddoc import *
|
||||
from ...const import PROGRAM_NAME, VERSION
|
||||
from ...errors import ReportError
|
||||
from ...constfunc import cuni
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -389,7 +388,7 @@ class ODSTab(TabbedDoc):
|
||||
text = text.replace('>','>')
|
||||
text = text.replace('\t','<text:tab-stop/>')
|
||||
text = text.replace('\n','<text:line-break/>')
|
||||
self.f.write(cuni(text))
|
||||
self.f.write(str(text))
|
||||
|
||||
self.f.write('</text:p>\n')
|
||||
self.f.write('</table:table-cell>\n')
|
||||
|
@ -42,7 +42,7 @@ LOG = logging.getLogger(".gen.utils.file")
|
||||
# Gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from ..constfunc import win, mac, cuni, conv_to_unicode, get_env_var
|
||||
from ..constfunc import win, mac, conv_to_unicode, get_env_var
|
||||
from ..const import TEMP_DIR, USER_HOME, GRAMPS_LOCALE as glocale
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -95,7 +95,7 @@ def get_empty_tempdir(dirname):
|
||||
or for inadequate permissions to delete dir/files or create dir(s)
|
||||
|
||||
"""
|
||||
dirpath = os.path.join(TEMP_DIR,cuni(dirname))
|
||||
dirpath = os.path.join(TEMP_DIR, str(dirname))
|
||||
if os.path.isdir(dirpath):
|
||||
shutil.rmtree(dirpath)
|
||||
os.makedirs(dirpath)
|
||||
|
@ -59,7 +59,6 @@ from .glade import Glade
|
||||
from .ddtargets import DdTargets
|
||||
from .makefilter import make_filter
|
||||
from .utils import is_right_click
|
||||
from gramps.gen.constfunc import cuni
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -404,7 +403,7 @@ class ClipNote(ClipHandleWrapper):
|
||||
note = value.get().replace('\n', ' ')
|
||||
#String must be unicode for truncation to work for non
|
||||
#ascii characters
|
||||
note = cuni(note)
|
||||
note = str(note)
|
||||
if len(note) > 80:
|
||||
self._value = note[:80]+"..."
|
||||
else:
|
||||
@ -510,7 +509,7 @@ class ClipCitation(ClipHandleWrapper):
|
||||
text = " ".join(srctxtlist[0].get().split())
|
||||
#String must be unicode for truncation to work for non
|
||||
#ascii characters
|
||||
text = cuni(text)
|
||||
text = str(text)
|
||||
if len(text) > 60:
|
||||
text = text[:60]+"..."
|
||||
self._value = _("Volume/Page: %(pag)s -- %(sourcetext)s") % {
|
||||
|
@ -46,7 +46,6 @@ _ = glocale.translation.gettext
|
||||
from gramps.gen.const import ICON, URL_BUGHOME
|
||||
from gramps.gen.config import config
|
||||
from gramps.gui.glade import Glade
|
||||
from gramps.gen.constfunc import cuni
|
||||
|
||||
try:
|
||||
ICON = GdkPixbuf.Pixbuf.new_from_file(ICON)
|
||||
|
@ -63,7 +63,6 @@ from .managedwindow import GrampsWindowManager
|
||||
from gramps.gen.relationship import get_relationship_calculator
|
||||
from .glade import Glade
|
||||
from gramps.gen.utils.db import navigation_label
|
||||
from gramps.gen.constfunc import cuni
|
||||
from .widgets.progressdialog import ProgressMonitor, GtkProgressDialog
|
||||
|
||||
DISABLED = -1
|
||||
@ -137,7 +136,7 @@ class History(Callback):
|
||||
if self.history:
|
||||
newact = self.history[self.index]
|
||||
if not isinstance(newact, str):
|
||||
newact = cuni(newact)
|
||||
newact = str(newact)
|
||||
self.emit('active-changed', (newact,))
|
||||
|
||||
def push(self, handle):
|
||||
@ -155,7 +154,7 @@ class History(Callback):
|
||||
if self.history:
|
||||
newact = self.history[self.index]
|
||||
if not isinstance(newact, str):
|
||||
newact = cuni(newact)
|
||||
newact = str(newact)
|
||||
self.emit('active-changed', (newact,))
|
||||
|
||||
def forward(self, step=1):
|
||||
@ -170,7 +169,7 @@ class History(Callback):
|
||||
self.emit('mru-changed', (self.mru, ))
|
||||
newact = self.history[self.index]
|
||||
if not isinstance(newact, str):
|
||||
newact = cuni(newact)
|
||||
newact = str(newact)
|
||||
self.emit('active-changed', (newact,))
|
||||
return newact
|
||||
|
||||
@ -187,7 +186,7 @@ class History(Callback):
|
||||
self.emit('mru-changed', (self.mru, ))
|
||||
newact = self.history[self.index]
|
||||
if not isinstance(newact, str):
|
||||
newact = cuni(newact)
|
||||
newact = str(newact)
|
||||
self.emit('active-changed', (newact,))
|
||||
return newact
|
||||
except IndexError:
|
||||
|
@ -36,7 +36,7 @@ import os
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
from gramps.gen.constfunc import cuni, conv_to_unicode
|
||||
from gramps.gen.constfunc import conv_to_unicode
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -142,7 +142,7 @@ class AddMediaObject(ManagedWindow):
|
||||
Callback function called when the save button is pressed.
|
||||
The media object is updated, and callback called.
|
||||
"""
|
||||
description = cuni(self.description.get_text())
|
||||
description = str(self.description.get_text())
|
||||
|
||||
if self.file_text.get_filename() is None:
|
||||
msgstr = _("Import failed")
|
||||
@ -154,7 +154,7 @@ class AddMediaObject(ManagedWindow):
|
||||
full_file = filename
|
||||
|
||||
if self.relpath.get_active():
|
||||
pname = cuni(media_path(self.dbase))
|
||||
pname = str(media_path(self.dbase))
|
||||
if not os.path.exists(pname):
|
||||
msgstr = _("Cannot import %s")
|
||||
msgstr2 = _("Directory specified in preferences: Base path for relative media paths: %s does not exist. Change preferences or do not use relative path when importing")
|
||||
@ -190,7 +190,7 @@ class AddMediaObject(ManagedWindow):
|
||||
filename = conv_to_unicode(fname)
|
||||
basename = os.path.basename(filename)
|
||||
(root, ext) = os.path.splitext(basename)
|
||||
old_title = cuni(self.description.get_text())
|
||||
old_title = str(self.description.get_text())
|
||||
|
||||
if old_title == '' or old_title == self.temp_name:
|
||||
self.description.set_text(root)
|
||||
|
@ -49,7 +49,7 @@ from gi.repository import GLib
|
||||
from ...utils import is_right_click, open_file_with_default_application
|
||||
from ...dbguielement import DbGUIElement
|
||||
from ...selectors import SelectorFactory
|
||||
from gramps.gen.constfunc import cuni, win, conv_to_unicode
|
||||
from gramps.gen.constfunc import win, conv_to_unicode
|
||||
from gramps.gen.lib import MediaObject, MediaRef
|
||||
from gramps.gen.db import DbTxn
|
||||
from gramps.gen.utils.file import (media_path_full, media_path, relative_path,
|
||||
@ -526,7 +526,7 @@ class GalleryTab(ButtonTab, DbGUIElement):
|
||||
self.uistate.set_busy_cursor(True)
|
||||
photo.set_checksum(create_checksum(name))
|
||||
self.uistate.set_busy_cursor(False)
|
||||
base_dir = cuni(media_path(self.dbstate.db))
|
||||
base_dir = str(media_path(self.dbstate.db))
|
||||
if os.path.exists(base_dir):
|
||||
name = relative_path(name, base_dir)
|
||||
photo.set_path(name)
|
||||
|
@ -76,7 +76,6 @@ from .displaytabs import (PersonEventEmbedList, NameEmbedList, CitationEmbedList
|
||||
PersonBackRefList, SurnameTab)
|
||||
from gramps.gen.plug import CATEGORY_QR_PERSON
|
||||
from gramps.gen.const import URL_MANUAL_PAGE
|
||||
from gramps.gen.constfunc import cuni
|
||||
from gramps.gen.utils.id import create_id
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -739,7 +738,7 @@ class EditPerson(EditPrimary):
|
||||
return False
|
||||
try:
|
||||
gender_type = self.db.genderStats.guess_gender(
|
||||
cuni(entry.get_text()))
|
||||
str(entry.get_text()))
|
||||
self.gender.force(gender_type)
|
||||
except:
|
||||
return False
|
||||
|
@ -71,7 +71,6 @@ from gramps.gen.display.name import displayer as _nd
|
||||
from gramps.gen.display.place import displayer as _pd
|
||||
from gramps.gen.utils.db import family_name
|
||||
from gramps.gen.utils.string import conf_strings
|
||||
from gramps.gen.constfunc import cuni
|
||||
from ..widgets import DateEntry
|
||||
from gramps.gen.datehandler import displayer
|
||||
|
||||
@ -333,7 +332,7 @@ class MyID(Gtk.Box):
|
||||
self.set_text(val.get_gramps_id())
|
||||
|
||||
def get_text(self):
|
||||
return cuni(self.entry.get_text())
|
||||
return str(self.entry.get_text())
|
||||
|
||||
def name_from_gramps_id(self, gramps_id):
|
||||
if self.namespace == 'Person':
|
||||
@ -756,7 +755,7 @@ class EditRule(ManagedWindow):
|
||||
try:
|
||||
page = self.notebook.get_current_page()
|
||||
(class_obj, vallist, tlist, use_regex) = self.page[page]
|
||||
value_list = [cuni(sclass.get_text()) for sclass in tlist]
|
||||
value_list = [str(sclass.get_text()) for sclass in tlist]
|
||||
if class_obj.allow_regex:
|
||||
new_rule = class_obj(value_list, use_regex.get_active())
|
||||
else:
|
||||
@ -841,7 +840,7 @@ class EditFilter(ManagedWindow):
|
||||
self.close()
|
||||
|
||||
def filter_name_changed(self, obj):
|
||||
name = cuni(self.fname.get_text())
|
||||
name = str(self.fname.get_text())
|
||||
# Make sure that the name is not empty
|
||||
# and not in the list of existing filters (excluding this one)
|
||||
names = [filt.get_name()
|
||||
@ -864,14 +863,14 @@ class EditFilter(ManagedWindow):
|
||||
self.rlist.add([r.name,r.display_values()],r)
|
||||
|
||||
def on_ok_clicked(self, obj):
|
||||
n = cuni(self.fname.get_text()).strip()
|
||||
n = str(self.fname.get_text()).strip()
|
||||
if n == '':
|
||||
return
|
||||
if n != self.filter.get_name():
|
||||
self.uistate.emit('filter-name-changed',
|
||||
(self.namespace, cuni(self.filter.get_name()), n))
|
||||
(self.namespace, str(self.filter.get_name()), n))
|
||||
self.filter.set_name(n)
|
||||
self.filter.set_comment(cuni(self.comment.get_text()).strip())
|
||||
self.filter.set_comment(str(self.comment.get_text()).strip())
|
||||
for f in self.filterdb.get_filters(self.namespace)[:]:
|
||||
if n == f.get_name():
|
||||
self.filterdb.get_filters(self.namespace).remove(f)
|
||||
|
@ -36,7 +36,6 @@ from gi.repository import GObject
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.filters import CustomFilters
|
||||
from gramps.gen.constfunc import cuni
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -58,7 +57,7 @@ class FilterComboBox(Gtk.ComboBox):
|
||||
cnt = 0
|
||||
for filt in local_filters:
|
||||
self.store.append(row=[filt.get_name()])
|
||||
self.map[cuni(filt.get_name())] = filt
|
||||
self.map[str(filt.get_name())] = filt
|
||||
if default != "" and default == filt.get_name():
|
||||
active = cnt
|
||||
cnt += 1
|
||||
@ -72,7 +71,7 @@ class FilterComboBox(Gtk.ComboBox):
|
||||
|
||||
for filt in CustomFilters.get_filters():
|
||||
self.store.append(row=[filt.get_name()])
|
||||
self.map[cuni(filt.get_name())] = filt
|
||||
self.map[str(filt.get_name())] = filt
|
||||
if default != "" and default == filt.get_name():
|
||||
active = cnt
|
||||
cnt += 1
|
||||
@ -92,5 +91,5 @@ class FilterComboBox(Gtk.ComboBox):
|
||||
active = self.get_active()
|
||||
if active < 0:
|
||||
return None
|
||||
key = cuni(self.store[active][0])
|
||||
key = str(self.store[active][0])
|
||||
return self.map[key]
|
||||
|
@ -33,8 +33,6 @@ from gi.repository import Gtk
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
|
||||
from gramps.gen.constfunc import cuni
|
||||
|
||||
_RETURN = Gdk.keyval_from_name("Return")
|
||||
_KP_ENTER = Gdk.keyval_from_name("KP_Enter")
|
||||
|
||||
@ -155,14 +153,14 @@ class SearchBar(object):
|
||||
self.apply_filter()
|
||||
|
||||
def get_value(self):
|
||||
text = cuni(self.filter_text.get_text()).strip()
|
||||
text = str(self.filter_text.get_text()).strip()
|
||||
node = self.filter_list.get_active_iter()
|
||||
index = self.filter_model.get_value(node, 1)
|
||||
inv = self.filter_model.get_value(node, 2)
|
||||
return (index, text, inv)
|
||||
|
||||
def apply_filter(self, current_model=None):
|
||||
self.apply_text = cuni(self.filter_text.get_text())
|
||||
self.apply_text = str(self.filter_text.get_text())
|
||||
self.filter_button.set_sensitive(False)
|
||||
self.uistate.status_text(_('Updating display...'))
|
||||
self.on_apply_callback()
|
||||
|
@ -34,13 +34,10 @@ from gi.repository import Gtk
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.sgettext
|
||||
|
||||
from gramps.gen.constfunc import cuni
|
||||
|
||||
from ...widgets import MonitoredMenu, DateEntry, BasicEntry
|
||||
from gramps.gen.lib import Citation
|
||||
from .. import build_filter_model
|
||||
from . import SidebarFilter
|
||||
from gramps.gen.constfunc import cuni
|
||||
from gramps.gen.filters import GenericFilterFactory, rules
|
||||
from gramps.gen.filters.rules.citation import (RegExpIdOf, HasCitation, HasTag,
|
||||
HasNoteRegexp, MatchesFilter,
|
||||
@ -136,15 +133,15 @@ class CitationSidebarFilter(SidebarFilter):
|
||||
self.generic.set_active(0)
|
||||
|
||||
def get_filter(self):
|
||||
src_id = cuni(self.filter_src_id.get_text()).strip()
|
||||
src_title = cuni(self.filter_src_title.get_text()).strip()
|
||||
src_author = cuni(self.filter_src_author.get_text()).strip()
|
||||
src_abbr = cuni(self.filter_src_abbr.get_text()).strip()
|
||||
src_pub = cuni(self.filter_src_pub.get_text()).strip()
|
||||
src_note = cuni(self.filter_src_note.get_text()).strip()
|
||||
gid = cuni(self.filter_id.get_text()).strip()
|
||||
page = cuni(self.filter_page.get_text()).strip()
|
||||
date = cuni(self.filter_date.get_text()).strip()
|
||||
src_id = str(self.filter_src_id.get_text()).strip()
|
||||
src_title = str(self.filter_src_title.get_text()).strip()
|
||||
src_author = str(self.filter_src_author.get_text()).strip()
|
||||
src_abbr = str(self.filter_src_abbr.get_text()).strip()
|
||||
src_pub = str(self.filter_src_pub.get_text()).strip()
|
||||
src_note = str(self.filter_src_note.get_text()).strip()
|
||||
gid = str(self.filter_id.get_text()).strip()
|
||||
page = str(self.filter_page.get_text()).strip()
|
||||
date = str(self.filter_date.get_text()).strip()
|
||||
model = self.filter_conf.get_model()
|
||||
node = self.filter_conf.get_active_iter()
|
||||
conf_name = model.get_value(node, 0) # The value is actually the text
|
||||
@ -154,7 +151,7 @@ class CitationSidebarFilter(SidebarFilter):
|
||||
conf = i
|
||||
break
|
||||
# conf = self.citn.get_confidence_level()
|
||||
note = cuni(self.filter_note.get_text()).strip()
|
||||
note = str(self.filter_note.get_text()).strip()
|
||||
regex = self.filter_regex.get_active()
|
||||
tag = self.tag.get_active() > 0
|
||||
gen = self.generic.get_active() > 0
|
||||
@ -200,7 +197,7 @@ class CitationSidebarFilter(SidebarFilter):
|
||||
if self.generic.get_active() != 0:
|
||||
model = self.generic.get_model()
|
||||
node = self.generic.get_active_iter()
|
||||
obj = cuni(model.get_value(node, 0))
|
||||
obj = str(model.get_value(node, 0))
|
||||
rule = MatchesFilter([obj])
|
||||
generic_filter.add_rule(rule)
|
||||
|
||||
|
@ -42,7 +42,6 @@ from ... import widgets
|
||||
from gramps.gen.lib import Event, EventType
|
||||
from .. import build_filter_model
|
||||
from . import SidebarFilter
|
||||
from gramps.gen.constfunc import cuni
|
||||
from gramps.gen.filters import GenericFilterFactory, rules
|
||||
from gramps.gen.filters.rules.event import (RegExpIdOf, HasNoteRegexp,
|
||||
MatchesFilter, HasEvent, HasTag)
|
||||
@ -119,12 +118,12 @@ class EventSidebarFilter(SidebarFilter):
|
||||
self.generic.set_active(0)
|
||||
|
||||
def get_filter(self):
|
||||
gid = cuni(self.filter_id.get_text()).strip()
|
||||
desc = cuni(self.filter_desc.get_text()).strip()
|
||||
mainparts = cuni(self.filter_mainparts.get_text()).strip()
|
||||
date = cuni(self.filter_date.get_text()).strip()
|
||||
place = cuni(self.filter_place.get_text()).strip()
|
||||
note = cuni(self.filter_note.get_text()).strip()
|
||||
gid = str(self.filter_id.get_text()).strip()
|
||||
desc = str(self.filter_desc.get_text()).strip()
|
||||
mainparts = str(self.filter_mainparts.get_text()).strip()
|
||||
date = str(self.filter_date.get_text()).strip()
|
||||
place = str(self.filter_place.get_text()).strip()
|
||||
note = str(self.filter_note.get_text()).strip()
|
||||
regex = self.filter_regex.get_active()
|
||||
tag = self.tag.get_active() > 0
|
||||
generic = self.generic.get_active() > 0
|
||||
@ -159,7 +158,7 @@ class EventSidebarFilter(SidebarFilter):
|
||||
if self.generic.get_active() != 0:
|
||||
model = self.generic.get_model()
|
||||
node = self.generic.get_active_iter()
|
||||
obj = cuni(model.get_value(node, 0))
|
||||
obj = str(model.get_value(node, 0))
|
||||
rule = MatchesFilter([obj])
|
||||
generic_filter.add_rule(rule)
|
||||
|
||||
|
@ -43,7 +43,6 @@ from ... import widgets
|
||||
from gramps.gen.lib import Event, EventType, Family, FamilyRelType
|
||||
from .. import build_filter_model
|
||||
from . import SidebarFilter
|
||||
from gramps.gen.constfunc import cuni
|
||||
from gramps.gen.filters import GenericFilterFactory, rules
|
||||
from gramps.gen.filters.rules.family import (RegExpIdOf, RegExpFatherName,
|
||||
RegExpMotherName, RegExpChildName,
|
||||
@ -132,11 +131,11 @@ class FamilySidebarFilter(SidebarFilter):
|
||||
self.generic.set_active(0)
|
||||
|
||||
def get_filter(self):
|
||||
gid = cuni(self.filter_id.get_text()).strip()
|
||||
father = cuni(self.filter_father.get_text()).strip()
|
||||
mother = cuni(self.filter_mother.get_text()).strip()
|
||||
child = cuni(self.filter_child.get_text()).strip()
|
||||
note = cuni(self.filter_note.get_text()).strip()
|
||||
gid = str(self.filter_id.get_text()).strip()
|
||||
father = str(self.filter_father.get_text()).strip()
|
||||
mother = str(self.filter_mother.get_text()).strip()
|
||||
child = str(self.filter_child.get_text()).strip()
|
||||
note = str(self.filter_note.get_text()).strip()
|
||||
etype = self.filter_event.get_type().xml_str()
|
||||
rtype = self.family_stub.get_relationship().xml_str()
|
||||
regex = self.filter_regex.get_active()
|
||||
@ -188,7 +187,7 @@ class FamilySidebarFilter(SidebarFilter):
|
||||
if self.generic.get_active() != 0:
|
||||
model = self.generic.get_model()
|
||||
node = self.generic.get_active_iter()
|
||||
obj = cuni(model.get_value(node, 0))
|
||||
obj = str(model.get_value(node, 0))
|
||||
rule = MatchesFilter([obj])
|
||||
generic_filter.add_rule(rule)
|
||||
|
||||
|
@ -42,7 +42,6 @@ from gi.repository import Gtk
|
||||
from ... import widgets
|
||||
from .. import build_filter_model
|
||||
from . import SidebarFilter
|
||||
from gramps.gen.constfunc import cuni
|
||||
from gramps.gen.filters import GenericFilterFactory, rules
|
||||
from gramps.gen.filters.rules.media import (RegExpIdOf, HasMedia, HasTag,
|
||||
HasNoteRegexp, MatchesFilter)
|
||||
@ -106,12 +105,12 @@ class MediaSidebarFilter(SidebarFilter):
|
||||
self.generic.set_active(0)
|
||||
|
||||
def get_filter(self):
|
||||
gid = cuni(self.filter_id.get_text()).strip()
|
||||
title = cuni(self.filter_title.get_text()).strip()
|
||||
mime = cuni(self.filter_type.get_text()).strip()
|
||||
path = cuni(self.filter_path.get_text()).strip()
|
||||
date = cuni(self.filter_date.get_text()).strip()
|
||||
note = cuni(self.filter_note.get_text()).strip()
|
||||
gid = str(self.filter_id.get_text()).strip()
|
||||
title = str(self.filter_title.get_text()).strip()
|
||||
mime = str(self.filter_type.get_text()).strip()
|
||||
path = str(self.filter_path.get_text()).strip()
|
||||
date = str(self.filter_date.get_text()).strip()
|
||||
note = str(self.filter_note.get_text()).strip()
|
||||
regex = self.filter_regex.get_active()
|
||||
tag = self.tag.get_active() > 0
|
||||
gen = self.generic.get_active() > 0
|
||||
@ -144,7 +143,7 @@ class MediaSidebarFilter(SidebarFilter):
|
||||
if self.generic.get_active() != 0:
|
||||
model = self.generic.get_model()
|
||||
node = self.generic.get_active_iter()
|
||||
obj = cuni(model.get_value(node, 0))
|
||||
obj = str(model.get_value(node, 0))
|
||||
rule = MatchesFilter([obj])
|
||||
generic_filter.add_rule(rule)
|
||||
|
||||
|
@ -43,7 +43,6 @@ from ... import widgets
|
||||
from gramps.gen.lib import Note, NoteType
|
||||
from .. import build_filter_model
|
||||
from . import SidebarFilter
|
||||
from gramps.gen.constfunc import cuni
|
||||
from gramps.gen.filters import GenericFilterFactory, rules
|
||||
from gramps.gen.filters.rules.note import (RegExpIdOf, HasNote, MatchesFilter,
|
||||
HasTag)
|
||||
@ -107,8 +106,8 @@ class NoteSidebarFilter(SidebarFilter):
|
||||
self.generic.set_active(0)
|
||||
|
||||
def get_filter(self):
|
||||
gid = cuni(self.filter_id.get_text()).strip()
|
||||
text = cuni(self.filter_text.get_text()).strip()
|
||||
gid = str(self.filter_id.get_text()).strip()
|
||||
text = str(self.filter_text.get_text()).strip()
|
||||
ntype = self.note.get_type().xml_str()
|
||||
regex = self.filter_regex.get_active()
|
||||
tag = self.tag.get_active() > 0
|
||||
@ -137,7 +136,7 @@ class NoteSidebarFilter(SidebarFilter):
|
||||
if self.generic.get_active() != 0:
|
||||
model = self.generic.get_model()
|
||||
node = self.generic.get_active_iter()
|
||||
obj = cuni(model.get_value(node, 0))
|
||||
obj = str(model.get_value(node, 0))
|
||||
rule = MatchesFilter([obj])
|
||||
generic_filter.add_rule(rule)
|
||||
|
||||
|
@ -44,7 +44,6 @@ from gramps.gen.lib import Date, Event, EventType
|
||||
from gramps.gen.datehandler import displayer
|
||||
from .. import build_filter_model
|
||||
from . import SidebarFilter
|
||||
from gramps.gen.constfunc import cuni
|
||||
from gramps.gen.filters import GenericFilter, rules
|
||||
from gramps.gen.filters.rules.person import (RegExpName, RegExpIdOf, IsMale,
|
||||
IsFemale, HasUnknownGender,
|
||||
@ -61,7 +60,7 @@ def extract_text(entry_widget):
|
||||
of type unicode.
|
||||
|
||||
"""
|
||||
return cuni(entry_widget.get_text().strip())
|
||||
return str(entry_widget.get_text().strip())
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -234,7 +233,7 @@ class PersonSidebarFilter(SidebarFilter):
|
||||
if self.generic.get_active() != 0:
|
||||
model = self.generic.get_model()
|
||||
node = self.generic.get_active_iter()
|
||||
obj = cuni(model.get_value(node, 0))
|
||||
obj = str(model.get_value(node, 0))
|
||||
rule = MatchesFilter([obj])
|
||||
generic_filter.add_rule(rule)
|
||||
|
||||
|
@ -44,7 +44,6 @@ from ... import widgets
|
||||
from gramps.gen.lib import Place, PlaceType
|
||||
from .. import build_filter_model
|
||||
from . import SidebarFilter
|
||||
from gramps.gen.constfunc import cuni
|
||||
from gramps.gen.filters import GenericFilterFactory, rules
|
||||
from gramps.gen.filters.rules.place import (RegExpIdOf, HasData, HasTitle,
|
||||
HasTag, HasNoteRegexp,
|
||||
@ -116,12 +115,12 @@ class PlaceSidebarFilter(SidebarFilter):
|
||||
self.generic.set_active(0)
|
||||
|
||||
def get_filter(self):
|
||||
gid = cuni(self.filter_id.get_text()).strip()
|
||||
title = cuni(self.filter_title.get_text()).strip()
|
||||
name = cuni(self.filter_name.get_text()).strip()
|
||||
gid = str(self.filter_id.get_text()).strip()
|
||||
title = str(self.filter_title.get_text()).strip()
|
||||
name = str(self.filter_name.get_text()).strip()
|
||||
ptype = self.filter_place.get_type().xml_str()
|
||||
code = cuni(self.filter_code.get_text()).strip()
|
||||
note = cuni(self.filter_note.get_text()).strip()
|
||||
code = str(self.filter_code.get_text()).strip()
|
||||
note = str(self.filter_note.get_text()).strip()
|
||||
regex = self.filter_regex.get_active()
|
||||
tag = self.tag.get_active() > 0
|
||||
gen = self.generic.get_active() > 0
|
||||
@ -158,7 +157,7 @@ class PlaceSidebarFilter(SidebarFilter):
|
||||
if self.generic.get_active() != 0:
|
||||
model = self.generic.get_model()
|
||||
node = self.generic.get_active_iter()
|
||||
obj = cuni(model.get_value(node, 0))
|
||||
obj = str(model.get_value(node, 0))
|
||||
rule = MatchesFilter([obj])
|
||||
generic_filter.add_rule(rule)
|
||||
|
||||
|
@ -42,7 +42,6 @@ from ... import widgets
|
||||
from gramps.gen.lib import Repository, RepositoryType
|
||||
from .. import build_filter_model
|
||||
from . import SidebarFilter
|
||||
from gramps.gen.constfunc import cuni
|
||||
from gramps.gen.filters import GenericFilterFactory, rules
|
||||
from gramps.gen.filters.rules.repository import (RegExpIdOf, HasRepo, HasTag,
|
||||
HasNoteRegexp, MatchesFilter)
|
||||
@ -116,12 +115,12 @@ class RepoSidebarFilter(SidebarFilter):
|
||||
self.generic.set_active(0)
|
||||
|
||||
def get_filter(self):
|
||||
gid = cuni(self.filter_id.get_text()).strip()
|
||||
title = cuni(self.filter_title.get_text()).strip()
|
||||
address = cuni(self.filter_address.get_text()).strip()
|
||||
url = cuni(self.filter_url.get_text()).strip()
|
||||
gid = str(self.filter_id.get_text()).strip()
|
||||
title = str(self.filter_title.get_text()).strip()
|
||||
address = str(self.filter_address.get_text()).strip()
|
||||
url = str(self.filter_url.get_text()).strip()
|
||||
rtype = self.repo.get_type().xml_str()
|
||||
note = cuni(self.filter_note.get_text()).strip()
|
||||
note = str(self.filter_note.get_text()).strip()
|
||||
regex = self.filter_regex.get_active()
|
||||
tag = self.tag.get_active() > 0
|
||||
gen = self.generic.get_active() > 0
|
||||
@ -154,7 +153,7 @@ class RepoSidebarFilter(SidebarFilter):
|
||||
if self.generic.get_active() != 0:
|
||||
model = self.generic.get_model()
|
||||
node = self.generic.get_active_iter()
|
||||
obj = cuni(model.get_value(node, 0))
|
||||
obj = str(model.get_value(node, 0))
|
||||
rule = MatchesFilter([obj])
|
||||
generic_filter.add_rule(rule)
|
||||
|
||||
|
@ -41,7 +41,6 @@ from gi.repository import Gtk
|
||||
from ... import widgets
|
||||
from .. import build_filter_model
|
||||
from . import SidebarFilter
|
||||
from gramps.gen.constfunc import cuni
|
||||
from gramps.gen.filters import GenericFilterFactory, rules
|
||||
from gramps.gen.filters.rules.source import (RegExpIdOf, HasSource, HasTag,
|
||||
HasNoteRegexp, MatchesFilter)
|
||||
@ -105,12 +104,12 @@ class SourceSidebarFilter(SidebarFilter):
|
||||
self.generic.set_active(0)
|
||||
|
||||
def get_filter(self):
|
||||
gid = cuni(self.filter_id.get_text()).strip()
|
||||
title = cuni(self.filter_title.get_text()).strip()
|
||||
author = cuni(self.filter_author.get_text()).strip()
|
||||
abbr = cuni(self.filter_abbr.get_text()).strip()
|
||||
pub = cuni(self.filter_pub.get_text()).strip()
|
||||
note = cuni(self.filter_note.get_text()).strip()
|
||||
gid = str(self.filter_id.get_text()).strip()
|
||||
title = str(self.filter_title.get_text()).strip()
|
||||
author = str(self.filter_author.get_text()).strip()
|
||||
abbr = str(self.filter_abbr.get_text()).strip()
|
||||
pub = str(self.filter_pub.get_text()).strip()
|
||||
note = str(self.filter_note.get_text()).strip()
|
||||
regex = self.filter_regex.get_active()
|
||||
tag = self.tag.get_active() > 0
|
||||
gen = self.generic.get_active() > 0
|
||||
@ -143,7 +142,7 @@ class SourceSidebarFilter(SidebarFilter):
|
||||
if self.generic.get_active() != 0:
|
||||
model = self.generic.get_model()
|
||||
node = self.generic.get_active_iter()
|
||||
obj = cuni(model.get_value(node, 0))
|
||||
obj = str(model.get_value(node, 0))
|
||||
rule = MatchesFilter([obj])
|
||||
generic_filter.add_rule(rule)
|
||||
|
||||
|
@ -59,7 +59,7 @@ from ..selectors import SelectorFactory
|
||||
from gramps.gen.display.name import displayer as _nd
|
||||
from gramps.gen.display.place import displayer as _pd
|
||||
from gramps.gen.filters import GenericFilterFactory, GenericFilter, rules
|
||||
from gramps.gen.constfunc import (conv_to_unicode, get_curr_dir, cuni)
|
||||
from gramps.gen.constfunc import conv_to_unicode, get_curr_dir
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
|
||||
@ -387,9 +387,9 @@ class GuiTextOption(Gtk.ScrolledWindow):
|
||||
"""
|
||||
Handle the change of the value made by the user.
|
||||
"""
|
||||
text_val = cuni( self.__buff.get_text( self.__buff.get_start_iter(),
|
||||
self.__buff.get_end_iter(),
|
||||
False) )
|
||||
text_val = str(self.__buff.get_text(self.__buff.get_start_iter(),
|
||||
self.__buff.get_end_iter(),
|
||||
False))
|
||||
|
||||
self.__option.disable_signals()
|
||||
self.__option.set_value( text_val.split('\n') )
|
||||
|
@ -57,7 +57,6 @@ from gi.repository import GObject
|
||||
#-------------------------------------------------------------------------
|
||||
from ...listmodel import ListModel
|
||||
from gramps.gen.errors import FilterError, ReportError
|
||||
from gramps.gen.constfunc import cuni
|
||||
from ...pluginmanager import GuiPluginManager
|
||||
from ...dialog import WarningDialog, ErrorDialog
|
||||
from gramps.gen.plug.menu import PersonOption, FilterOption, FamilyOption
|
||||
@ -263,7 +262,7 @@ class BookListDisplay(object):
|
||||
store, the_iter = self.blist.get_selected()
|
||||
if the_iter:
|
||||
data = self.blist.get_data(the_iter, [0])
|
||||
self.selection = self.booklist.get_book(cuni(data[0]))
|
||||
self.selection = self.booklist.get_book(str(data[0]))
|
||||
if self.dosave:
|
||||
self.booklist.save()
|
||||
|
||||
@ -277,7 +276,7 @@ class BookListDisplay(object):
|
||||
if not the_iter:
|
||||
return
|
||||
data = self.blist.get_data(the_iter, [0])
|
||||
self.booklist.delete_book(cuni(data[0]))
|
||||
self.booklist.delete_book(str(data[0]))
|
||||
self.blist.remove(the_iter)
|
||||
self.unsaved_changes = True
|
||||
self.top.run()
|
||||
@ -715,7 +714,7 @@ class BookSelector(ManagedWindow):
|
||||
Save the current book in the xml booklist file.
|
||||
"""
|
||||
self.book_list = BookList(self.file, self.db)
|
||||
name = cuni(self.name_entry.get_text())
|
||||
name = str(self.name_entry.get_text())
|
||||
if not name:
|
||||
WarningDialog(_('No book name'), _(
|
||||
'You are about to save away a book with no name.\n\n'
|
||||
|
@ -42,7 +42,6 @@ from gi.repository import GObject
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.plug.docgen import PaperStyle, PAPER_PORTRAIT, PAPER_LANDSCAPE
|
||||
from gramps.gen.plug.report._paper import paper_sizes
|
||||
from gramps.gen.constfunc import cuni
|
||||
from ...glade import Glade
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -81,7 +80,7 @@ class PaperComboBox(Gtk.ComboBox):
|
||||
active = self.get_active()
|
||||
if active < 0:
|
||||
return None
|
||||
key = cuni(self.store[active][0])
|
||||
key = str(self.store[active][0])
|
||||
for paper in paper_sizes:
|
||||
if key == paper.trans_pname:
|
||||
key = paper.get_name()
|
||||
@ -245,8 +244,8 @@ class PaperFrame(Gtk.Box):
|
||||
papersize, papername = self.papersize_menu.get_value()
|
||||
if papername == 'Custom Size':
|
||||
try:
|
||||
h = float(cuni(self.pheight.get_text().replace(",", ".")))
|
||||
w = float(cuni(self.pwidth.get_text().replace(",", ".") ))
|
||||
h = float(str(self.pheight.get_text().replace(",", ".")))
|
||||
w = float(str(self.pwidth.get_text().replace(",", ".") ))
|
||||
|
||||
if h <= 1.0 or w <= 1.0:
|
||||
papersize.set_height(29.7)
|
||||
@ -266,7 +265,7 @@ class PaperFrame(Gtk.Box):
|
||||
Values returned in [cm].
|
||||
|
||||
"""
|
||||
paper_margins = [cuni(margin.get_text()) for margin in
|
||||
paper_margins = [str(margin.get_text()) for margin in
|
||||
(self.lmargin, self.rmargin, self.tmargin, self.bmargin)]
|
||||
|
||||
for i, margin in enumerate(paper_margins):
|
||||
|
@ -25,8 +25,6 @@ _ = glocale.translation.gettext
|
||||
from gi.repository import Gtk
|
||||
from gi.repository import GObject
|
||||
|
||||
from gramps.gen.constfunc import cuni
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# StyleComboBox
|
||||
@ -83,7 +81,7 @@ class StyleComboBox(Gtk.ComboBox):
|
||||
active = self.get_active()
|
||||
if active < 0:
|
||||
return None
|
||||
key = cuni(self.store[active][0])
|
||||
key = str(self.store[active][0])
|
||||
if key == _('default'):
|
||||
key = "default"
|
||||
return (key,self.style_map[key])
|
||||
|
@ -54,7 +54,6 @@ from gramps.gen.plug.docgen import (StyleSheet, FONT_SERIF, FONT_SANS_SERIF,
|
||||
PARA_ALIGN_RIGHT, PARA_ALIGN_CENTER, PARA_ALIGN_LEFT,
|
||||
PARA_ALIGN_JUSTIFY, ParagraphStyle, TableStyle, TableCellStyle,
|
||||
GraphicsStyle)
|
||||
from gramps.gen.constfunc import cuni
|
||||
from ...listmodel import ListModel
|
||||
from ...managedwindow import set_titles
|
||||
from ...glade import Glade
|
||||
@ -154,7 +153,7 @@ class StyleListDisplay(object):
|
||||
if not node:
|
||||
return
|
||||
|
||||
name = cuni(self.list.model.get_value(node, 0))
|
||||
name = str(self.list.model.get_value(node, 0))
|
||||
if name == _('default'): # the default style cannot be edited
|
||||
return
|
||||
style = self.sheetlist.get_style_sheet(name)
|
||||
@ -165,7 +164,7 @@ class StyleListDisplay(object):
|
||||
store, node = self.list.selection.get_selected()
|
||||
if not node:
|
||||
return
|
||||
name = cuni(self.list.model.get_value(node, 0))
|
||||
name = str(self.list.model.get_value(node, 0))
|
||||
if name == _('default'): # the default style cannot be removed
|
||||
return
|
||||
self.sheetlist.delete_style_sheet(name)
|
||||
@ -517,7 +516,7 @@ class StyleEditor(object):
|
||||
Saves the current style sheet and causes the parent to be updated with
|
||||
the changes.
|
||||
"""
|
||||
name = cuni(self.top.get_object("style_name").get_text())
|
||||
name = str(self.top.get_object("style_name").get_text())
|
||||
|
||||
self.save()
|
||||
self.style.set_name(name)
|
||||
|
@ -50,7 +50,7 @@ from gi.repository import GdkPixbuf
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.const import (ICON, IMAGE_DIR, THUMB_LARGE, THUMB_NORMAL,
|
||||
THUMBSCALE, THUMBSCALE_LARGE, USE_THUMBNAILER)
|
||||
from gramps.gen.constfunc import cuni, win
|
||||
from gramps.gen.constfunc import win
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -98,7 +98,7 @@ def __get_gconf_string(key):
|
||||
val = CLIENT.get_string(key)
|
||||
except GObject.GError:
|
||||
val = None
|
||||
return cuni(val)
|
||||
return str(val)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
@ -50,7 +50,6 @@ from gramps.gen.const import URL_MANUAL_PAGE
|
||||
from ..display import display_help
|
||||
from ..dialog import ErrorDialog, QuestionDialog2
|
||||
import gramps.gui.widgets.progressdialog as progressdlg
|
||||
from gramps.gen.constfunc import cuni
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -552,7 +551,7 @@ class EditTag(object):
|
||||
"""
|
||||
Save the changes made to the tag.
|
||||
"""
|
||||
self.tag.set_name(cuni(self.entry.get_text()))
|
||||
self.tag.set_name(str(self.entry.get_text()))
|
||||
rgba = self.color.get_rgba()
|
||||
hexval = "#%02x%02x%02x" % (int(rgba.red * 255),
|
||||
int(rgba.green * 255),
|
||||
|
@ -44,7 +44,6 @@ from gramps.gen.datehandler import format_time, get_date, get_date_valid
|
||||
from gramps.gen.lib import Citation
|
||||
from gramps.gen.utils.string import conf_strings
|
||||
from gramps.gen.config import config
|
||||
from gramps.gen.constfunc import cuni
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -110,13 +109,13 @@ class CitationBaseModel(object):
|
||||
return ''
|
||||
|
||||
def citation_id(self, data):
|
||||
return cuni(data[COLUMN_ID])
|
||||
return str(data[COLUMN_ID])
|
||||
|
||||
def citation_page(self, data):
|
||||
return cuni(data[COLUMN_PAGE])
|
||||
return str(data[COLUMN_PAGE])
|
||||
|
||||
def citation_confidence(self, data):
|
||||
return cuni(_(conf_strings[data[COLUMN_CONFIDENCE]]))
|
||||
return str(_(conf_strings[data[COLUMN_CONFIDENCE]]))
|
||||
|
||||
def citation_private(self, data):
|
||||
if data[COLUMN_PRIV]:
|
||||
@ -160,7 +159,7 @@ class CitationBaseModel(object):
|
||||
source_handle = data[COLUMN_SOURCE]
|
||||
try:
|
||||
source = self.db.get_source_from_handle(source_handle)
|
||||
return cuni(source.get_title())
|
||||
return str(source.get_title())
|
||||
except:
|
||||
return ''
|
||||
|
||||
@ -168,7 +167,7 @@ class CitationBaseModel(object):
|
||||
source_handle = data[COLUMN_SOURCE]
|
||||
try:
|
||||
source = self.db.get_source_from_handle(source_handle)
|
||||
return cuni(source.gramps_id)
|
||||
return str(source.gramps_id)
|
||||
except:
|
||||
return ''
|
||||
|
||||
@ -176,7 +175,7 @@ class CitationBaseModel(object):
|
||||
source_handle = data[COLUMN_SOURCE]
|
||||
try:
|
||||
source = self.db.get_source_from_handle(source_handle)
|
||||
return cuni(source.get_author())
|
||||
return str(source.get_author())
|
||||
except:
|
||||
return ''
|
||||
|
||||
@ -184,7 +183,7 @@ class CitationBaseModel(object):
|
||||
source_handle = data[COLUMN_SOURCE]
|
||||
try:
|
||||
source = self.db.get_source_from_handle(source_handle)
|
||||
return cuni(source.get_abbreviation())
|
||||
return str(source.get_abbreviation())
|
||||
except:
|
||||
return ''
|
||||
|
||||
@ -192,7 +191,7 @@ class CitationBaseModel(object):
|
||||
source_handle = data[COLUMN_SOURCE]
|
||||
try:
|
||||
source = self.db.get_source_from_handle(source_handle)
|
||||
return cuni(source.get_publication_info())
|
||||
return str(source.get_publication_info())
|
||||
except:
|
||||
return ''
|
||||
|
||||
@ -228,19 +227,19 @@ class CitationBaseModel(object):
|
||||
# Fields access when 'data' is a Source
|
||||
|
||||
def source_src_title(self, data):
|
||||
return cuni(data[COLUMN2_TITLE])
|
||||
return str(data[COLUMN2_TITLE])
|
||||
|
||||
def source_src_id(self, data):
|
||||
return cuni(data[COLUMN2_ID])
|
||||
return str(data[COLUMN2_ID])
|
||||
|
||||
def source_src_auth(self, data):
|
||||
return cuni(data[COLUMN2_AUTHOR])
|
||||
return str(data[COLUMN2_AUTHOR])
|
||||
|
||||
def source_src_abbr(self, data):
|
||||
return cuni(data[COLUMN2_ABBREV])
|
||||
return str(data[COLUMN2_ABBREV])
|
||||
|
||||
def source_src_pinfo(self, data):
|
||||
return cuni(data[COLUMN2_PUBINFO])
|
||||
return str(data[COLUMN2_PUBINFO])
|
||||
|
||||
def source_src_private(self, data):
|
||||
if data[COLUMN2_PRIV]:
|
||||
|
@ -44,7 +44,6 @@ from gramps.gen.lib import Event, EventType
|
||||
from gramps.gen.utils.db import get_participant_from_event
|
||||
from gramps.gen.display.place import displayer as place_displayer
|
||||
from gramps.gen.config import config
|
||||
from gramps.gen.constfunc import cuni
|
||||
from .flatbasemodel import FlatBaseModel
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
|
||||
@ -139,10 +138,10 @@ class EventModel(FlatBaseModel):
|
||||
return ''
|
||||
|
||||
def column_type(self,data):
|
||||
return cuni(EventType(data[COLUMN_TYPE]))
|
||||
return str(EventType(data[COLUMN_TYPE]))
|
||||
|
||||
def column_id(self,data):
|
||||
return cuni(data[COLUMN_ID])
|
||||
return str(data[COLUMN_ID])
|
||||
|
||||
def column_date(self,data):
|
||||
if data[COLUMN_DATE]:
|
||||
|
@ -45,7 +45,6 @@ from gramps.gen.lib import EventRoleType, FamilyRelType
|
||||
from .flatbasemodel import FlatBaseModel
|
||||
from gramps.gen.utils.db import get_marriage_or_fallback
|
||||
from gramps.gen.config import config
|
||||
from gramps.gen.constfunc import cuni
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
|
||||
invalid_date_format = config.get('preferences.invalid-date-format')
|
||||
@ -135,7 +134,7 @@ class FamilyModel(FlatBaseModel):
|
||||
return ""
|
||||
|
||||
def column_type(self, data):
|
||||
return cuni(FamilyRelType(data[5]))
|
||||
return str(FamilyRelType(data[5]))
|
||||
|
||||
def column_marriage(self, data):
|
||||
family = self.db.get_family_from_handle(data[0])
|
||||
@ -159,7 +158,7 @@ class FamilyModel(FlatBaseModel):
|
||||
return ''
|
||||
|
||||
def column_id(self, data):
|
||||
return cuni(data[1])
|
||||
return str(data[1])
|
||||
|
||||
def column_private(self, data):
|
||||
if data[14]:
|
||||
|
@ -71,7 +71,7 @@ from gi.repository import Gtk
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.filters import SearchFilter, ExactSearchFilter
|
||||
from gramps.gen.constfunc import cuni, conv_to_unicode, handle2internal
|
||||
from gramps.gen.constfunc import conv_to_unicode, handle2internal
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -80,7 +80,7 @@ from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
UEMPTY = cuni("")
|
||||
UEMPTY = ""
|
||||
|
||||
class FlatNodeMap(object):
|
||||
"""
|
||||
|
@ -43,7 +43,7 @@ from gi.repository import Gtk
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.datehandler import displayer, format_time
|
||||
from gramps.gen.lib import Date, MediaObject
|
||||
from gramps.gen.constfunc import cuni, conv_to_unicode
|
||||
from gramps.gen.constfunc import conv_to_unicode
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
from .flatbasemodel import FlatBaseModel
|
||||
|
||||
@ -110,7 +110,7 @@ class MediaModel(FlatBaseModel):
|
||||
if isinstance(descr, str):
|
||||
return descr
|
||||
try:
|
||||
return cuni(descr)
|
||||
return str(descr)
|
||||
except:
|
||||
return conv_to_unicode(descr, 'latin1')
|
||||
|
||||
@ -119,27 +119,27 @@ class MediaModel(FlatBaseModel):
|
||||
if isinstance(path, str):
|
||||
return path
|
||||
try:
|
||||
return cuni(path)
|
||||
return str(path)
|
||||
except:
|
||||
return cuni(path.encode('iso-8859-1'))
|
||||
return str(path.encode('iso-8859-1'))
|
||||
|
||||
def column_mime(self, data):
|
||||
mime = data[3]
|
||||
if mime and isinstance(mime, str):
|
||||
return mime
|
||||
if mime:
|
||||
return cuni(mime)
|
||||
return str(mime)
|
||||
else:
|
||||
return _('Note')
|
||||
|
||||
def column_id(self,data):
|
||||
return cuni(data[1])
|
||||
return str(data[1])
|
||||
|
||||
def column_date(self,data):
|
||||
if data[10]:
|
||||
date = Date()
|
||||
date.unserialize(data[10])
|
||||
return cuni(displayer.display(date))
|
||||
return str(displayer.display(date))
|
||||
return ''
|
||||
|
||||
def sort_date(self,data):
|
||||
@ -152,7 +152,7 @@ class MediaModel(FlatBaseModel):
|
||||
return ''
|
||||
|
||||
def column_handle(self,data):
|
||||
return cuni(data[0])
|
||||
return str(data[0])
|
||||
|
||||
def column_private(self, data):
|
||||
if data[12]:
|
||||
@ -168,7 +168,7 @@ class MediaModel(FlatBaseModel):
|
||||
return format_time(data[9])
|
||||
|
||||
def column_tooltip(self,data):
|
||||
return cuni('Media tooltip')
|
||||
return 'Media tooltip'
|
||||
|
||||
def get_tag_name(self, tag_handle):
|
||||
"""
|
||||
|
@ -40,7 +40,6 @@ from gi.repository import Gtk
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.datehandler import format_time
|
||||
from gramps.gen.constfunc import cuni
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
from .flatbasemodel import FlatBaseModel
|
||||
from gramps.gen.lib import (Note, NoteType, StyledText)
|
||||
@ -102,19 +101,19 @@ class NoteModel(FlatBaseModel):
|
||||
|
||||
def column_id(self, data):
|
||||
"""Return the id of the Note."""
|
||||
return cuni(data[Note.POS_ID])
|
||||
return str(data[Note.POS_ID])
|
||||
|
||||
def column_type(self, data):
|
||||
"""Return the type of the Note in readable format."""
|
||||
temp = NoteType()
|
||||
temp.set(data[Note.POS_TYPE])
|
||||
return cuni(str(temp))
|
||||
return str(temp)
|
||||
|
||||
def column_preview(self, data):
|
||||
"""Return a shortend version of the Note's text."""
|
||||
#data is the encoding in the database, make it a unicode object
|
||||
#for universal work
|
||||
note = cuni(data[Note.POS_TEXT][StyledText.POS_TEXT])
|
||||
note = str(data[Note.POS_TEXT][StyledText.POS_TEXT])
|
||||
note = " ".join(note.split())
|
||||
if len(note) > 80:
|
||||
return note[:80] + "..."
|
||||
|
@ -63,7 +63,6 @@ from .lru import LRU
|
||||
from .flatbasemodel import FlatBaseModel
|
||||
from .treebasemodel import TreeBaseModel
|
||||
from gramps.gen.config import config
|
||||
from gramps.gen.constfunc import cuni
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -469,25 +468,25 @@ class PeopleBaseModel(object):
|
||||
return todo
|
||||
|
||||
def column_parents(self, data):
|
||||
return cuni(self._get_parents_data(data))
|
||||
return str(self._get_parents_data(data))
|
||||
|
||||
def sort_parents(self, data):
|
||||
return '%06d' % self._get_parents_data(data)
|
||||
|
||||
def column_marriages(self, data):
|
||||
return cuni(self._get_marriages_data(data))
|
||||
return str(self._get_marriages_data(data))
|
||||
|
||||
def sort_marriages(self, data):
|
||||
return '%06d' % self._get_marriages_data(data)
|
||||
|
||||
def column_children(self, data):
|
||||
return cuni(self._get_children_data(data))
|
||||
return str(self._get_children_data(data))
|
||||
|
||||
def sort_children(self, data):
|
||||
return '%06d' % self._get_children_data(data)
|
||||
|
||||
def column_todo(self, data):
|
||||
return cuni(self._get_todo_data(data))
|
||||
return str(self._get_todo_data(data))
|
||||
|
||||
def sort_todo(self, data):
|
||||
return '%06d' % self._get_todo_data(data)
|
||||
|
@ -47,7 +47,6 @@ from gi.repository import Gtk
|
||||
from gramps.gen.lib.placetype import PlaceType
|
||||
from gramps.gen.datehandler import format_time
|
||||
from gramps.gen.utils.place import conv_lat_lon
|
||||
from gramps.gen.constfunc import cuni
|
||||
from .flatbasemodel import FlatBaseModel
|
||||
from .treebasemodel import TreeBaseModel
|
||||
|
||||
@ -116,10 +115,10 @@ class PlaceBaseModel(object):
|
||||
return len(self.fmap)+1
|
||||
|
||||
def column_title(self, data):
|
||||
return cuni(data[2])
|
||||
return str(data[2])
|
||||
|
||||
def column_name(self, data):
|
||||
return cuni(data[6])
|
||||
return str(data[6])
|
||||
|
||||
def column_longitude(self, data):
|
||||
if not data[3]:
|
||||
@ -154,13 +153,13 @@ class PlaceBaseModel(object):
|
||||
return value
|
||||
|
||||
def column_id(self, data):
|
||||
return cuni(data[1])
|
||||
return str(data[1])
|
||||
|
||||
def column_type(self, data):
|
||||
return str(PlaceType(data[8]))
|
||||
|
||||
def column_code(self, data):
|
||||
return cuni(data[9])
|
||||
return str(data[9])
|
||||
|
||||
def column_private(self, data):
|
||||
if data[17]:
|
||||
|
@ -40,7 +40,6 @@ from gi.repository import Gtk
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.lib import Address, RepositoryType, Url, UrlType
|
||||
from gramps.gen.datehandler import format_time
|
||||
from gramps.gen.constfunc import cuni
|
||||
from .flatbasemodel import FlatBaseModel
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
#-------------------------------------------------------------------------
|
||||
@ -118,13 +117,13 @@ class RepositoryModel(FlatBaseModel):
|
||||
return len(self.fmap)+1
|
||||
|
||||
def column_id(self,data):
|
||||
return cuni(data[1])
|
||||
return str(data[1])
|
||||
|
||||
def column_type(self,data):
|
||||
return cuni(RepositoryType(data[2]))
|
||||
return str(RepositoryType(data[2]))
|
||||
|
||||
def column_name(self,data):
|
||||
return cuni(data[3])
|
||||
return str(data[3])
|
||||
|
||||
def column_city(self,data):
|
||||
try:
|
||||
@ -134,7 +133,7 @@ class RepositoryModel(FlatBaseModel):
|
||||
return addr.get_city()
|
||||
except:
|
||||
pass
|
||||
return cuni('')
|
||||
return ''
|
||||
|
||||
def column_street(self,data):
|
||||
try:
|
||||
@ -144,7 +143,7 @@ class RepositoryModel(FlatBaseModel):
|
||||
return addr.get_street()
|
||||
except:
|
||||
pass
|
||||
return cuni('')
|
||||
return ''
|
||||
|
||||
def column_locality(self,data):
|
||||
try:
|
||||
@ -154,7 +153,7 @@ class RepositoryModel(FlatBaseModel):
|
||||
return addr.get_locality()
|
||||
except:
|
||||
pass
|
||||
return cuni('')
|
||||
return ''
|
||||
|
||||
def column_state(self,data):
|
||||
try:
|
||||
@ -164,7 +163,7 @@ class RepositoryModel(FlatBaseModel):
|
||||
return addr.get_state()
|
||||
except:
|
||||
pass
|
||||
return cuni('')
|
||||
return ''
|
||||
|
||||
def column_country(self,data):
|
||||
try:
|
||||
@ -174,7 +173,7 @@ class RepositoryModel(FlatBaseModel):
|
||||
return addr.get_country()
|
||||
except:
|
||||
pass
|
||||
return cuni('')
|
||||
return ''
|
||||
|
||||
def column_postal_code(self,data):
|
||||
try:
|
||||
@ -184,7 +183,7 @@ class RepositoryModel(FlatBaseModel):
|
||||
return addr.get_postal_code()
|
||||
except:
|
||||
pass
|
||||
return cuni('')
|
||||
return ''
|
||||
|
||||
def column_phone(self,data):
|
||||
try:
|
||||
@ -194,7 +193,7 @@ class RepositoryModel(FlatBaseModel):
|
||||
return addr.get_phone()
|
||||
except:
|
||||
pass
|
||||
return cuni('')
|
||||
return ''
|
||||
|
||||
def column_email(self,data):
|
||||
if data[6]:
|
||||
@ -202,8 +201,8 @@ class RepositoryModel(FlatBaseModel):
|
||||
url = Url()
|
||||
url.unserialize(i)
|
||||
if url.get_type() == UrlType.EMAIL:
|
||||
return cuni(url.path)
|
||||
return cuni('')
|
||||
return str(url.path)
|
||||
return ''
|
||||
|
||||
def column_search_url(self,data):
|
||||
if data[6]:
|
||||
@ -211,7 +210,7 @@ class RepositoryModel(FlatBaseModel):
|
||||
url = Url()
|
||||
url.unserialize(i)
|
||||
if url.get_type() == UrlType.WEB_SEARCH:
|
||||
return cuni(url.path)
|
||||
return str(url.path)
|
||||
return ''
|
||||
|
||||
def column_home_url(self,data):
|
||||
@ -220,7 +219,7 @@ class RepositoryModel(FlatBaseModel):
|
||||
url = Url()
|
||||
url.unserialize(i)
|
||||
if url.get_type() == UrlType.WEB_HOME:
|
||||
return cuni(url.path)
|
||||
return str(url.path)
|
||||
return ""
|
||||
|
||||
def column_private(self, data):
|
||||
|
@ -39,7 +39,6 @@ from gi.repository import Gtk
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.datehandler import format_time
|
||||
from gramps.gen.constfunc import cuni
|
||||
from .flatbasemodel import FlatBaseModel
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
|
||||
@ -100,19 +99,19 @@ class SourceModel(FlatBaseModel):
|
||||
return len(self.fmap)+1
|
||||
|
||||
def column_title(self,data):
|
||||
return cuni(data[2])
|
||||
return str(data[2])
|
||||
|
||||
def column_author(self,data):
|
||||
return cuni(data[3])
|
||||
return str(data[3])
|
||||
|
||||
def column_abbrev(self,data):
|
||||
return cuni(data[7])
|
||||
return str(data[7])
|
||||
|
||||
def column_id(self,data):
|
||||
return cuni(data[1])
|
||||
return str(data[1])
|
||||
|
||||
def column_pubinfo(self,data):
|
||||
return cuni(data[4])
|
||||
return str(data[4])
|
||||
|
||||
def column_private(self, data):
|
||||
if data[12]:
|
||||
|
@ -53,7 +53,6 @@ from gi.repository import Gtk
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
import gramps.gui.widgets.progressdialog as progressdlg
|
||||
from gramps.gen.constfunc import cuni
|
||||
from .lru import LRU
|
||||
from bisect import bisect_right
|
||||
from gramps.gen.filters import SearchFilter, ExactSearchFilter
|
||||
|
@ -57,7 +57,6 @@ from ..display import display_help, display_url
|
||||
from ..glade import Glade
|
||||
from ..pluginmanager import GuiPluginManager
|
||||
from .undoablebuffer import UndoableBuffer
|
||||
from gramps.gen.constfunc import cuni
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
|
||||
|
@ -54,7 +54,6 @@ from ..autocomp import StandardCustomSelector, fill_entry
|
||||
from gramps.gen.datehandler import displayer, parser
|
||||
from gramps.gen.lib.date import Date, NextYear
|
||||
from gramps.gen.errors import ValidationError
|
||||
from gramps.gen.constfunc import cuni
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -146,7 +145,7 @@ class MonitoredEntry(object):
|
||||
self.obj.set_text(value)
|
||||
|
||||
def get_value(self, value):
|
||||
return cuni(self.obj.get_text())
|
||||
return str(self.obj.get_text())
|
||||
|
||||
def enable(self, value):
|
||||
self.obj.set_sensitive(value)
|
||||
@ -189,7 +188,7 @@ class MonitoredEntryIndicator(MonitoredEntry):
|
||||
|
||||
def _on_change(self, obj):
|
||||
if not self.indicatorshown:
|
||||
self.set_val(cuni(obj.get_text()))
|
||||
self.set_val(str(obj.get_text()))
|
||||
if self.changed:
|
||||
self.changed(obj)
|
||||
|
||||
@ -362,7 +361,7 @@ class MonitoredText(object):
|
||||
|
||||
def on_change(self, obj):
|
||||
s, e = self.buf.get_bounds()
|
||||
self.set_val(cuni(self.buf.get_text(s, e, False)))
|
||||
self.set_val(str(self.buf.get_text(s, e, False)))
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -640,7 +639,7 @@ class MonitoredDate(object):
|
||||
"""
|
||||
Parse date from text entry to date object
|
||||
"""
|
||||
date = parser.parse(cuni(self.text_obj.get_text()))
|
||||
date = parser.parse(str(self.text_obj.get_text()))
|
||||
self.date_obj.copy(date)
|
||||
|
||||
def validate(self, widget, data):
|
||||
@ -792,7 +791,7 @@ class MonitoredComboSelectedEntry(object):
|
||||
self.set_val_list[self.active_key](self.get_value_entry())
|
||||
|
||||
def get_value_entry(self):
|
||||
return cuni(self.objentry.get_text())
|
||||
return str(self.objentry.get_text())
|
||||
|
||||
def enable(self, value):
|
||||
self.objentry.set_sensitive(value)
|
||||
|
@ -54,7 +54,6 @@ UNDERLINE_SINGLE = Pango.Underline.SINGLE
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.lib import (StyledText, StyledTextTag, StyledTextTagType)
|
||||
from gramps.gen.constfunc import cuni
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -336,7 +335,7 @@ class StyledTextBuffer(UndoableBuffer):
|
||||
def do_changed(self, data=None):
|
||||
"""Parse for patterns in the text."""
|
||||
self.matches = []
|
||||
text = cuni(super(StyledTextBuffer, self).get_text(
|
||||
text = str(super(StyledTextBuffer, self).get_text(
|
||||
self.get_start_iter(),
|
||||
self.get_end_iter(), True))
|
||||
for regex, flavor in self.patterns:
|
||||
@ -589,7 +588,7 @@ class StyledTextBuffer(UndoableBuffer):
|
||||
|
||||
txt = super(StyledTextBuffer, self).get_text(start, end,
|
||||
include_hidden_chars)
|
||||
txt = cuni(txt)
|
||||
txt = str(txt)
|
||||
|
||||
# extract tags out of the buffer
|
||||
g_tags = self._get_tag_from_range()
|
||||
|
@ -32,9 +32,6 @@ __all__ = ["UndoableBuffer"]
|
||||
from gi.repository import GObject
|
||||
from gi.repository import Gtk
|
||||
|
||||
|
||||
from gramps.gen.constfunc import cuni
|
||||
|
||||
class Stack(list):
|
||||
"""
|
||||
Very simple stack implementation that cannot grow beyond an at init
|
||||
@ -56,7 +53,7 @@ class UndoableInsert(object):
|
||||
self.offset = text_iter.get_offset()
|
||||
self.text = str(text)
|
||||
#unicode char can have length > 1 as it points in the buffer
|
||||
charlength = len(cuni(text))
|
||||
charlength = len(str(text))
|
||||
self.length = charlength
|
||||
if charlength > 1 or self.text in ("\r", "\n", " "):
|
||||
self.mergeable = False
|
||||
|
@ -52,7 +52,6 @@ from gi.repository import Pango
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.errors import MaskError, ValidationError, WindowActiveError
|
||||
from gramps.gen.constfunc import cuni
|
||||
from .undoableentry import UndoableEntry
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -318,7 +317,7 @@ class MaskedEntry(UndoableEntry):
|
||||
self._mask_fields = []
|
||||
self._current_field = -1
|
||||
|
||||
mask = cuni(mask)
|
||||
mask = str(mask)
|
||||
input_length = len(mask)
|
||||
lenght = 0
|
||||
pos = 0
|
||||
@ -377,7 +376,7 @@ class MaskedEntry(UndoableEntry):
|
||||
|
||||
fields = []
|
||||
|
||||
text = cuni(self.get_text())
|
||||
text = str(self.get_text())
|
||||
for start, end in self._mask_fields:
|
||||
fields.append(text[start:end].strip())
|
||||
|
||||
@ -798,7 +797,7 @@ class MaskedEntry(UndoableEntry):
|
||||
if not self._mask:
|
||||
UndoableEntry._on_insert_text(self, editable, new, length, position)
|
||||
return
|
||||
new = cuni(new)
|
||||
new = str(new)
|
||||
pos = self.get_position()
|
||||
|
||||
self.stop_emission('insert-text')
|
||||
|
@ -63,8 +63,6 @@ from gramps.gen.const import ROOT_DIR
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
|
||||
from gramps.gen.constfunc import cuni
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Classes
|
||||
|
@ -55,7 +55,6 @@ from gramps.gen.const import IMAGE_DIR, ROOT_DIR
|
||||
from gramps.cli.clidbman import CLIDbManager, NAME_FILE, time_val
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
from gramps.gen.constfunc import cuni
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
@ -53,7 +53,6 @@ from PySide import QtOpenGL
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.const import ROOT_DIR
|
||||
from gramps.gen.constfunc import cuni
|
||||
from gramps.gui.views.treemodels import conv_unicode_tosrtkey
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
|
@ -42,7 +42,6 @@ from gramps.gen.plug.docgen import (BaseDoc, TextDoc, FONT_SERIF, PARA_ALIGN_RIG
|
||||
URL_PATTERN)
|
||||
from gramps.gen.utils.image import image_size, image_actual_size, resize_to_jpeg_buffer
|
||||
from gramps.gen.errors import ReportError
|
||||
from gramps.gen.constfunc import cuni
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
@ -472,7 +471,7 @@ class RTFDoc(BaseDoc,TextDoc):
|
||||
#--------------------------------------------------------------------
|
||||
def write_text(self, text, mark=None, links=False):
|
||||
# Convert to unicode, just in case it's not. Fix of bug 2449.
|
||||
text = cuni(text)
|
||||
text = str(text)
|
||||
LOG.debug("write_text: opened: %d input text: %s" %
|
||||
(self.opened,
|
||||
text))
|
||||
|
@ -54,7 +54,6 @@ from gramps.gui.plug.export import WriterOptionBox
|
||||
from gramps.gen.updatecallback import UpdateCallback
|
||||
from gramps.gen.utils.file import media_path_full
|
||||
from gramps.gen.utils.place import conv_lat_lon
|
||||
from gramps.gen.constfunc import cuni
|
||||
from gramps.gen.utils.location import get_main_location
|
||||
from gramps.gen.display.place import displayer as place_displayer
|
||||
|
||||
@ -273,17 +272,17 @@ class GedcomWriter(UpdateCallback):
|
||||
token_level = level
|
||||
for text in textlist:
|
||||
# make it unicode so that breakup below does the right thin.
|
||||
text = cuni(text)
|
||||
text = str(text)
|
||||
if limit:
|
||||
prefix = cuni("\n%d CONC " % (level + 1))
|
||||
prefix = "\n%d CONC " % (level + 1)
|
||||
txt = prefix.join(breakup(text, limit))
|
||||
else:
|
||||
txt = text
|
||||
self.gedcom_file.write(cuni("%d %s %s\n" % (token_level, token, txt)))
|
||||
self.gedcom_file.write("%d %s %s\n" % (token_level, token, txt))
|
||||
token_level = level + 1
|
||||
token = "CONT"
|
||||
else:
|
||||
self.gedcom_file.write(cuni("%d %s\n" % (level, token)))
|
||||
self.gedcom_file.write("%d %s\n" % (level, token))
|
||||
|
||||
def _header(self, filename):
|
||||
"""
|
||||
|
@ -61,7 +61,7 @@ from gramps.gen.lib import Date, Person
|
||||
from gramps.gen.updatecallback import UpdateCallback
|
||||
from gramps.gen.db.exceptions import DbWriteFailure
|
||||
from gramps.version import VERSION
|
||||
from gramps.gen.constfunc import win, cuni, conv_to_unicode
|
||||
from gramps.gen.constfunc import win, conv_to_unicode
|
||||
from gramps.gui.plug.export import WriterOptionBox
|
||||
import gramps.plugins.lib.libgrampsxml as libgrampsxml
|
||||
|
||||
@ -434,7 +434,7 @@ class GrampsXmlWriter(UpdateCallback):
|
||||
|
||||
def fix(self,line):
|
||||
try:
|
||||
l = cuni(line)
|
||||
l = str(line)
|
||||
except:
|
||||
l = conv_to_unicode(str(line), errors='replace')
|
||||
l = l.strip().translate(strip_dict)
|
||||
@ -454,7 +454,7 @@ class GrampsXmlWriter(UpdateCallback):
|
||||
format = note.get_format()
|
||||
text = note.get_styledtext()
|
||||
styles = text.get_tags()
|
||||
text = cuni(text)
|
||||
text = str(text)
|
||||
|
||||
self.g.write(' type="%s"' % ntype)
|
||||
if format != note.FLOWED:
|
||||
|
@ -47,7 +47,6 @@ from gi.repository import Gtk
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from gramps.gen.plug import Gramplet
|
||||
from gramps.gen.constfunc import cuni
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -103,7 +102,7 @@ class PythonEvaluation(Gramplet):
|
||||
return tview.get_buffer()
|
||||
|
||||
def apply_clicked(self, obj):
|
||||
text = cuni(self.ebuf.get_text(self.ebuf.get_start_iter(),
|
||||
text = str(self.ebuf.get_text(self.ebuf.get_start_iter(),
|
||||
self.ebuf.get_end_iter(),False))
|
||||
|
||||
outtext = StringIO()
|
||||
|
@ -35,7 +35,6 @@ _ = glocale.translation.sgettext
|
||||
#------------------------------------------------------------------------
|
||||
from gramps.plugins.lib.librecords import find_records, CALLNAME_DONTUSE
|
||||
from gramps.gen.plug import Gramplet
|
||||
from gramps.gen.constfunc import cuni
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
@ -68,7 +67,7 @@ class RecordsGramplet(Gramplet):
|
||||
last_value = value
|
||||
rank = number
|
||||
self.append_text("\n %s. " % (rank+1))
|
||||
self.link(cuni(name), handletype, handle)
|
||||
self.link(str(name), handletype, handle)
|
||||
self.append_text(" (%s)" % value)
|
||||
self.append_text("\n")
|
||||
self.append_text("", scroll_to='begin')
|
||||
|
@ -37,7 +37,6 @@ from gi.repository import Gtk
|
||||
from gramps.gen.soundex import soundex
|
||||
from gramps.gui.autocomp import fill_combo
|
||||
from gramps.gen.plug import Gramplet
|
||||
from gramps.gen.constfunc import cuni
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.sgettext
|
||||
|
||||
@ -109,7 +108,7 @@ class SoundGen(Gramplet):
|
||||
|
||||
def on_apply_clicked(self, obj):
|
||||
try:
|
||||
se_text = soundex(cuni(obj.get_text()))
|
||||
se_text = soundex(str(obj.get_text()))
|
||||
except UnicodeEncodeError:
|
||||
se_text = soundex('')
|
||||
self.value.set_text(se_text)
|
||||
|
@ -56,7 +56,7 @@ from gramps.gen.datehandler import parser as _dp
|
||||
from gramps.gen.utils.string import gender as gender_map
|
||||
from gramps.gen.utils.id import create_id
|
||||
from gramps.gen.lib.eventroletype import EventRoleType
|
||||
from gramps.gen.constfunc import cuni, conv_to_unicode
|
||||
from gramps.gen.constfunc import conv_to_unicode
|
||||
from gramps.gen.config import config
|
||||
from gramps.gen.display.place import displayer as place_displayer
|
||||
|
||||
|
@ -52,7 +52,7 @@ from gramps.gen.lib import (Attribute, AttributeType, ChildRef, Citation,
|
||||
Family, FamilyRelType, Name, NameType, Note, Person, PersonRef,
|
||||
Place, Source)
|
||||
from gramps.gen.db import DbTxn
|
||||
from gramps.gen.constfunc import cuni, conv_to_unicode
|
||||
from gramps.gen.constfunc import conv_to_unicode
|
||||
from html.entities import name2codepoint
|
||||
|
||||
_date_parse = re.compile('([kmes~?<>]+)?([0-9/]+)([J|H|F])?(\.\.)?([0-9/]+)?([J|H|F])?')
|
||||
@ -109,7 +109,7 @@ class GeneWebParser(object):
|
||||
line = self.f.readline()
|
||||
if line:
|
||||
try:
|
||||
line = cuni(line.strip())
|
||||
line = str(line.strip())
|
||||
except UnicodeDecodeError:
|
||||
line = conv_to_unicode(line.strip(), self.encoding)
|
||||
else:
|
||||
|
@ -132,7 +132,7 @@ from gramps.gen.db.dbconst import EVENT_KEY
|
||||
from gramps.gui.dialog import WarningDialog
|
||||
from gramps.gen.lib.const import IDENTICAL, DIFFERENT
|
||||
from gramps.gen.lib import (StyledText, StyledTextTag, StyledTextTagType)
|
||||
from gramps.gen.constfunc import cuni, conv_to_unicode, win
|
||||
from gramps.gen.constfunc import conv_to_unicode, win
|
||||
from gramps.plugins.lib.libplaceimport import PlaceImport
|
||||
from gramps.gen.display.place import displayer as place_displayer
|
||||
|
||||
|
@ -38,7 +38,6 @@ import re
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
from gramps.gen.constfunc import cuni
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
@ -406,14 +405,14 @@ class Html(list):
|
||||
elif self.indent:
|
||||
tabs += indent
|
||||
if self.inline: # if inline, write all list and
|
||||
method(cuni('%s%s' % (tabs, self))) # nested list elements
|
||||
method(str('%s%s' % (tabs, self))) # nested list elements
|
||||
#
|
||||
else:
|
||||
for item in self[:]: # else write one at a time
|
||||
if isinstance(item, Html): # recurse if nested Html class
|
||||
item.write(method=method, indent=indent, tabs=tabs)
|
||||
else:
|
||||
method(cuni('%s%s' % (tabs, item))) # else write the line
|
||||
method(str('%s%s' % (tabs, item))) # else write the line
|
||||
#
|
||||
def addXML(self, version=1.0, encoding="UTF-8", standalone="no"):
|
||||
"""
|
||||
|
@ -40,7 +40,6 @@ Mary Smith was born on 3/28/1923.
|
||||
#------------------------------------------------------------------------
|
||||
from gramps.gen.lib import EventType, PlaceType, Location
|
||||
from gramps.gen.utils.db import get_birth_or_fallback, get_death_or_fallback
|
||||
from gramps.gen.constfunc import cuni
|
||||
from gramps.gen.utils.location import get_main_location
|
||||
from gramps.gen.display.place import displayer as place_displayer
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
@ -227,7 +226,7 @@ class DateFormat(GenericFormat):
|
||||
|
||||
def year(year, count):
|
||||
""" The year part only """
|
||||
year = cuni(year)
|
||||
year = str(year)
|
||||
if year == "0":
|
||||
return
|
||||
|
||||
@ -253,7 +252,7 @@ class DateFormat(GenericFormat):
|
||||
|
||||
def month(month, count):
|
||||
""" The month part only """
|
||||
month = cuni(month)
|
||||
month = str(month)
|
||||
if month == "0":
|
||||
return
|
||||
|
||||
@ -269,7 +268,7 @@ class DateFormat(GenericFormat):
|
||||
|
||||
def day(day, count):
|
||||
""" The day part only """
|
||||
day = cuni(day)
|
||||
day = str(day)
|
||||
if day == "0": # 0 means not defined!
|
||||
return
|
||||
|
||||
|
@ -48,7 +48,6 @@ from gramps.gen.plug.report import utils as ReportUtils
|
||||
from gramps.gen.plug.report import MenuReportOptions
|
||||
from gramps.gen.plug.report import stdoptions
|
||||
from gramps.gen.lib import Span
|
||||
from gramps.gen.constfunc import cuni
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
@ -140,7 +139,7 @@ class RecordsReport(Report):
|
||||
self.doc.start_paragraph('REC-Normal')
|
||||
# FIXME this won't work for RTL languages:
|
||||
self.doc.write_text(self._("%(number)s. ") % {'number': rank+1})
|
||||
self.doc.write_markup(cuni(name), name.get_tags(), mark)
|
||||
self.doc.write_markup(str(name), name.get_tags(), mark)
|
||||
if isinstance(value, Span):
|
||||
tvalue = value.get_repr(dlocale=self._locale)
|
||||
else:
|
||||
|
@ -71,7 +71,7 @@ from gramps.gui.plug import tool
|
||||
from gramps.gui.dialog import OkDialog, MissingMediaDialog
|
||||
from gramps.gen.display.name import displayer as _nd
|
||||
from gramps.gui.glade import Glade
|
||||
from gramps.gen.constfunc import cuni, handle2internal, conv_to_unicode
|
||||
from gramps.gen.constfunc import handle2internal, conv_to_unicode
|
||||
|
||||
# table for handling control chars in notes.
|
||||
# All except 09, 0A, 0D are replaced with space.
|
||||
@ -386,7 +386,7 @@ class CheckIntegrity(object):
|
||||
handle = handle2internal(bhandle)
|
||||
note = self.db.get_note_from_handle(handle)
|
||||
stext = note.get_styledtext()
|
||||
old_text = cuni(stext)
|
||||
old_text = str(stext)
|
||||
new_text = old_text.translate(strip_dict)
|
||||
if old_text != new_text:
|
||||
logging.warning(' FAIL: control characters found in note "%s"' %
|
||||
|
@ -57,7 +57,6 @@ from gramps.gen.utils.file import media_path_full, relative_path, media_path
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.sgettext
|
||||
from gramps.gen.mime import get_type, is_image_type
|
||||
from gramps.gen.constfunc import cuni
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -515,8 +514,8 @@ class PathChange(BatchOp):
|
||||
return (title, box)
|
||||
|
||||
def build_confirm_text(self):
|
||||
from_text = cuni(self.from_entry.get_text())
|
||||
to_text = cuni(self.to_entry.get_text())
|
||||
from_text = str(self.from_entry.get_text())
|
||||
to_text = str(self.to_entry.get_text())
|
||||
text = _(
|
||||
'The following action is to be performed:\n\n'
|
||||
'Operation:\t%(title)s\n'
|
||||
@ -528,7 +527,7 @@ class PathChange(BatchOp):
|
||||
return text
|
||||
|
||||
def _prepare(self):
|
||||
from_text = cuni(self.from_entry.get_text())
|
||||
from_text = str(self.from_entry.get_text())
|
||||
self.set_total(self.db.get_number_of_media_objects())
|
||||
with self.db.get_media_cursor() as cursor:
|
||||
for handle, data in cursor:
|
||||
@ -545,8 +544,8 @@ class PathChange(BatchOp):
|
||||
if not self.prepared:
|
||||
self.prepare()
|
||||
self.set_total(len(self.handle_list))
|
||||
from_text = cuni(self.from_entry.get_text())
|
||||
to_text = cuni(self.to_entry.get_text())
|
||||
from_text = str(self.from_entry.get_text())
|
||||
to_text = str(self.to_entry.get_text())
|
||||
for handle in self.handle_list:
|
||||
obj = self.db.get_object_from_handle(handle)
|
||||
new_path = obj.get_path().replace(from_text, to_text)
|
||||
|
@ -49,7 +49,6 @@ from gramps.gui.display import display_help
|
||||
from gramps.gui.glade import Glade
|
||||
from gramps.gen.lib import Tag
|
||||
from gramps.gen.db import DbTxn
|
||||
from gramps.gen.constfunc import cuni
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -235,7 +234,7 @@ class NotRelated(tool.ActivePersonTool, ManagedWindow) :
|
||||
def applyTagClicked(self, button) :
|
||||
progress = None
|
||||
rows = self.treeSelection.count_selected_rows()
|
||||
tag_name = cuni(self.tagcombo.get_active_text())
|
||||
tag_name = str(self.tagcombo.get_active_text())
|
||||
|
||||
# start the db transaction
|
||||
with DbTxn("Tag not related", self.db) as transaction:
|
||||
|
@ -75,7 +75,6 @@ from gramps.gui.utils import ProgressMeter
|
||||
from gramps.gen.utils.lds import TEMPLES
|
||||
from gramps.gen.db.dbconst import *
|
||||
from gramps.gen.const import ICON, LOGO, SPLASH
|
||||
from gramps.gen.constfunc import cuni
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -233,7 +232,7 @@ class TestcaseGenerator(tool.BatchTool):
|
||||
self.top.vbox.pack_start(self.label,0,0,5)
|
||||
|
||||
self.entry_count = Gtk.Entry()
|
||||
self.entry_count.set_text(cuni( self.options.handler.options_dict['person_count']))
|
||||
self.entry_count.set_text(str( self.options.handler.options_dict['person_count']))
|
||||
self.on_dummy_data_clicked(self.check_persons)
|
||||
self.top.vbox.pack_start(self.entry_count,0,0,5)
|
||||
|
||||
@ -924,7 +923,7 @@ class TestcaseGenerator(tool.BatchTool):
|
||||
# Address
|
||||
m = MediaObject()
|
||||
m.set_description(message)
|
||||
m.set_path(cuni(ICON))
|
||||
m.set_path(str(ICON))
|
||||
m.set_mime_type(get_type(m.get_path()))
|
||||
m.add_citation(choice(c_h_list))
|
||||
# MediaObject : Attribute
|
||||
@ -1604,14 +1603,14 @@ class TestcaseGenerator(tool.BatchTool):
|
||||
|
||||
if isinstance(o,MediaObject):
|
||||
if randint(0,3) == 1:
|
||||
o.set_description(cuni(self.rand_text(self.LONG)))
|
||||
o.set_description(str(self.rand_text(self.LONG)))
|
||||
path = choice((ICON, LOGO, SPLASH))
|
||||
o.set_path(cuni(path))
|
||||
o.set_path(str(path))
|
||||
mime = get_type(path)
|
||||
o.set_mime_type(mime)
|
||||
else:
|
||||
o.set_description(cuni(self.rand_text(self.SHORT)))
|
||||
o.set_path(cuni(ICON))
|
||||
o.set_description(str(self.rand_text(self.SHORT)))
|
||||
o.set_path(str(ICON))
|
||||
o.set_mime_type("image/png")
|
||||
|
||||
if isinstance(o,MediaRef):
|
||||
|
@ -51,7 +51,7 @@ from gi.repository import Gtk
|
||||
from gramps.gui.utils import open_file_with_default_application
|
||||
from gramps.gui.views.listview import ListView, TEXT, MARKUP, ICON
|
||||
from gramps.gui.views.treemodels import MediaModel
|
||||
from gramps.gen.constfunc import win, cuni, conv_to_unicode
|
||||
from gramps.gen.constfunc import win, conv_to_unicode
|
||||
from gramps.gen.config import config
|
||||
from gramps.gen.utils.file import (media_path, relative_path, media_path_full,
|
||||
create_checksum)
|
||||
@ -193,7 +193,7 @@ class MediaView(ListView):
|
||||
self.uistate.set_busy_cursor(True)
|
||||
photo.set_checksum(create_checksum(name))
|
||||
self.uistate.set_busy_cursor(False)
|
||||
base_dir = cuni(media_path(self.dbstate.db))
|
||||
base_dir = str(media_path(self.dbstate.db))
|
||||
if os.path.exists(base_dir):
|
||||
name = relative_path(name, base_dir)
|
||||
photo.set_path(name)
|
||||
|
@ -122,7 +122,7 @@ from gramps.gen.utils.string import conf_strings
|
||||
from gramps.gen.utils.file import media_path_full
|
||||
from gramps.gen.utils.alive import probably_alive
|
||||
from gramps.gen.utils.db import get_source_and_citation_referents
|
||||
from gramps.gen.constfunc import win, cuni, conv_to_unicode, get_curr_dir
|
||||
from gramps.gen.constfunc import win, conv_to_unicode, get_curr_dir
|
||||
from gramps.gen.config import config
|
||||
from gramps.gui.thumbnails import get_thumbnail_path, run_thumbnailer
|
||||
from gramps.gen.utils.image import image_size, resize_to_jpeg_buffer
|
||||
@ -3700,7 +3700,7 @@ class EventPages(BasePage):
|
||||
|
||||
if evt_type and not evt_type.isspace():
|
||||
letter = get_index_letter(
|
||||
cuni(evt_type)[0].capitalize(),
|
||||
str(evt_type)[0].capitalize(),
|
||||
index_list)
|
||||
else:
|
||||
letter = " "
|
||||
@ -8598,11 +8598,11 @@ def __get_place_keyname(dbase, handle):
|
||||
contractions_dict = {
|
||||
# bg Bulgarian validSubLocales="bg_BG" no contractions
|
||||
# ca Catalan validSubLocales="ca_AD ca_ES"
|
||||
"ca" : [((cuni("l·"), cuni("L·")), cuni("L"))],
|
||||
"ca" : [(("l·", "L·"), "L")],
|
||||
# Czech, validSubLocales="cs_CZ" Czech_Czech Republic
|
||||
"cs" : [((cuni("ch"), cuni("cH"), cuni("Ch"), cuni("CH")), cuni("Ch"))],
|
||||
"cs" : [(("ch", "cH", "Ch", "CH"), "Ch")],
|
||||
# Danish validSubLocales="da_DK" Danish_Denmark
|
||||
"da" : [((cuni("aa"), cuni("Aa"), cuni("AA")), cuni("Å"))],
|
||||
"da" : [(("aa", "Aa", "AA"), "Å")],
|
||||
# de German validSubLocales="de_AT de_BE de_CH de_DE de_LI de_LU" no
|
||||
# contractions in standard collation.
|
||||
# el Greek validSubLocales="el_CY el_GR" no contractions.
|
||||
@ -8615,27 +8615,27 @@ contractions_dict = {
|
||||
# fr French no collation data.
|
||||
# he Hebrew validSubLocales="he_IL" no contractions
|
||||
# hr Croation validSubLocales="hr_BA hr_HR"
|
||||
"hr" : [((cuni("dž"), cuni("Dž")), cuni("dž")),
|
||||
((cuni("lj"), cuni("Lj"), cuni('LJ')), cuni("LJ")),
|
||||
((cuni("Nj"), cuni("NJ"), cuni("nj")), cuni("NJ"))],
|
||||
"hr" : [(("dž", "Dž"), "dž"),
|
||||
(("lj", "Lj", 'LJ'), "LJ"),
|
||||
(("Nj", "NJ", "nj"), "NJ")],
|
||||
# Hungarian hu_HU for two and three character contractions.
|
||||
"hu" : [((cuni("cs"), cuni("Cs"), cuni("CS")), cuni("CS")),
|
||||
((cuni("dzs"), cuni("Dzs"), cuni("DZS")), cuni("DZS")), # order is important
|
||||
((cuni("dz"), cuni("Dz"), cuni("DZ")), cuni("DZ")),
|
||||
((cuni("gy"), cuni("Gy"), cuni("GY")), cuni("GY")),
|
||||
((cuni("ly"), cuni("Ly"), cuni("LY")), cuni("LY")),
|
||||
((cuni("ny"), cuni("Ny"), cuni("NY")), cuni("NY")),
|
||||
((cuni("sz"), cuni("Sz"), cuni("SZ")), cuni("SZ")),
|
||||
((cuni("ty"), cuni("Ty"), cuni("TY")), cuni("TY")),
|
||||
((cuni("zs"), cuni("Zs"), cuni("ZS")), cuni("ZS"))
|
||||
"hu" : [(("cs", "Cs", "CS"), "CS"),
|
||||
(("dzs", "Dzs", "DZS"), "DZS"), # order is important
|
||||
(("dz", "Dz", "DZ"), "DZ"),
|
||||
(("gy", "Gy", "GY"), "GY"),
|
||||
(("ly", "Ly", "LY"), "LY"),
|
||||
(("ny", "Ny", "NY"), "NY"),
|
||||
(("sz", "Sz", "SZ"), "SZ"),
|
||||
(("ty", "Ty", "TY"), "TY"),
|
||||
(("zs", "Zs", "ZS"), "ZS")
|
||||
],
|
||||
# it Italian no collation data.
|
||||
# ja Japanese unable to process the data as it is too complex.
|
||||
# lt Lithuanian no contractions.
|
||||
# Norwegian Bokmål
|
||||
"nb" : [((cuni("aa"), cuni("Aa"), cuni("AA")), cuni("Å"))],
|
||||
"nb" : [(("aa", "Aa", "AA"), "Å")],
|
||||
# nn Norwegian Nynorsk validSubLocales="nn_NO"
|
||||
"nn" : [((cuni("aa"), cuni("Aa"), cuni("AA")), cuni("Å"))],
|
||||
"nn" : [(("aa", "Aa", "AA"), "Å")],
|
||||
# nl Dutch no collation data.
|
||||
# pl Polish validSubLocales="pl_PL" no contractions
|
||||
# pt Portuguese no collation data.
|
||||
@ -8644,7 +8644,7 @@ contractions_dict = {
|
||||
# Slovak, validSubLocales="sk_SK" Slovak_Slovakia
|
||||
# having DZ in Slovak as a contraction was rejected in
|
||||
# http://unicode.org/cldr/trac/ticket/2968
|
||||
"sk" : [((cuni("ch"), cuni("cH"), cuni("Ch"), cuni("CH")), cuni("Ch"))],
|
||||
"sk" : [(("ch", "cH", "Ch", "CH"), "Ch")],
|
||||
# sl Slovenian validSubLocales="sl_SI" no contractions
|
||||
# sv Swedish validSubLocales="sv_AX sv_FI sv_SE" default collation is
|
||||
# "reformed" no contractions.
|
||||
@ -8680,9 +8680,9 @@ def first_letter(string):
|
||||
recieves a string and returns the first letter
|
||||
"""
|
||||
if string is None or len(string) < 1:
|
||||
return cuni(' ')
|
||||
return ' '
|
||||
|
||||
norm_unicode = normalize('NFKC', cuni(string))
|
||||
norm_unicode = normalize('NFKC', str(string))
|
||||
contractions = contractions_dict.get(COLLATE_LANG)
|
||||
if contractions == None:
|
||||
contractions = contractions_dict.get(COLLATE_LANG.split("_")[0])
|
||||
@ -8714,8 +8714,8 @@ except:
|
||||
|
||||
# The test characters here must not be any that are used in contractions.
|
||||
|
||||
return SORT_KEY(prev_key + cuni("e")) >= SORT_KEY(new_key + cuni("f")) or\
|
||||
SORT_KEY(new_key + cuni("e")) >= SORT_KEY(prev_key + cuni("f"))
|
||||
return SORT_KEY(prev_key + "e") >= SORT_KEY(new_key + "f") or\
|
||||
SORT_KEY(new_key + "e") >= SORT_KEY(prev_key + "f")
|
||||
|
||||
def get_first_letters(dbase, handle_list, key):
|
||||
"""
|
||||
|
@ -32,7 +32,6 @@ from gramps.gen.lib.date import Date as GDate, Today
|
||||
from gramps.gen.utils.id import create_id, create_uid
|
||||
|
||||
from gramps.webapp.grampsdb.profile import Profile
|
||||
from gramps.gen.constfunc import cuni
|
||||
|
||||
import pickle
|
||||
import base64
|
||||
@ -106,7 +105,7 @@ class mGrampsType(models.Model):
|
||||
name = models.CharField(max_length=40)
|
||||
|
||||
def __unicode__(self):
|
||||
return cuni(self.name)
|
||||
return str(self.name)
|
||||
|
||||
def get_default_type(self):
|
||||
""" return a tuple default (val,name) """
|
||||
@ -185,10 +184,10 @@ class EventType(mGrampsType):
|
||||
val = models.IntegerField('event type', choices=_DATAMAP, blank=False)
|
||||
|
||||
def get_url(self):
|
||||
return cuni("/event/?search=type%%3D%s") % self.name
|
||||
return "/event/?search=type%%3D%s" % self.name
|
||||
|
||||
def get_link(self):
|
||||
return cuni("<a href='%s'>%s</a>") % (self.get_url(), self.name)
|
||||
return "<a href='%s'>%s</a>" % (self.get_url(), self.name)
|
||||
|
||||
|
||||
class FamilyRelType(mGrampsType):
|
||||
@ -410,7 +409,7 @@ class Config(models.Model):
|
||||
value = models.TextField('value')
|
||||
|
||||
def __unicode__(self):
|
||||
return cuni(self.setting)
|
||||
return str(self.setting)
|
||||
|
||||
class Tag(models.Model):
|
||||
handle = models.CharField(max_length=19, unique=True)
|
||||
@ -427,13 +426,13 @@ class Tag(models.Model):
|
||||
dji = None
|
||||
|
||||
def __unicode__(self):
|
||||
return cuni(self.name)
|
||||
return str(self.name)
|
||||
|
||||
def get_url(self):
|
||||
return cuni("/tag/%s") % self.handle
|
||||
return "/tag/%s" % self.handle
|
||||
|
||||
def get_link(self):
|
||||
return cuni("<a href='%s'>%s</a>") % (self.get_url(), self.name)
|
||||
return "<a href='%s'>%s</a>" % (self.get_url(), self.name)
|
||||
|
||||
def make_cache(self):
|
||||
from gramps.webapp.libdjango import DjangoInterface
|
||||
@ -493,11 +492,11 @@ class PrimaryObject(models.Model):
|
||||
dji = None
|
||||
|
||||
def __unicode__(self):
|
||||
return cuni("%s: %s") % (self.__class__.__name__,
|
||||
return "%s: %s" % (self.__class__.__name__,
|
||||
self.gramps_id)
|
||||
|
||||
def get_url(self):
|
||||
return cuni("/%s/%s") % (self.__class__.__name__.lower(),
|
||||
return "/%s/%s" % (self.__class__.__name__.lower(),
|
||||
self.handle)
|
||||
|
||||
def get_tag_list(self):
|
||||
@ -599,7 +598,7 @@ class Person(PrimaryObject):
|
||||
return ""
|
||||
|
||||
def __unicode__(self):
|
||||
return cuni("%s [%s]") % (self.get_primary_name(), self.gramps_id)
|
||||
return "%s [%s]" % (self.get_primary_name(), self.gramps_id)
|
||||
|
||||
def get_selection_string(self):
|
||||
return self.name_set.get(preferred=True).get_selection_string()
|
||||
@ -642,7 +641,7 @@ class Family(PrimaryObject):
|
||||
def __unicode__(self):
|
||||
father = self.father.get_primary_name() if self.father else "No father"
|
||||
mother = self.mother.get_primary_name() if self.mother else "No mother"
|
||||
return cuni("%s and %s") % (father, mother)
|
||||
return "%s and %s" % (father, mother)
|
||||
|
||||
class Citation(DateObject, PrimaryObject):
|
||||
confidence = models.IntegerField(blank=True, null=True)
|
||||
@ -653,7 +652,7 @@ class Citation(DateObject, PrimaryObject):
|
||||
object_id_field="object_id")
|
||||
|
||||
def __unicode__(self):
|
||||
return cuni("[%s] (%s, %s) to %s") % (self.gramps_id,
|
||||
return "[%s] (%s, %s) to %s" % (self.gramps_id,
|
||||
self.confidence,
|
||||
self.page,
|
||||
self.source)
|
||||
@ -668,7 +667,7 @@ class Source(PrimaryObject):
|
||||
abbrev = models.CharField("Abbreviation", max_length=50, blank=True, null=True)
|
||||
|
||||
def __unicode__(self):
|
||||
return cuni("[%s] %s") % (self.gramps_id,
|
||||
return "[%s] %s" % (self.gramps_id,
|
||||
self.title)
|
||||
|
||||
# Other keys here:
|
||||
@ -683,7 +682,7 @@ class Event(DateObject, PrimaryObject):
|
||||
object_id_field="object_id")
|
||||
|
||||
def __unicode__(self):
|
||||
return cuni("[%s] (%s) %s") % (self.gramps_id,
|
||||
return "[%s] (%s) %s" % (self.gramps_id,
|
||||
self.event_type,
|
||||
self.description)
|
||||
|
||||
@ -697,7 +696,7 @@ class Repository(PrimaryObject):
|
||||
#url_list = models.ManyToManyField('Url', null=True, blank=True)
|
||||
|
||||
def __unicode__(self):
|
||||
return cuni("[%s] %s") % (self.gramps_id, self.name)
|
||||
return "[%s] %s" % (self.gramps_id, self.name)
|
||||
|
||||
# Others keys here:
|
||||
# .address_set
|
||||
@ -715,10 +714,10 @@ class Place(PrimaryObject):
|
||||
#url_list = models.ManyToManyField('Url', null=True, blank=True)
|
||||
|
||||
def get_selection_string(self):
|
||||
return cuni("%s [%s]") % (self.title, self.gramps_id)
|
||||
return "%s [%s]" % (self.title, self.gramps_id)
|
||||
|
||||
def __unicode__(self):
|
||||
return cuni(self.title)
|
||||
return str(self.title)
|
||||
|
||||
# Others keys here:
|
||||
# .url_set
|
||||
@ -734,7 +733,7 @@ class Media(DateObject, PrimaryObject):
|
||||
object_id_field="object_id")
|
||||
|
||||
def __unicode__(self):
|
||||
return cuni(self.desc)
|
||||
return str(self.desc)
|
||||
|
||||
class Note(PrimaryObject):
|
||||
note_type = models.ForeignKey('NoteType', verbose_name="Type")
|
||||
@ -745,7 +744,7 @@ class Note(PrimaryObject):
|
||||
object_id_field="object_id")
|
||||
|
||||
def __unicode__(self):
|
||||
return cuni(self.gramps_id)
|
||||
return str(self.gramps_id)
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
#
|
||||
@ -783,11 +782,11 @@ class Surname(models.Model):
|
||||
order = models.PositiveIntegerField()
|
||||
|
||||
def __unicode__(self):
|
||||
return cuni(self.surname)
|
||||
return str(self.surname)
|
||||
|
||||
def get_url(self):
|
||||
# /person/handle/name/1/surname/2
|
||||
return cuni("/person/%s/name/%s/surname/%s") % (self.name.person.handle,
|
||||
return "/person/%s/name/%s/surname/%s" % (self.name.person.handle,
|
||||
self.name.order,
|
||||
self.order)
|
||||
|
||||
@ -818,14 +817,14 @@ class Name(DateObject, SecondaryObject):
|
||||
surname = self.surname_set.get(primary=True)
|
||||
except:
|
||||
surname = "[No primary surname]"
|
||||
return cuni("%s, %s") % (surname, self.first_name)
|
||||
return "%s, %s" % (surname, self.first_name)
|
||||
|
||||
def get_selection_string(self):
|
||||
try:
|
||||
surname = self.surname_set.get(primary=True)
|
||||
except:
|
||||
surname = "[No primary surname]"
|
||||
return cuni("%s, %s [%s]") % (surname, self.first_name, self.person.gramps_id)
|
||||
return "%s, %s [%s]" % (surname, self.first_name, self.person.gramps_id)
|
||||
|
||||
@staticmethod
|
||||
def get_dummy():
|
||||
@ -849,7 +848,7 @@ class Name(DateObject, SecondaryObject):
|
||||
|
||||
def get_url(self):
|
||||
# /person/handle/name/1
|
||||
return cuni("/person/%s/name/%s") % (self.person.handle, self.order)
|
||||
return "/person/%s/name/%s" % (self.person.handle, self.order)
|
||||
|
||||
class Lds(DateObject, SecondaryObject):
|
||||
"""
|
||||
@ -981,7 +980,7 @@ class BaseRef(models.Model):
|
||||
# /person/3536453463/reference/event/2
|
||||
ref_by = self.object_type.model_class().objects.get(id=self.object_id)
|
||||
ref_to = self.get_reference_to()
|
||||
return cuni("/%s/%s/reference/%s/%s") % (ref_by.__class__.__name__.lower(),
|
||||
return "/%s/%s/reference/%s/%s" % (ref_by.__class__.__name__.lower(),
|
||||
ref_by.handle,
|
||||
ref_to.__class__.__name__.lower(),
|
||||
self.order)
|
||||
@ -991,7 +990,7 @@ class Log(BaseRef):
|
||||
cache = models.TextField(blank=True, null=True)
|
||||
|
||||
def __unicode__(self):
|
||||
return cuni("%s: %s on %s by %s") % (self.log_type,
|
||||
return "%s: %s on %s by %s" % (self.log_type,
|
||||
self.referenced_by,
|
||||
self.last_changed,
|
||||
self.last_changed_by)
|
||||
@ -1003,14 +1002,14 @@ class NoteRef(BaseRef):
|
||||
return self.ref_object
|
||||
|
||||
def __unicode__(self):
|
||||
return cuni("NoteRef to ") + cuni(self.ref_object)
|
||||
return "NoteRef to " + str(self.ref_object)
|
||||
|
||||
class EventRef(BaseRef):
|
||||
ref_object = models.ForeignKey('Event')
|
||||
role_type = models.ForeignKey('EventRoleType')
|
||||
|
||||
def __unicode__(self):
|
||||
return cuni(self.ref_object)
|
||||
return str(self.ref_object)
|
||||
|
||||
def get_reference_to(self):
|
||||
return self.ref_object
|
||||
@ -1019,7 +1018,7 @@ class EventRef(BaseRef):
|
||||
# /person/3536453463/reference/event/2
|
||||
ref_by = self.object_type.model_class().objects.get(id=self.object_id)
|
||||
ref_to = self.ref_object
|
||||
return cuni("/%s/%s/reference/%s/%s") % (ref_by.__class__.__name__.lower(),
|
||||
return "/%s/%s/reference/%s/%s" % (ref_by.__class__.__name__.lower(),
|
||||
ref_by.handle,
|
||||
ref_to.__class__.__name__.lower(),
|
||||
self.order)
|
||||
@ -1033,7 +1032,7 @@ class RepositoryRef(BaseRef):
|
||||
return self.ref_object
|
||||
|
||||
def __unicode__(self):
|
||||
return cuni("RepositoryRef to ") + cuni(self.ref_object)
|
||||
return "RepositoryRef to " + str(self.ref_object)
|
||||
|
||||
class PlaceRef(BaseRef, DateObject):
|
||||
ref_object = models.ForeignKey('Place')
|
||||
@ -1042,7 +1041,7 @@ class PlaceRef(BaseRef, DateObject):
|
||||
return self.ref_object
|
||||
|
||||
def __unicode__(self):
|
||||
return cuni("PlaceRef to ") + cuni(self.ref_object)
|
||||
return "PlaceRef to " + str(self.ref_object)
|
||||
|
||||
class PersonRef(BaseRef):
|
||||
ref_object = models.ForeignKey('Person')
|
||||
@ -1052,13 +1051,13 @@ class PersonRef(BaseRef):
|
||||
return self.ref_object
|
||||
|
||||
def __unicode__(self):
|
||||
return cuni("PersonRef to ") + cuni(self.ref_object)
|
||||
return "PersonRef to " + str(self.ref_object)
|
||||
|
||||
class CitationRef(BaseRef):
|
||||
citation = models.ForeignKey('Citation')
|
||||
|
||||
def __unicode__(self):
|
||||
return cuni("CitationRef to ") + cuni(self.citation)
|
||||
return "CitationRef to " + str(self.citation)
|
||||
|
||||
def get_reference_to(self):
|
||||
return self.citation
|
||||
@ -1075,10 +1074,10 @@ class ChildRef(BaseRef):
|
||||
|
||||
def get_url(self):
|
||||
# FIXME: go to child reference
|
||||
return cuni("/person/%s") % self.ref_object.handle
|
||||
return "/person/%s" % self.ref_object.handle
|
||||
|
||||
def __unicode__(self):
|
||||
return cuni("ChildRef to ") + cuni(self.ref_object)
|
||||
return "ChildRef to " + str(self.ref_object)
|
||||
|
||||
class MediaRef(BaseRef):
|
||||
x1 = models.IntegerField()
|
||||
@ -1091,7 +1090,7 @@ class MediaRef(BaseRef):
|
||||
return self.ref_object
|
||||
|
||||
def __unicode__(self):
|
||||
return cuni("MediaRef to ") + cuni(self.ref_object)
|
||||
return "MediaRef to " + str(self.ref_object)
|
||||
|
||||
class Report(models.Model):
|
||||
gramps_id = models.TextField(blank=True, null=True)
|
||||
@ -1101,7 +1100,7 @@ class Report(models.Model):
|
||||
options = models.TextField(blank=True, null=True)
|
||||
|
||||
def __unicode__(self):
|
||||
return cuni(self.name)
|
||||
return str(self.name)
|
||||
|
||||
class Result(models.Model):
|
||||
name = models.TextField(blank=True, null=True)
|
||||
@ -1111,7 +1110,7 @@ class Result(models.Model):
|
||||
status = models.TextField(blank=True, null=True)
|
||||
|
||||
def __unicode__(self):
|
||||
return cuni(self.name)
|
||||
return str(self.name)
|
||||
|
||||
TABLES = [
|
||||
("abstract", mGrampsType),
|
||||
|
@ -21,8 +21,6 @@ from django.db import models
|
||||
from django.db.models.signals import post_save
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
from gramps.gen.constfunc import cuni
|
||||
|
||||
def save_profile(sender, instance, created, **kwargs):
|
||||
"""
|
||||
Creates the profile when the user gets created.
|
||||
@ -40,6 +38,6 @@ class Profile(models.Model):
|
||||
theme_type = models.ForeignKey("ThemeType", default=1) # The default is a pk?
|
||||
|
||||
def __unicode__(self):
|
||||
return cuni(self.user)
|
||||
return str(self.user)
|
||||
|
||||
post_save.connect(save_profile, sender=User)
|
||||
|
@ -47,7 +47,6 @@ import gramps.webapp.grampsdb.models as models
|
||||
import gramps.webapp.grampsdb.forms as forms
|
||||
from gramps.webapp import libdjango
|
||||
from gramps.webapp.dbdjango import DbDjango
|
||||
from gramps.gen.constfunc import cuni
|
||||
from gramps.cli.user import User as GUser # gramps user
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
@ -139,7 +138,7 @@ def get_person_from_handle(db, handle):
|
||||
print("error in get_person_from_handle:", file=sys.stderr)
|
||||
import sys, traceback
|
||||
cla, exc, trbk = sys.exc_info()
|
||||
print(_("Error") + (cuni(" : %s %s") %(cla, exc)), file=sys.stderr)
|
||||
print(_("Error") + (" : %s %s" %(cla, exc)), file=sys.stderr)
|
||||
traceback.print_exc()
|
||||
return None
|
||||
|
||||
@ -243,18 +242,18 @@ class Table(object):
|
||||
self.table.set_link_col(links)
|
||||
|
||||
def get_html(self):
|
||||
retval = cuni("")
|
||||
retval = ""
|
||||
# The HTML writer escapes data:
|
||||
self.table.write(self.doc, self.column_widths) # forces to htmllist
|
||||
# FIXME: do once, or once per table?
|
||||
self.doc.doc.build_style_declaration(self.id) # can pass id, for whole
|
||||
# FIXME: don't want to repeat this, unless diff for each table:
|
||||
retval += cuni("<style>%s</style>") % self.doc.doc.style_declaration
|
||||
retval += "<style>%s</style>" % self.doc.doc.style_declaration
|
||||
# We have a couple of HTML bits that we want to unescape:
|
||||
return retval + cuni(self.doc.doc.htmllist[0]).replace("&nbsp;", " ")
|
||||
return retval + str(self.doc.doc.htmllist[0]).replace("&nbsp;", " ")
|
||||
|
||||
def build_args(**kwargs):
|
||||
retval = cuni("")
|
||||
retval = ""
|
||||
first = True
|
||||
for key in kwargs:
|
||||
if kwargs[key] is not "":
|
||||
@ -263,7 +262,7 @@ def build_args(**kwargs):
|
||||
first = False
|
||||
else:
|
||||
retval += "&"
|
||||
retval += cuni("%s=%s") % (key, kwargs[key])
|
||||
retval += "%s=%s" % (key, kwargs[key])
|
||||
return retval
|
||||
|
||||
def build_search(request):
|
||||
@ -273,8 +272,8 @@ def build_search(request):
|
||||
|
||||
def make_button(text, url, *args):
|
||||
newargs = []
|
||||
kwargs = cuni("")
|
||||
last = cuni("")
|
||||
kwargs = ""
|
||||
last = ""
|
||||
for arg in args:
|
||||
if isinstance(arg, str) and arg.startswith("?"):
|
||||
kwargs = arg
|
||||
@ -289,7 +288,7 @@ def make_button(text, url, *args):
|
||||
if text[0] in "+$-?x" or text in ["x", "^", "v", "<", "<<", ">", ">>"]:
|
||||
return mark_safe(make_image_button(text, url, kwargs, last))
|
||||
else:
|
||||
return mark_safe(cuni("""<input type="button" value="%s" onclick="document.location.href='%s%s%s'"/>""") %
|
||||
return mark_safe("""<input type="button" value="%s" onclick="document.location.href='%s%s%s'"/>""" %
|
||||
(text, url, kwargs, last))
|
||||
|
||||
def make_image_button(text, url, kwargs, last):
|
||||
@ -362,10 +361,10 @@ def make_image_button2(button, text, url, kwargs="", last=""):
|
||||
filename = "/images/add-parent-existing-family.png"
|
||||
elif button == "add spouse to new family":
|
||||
filename = "/images/gramps-parents.png"
|
||||
return cuni("""<img height="22" width="22" alt="%s" title="%s" src="%s" onmouseover="buttonOver(this)" onmouseout="buttonOut(this)" onclick="document.location.href='%s%s%s'" style="background-color: lightgray; border: 1px solid lightgray; border-radius:5px; margin: 0px 1px; padding: 1px;" />""") % (text, text, filename, url, kwargs, last)
|
||||
return """<img height="22" width="22" alt="%s" title="%s" src="%s" onmouseover="buttonOver(this)" onmouseout="buttonOut(this)" onclick="document.location.href='%s%s%s'" style="background-color: lightgray; border: 1px solid lightgray; border-radius:5px; margin: 0px 1px; padding: 1px;" />""" % (text, text, filename, url, kwargs, last)
|
||||
|
||||
def event_table(obj, user, act, url, args):
|
||||
retval = cuni("")
|
||||
retval = ""
|
||||
has_data = False
|
||||
cssid = "tab-events"
|
||||
table = Table("event_table")
|
||||
@ -393,18 +392,18 @@ def event_table(obj, user, act, url, args):
|
||||
djevent.gramps_id,
|
||||
display_date(djevent),
|
||||
get_title(djevent.place),
|
||||
cuni(event_ref.role_type))
|
||||
str(event_ref.role_type))
|
||||
links.append(('URL', event_ref.get_url()))
|
||||
has_data = True
|
||||
count += 1
|
||||
table.links(links)
|
||||
retval += cuni("""<div style="background-color: lightgray; padding: 2px 0px 0px 2px">""")
|
||||
retval += """<div style="background-color: lightgray; padding: 2px 0px 0px 2px">"""
|
||||
if user.is_superuser and act == "view":
|
||||
retval += make_button(_("+Add New Event"), (url % args).replace("$act", "add"))
|
||||
retval += make_button(_("$Add Existing Event"), (url % args).replace("$act", "share"))
|
||||
else:
|
||||
retval += cuni("""<div style="height: 26px;"></div>""") # to keep tabs same height
|
||||
retval += cuni("""</div>""")
|
||||
retval += """<div style="height: 26px;"></div>""" # to keep tabs same height
|
||||
retval += """</div>"""
|
||||
retval += table.get_html()
|
||||
if user.is_superuser and act == "view":
|
||||
count = 1
|
||||
@ -412,16 +411,16 @@ def event_table(obj, user, act, url, args):
|
||||
retval = retval.replace("}}", """</div>""")
|
||||
for (djevent, event_ref) in event_list:
|
||||
item = obj.__class__.__name__.lower()
|
||||
retval = retval.replace("[[x%d]]" % count, make_button("x", cuni("/%s/%s/remove/eventref/%d") % (item, obj.handle, count)))
|
||||
retval = retval.replace("[[^%d]]" % count, make_button("^", cuni("/%s/%s/up/eventref/%d") % (item, obj.handle, count)))
|
||||
retval = retval.replace("[[v%d]]" % count, make_button("v", cuni("/%s/%s/down/eventref/%d") % (item, obj.handle, count)))
|
||||
retval = retval.replace("[[x%d]]" % count, make_button("x", "/%s/%s/remove/eventref/%d" % (item, obj.handle, count)))
|
||||
retval = retval.replace("[[^%d]]" % count, make_button("^", "/%s/%s/up/eventref/%d" % (item, obj.handle, count)))
|
||||
retval = retval.replace("[[v%d]]" % count, make_button("v", "/%s/%s/down/eventref/%d" % (item, obj.handle, count)))
|
||||
count += 1
|
||||
if has_data:
|
||||
retval += cuni(""" <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""") % cssid
|
||||
retval += """ <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""" % cssid
|
||||
return retval
|
||||
|
||||
def history_table(obj, user, act):
|
||||
retval = cuni("")
|
||||
retval = ""
|
||||
has_data = False
|
||||
cssid = "tab-history"
|
||||
table = Table("history_table")
|
||||
@ -435,23 +434,23 @@ def history_table(obj, user, act):
|
||||
object_id=obj.id,
|
||||
object_type=obj_type):
|
||||
table.row(
|
||||
cuni("%s on %s by %s") % (entry.log_type,
|
||||
"%s on %s by %s" % (entry.log_type,
|
||||
entry.last_changed,
|
||||
entry.last_changed_by),
|
||||
entry.reason)
|
||||
has_data = True
|
||||
table.row(
|
||||
cuni("Latest on %s by %s") % (obj.last_changed,
|
||||
"Latest on %s by %s" % (obj.last_changed,
|
||||
obj.last_changed_by),
|
||||
"Current status")
|
||||
retval += table.get_html()
|
||||
retval += nbsp("") # to keep tabs same height
|
||||
if has_data:
|
||||
retval += cuni(""" <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""") % cssid
|
||||
retval += """ <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""" % cssid
|
||||
return retval
|
||||
|
||||
def name_table(obj, user, act, url=None, *args):
|
||||
retval = cuni("")
|
||||
retval = ""
|
||||
has_data = False
|
||||
cssid = "tab-names"
|
||||
table = Table("name_table")
|
||||
@ -468,20 +467,20 @@ def name_table(obj, user, act, url=None, *args):
|
||||
object_id=name.id).count() > 0
|
||||
note_refs = dji.NoteRef.filter(object_type=obj_type,
|
||||
object_id=name.id)
|
||||
note = cuni("")
|
||||
note = ""
|
||||
if note_refs.count() > 0:
|
||||
try:
|
||||
note = dji.Note.get(id=note_refs[0].object_id).text[:50]
|
||||
except:
|
||||
note = None
|
||||
table.row(make_name(name, user),
|
||||
cuni(name.name_type) + ["", " (preferred)"][int(name.preferred)],
|
||||
str(name.name_type) + ["", " (preferred)"][int(name.preferred)],
|
||||
name.group_as,
|
||||
["No", "Yes"][citationq],
|
||||
note)
|
||||
links.append(('URL',
|
||||
# url is "/person/%s/name"
|
||||
(url % name.person.handle) + (cuni("/%s") % name.order)))
|
||||
(url % name.person.handle) + ("/%s" % name.order)))
|
||||
has_data = True
|
||||
table.links(links)
|
||||
retval += """<div style="background-color: lightgray; padding: 2px 0px 0px 2px">"""
|
||||
@ -492,13 +491,13 @@ def name_table(obj, user, act, url=None, *args):
|
||||
retval += """</div>"""
|
||||
retval += table.get_html()
|
||||
if has_data:
|
||||
retval += cuni(""" <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""") % cssid
|
||||
retval += """ <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""" % cssid
|
||||
return retval
|
||||
|
||||
def surname_table(obj, user, act, url=None, *args):
|
||||
person_handle = args[0]
|
||||
order = args[1]
|
||||
retval = cuni("")
|
||||
retval = ""
|
||||
has_data = False
|
||||
cssid = "tab-surnames"
|
||||
table = Table("surname_table")
|
||||
@ -516,19 +515,19 @@ def surname_table(obj, user, act, url=None, *args):
|
||||
name = None
|
||||
if name:
|
||||
for surname in name.surname_set.all().order_by("order"):
|
||||
table.row(cuni(surname.order), surname)
|
||||
table.row(str(surname.order), surname)
|
||||
has_data = True
|
||||
retval += table.get_html()
|
||||
else:
|
||||
retval += cuni("<p id='error'>No such name order = %s</p>") % order
|
||||
retval += "<p id='error'>No such name order = %s</p>" % order
|
||||
if has_data:
|
||||
retval += cuni(""" <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""") % cssid
|
||||
retval += """ <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""" % cssid
|
||||
return retval
|
||||
|
||||
def citation_table(obj, user, act, url=None, *args):
|
||||
# FIXME: how can citation_table and source_table both be on same
|
||||
# page? This causes problems with form names, tab names, etc.
|
||||
retval = cuni("")
|
||||
retval = ""
|
||||
has_data = False
|
||||
cssid = "tab-sources"
|
||||
table = Table("citation_table")
|
||||
@ -549,8 +548,8 @@ def citation_table(obj, user, act, url=None, *args):
|
||||
citation_ref.citation.handle)
|
||||
table.row(Link("{{[[x%d]][[^%d]][[v%d]]}}" % (count, count, count)) if user.is_superuser and url and act == "view" else "",
|
||||
citation.gramps_id,
|
||||
cuni(citation.confidence),
|
||||
cuni(citation.page),
|
||||
str(citation.confidence),
|
||||
str(citation.page),
|
||||
)
|
||||
links.append(('URL', citation_ref.get_url()))
|
||||
has_data = True
|
||||
@ -570,16 +569,16 @@ def citation_table(obj, user, act, url=None, *args):
|
||||
count = 1
|
||||
for citation_ref in citation_refs:
|
||||
item = obj.__class__.__name__.lower()
|
||||
retval = retval.replace("[[x%d]]" % count, make_button("x", cuni("/%s/%s/remove/citationref/%d") % (item, obj.handle, count)))
|
||||
retval = retval.replace("[[^%d]]" % count, make_button("^", cuni("/%s/%s/up/citationref/%d") % (item, obj.handle, count)))
|
||||
retval = retval.replace("[[v%d]]" % count, make_button("v", cuni("/%s/%s/down/citationref/%d") % (item, obj.handle, count)))
|
||||
retval = retval.replace("[[x%d]]" % count, make_button("x", "/%s/%s/remove/citationref/%d" % (item, obj.handle, count)))
|
||||
retval = retval.replace("[[^%d]]" % count, make_button("^", "/%s/%s/up/citationref/%d" % (item, obj.handle, count)))
|
||||
retval = retval.replace("[[v%d]]" % count, make_button("v", "/%s/%s/down/citationref/%d" % (item, obj.handle, count)))
|
||||
count += 1
|
||||
if has_data:
|
||||
retval += cuni(""" <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""") % cssid
|
||||
retval += """ <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""" % cssid
|
||||
return retval
|
||||
|
||||
def repository_table(obj, user, act, url=None, *args):
|
||||
retval = cuni("")
|
||||
retval = ""
|
||||
has_data = False
|
||||
cssid = "tab-repositories"
|
||||
table = Table("repository_table")
|
||||
@ -610,7 +609,7 @@ def repository_table(obj, user, act, url=None, *args):
|
||||
repository.gramps_id,
|
||||
repository.name,
|
||||
repo_ref.call_number,
|
||||
cuni(repository.repository_type),
|
||||
str(repository.repository_type),
|
||||
)
|
||||
has_data = True
|
||||
count += 1
|
||||
@ -620,17 +619,17 @@ def repository_table(obj, user, act, url=None, *args):
|
||||
count = 1
|
||||
for repo_ref in refs:
|
||||
item = obj.__class__.__name__.lower()
|
||||
text = text.replace("[[x%d]]" % count, make_button("x", cuni("/%s/%s/remove/repositoryref/%d") % (item, obj.handle, count)))
|
||||
text = text.replace("[[^%d]]" % count, make_button("^", cuni("/%s/%s/up/repositoryref/%d") % (item, obj.handle, count)))
|
||||
text = text.replace("[[v%d]]" % count, make_button("v", cuni("/%s/%s/down/repositoryref/%d") % (item, obj.handle, count)))
|
||||
text = text.replace("[[x%d]]" % count, make_button("x", "/%s/%s/remove/repositoryref/%d" % (item, obj.handle, count)))
|
||||
text = text.replace("[[^%d]]" % count, make_button("^", "/%s/%s/up/repositoryref/%d" % (item, obj.handle, count)))
|
||||
text = text.replace("[[v%d]]" % count, make_button("v", "/%s/%s/down/repositoryref/%d" % (item, obj.handle, count)))
|
||||
count += 1
|
||||
retval += text
|
||||
if has_data:
|
||||
retval += cuni(""" <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""") % cssid
|
||||
retval += """ <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""" % cssid
|
||||
return retval
|
||||
|
||||
def note_table(obj, user, act, url=None, *args):
|
||||
retval = cuni("")
|
||||
retval = ""
|
||||
has_data = False
|
||||
cssid = "tab-notes"
|
||||
table = Table("note_table")
|
||||
@ -650,7 +649,7 @@ def note_table(obj, user, act, url=None, *args):
|
||||
note = note_ref.ref_object
|
||||
table.row(Link("{{[[x%d]][[^%d]][[v%d]]}}" % (count, count, count)) if user.is_superuser else "",
|
||||
note.gramps_id,
|
||||
cuni(note.note_type),
|
||||
str(note.note_type),
|
||||
note.text[:50]
|
||||
)
|
||||
links.append(('URL', note_ref.get_url()))
|
||||
@ -671,17 +670,17 @@ def note_table(obj, user, act, url=None, *args):
|
||||
count = 1
|
||||
for note_ref in note_refs:
|
||||
item = obj.__class__.__name__.lower()
|
||||
text = text.replace("[[x%d]]" % count, make_button("x", cuni("/%s/%s/remove/noteref/%d") % (item, obj.handle, count)))
|
||||
text = text.replace("[[^%d]]" % count, make_button("^", cuni("/%s/%s/up/noteref/%d") % (item, obj.handle, count)))
|
||||
text = text.replace("[[v%d]]" % count, make_button("v", cuni("/%s/%s/down/noteref/%d") % (item, obj.handle, count)))
|
||||
text = text.replace("[[x%d]]" % count, make_button("x", "/%s/%s/remove/noteref/%d" % (item, obj.handle, count)))
|
||||
text = text.replace("[[^%d]]" % count, make_button("^", "/%s/%s/up/noteref/%d" % (item, obj.handle, count)))
|
||||
text = text.replace("[[v%d]]" % count, make_button("v", "/%s/%s/down/noteref/%d" % (item, obj.handle, count)))
|
||||
count += 1
|
||||
retval += text
|
||||
if has_data:
|
||||
retval += cuni(""" <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""") % cssid
|
||||
retval += """ <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""" % cssid
|
||||
return retval
|
||||
|
||||
def data_table(obj, user, act, url=None, *args):
|
||||
retval = cuni("")
|
||||
retval = ""
|
||||
has_data = False
|
||||
cssid = "tab-data"
|
||||
table = Table("data_table")
|
||||
@ -722,9 +721,9 @@ def data_table(obj, user, act, url=None, *args):
|
||||
text = text.replace("}}", """</div>""")
|
||||
count = 1
|
||||
for repo_ref in refs:
|
||||
text = text.replace("[[x%d]]" % count, make_button("x", cuni("/%s/%s/remove/attribute/%d") % (item_class, obj.handle, count)))
|
||||
text = text.replace("[[^%d]]" % count, make_button("^", cuni("/%s/%s/up/attribute/%d") % (item_class, obj.handle, count)))
|
||||
text = text.replace("[[v%d]]" % count, make_button("v", cuni("/%s/%s/down/attribute/%d") % (item_class, obj.handle, count)))
|
||||
text = text.replace("[[x%d]]" % count, make_button("x", "/%s/%s/remove/attribute/%d" % (item_class, obj.handle, count)))
|
||||
text = text.replace("[[^%d]]" % count, make_button("^", "/%s/%s/up/attribute/%d" % (item_class, obj.handle, count)))
|
||||
text = text.replace("[[v%d]]" % count, make_button("v", "/%s/%s/down/attribute/%d" % (item_class, obj.handle, count)))
|
||||
count += 1
|
||||
retval += text
|
||||
if has_data:
|
||||
@ -732,7 +731,7 @@ def data_table(obj, user, act, url=None, *args):
|
||||
return retval
|
||||
|
||||
def attribute_table(obj, user, act, url=None, *args):
|
||||
retval = cuni("")
|
||||
retval = ""
|
||||
has_data = False
|
||||
cssid = "tab-attributes"
|
||||
table = Table("attribute_table")
|
||||
@ -759,7 +758,7 @@ def attribute_table(obj, user, act, url=None, *args):
|
||||
return retval
|
||||
|
||||
def address_table(obj, user, act, url=None, *args):
|
||||
retval = cuni("")
|
||||
retval = ""
|
||||
has_data = False
|
||||
cssid = "tab-addresses"
|
||||
table = Table("address_table")
|
||||
@ -790,7 +789,7 @@ def address_table(obj, user, act, url=None, *args):
|
||||
return retval
|
||||
|
||||
def media_table(obj, user, act, url=None, *args):
|
||||
retval = cuni("")
|
||||
retval = ""
|
||||
has_data = False
|
||||
cssid = "tab-media"
|
||||
table = Table("media_table")
|
||||
@ -806,7 +805,7 @@ def media_table(obj, user, act, url=None, *args):
|
||||
media = table.db.get_object_from_handle(
|
||||
media_ref.ref_object.handle)
|
||||
table.row(table.db.get_object_from_handle(media.handle),
|
||||
cuni(media_ref.ref_object.desc),
|
||||
str(media_ref.ref_object.desc),
|
||||
media_ref.ref_object.path)
|
||||
has_data = True
|
||||
retval += """<div style="background-color: lightgray; padding: 2px 0px 0px 2px">"""
|
||||
@ -822,7 +821,7 @@ def media_table(obj, user, act, url=None, *args):
|
||||
return retval
|
||||
|
||||
def internet_table(obj, user, act, url=None, *args):
|
||||
retval = cuni("")
|
||||
retval = ""
|
||||
has_data = False
|
||||
cssid = "tab-internet"
|
||||
table = Table("internet_table")
|
||||
@ -832,13 +831,13 @@ def internet_table(obj, user, act, url=None, *args):
|
||||
if user.is_authenticated() or obj.public:
|
||||
urls = dji.Url.filter(person=obj)
|
||||
for url_obj in urls:
|
||||
table.row(cuni(url_obj.url_type),
|
||||
table.row(str(url_obj.url_type),
|
||||
url_obj.path,
|
||||
url_obj.desc)
|
||||
has_data = True
|
||||
retval += """<div style="background-color: lightgray; padding: 2px 0px 0px 2px">"""
|
||||
if user.is_superuser and url and act == "view":
|
||||
retval += make_button(_("+Add Internet"), (cuni(url) % args))
|
||||
retval += make_button(_("+Add Internet"), (str(url) % args))
|
||||
else:
|
||||
retval += nbsp("") # to keep tabs same height
|
||||
retval += """</div>"""
|
||||
@ -848,7 +847,7 @@ def internet_table(obj, user, act, url=None, *args):
|
||||
return retval
|
||||
|
||||
def association_table(obj, user, act, url=None, *args):
|
||||
retval = cuni("")
|
||||
retval = ""
|
||||
has_data = False
|
||||
cssid = "tab-associations"
|
||||
table = Table("association_table")
|
||||
@ -892,7 +891,7 @@ def association_table(obj, user, act, url=None, *args):
|
||||
|
||||
def location_table(obj, user, act, url=None, *args):
|
||||
# obj is Place or Address
|
||||
retval = cuni("")
|
||||
retval = ""
|
||||
has_data = False
|
||||
cssid = "tab-alternatelocations"
|
||||
table = Table("location_table")
|
||||
@ -926,7 +925,7 @@ def location_table(obj, user, act, url=None, *args):
|
||||
return retval
|
||||
|
||||
def lds_table(obj, user, act, url=None, *args):
|
||||
retval = cuni("")
|
||||
retval = ""
|
||||
has_data = False
|
||||
cssid = "tab-lds"
|
||||
table = Table("lds_table")
|
||||
@ -939,9 +938,9 @@ def lds_table(obj, user, act, url=None, *args):
|
||||
obj_type = ContentType.objects.get_for_model(obj)
|
||||
ldss = obj.lds_set.all().order_by("order")
|
||||
for lds in ldss:
|
||||
table.row(cuni(lds.lds_type),
|
||||
table.row(str(lds.lds_type),
|
||||
display_date(lds),
|
||||
cuni(lds.status),
|
||||
str(lds.status),
|
||||
lds.temple,
|
||||
get_title(lds.place))
|
||||
has_data = True
|
||||
@ -957,11 +956,11 @@ def lds_table(obj, user, act, url=None, *args):
|
||||
return retval
|
||||
|
||||
def person_reference_table(obj, user, act):
|
||||
retval = cuni("")
|
||||
retval = ""
|
||||
has_data = False
|
||||
cssid = "tab-references"
|
||||
text1 = cuni("")
|
||||
text2 = cuni("")
|
||||
text1 = ""
|
||||
text2 = ""
|
||||
table1 = Table("person_reference_table", style="background-color: #f4f0ec;")
|
||||
table1.columns(
|
||||
"As Spouse",
|
||||
@ -1037,11 +1036,11 @@ def person_reference_table(obj, user, act):
|
||||
retval += """<div style="overflow: auto; height:%spx;">""" % TAB_HEIGHT
|
||||
retval += text1 + text2 + "</div>"
|
||||
if has_data:
|
||||
retval += cuni(""" <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""") % cssid
|
||||
retval += """ <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""" % cssid
|
||||
return retval
|
||||
|
||||
def note_reference_table(obj, user, act):
|
||||
retval = cuni("")
|
||||
retval = ""
|
||||
has_data = False
|
||||
cssid = "tab-references"
|
||||
table = Table("note_reference_table")
|
||||
@ -1065,7 +1064,7 @@ def note_reference_table(obj, user, act):
|
||||
return retval
|
||||
|
||||
def event_reference_table(obj, user, act):
|
||||
retval = cuni("")
|
||||
retval = ""
|
||||
has_data = False
|
||||
cssid = "tab-references"
|
||||
table = Table("event_reference_table")
|
||||
@ -1089,11 +1088,11 @@ def event_reference_table(obj, user, act):
|
||||
retval += table.get_html()
|
||||
retval += nbsp("") # to keep tabs same height
|
||||
if has_data:
|
||||
retval += cuni(""" <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""") % cssid
|
||||
retval += """ <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""" % cssid
|
||||
return retval
|
||||
|
||||
def repository_reference_table(obj, user, act):
|
||||
retval = cuni("")
|
||||
retval = ""
|
||||
has_data = False
|
||||
cssid = "tab-references"
|
||||
table = Table("repository_reference_table")
|
||||
@ -1113,11 +1112,11 @@ def repository_reference_table(obj, user, act):
|
||||
retval += table.get_html()
|
||||
retval += nbsp("") # to keep tabs same height
|
||||
if has_data:
|
||||
retval += cuni(""" <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""") % cssid
|
||||
retval += """ <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""" % cssid
|
||||
return retval
|
||||
|
||||
def citation_reference_table(obj, user, act):
|
||||
retval = cuni("")
|
||||
retval = ""
|
||||
has_data = False
|
||||
cssid = "tab-references"
|
||||
table = Table("citation_reference_table")
|
||||
@ -1137,11 +1136,11 @@ def citation_reference_table(obj, user, act):
|
||||
retval += table.get_html()
|
||||
retval += nbsp("") # to keep tabs same height
|
||||
if has_data:
|
||||
retval += cuni(""" <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""") % cssid
|
||||
retval += """ <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""" % cssid
|
||||
return retval
|
||||
|
||||
def source_reference_table(obj, user, act):
|
||||
retval = cuni("")
|
||||
retval = ""
|
||||
has_data = False
|
||||
cssid = "tab-references"
|
||||
table = Table("source_reference_table")
|
||||
@ -1159,11 +1158,11 @@ def source_reference_table(obj, user, act):
|
||||
retval += table.get_html()
|
||||
retval += nbsp("") # to keep tabs same height
|
||||
if has_data:
|
||||
retval += cuni(""" <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""") % cssid
|
||||
retval += """ <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""" % cssid
|
||||
return retval
|
||||
|
||||
def media_reference_table(obj, user, act):
|
||||
retval = cuni("")
|
||||
retval = ""
|
||||
has_data = False
|
||||
cssid = "tab-references"
|
||||
table = Table("media_reference_table")
|
||||
@ -1183,11 +1182,11 @@ def media_reference_table(obj, user, act):
|
||||
retval += table.get_html()
|
||||
retval += nbsp("") # to keep tabs same height
|
||||
if has_data:
|
||||
retval += cuni(""" <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""") % cssid
|
||||
retval += """ <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""" % cssid
|
||||
return retval
|
||||
|
||||
def place_reference_table(obj, user, act):
|
||||
retval = cuni("")
|
||||
retval = ""
|
||||
has_data = False
|
||||
cssid = "tab-references"
|
||||
table = Table("place_reference_table")
|
||||
@ -1206,11 +1205,11 @@ def place_reference_table(obj, user, act):
|
||||
retval += table.get_html()
|
||||
retval += nbsp("") # to keep tabs same height
|
||||
if has_data:
|
||||
retval += cuni(""" <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""") % cssid
|
||||
retval += """ <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""" % cssid
|
||||
return retval
|
||||
|
||||
def tag_reference_table(obj, user, act):
|
||||
retval = cuni("")
|
||||
retval = ""
|
||||
has_data = False
|
||||
cssid = "tab-references"
|
||||
table = Table("tag_reference_table")
|
||||
@ -1230,7 +1229,7 @@ def tag_reference_table(obj, user, act):
|
||||
retval += table.get_html()
|
||||
retval += nbsp("") # to keep tabs same height
|
||||
if has_data:
|
||||
retval += cuni(""" <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""") % cssid
|
||||
retval += """ <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""" % cssid
|
||||
return retval
|
||||
|
||||
class Link(object):
|
||||
@ -1243,7 +1242,7 @@ class Link(object):
|
||||
return self.string
|
||||
|
||||
def children_table(obj, user, act, url=None, *args):
|
||||
retval = cuni("")
|
||||
retval = ""
|
||||
has_data = False
|
||||
cssid = "tab-children"
|
||||
table = Table("children_table")
|
||||
@ -1269,8 +1268,8 @@ def children_table(obj, user, act, url=None, *args):
|
||||
child = childref.ref_object
|
||||
if user.is_authenticated() or obj.public:
|
||||
table.row(Link("{{[[x%d]][[^%d]][[v%d]]}}" % (count, count, count)) if user.is_superuser and url and act == "view" else "",
|
||||
cuni(count),
|
||||
cuni("[%s]") % child.gramps_id,
|
||||
str(count),
|
||||
"[%s]" % child.gramps_id,
|
||||
render_name(child, user),
|
||||
child.gender_type,
|
||||
childref.father_rel_type,
|
||||
@ -1282,8 +1281,8 @@ def children_table(obj, user, act, url=None, *args):
|
||||
count += 1
|
||||
else:
|
||||
table.row("",
|
||||
cuni(count),
|
||||
cuni("[%s]") % child.gramps_id,
|
||||
str(count),
|
||||
"[%s]" % child.gramps_id,
|
||||
render_name(child, user) if not child.private else "[Private]",
|
||||
child.gender_type if not child.private else "[Private]",
|
||||
"[Private]",
|
||||
@ -1304,9 +1303,9 @@ def children_table(obj, user, act, url=None, *args):
|
||||
text = text.replace("}}", """</div>""")
|
||||
count = 1
|
||||
for childref in childrefs:
|
||||
text = text.replace("[[x%d]]" % count, make_button("x", cuni("/family/%s/remove/child/%d") % (family.handle, count)))
|
||||
text = text.replace("[[^%d]]" % count, make_button("^", cuni("/family/%s/up/child/%d") % (family.handle, count)))
|
||||
text = text.replace("[[v%d]]" % count, make_button("v", cuni("/family/%s/down/child/%d") % (family.handle, count)))
|
||||
text = text.replace("[[x%d]]" % count, make_button("x", "/family/%s/remove/child/%d" % (family.handle, count)))
|
||||
text = text.replace("[[^%d]]" % count, make_button("^", "/family/%s/up/child/%d" % (family.handle, count)))
|
||||
text = text.replace("[[v%d]]" % count, make_button("v", "/family/%s/down/child/%d" % (family.handle, count)))
|
||||
count += 1
|
||||
retval += make_button(_("+Add New Person as Child"), (url.replace("$act", "add") % args))
|
||||
retval += make_button(_("$Add Existing Person as Child"), (url.replace("$act", "share") % args))
|
||||
@ -1315,7 +1314,7 @@ def children_table(obj, user, act, url=None, *args):
|
||||
retval += """</div>"""
|
||||
retval += text
|
||||
if has_data:
|
||||
retval += cuni(""" <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""") % cssid
|
||||
retval += """ <SCRIPT LANGUAGE="JavaScript">setHasData("%s", 1)</SCRIPT>\n""" % cssid
|
||||
return retval
|
||||
|
||||
## FIXME: these dji function wrappers just use the functions
|
||||
@ -1337,9 +1336,9 @@ def display_date(obj):
|
||||
return ""
|
||||
|
||||
def media_link(handle, user, act):
|
||||
retval = cuni("""<a href="%s"><img src="%s" /></a>""") % (
|
||||
cuni("/media/%s/full") % handle,
|
||||
cuni("/media/%s/thumbnail") % handle)
|
||||
retval = """<a href="%s"><img src="%s" /></a>""" % (
|
||||
"/media/%s/full" % handle,
|
||||
"/media/%s/thumbnail" % handle)
|
||||
return retval
|
||||
|
||||
def render(formfield, user, act, id=None, url=None, *args):
|
||||
@ -1350,14 +1349,14 @@ def render(formfield, user, act, id=None, url=None, *args):
|
||||
try:
|
||||
item = getattr(formfield.form.model, fieldname)
|
||||
if (item.__class__.__name__ == 'ManyRelatedManager'):
|
||||
retval = cuni(", ").join([i.get_link() for i in item.all()])
|
||||
retval = ", ".join([i.get_link() for i in item.all()])
|
||||
else:
|
||||
if url:
|
||||
retval = cuni("""<a href="%s">%s</a>""") % (url % args, item)
|
||||
retval = """<a href="%s">%s</a>""" % (url % args, item)
|
||||
elif hasattr(item, "get_link"):
|
||||
retval = item.get_link()
|
||||
else:
|
||||
retval = cuni(item)
|
||||
retval = str(item)
|
||||
#### Some cleanup:
|
||||
if fieldname == "private": # obj.private
|
||||
if retval == "True":
|
||||
@ -1372,7 +1371,7 @@ def render(formfield, user, act, id=None, url=None, *args):
|
||||
except:
|
||||
# name, "prefix"
|
||||
try:
|
||||
retval = cuni(formfield.form.data[fieldname])
|
||||
retval = str(formfield.form.data[fieldname])
|
||||
except:
|
||||
retval = "[None]"
|
||||
else: # show as widget
|
||||
@ -1398,7 +1397,7 @@ def render_name(name, user, act=None):
|
||||
surname = name.surname_set.get(primary=True)
|
||||
except:
|
||||
surname = "[No primary surname]"
|
||||
return cuni("%s, %s") % (surname, name.first_name)
|
||||
return "%s, %s" % (surname, name.first_name)
|
||||
elif isinstance(name, forms.NameForm):
|
||||
if not user.is_authenticated():
|
||||
name.model.sanitize()
|
||||
@ -1406,7 +1405,7 @@ def render_name(name, user, act=None):
|
||||
surname = name.model.surname_set.get(primary=True)
|
||||
except:
|
||||
surname = "[No primary surname]"
|
||||
return cuni("%s, %s") % (surname,
|
||||
return "%s, %s" % (surname,
|
||||
name.model.first_name)
|
||||
elif isinstance(name, Person): # name is a Person
|
||||
person = name
|
||||
@ -1422,7 +1421,7 @@ def render_name(name, user, act=None):
|
||||
surname = name.surname_set.get(primary=True)
|
||||
except:
|
||||
surname = "[No primary surname]"
|
||||
return cuni("%s, %s") % (surname, name.first_name)
|
||||
return "%s, %s" % (surname, name.first_name)
|
||||
elif isinstance(name, models.Person): # django person
|
||||
person = name
|
||||
try:
|
||||
@ -1457,7 +1456,7 @@ def person_get_event(person, event_type=None):
|
||||
index = libdjango.lookup_role_index(event_type, event_ref_list)
|
||||
if index >= 0:
|
||||
event_handle = event_ref_list[index][3]
|
||||
# (False, [], [], cuni('b2cfa6cdec87392cf3b'), (1, cuni('Primary')))
|
||||
# (False, [], [], 'b2cfa6cdec87392cf3b', (1, 'Primary'))
|
||||
# WARNING: the same object can be referred to more than once
|
||||
objs = models.EventRef.objects.filter(ref_object__handle=event_handle)
|
||||
if objs.count() > 0:
|
||||
@ -1517,7 +1516,7 @@ class StyledNoteFormatter(object):
|
||||
return self.styled_note(note.get_styledtext())
|
||||
|
||||
def styled_note(self, styledtext):
|
||||
text = cuni(styledtext)
|
||||
text = str(styledtext)
|
||||
if not text:
|
||||
return ''
|
||||
s_tags = styledtext.get_tags()
|
||||
@ -1534,13 +1533,13 @@ class StyledNoteFormatter(object):
|
||||
if obj:
|
||||
handle = obj.handle
|
||||
else:
|
||||
raise AttributeError(cuni("gramps_id '%s' not found in '%s'") %
|
||||
raise AttributeError("gramps_id '%s' not found in '%s'" %
|
||||
(handle, obj_class))
|
||||
else:
|
||||
raise AttributeError(cuni("invalid gramps_id lookup ") +
|
||||
cuni("in table name '%s'") % obj_class)
|
||||
raise AttributeError("invalid gramps_id lookup " +
|
||||
"in table name '%s'" % obj_class)
|
||||
# handle, ppl
|
||||
return cuni("/%s/%s") % (obj_class.lower(), handle)
|
||||
return "/%s/%s" % (obj_class.lower(), handle)
|
||||
|
||||
class WebAppParser(HTMLParser):
|
||||
BOLD = 0
|
||||
@ -1650,7 +1649,7 @@ class WebAppParser(HTMLParser):
|
||||
href = attrs["href"]
|
||||
if href.startswith("/"):
|
||||
parts = href.split("/")
|
||||
arg = cuni("gramps://%s/handle/%s") % (parts[-2].title(), parts[-1])
|
||||
arg = "gramps://%s/handle/%s" % (parts[-2].title(), parts[-1])
|
||||
else:
|
||||
arg = href
|
||||
else:
|
||||
@ -1666,7 +1665,7 @@ class WebAppParser(HTMLParser):
|
||||
self.__tags[key].append((start_pos, len(self.__text)))
|
||||
|
||||
def tags(self):
|
||||
# [((code, cuni('')), string/num, [(start, stop), ...]), ...]
|
||||
# [((code, ''), string/num, [(start, stop), ...]), ...]
|
||||
return [(key[0], key[1], self.__tags[key]) for key in self.__tags]
|
||||
|
||||
def text(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user