Unicode conversion not required for other Gtk methods
This commit is contained in:
parent
415540e4a6
commit
b34b257d33
@ -58,7 +58,6 @@ from gramps.gen.utils.keyword import (get_keywords, get_translation_from_keyword
|
||||
get_translations, get_keyword_from_translation)
|
||||
from gramps.gen.lib import Date, FamilyRelType
|
||||
from gramps.gen.lib import Name, Surname, NameOriginType
|
||||
from gramps.gen.constfunc import conv_to_unicode
|
||||
from .managedwindow import ManagedWindow
|
||||
from .widgets import MarkupLabel, BasicLabel
|
||||
from .dialog import ErrorDialog, QuestionDialog2, OkDialog
|
||||
@ -236,7 +235,7 @@ class ConfigureDialog(ManagedWindow):
|
||||
obj.get_text(), parent=self.window)
|
||||
obj.set_text('<b>%s</b>')
|
||||
|
||||
self.__config.set(constant, unicode(obj.get_text()))
|
||||
self.__config.set(constant, obj.get_text())
|
||||
|
||||
def update_entry(self, obj, constant):
|
||||
"""
|
||||
@ -244,7 +243,7 @@ class ConfigureDialog(ManagedWindow):
|
||||
:param constant: the config setting to which the text value must be
|
||||
saved
|
||||
"""
|
||||
self.__config.set(constant, conv_to_unicode(obj.get_text()))
|
||||
self.__config.set(constant, obj.get_text())
|
||||
|
||||
def update_color(self, obj, constant, color_hex_label):
|
||||
rgba = obj.get_rgba()
|
||||
@ -1472,7 +1471,7 @@ class GrampsPreferences(ConfigureDialog):
|
||||
f.destroy()
|
||||
|
||||
def set_dbpath(self, *obj):
|
||||
path = conv_to_unicode(self.dbpath_entry.get_text().strip())
|
||||
path = self.dbpath_entry.get_text().strip()
|
||||
config.set('behavior.database-path', path)
|
||||
|
||||
def select_dbpath(self, *obj):
|
||||
@ -1491,13 +1490,13 @@ class GrampsPreferences(ConfigureDialog):
|
||||
|
||||
status = f.run()
|
||||
if status == Gtk.ResponseType.OK:
|
||||
val = conv_to_unicode(f.get_filename())
|
||||
val = f.get_filename()
|
||||
if val:
|
||||
self.dbpath_entry.set_text(val)
|
||||
f.destroy()
|
||||
|
||||
def update_idformat_entry(self, obj, constant):
|
||||
config.set(constant, conv_to_unicode(obj.get_text()))
|
||||
config.set(constant, obj.get_text())
|
||||
self.dbstate.db.set_prefixes(
|
||||
config.get('preferences.iprefix'),
|
||||
config.get('preferences.oprefix'),
|
||||
|
@ -44,7 +44,7 @@ from urllib.parse import urlparse
|
||||
import logging
|
||||
LOG = logging.getLogger(".DbManager")
|
||||
|
||||
from gramps.gen.constfunc import win, conv_to_unicode
|
||||
from gramps.gen.constfunc import win
|
||||
if win():
|
||||
_RCS_FOUND = os.system("rcs -V >nul 2>nul") == 0
|
||||
if _RCS_FOUND and "TZ" not in os.environ:
|
||||
@ -282,7 +282,7 @@ class DbManager(CLIDbManager):
|
||||
self.rcs.set_sensitive(False)
|
||||
|
||||
if store.get_value(node, ICON_COL) == 'dialog-error':
|
||||
path = conv_to_unicode(store.get_value(node, PATH_COL), 'utf8')
|
||||
path = store.get_value(node, PATH_COL)
|
||||
backup = os.path.join(path, "person.gbkp")
|
||||
self.repair.set_sensitive(os.path.isfile(backup))
|
||||
else:
|
||||
@ -399,7 +399,7 @@ class DbManager(CLIDbManager):
|
||||
self.top.destroy()
|
||||
del self.selection
|
||||
del self.name_renderer
|
||||
path = conv_to_unicode(store.get_value(node, PATH_COL), 'utf8')
|
||||
path = store.get_value(node, PATH_COL)
|
||||
return (path, store.get_value(node, NAME_COL))
|
||||
else:
|
||||
self.top.destroy()
|
||||
@ -434,7 +434,7 @@ class DbManager(CLIDbManager):
|
||||
try:
|
||||
self.break_lock(self.lock_file)
|
||||
store, node = self.selection.get_selected()
|
||||
dbpath = conv_to_unicode(store.get_value(node, PATH_COL), 'utf8')
|
||||
dbpath = store.get_value(node, PATH_COL)
|
||||
(tval, last) = time_val(dbpath)
|
||||
store.set_value(node, OPEN_COL, 0)
|
||||
store.set_value(node, ICON_COL, "")
|
||||
@ -472,7 +472,6 @@ class DbManager(CLIDbManager):
|
||||
#path is a string, convert to TreePath first
|
||||
path = Gtk.TreePath(path=path)
|
||||
if len(new_text) > 0:
|
||||
new_text = conv_to_unicode(new_text, 'utf8')
|
||||
node = self.model.get_iter(path)
|
||||
old_text = self.model.get_value(node, NAME_COL)
|
||||
if not old_text.strip() == new_text.strip():
|
||||
@ -622,13 +621,13 @@ class DbManager(CLIDbManager):
|
||||
store, node = self.selection.get_selected()
|
||||
path = store.get_path(node)
|
||||
node = self.model.get_iter(path)
|
||||
filename = conv_to_unicode(self.model.get_value(node, FILE_COL), 'utf8')
|
||||
filename = self.model.get_value(node, FILE_COL)
|
||||
try:
|
||||
name_file = open(filename, "r")
|
||||
file_name_to_delete=name_file.read()
|
||||
name_file.close()
|
||||
remove_filename(file_name_to_delete)
|
||||
directory = conv_to_unicode(self.data_to_delete[1], 'utf8')
|
||||
directory = self.data_to_delete[1]
|
||||
for (top, dirs, files) in os.walk(directory):
|
||||
for filename in files:
|
||||
os.unlink(os.path.join(top, filename))
|
||||
@ -804,8 +803,7 @@ class DbManager(CLIDbManager):
|
||||
"""
|
||||
Create a new database, append to model
|
||||
"""
|
||||
new_path, title = self.create_new_db_cli(conv_to_unicode(title, 'utf8'),
|
||||
create_db, dbid)
|
||||
new_path, title = self.create_new_db_cli(title, create_db, dbid)
|
||||
path_name = os.path.join(new_path, NAME_FILE)
|
||||
(tval, last) = time_val(new_path)
|
||||
node = self.model.append(None, [title, new_path, path_name,
|
||||
|
@ -49,7 +49,6 @@ from gi.repository import GdkPixbuf
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.sgettext
|
||||
from gramps.gen.constfunc import conv_to_unicode
|
||||
from gramps.gen.const import ICON, THUMBSCALE, USER_HOME
|
||||
from gramps.gen.config import config
|
||||
from gramps.gen.utils.file import (media_path_full, media_path, relative_path,
|
||||
@ -161,7 +160,7 @@ class AddMediaObject(ManagedWindow):
|
||||
ErrorDialog(msgstr, msgstr2)
|
||||
return
|
||||
|
||||
filename = conv_to_unicode(self.file_text.get_filename())
|
||||
filename = self.file_text.get_filename()
|
||||
full_file = filename
|
||||
|
||||
if self.relpath.get_active():
|
||||
@ -198,10 +197,10 @@ class AddMediaObject(ManagedWindow):
|
||||
fname = self.file_text.get_filename()
|
||||
if not fname:
|
||||
return
|
||||
filename = conv_to_unicode(fname)
|
||||
filename = fname
|
||||
basename = os.path.basename(filename)
|
||||
(root, ext) = os.path.splitext(basename)
|
||||
old_title = str(self.description.get_text())
|
||||
old_title = self.description.get_text()
|
||||
|
||||
if old_title == '' or old_title == self.temp_name:
|
||||
self.description.set_text(root)
|
||||
|
@ -48,7 +48,6 @@ from .surnamemodel import SurnameModel
|
||||
from .embeddedlist import EmbeddedList, TEXT_COL, MARKUP_COL, ICON_COL
|
||||
from ...ddtargets import DdTargets
|
||||
from gramps.gen.lib import Surname, NameOriginType
|
||||
from gramps.gen.constfunc import conv_to_unicode
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -176,10 +175,10 @@ class SurnameTab(EmbeddedList):
|
||||
for idx in range(len(self.model)):
|
||||
node = self.model.get_iter(idx)
|
||||
surn = self.model.get_value(node, 5)
|
||||
surn.set_prefix(conv_to_unicode(self.model.get_value(node, 0), 'UTF-8'))
|
||||
surn.set_surname(conv_to_unicode(self.model.get_value(node, 1), 'UTF-8'))
|
||||
surn.set_connector(conv_to_unicode(self.model.get_value(node, 2), 'UTF-8'))
|
||||
surn.get_origintype().set(conv_to_unicode(self.model.get_value(node, 3), 'UTF-8'))
|
||||
surn.set_prefix(self.model.get_value(node, 0))
|
||||
surn.set_surname(self.model.get_value(node, 1))
|
||||
surn.set_connector(self.model.get_value(node, 2))
|
||||
surn.get_origintype().set(self.model.get_value(node, 3))
|
||||
surn.set_primary(self.model.get_value(node, 4))
|
||||
new_list += [surn]
|
||||
return new_list
|
||||
|
@ -42,7 +42,6 @@ from gi.repository import Gdk
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.sgettext
|
||||
from gramps.gen.constfunc import conv_to_unicode
|
||||
from ..utils import open_file_with_default_application
|
||||
from gramps.gen.lib import MediaObject, NoteType
|
||||
from gramps.gen.db import DbTxn
|
||||
@ -258,7 +257,7 @@ class EditMedia(EditPrimary):
|
||||
def select_file(self, val):
|
||||
self.determine_mime()
|
||||
path = self.file_path.get_text()
|
||||
self.obj.set_path(conv_to_unicode(path))
|
||||
self.obj.set_path(path)
|
||||
AddMediaObject(self.dbstate, self.uistate, self.track, self.obj,
|
||||
self._update_addmedia)
|
||||
|
||||
@ -306,7 +305,7 @@ class EditMedia(EditPrimary):
|
||||
self.ok_button.set_sensitive(True)
|
||||
return
|
||||
|
||||
path = conv_to_unicode(self.file_path.get_text())
|
||||
path = self.file_path.get_text()
|
||||
full_path = media_path_full(self.db, path)
|
||||
if os.path.isfile(full_path):
|
||||
self.determine_mime()
|
||||
|
@ -45,7 +45,6 @@ from gi.repository import Gdk
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.sgettext
|
||||
from gramps.gen.constfunc import conv_to_unicode
|
||||
from ..utils import open_file_with_default_application
|
||||
from gramps.gen.const import THUMBSCALE
|
||||
from gramps.gen.mime import get_description, get_type
|
||||
@ -435,7 +434,7 @@ class EditMediaRef(EditReference):
|
||||
def select_file(self, val):
|
||||
self.determine_mime()
|
||||
path = self.file_path.get_text()
|
||||
self.source.set_path(conv_to_unicode(path))
|
||||
self.source.set_path(path)
|
||||
AddMediaObject(self.dbstate, self.uistate, self.track, self.source,
|
||||
self._update_addmedia)
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
import os
|
||||
from gi.repository import Gtk
|
||||
from gi.repository import GObject
|
||||
from gramps.gen.constfunc import conv_to_unicode, get_curr_dir
|
||||
from gramps.gen.constfunc import get_curr_dir
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
|
||||
@ -65,7 +65,7 @@ class FileEntry(Gtk.Box):
|
||||
_('_Open'),
|
||||
Gtk.ResponseType.OK))
|
||||
|
||||
name = os.path.basename(conv_to_unicode(self.entry.get_text()))
|
||||
name = os.path.basename(self.entry.get_text())
|
||||
if self.dir:
|
||||
if os.path.isdir(name):
|
||||
dialog.set_current_name(name)
|
||||
|
@ -61,7 +61,6 @@ from ...managedwindow import ManagedWindow
|
||||
from ._stylecombobox import StyleComboBox
|
||||
from ._styleeditor import StyleListDisplay
|
||||
from ._fileentry import FileEntry
|
||||
from gramps.gen.constfunc import conv_to_unicode
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Private Constants
|
||||
@ -483,7 +482,7 @@ class ReportDialog(ManagedWindow):
|
||||
to tell the calling routine to give up. This function also
|
||||
saves the current directory so that any future reports will
|
||||
default to the most recently used directory."""
|
||||
self.target_path = conv_to_unicode(self.target_fileentry.get_full_path(0))
|
||||
self.target_path = self.target_fileentry.get_full_path(0)
|
||||
if not self.target_path:
|
||||
return None
|
||||
|
||||
|
@ -77,7 +77,7 @@ from .displaystate import DisplayState, RecentDocsMenu
|
||||
from gramps.gen.const import (HOME_DIR, ICON, URL_BUGTRACKER, URL_HOMEPAGE,
|
||||
URL_MAILINGLIST, URL_MANUAL_PAGE, URL_WIKISTRING,
|
||||
WIKI_EXTRAPLUGINS, URL_BUGHOME)
|
||||
from gramps.gen.constfunc import is_quartz, conv_to_unicode
|
||||
from gramps.gen.constfunc import is_quartz
|
||||
from gramps.gen.config import config
|
||||
from gramps.gen.errors import WindowActiveError
|
||||
from .dialog import ErrorDialog, WarningDialog, QuestionDialog2, InfoDialog
|
||||
@ -1095,7 +1095,6 @@ class ViewManager(CLIManager):
|
||||
value = dialog.run()
|
||||
if value:
|
||||
(filename, title) = value
|
||||
filename = conv_to_unicode(filename)
|
||||
self.db_loader.read_file(filename)
|
||||
self._post_load_newdb(filename, 'x-directory/normal', title)
|
||||
|
||||
@ -1295,10 +1294,9 @@ class ViewManager(CLIManager):
|
||||
window.hide()
|
||||
if d == Gtk.ResponseType.APPLY:
|
||||
# if file exists, ask if overwrite; else abort
|
||||
basefile = conv_to_unicode(file_entry.get_text())
|
||||
basefile = file_entry.get_text()
|
||||
basefile = basefile.replace("/", r"-")
|
||||
filename = os.path.join(conv_to_unicode(path_entry.get_text()),
|
||||
basefile)
|
||||
filename = os.path.join(path_entry.get_text(), basefile)
|
||||
if os.path.exists(filename):
|
||||
question = QuestionDialog2(
|
||||
_("Backup file already exists! Overwrite?"),
|
||||
|
Loading…
Reference in New Issue
Block a user