Remove uni_to_gui function
We no longer need to convert strings to utf8 before passing them to Gtk functions.
This commit is contained in:
parent
2ecf1a3ddc
commit
63ffd83021
@ -58,13 +58,6 @@ cuni = conv_to_unicode_direct
|
||||
def conv_to_unicode(x, y='utf8'):
|
||||
return x if x is None or isinstance(x, UNITYPE) else cuni(x, y) if y else cuni(x)
|
||||
|
||||
def uni_to_gui(x):
|
||||
'''
|
||||
In Py2 we need to convert strings to utf8 before passing them to
|
||||
Gtk functions.
|
||||
'''
|
||||
return x
|
||||
|
||||
# handle in database is bytes, while internally Gramps wants unicode for py3
|
||||
handle2internal = lambda x: conv_to_unicode(x, 'utf-8')
|
||||
|
||||
|
@ -47,7 +47,7 @@ from gi.repository import Gtk
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from gramps.gen.const import GLADE_DIR, GRAMPS_LOCALE as glocale
|
||||
from gramps.gen.constfunc import STRTYPE, uni_to_gui
|
||||
from gramps.gen.constfunc import STRTYPE
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
@ -122,7 +122,7 @@ class Glade(Gtk.Builder):
|
||||
|
||||
# try to build Gtk objects from glade file. Let exceptions happen
|
||||
|
||||
self.add_from_file(uni_to_gui(path))
|
||||
self.add_from_file(path)
|
||||
self.__dirname, self.__filename = os.path.split(path)
|
||||
|
||||
# try to find the toplevel widget
|
||||
|
@ -59,8 +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, uni_to_gui, get_curr_dir,
|
||||
STRTYPE, cuni)
|
||||
from gramps.gen.constfunc import (conv_to_unicode, get_curr_dir, STRTYPE, cuni)
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
|
||||
@ -1708,7 +1707,7 @@ class GuiDestinationOption(Gtk.Box):
|
||||
if not self.__option.get_directory_entry() and \
|
||||
not path.endswith(self.__option.get_extension()):
|
||||
path = path + self.__option.get_extension()
|
||||
self.__entry.set_text(uni_to_gui(path))
|
||||
self.__entry.set_text(path)
|
||||
self.__option.set_value(path)
|
||||
fcd.destroy()
|
||||
|
||||
|
@ -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, uni_to_gui
|
||||
from gramps.gen.constfunc import conv_to_unicode, get_curr_dir
|
||||
class FileEntry(Gtk.Box):
|
||||
""" A widget that allows the user to select a file from the file system """
|
||||
def __init__(self, defname, title):
|
||||
@ -85,8 +85,7 @@ class FileEntry(Gtk.Box):
|
||||
else:
|
||||
self.__base_path = get_curr_dir()
|
||||
self.__file_name = path
|
||||
self.entry.set_text(uni_to_gui(os.path.join(self.__base_path,
|
||||
self.__file_name)))
|
||||
self.entry.set_text(os.path.join(self.__base_path, self.__file_name))
|
||||
|
||||
def get_full_path(self, val):
|
||||
""" Get the full path of the currently selected file. """
|
||||
|
@ -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, uni_to_gui
|
||||
from gramps.gen.constfunc import is_quartz, conv_to_unicode
|
||||
from gramps.gen.config import config
|
||||
from gramps.gen.errors import WindowActiveError
|
||||
from .dialog import ErrorDialog, WarningDialog, QuestionDialog2, InfoDialog
|
||||
@ -1341,7 +1341,7 @@ class ViewManager(CLIManager):
|
||||
if not mpath:
|
||||
mpath = HOME_DIR
|
||||
f.set_current_folder(os.path.dirname(mpath))
|
||||
f.set_filename(uni_to_gui(os.path.join(mpath, ".")))
|
||||
f.set_filename(os.path.join(mpath, "."))
|
||||
status = f.run()
|
||||
if status == Gtk.ResponseType.OK:
|
||||
filename = f.get_filename()
|
||||
|
@ -59,7 +59,7 @@ from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.sgettext
|
||||
from gramps.gui.glade import Glade
|
||||
from gramps.gui.editors import FilterEditor
|
||||
from gramps.gen.constfunc import conv_to_unicode, uni_to_gui, get_curr_dir
|
||||
from gramps.gen.constfunc import conv_to_unicode, get_curr_dir
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
Loading…
Reference in New Issue
Block a user