Remove get_unicode_path_from_env_var(), get_unicode_path_from_file_chooser()

Two very cumbersome ways of saying conv_to_unicode().
(cherry picked from commit 55610b6f0a)
This commit is contained in:
John Ralls 2014-04-20 16:35:22 -07:00
parent 72c5c82f7d
commit 236a031b14
21 changed files with 71 additions and 105 deletions

View File

@ -46,8 +46,7 @@ import sys
#
#-------------------------------------------------------------------------
from gramps.gen.recentfiles import recent_files
from gramps.gen.utils.file import (rm_tempdir, get_empty_tempdir,
get_unicode_path_from_env_var)
from gramps.gen.utils.file import rm_tempdir, get_empty_tempdir
from gramps.gen.db import DbBsddb
from .clidbman import CLIDbManager, NAME_FILE, find_locker_name
@ -56,6 +55,7 @@ from gramps.gen.plug.report import CATEGORY_BOOK, CATEGORY_CODE, BookList
from .plug import cl_report, cl_book
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext
from gramps.gen.constfunc import conv_to_unicode
#-------------------------------------------------------------------------
#
@ -213,7 +213,7 @@ class ArgHandler(object):
"""
if value is None:
return None
value = get_unicode_path_from_env_var(value)
value = conv_to_unicode(value, sys.stdin.encoding)
db_path = self.__deduce_db_path(value)
if db_path:
@ -243,8 +243,7 @@ class ArgHandler(object):
"""
# Need to convert path/filename to unicode before opening
# For non latin characters in Windows path/file/user names
value = get_unicode_path_from_env_var(value)
fname = value
fname = conv_to_unicode(value, sys.stdin.encoding)
fullpath = os.path.abspath(os.path.expanduser(fname))
if fname != '-' and not os.path.exists(fullpath):
self.__error(_('Error: Import file %s not found.') % fname)
@ -280,8 +279,7 @@ class ArgHandler(object):
return
# Need to convert path/filename to unicode before opening
# For non latin characters in Windows path/file/user names
value = get_unicode_path_from_env_var(value)
fname = value
fname = conv_to_unicode(value, sys.stdin.encoding)
if fname == '-':
fullpath = '-'
else:

View File

@ -36,7 +36,7 @@ Module responsible for handling the command line arguments for GRAMPS.
# Standard python modules
#
#-------------------------------------------------------------------------
from __future__ import print_function
from __future__ import print_function, unicode_literals
import sys
import getopt
import logging
@ -49,9 +49,9 @@ import logging
from gramps.gen.const import LONGOPTS, SHORTOPTS
from gramps.gen.config import config
from gramps.gen.utils.cast import get_type_converter
from gramps.gen.utils.file import get_unicode_path_from_env_var
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext
from gramps.gen.constfunc import conv_to_unicode
_HELP = _("""
Usage: gramps.py [OPTION...]
@ -225,7 +225,8 @@ class ArgParser(object):
# -Ärik is '-\xc3\x84rik' and getopt will respond :
# option -\xc3 not recognized
for arg in range(len(self.args) - 1):
self.args[arg+1] = get_unicode_path_from_env_var(self.args[arg + 1])
self.args[arg+1] = conv_to_unicode(self.args[arg + 1],
sys.stdin.encoding)
options, leftargs = getopt.getopt(self.args[1:],
SHORTOPTS, LONGOPTS)
except getopt.GetoptError as msg:
@ -371,7 +372,8 @@ class ArgParser(object):
# but not for non-latin characters in list elements
cliargs = "[ "
for arg in range(len(self.args) - 1):
cliargs += get_unicode_path_from_env_var(self.args[arg + 1]) + " "
cliargs += conv_to_unicode(self.args[arg + 1],
sys.stdin.encoding) + ' '
cliargs += "]"
self.errors += [(_('Error parsing the arguments'),
_("Error parsing the arguments: %s \n"

View File

@ -54,11 +54,11 @@ from ._pluginreg import make_environment
from ..const import USER_PLUGINS
from ...version import VERSION_TUPLE
from . import BasePluginManager
from ..utils.file import get_unicode_path_from_file_chooser
from ..utils.configmanager import safe_eval
from ..config import config
from ..const import GRAMPS_LOCALE as glocale
_ = glocale.translation.sgettext
from ..constfunc import conv_to_unicode
#-------------------------------------------------------------------------
#
@ -369,7 +369,7 @@ def load_addon_file(path, callback=None):
gpr_files = set([os.path.split(os.path.join(USER_PLUGINS, name))[0]
for name in good_gpr])
for gpr_file in gpr_files:
u_gpr_file = get_unicode_path_from_file_chooser(gpr_file)
u_gpr_file = conv_to_unicode(gpr_file)
if callback:
callback(" " + (_("Registered '%s'") % u_gpr_file) + "\n")
file_obj.close()

View File

@ -60,7 +60,6 @@ _NEW_NAME_PATTERN = '%s%sUntitled_%d.%s'
def find_file( filename):
# try the filename we got
try:
fname = filename
if os.path.isfile(filename):
return(filename)
except UnicodeError:
@ -72,7 +71,6 @@ def find_file( filename):
def find_folder( filename):
# try the filename we got
try:
fname = filename
if os.path.isdir(filename):
return(filename)
except UnicodeError:
@ -82,26 +80,6 @@ def find_folder( filename):
repr(filename))
return ''
def get_unicode_path_from_file_chooser(path):
"""
Return the Unicode version of a path string.
:type path: str
:param path: The path to be converted to Unicode
:rtype: unicode
:returns: The Unicode version of path.
"""
# make only unicode of path of type 'str'
return conv_to_unicode(path)
def get_unicode_path_from_env_var(path):
'''
Environment variables should always return unicodes.
'''
assert isinstance(path, UNITYPE)
return path
def get_new_filename(ext, folder='~/'):
ix = 1
while os.path.isfile(os.path.expanduser(_NEW_NAME_PATTERN %

View File

@ -45,7 +45,7 @@ import tempfile
# Gramps modules
#
#-------------------------------------------------------------------------
from .file import get_unicode_path_from_env_var
from ..constfunc import conv_to_unicode
def crop_percentage_to_subpixel(width, height, crop):
"""
@ -283,7 +283,7 @@ def resize_to_jpeg_buffer(source, size, crop=None):
scaled = img.scale_simple(int(size[0]), int(size[1]), GdkPixbuf.InterpType.BILINEAR)
os.close(filed)
dest = get_unicode_path_from_env_var(dest)
dest = conv_to_unicode(dest, None)
scaled.savev(dest, "jpeg", "", "")
ofile = open(dest, mode='rb')
data = ofile.read()

View File

@ -32,8 +32,6 @@
from __future__ import print_function
import random
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext
import os
from xml.sax.saxutils import escape
import collections
@ -53,17 +51,16 @@ from gi.repository import Gtk
#
#-------------------------------------------------------------------------
from gramps.gen.config import config
from gramps.gen.const import HOME_DIR
from gramps.gen.const import HOME_DIR, GRAMPS_LOCALE as glocale
from gramps.gen.datehandler import get_date_formats
from gramps.gen.display.name import displayer as _nd
from gramps.gen.display.name import NameDisplayError
from gramps.gen.utils.file import get_unicode_path_from_file_chooser
from gramps.gen.utils.alive import update_constants
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 cuni
from gramps.gen.constfunc import conv_to_unicode
from .managedwindow import ManagedWindow
from .widgets import MarkupLabel, BasicLabel
from .dialog import ErrorDialog, QuestionDialog2, OkDialog
@ -72,6 +69,7 @@ from gramps.gen.plug.utils import available_updates
from .plug import PluginWindows
from gramps.gen.errors import WindowActiveError
from .spell import HAVE_GTKSPELL
_ = glocale.translation.gettext
#-------------------------------------------------------------------------
#
@ -251,7 +249,7 @@ class ConfigureDialog(ManagedWindow):
:param constant: the config setting to which the text value must be
saved
"""
self.__config.set(constant, cuni(obj.get_text()))
self.__config.set(constant, conv_to_unicode(obj.get_text()))
def update_color(self, obj, constant, color_hex_label):
color = obj.get_color()
@ -1388,7 +1386,7 @@ class GrampsPreferences(ConfigureDialog):
status = f.run()
if status == Gtk.ResponseType.OK:
val = get_unicode_path_from_file_chooser(f.get_filename())
val = conv_to_unicode(f.get_filename())
if val:
self.path_entry.set_text(val)
f.destroy()
@ -1412,13 +1410,13 @@ class GrampsPreferences(ConfigureDialog):
status = f.run()
if status == Gtk.ResponseType.OK:
val = get_unicode_path_from_file_chooser(f.get_filename())
val = conv_to_unicode(f.get_filename())
if val:
self.dbpath_entry.set_text(val)
f.destroy()
def update_idformat_entry(self, obj, constant):
config.set(constant, cuni(obj.get_text()))
config.set(constant, conv_to_unicode(obj.get_text()))
self.dbstate.db.set_prefixes(
config.get('preferences.iprefix'),
config.get('preferences.oprefix'),

View File

@ -66,8 +66,7 @@ from gramps.gen.db.exceptions import (DbUpgradeRequiredError,
BsddbDowngradeRequiredError,
PythonUpgradeRequiredError,
PythonDowngradeError)
from gramps.gen.constfunc import STRTYPE
from gramps.gen.utils.file import get_unicode_path_from_file_chooser
from gramps.gen.constfunc import STRTYPE, UNITYPE, conv_to_unicode
from .pluginmanager import GuiPluginManager
from .dialog import (DBErrorDialog, ErrorDialog, QuestionDialog2,
WarningDialog)
@ -174,7 +173,7 @@ class DbLoader(CLIDbLoader):
if response == Gtk.ResponseType.CANCEL:
break
elif response == Gtk.ResponseType.OK:
filename = get_unicode_path_from_file_chooser(import_dialog.get_filename())
filename = conv_to_unicode(import_dialog.get_filename())
if self.check_errors(filename):
# displays errors if any
continue
@ -213,7 +212,7 @@ class DbLoader(CLIDbLoader):
In this process, a warning dialog can pop up.
"""
if not isinstance(filename, STRTYPE):
if not isinstance(filename, (STRTYPE, UNITYPE)):
return True
filename = os.path.normpath(os.path.abspath(filename))

View File

@ -85,7 +85,6 @@ from gramps.gen.recentfiles import rename_filename, remove_filename
from .glade import Glade
from gramps.gen.db.backup import restore
from gramps.gen.db.exceptions import DbException
from gramps.gen.utils.file import get_unicode_path_from_env_var
_RETURN = Gdk.keyval_from_name("Return")

View File

@ -38,7 +38,7 @@ import os
#-------------------------------------------------------------------------
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext
from gramps.gen.constfunc import cuni
from gramps.gen.constfunc import cuni, conv_to_unicode
#-------------------------------------------------------------------------
#
@ -54,8 +54,8 @@ from gi.repository import GdkPixbuf
#-------------------------------------------------------------------------
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,
find_file, get_unicode_path_from_file_chooser)
from gramps.gen.utils.file import (media_path_full, media_path, relative_path,
find_file)
from gramps.gen.mime import get_type
from ..thumbnails import find_mime_type_pixbuf
from ..display import display_help
@ -152,7 +152,7 @@ class AddMediaObject(ManagedWindow):
ErrorDialog(msgstr, msgstr2)
return
filename = get_unicode_path_from_file_chooser(self.file_text.get_filename())
filename = conv_to_unicode(self.file_text.get_filename())
full_file = filename
if self.relpath.get_active():
@ -189,7 +189,7 @@ class AddMediaObject(ManagedWindow):
fname = self.file_text.get_filename()
if not fname:
return
filename = get_unicode_path_from_file_chooser(fname)
filename = conv_to_unicode(fname)
basename = os.path.basename(filename)
(root, ext) = os.path.splitext(basename)
old_title = cuni(self.description.get_text())

View File

@ -50,8 +50,7 @@ from gramps.gen.lib import MediaObject, NoteType
from gramps.gen.db import DbTxn
from gramps.gen.mime import get_description, get_type
from ..thumbnails import get_thumbnail_image, find_mime_type_pixbuf
from gramps.gen.utils.file import (media_path_full, find_file,
get_unicode_path_from_file_chooser)
from gramps.gen.utils.file import (media_path_full, find_file)
from .editprimary import EditPrimary
from ..widgets import (MonitoredDate, MonitoredEntry, PrivacyButton,
MonitoredTagList)
@ -307,7 +306,7 @@ class EditMedia(EditPrimary):
self.ok_button.set_sensitive(True)
return
self.obj.set_path(get_unicode_path_from_file_chooser(path))
self.obj.set_path(conv_to_unicode(path))
with DbTxn('', self.db) as trans:
if not self.obj.get_handle():

View File

@ -45,12 +45,14 @@ from gi.repository import Gdk
# gramps modules
#
#-------------------------------------------------------------------------
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
from ..thumbnails import get_thumbnail_image, find_mime_type_pixbuf
from gramps.gen.utils.file import (media_path_full, find_file,
get_unicode_path_from_file_chooser)
from gramps.gen.utils.file import (media_path_full, find_file)
from gramps.gen.lib import NoteType
from gramps.gen.db import DbTxn
from ..glade import Glade
@ -558,7 +560,7 @@ class EditMediaRef(EditReference):
def select_file(self, val):
self.determine_mime()
path = self.file_path.get_text()
self.source.set_path(get_unicode_path_from_file_chooser(path))
self.source.set_path(conv_to_unicode(path))
AddMediaObject(self.dbstate, self.uistate, self.track, self.source,
self._update_addmedia)

View File

@ -52,7 +52,6 @@ from gi.repository import GObject
# gramps modules
#
#-------------------------------------------------------------------------
from gramps.gen.utils.file import get_unicode_path_from_file_chooser
from ..utils import ProgressMeter
from ..pluginmanager import GuiPluginManager
from .. import widgets
@ -1702,12 +1701,12 @@ class GuiDestinationOption(Gtk.HBox):
status = fcd.run()
if status == Gtk.ResponseType.OK:
path = get_unicode_path_from_file_chooser(fcd.get_filename())
path = conv_to_unicode(fcd.get_filename())
if path:
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(path)
self.__entry.set_text(uni_to_gui(path))
self.__option.set_value(path)
fcd.destroy()

View File

@ -70,9 +70,8 @@ from ..dialog import InfoDialog, OkDialog
from ..editors import EditPerson
from ..glade import Glade
from ..listmodel import ListModel, NOSORT, TOGGLE
from gramps.gen.utils.file import get_unicode_path_from_file_chooser
from gramps.gen.const import URL_WIKISTRING, USER_HOME, WIKI_EXTRAPLUGINS_RAWDATA
from gramps.gen.constfunc import win
from gramps.gen.constfunc import win, conv_to_unicode
from gramps.gen.config import config
from ..widgets.progressdialog import (LongOpStatus, ProgressMonitor,
GtkProgressDialog)
@ -451,7 +450,7 @@ class PluginStatus(ManagedWindow):
status = fcd.run()
if status == Gtk.ResponseType.OK:
path = get_unicode_path_from_file_chooser(fcd.get_filename())
path = conv_to_unicode(fcd.get_filename())
if path:
self.install_addon_path.set_text(path)
fcd.destroy()

View File

@ -33,8 +33,6 @@
#-------------------------------------------------------------------------
import os
import sys
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext
#-------------------------------------------------------------------------
#
@ -59,11 +57,12 @@ from gi.repository import GdkPixbuf
#
#-------------------------------------------------------------------------
from gramps.gen.const import USER_HOME, ICON, SPLASH
from gramps.gen.const import USER_HOME, ICON, SPLASH, GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext
from gramps.gen.constfunc import conv_to_unicode
from gramps.gen.config import config
from ...pluginmanager import GuiPluginManager
from gramps.gen.utils.file import (find_folder, get_new_filename,
get_unicode_path_from_file_chooser)
from gramps.gen.utils.file import (find_folder, get_new_filename)
from ...managedwindow import ManagedWindow
from ...dialog import ErrorDialog
from ...user import User
@ -315,11 +314,11 @@ class ExportAssistant(Gtk.Assistant, ManagedWindow) :
Used as normal callback and event callback. For callback, we will have
show=True
"""
filename = filechooser.get_filename()
filename = conv_to_unicode(filechooser.get_filename())
if not filename:
self.set_page_complete(filechooser, False)
else:
folder = filechooser.get_current_folder()
folder = conv_to_unicode(filechooser.get_current_folder())
if not folder:
folder = find_folder(filename)
else:
@ -453,7 +452,7 @@ class ExportAssistant(Gtk.Assistant, ManagedWindow) :
#Allow for exotic error: file is still not correct
self.check_fileselect(self.chooser, show=False)
if self.get_page_complete(self.chooser) :
filename = get_unicode_path_from_file_chooser(self.chooser.get_filename())
filename = conv_to_unicode(self.chooser.get_filename())
name = os.path.split(filename)[1]
folder = os.path.split(filename)[0]
confirm_text = _(
@ -586,7 +585,7 @@ class ExportAssistant(Gtk.Assistant, ManagedWindow) :
hasattr(self.option_box_instance, "no_fileselect")):
filename = ""
else:
filename = get_unicode_path_from_file_chooser(self.chooser.get_filename())
filename = conv_to_unicode(self.chooser.get_filename())
config.set('paths.recent-export-dir', os.path.split(filename)[0])
ix = self.get_selected_format_index()
config.set('behavior.recent-export-type', ix)

View File

@ -62,7 +62,7 @@ class FileEntry(Gtk.HBox):
Gtk.STOCK_OPEN,
Gtk.ResponseType.OK))
name = os.path.basename(self.entry.get_text())
name = os.path.basename(conv_to_unicode(self.entry.get_text()))
if self.dir:
if os.path.isdir(name):
dialog.set_current_name(name)
@ -74,7 +74,7 @@ class FileEntry(Gtk.HBox):
dialog.present()
status = dialog.run()
if status == Gtk.ResponseType.OK:
self.set_filename(get_unicode_path_from_file_chooser(dialog.get_filename()))
self.set_filename(conv_to_unicode(dialog.get_filename()))
dialog.destroy()
def set_filename(self, path):
@ -87,7 +87,8 @@ class FileEntry(Gtk.HBox):
else:
self.__base_path = get_curr_dir()
self.__file_name = path
self.entry.set_text(os.path.join(self.__base_path, self.__file_name))
self.entry.set_text(uni_to_gui(os.path.join(self.__base_path,
self.__file_name)))
def get_full_path(self, val):
""" Get the full path of the currently selected file. """

View File

@ -47,7 +47,7 @@ from gi.repository import Gtk
# GRAMPS modules
#
#-------------------------------------------------------------------------
from gramps.gen.const import GRAMPS_LOCALE as glocale
from gramps.gen.const import GRAMPS_LOCALE as glocale, URL_MANUAL_PAGE
_ = glocale.translation.gettext
from gramps.gen.config import config
from gramps.gen.errors import DatabaseError, FilterError, ReportError, WindowActiveError
@ -63,8 +63,7 @@ from ...managedwindow import ManagedWindow
from ._stylecombobox import StyleComboBox
from ._styleeditor import StyleListDisplay
from ._fileentry import FileEntry
from gramps.gen.const import URL_MANUAL_PAGE
from gramps.gen.utils.file import get_unicode_path_from_file_chooser
from gramps.gen.constfunc import conv_to_unicode
#-------------------------------------------------------------------------
#
# Private Constants
@ -494,7 +493,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 = get_unicode_path_from_file_chooser(self.target_fileentry.get_full_path(0))
self.target_path = conv_to_unicode(self.target_fileentry.get_full_path(0))
if not self.target_path:
return None

View File

@ -91,8 +91,7 @@ from gramps.gen.errors import WindowActiveError
from .dialog import ErrorDialog, WarningDialog, QuestionDialog2, InfoDialog
from .widgets import Statusbar
from .undohistory import UndoHistory
from gramps.gen.utils.file import (media_path_full, get_unicode_path_from_env_var,
get_unicode_path_from_file_chooser)
from gramps.gen.utils.file import media_path_full
from .dbloader import DbLoader
from .display import display_help, display_url
from .configure import GrampsPreferences
@ -1102,7 +1101,7 @@ class ViewManager(CLIManager):
value = dialog.run()
if value:
(filename, title) = value
filename = conv_to_unicode(filename, 'utf8')
filename = conv_to_unicode(filename)
self.db_loader.read_file(filename)
self._post_load_newdb(filename, 'x-directory/normal', title)
@ -1301,9 +1300,10 @@ class ViewManager(CLIManager):
window.hide()
if d == Gtk.ResponseType.APPLY:
# if file exists, ask if overwrite; else abort
basefile = file_entry.get_text()
basefile = conv_to_unicode(file_entry.get_text())
basefile = basefile.replace("/", r"-")
filename = os.path.join(path_entry.get_text(), basefile)
filename = os.path.join(conv_to_unicode(path_entry.get_text()),
basefile)
if os.path.exists(filename):
question = QuestionDialog2(
_("Backup file already exists! Overwrite?"),
@ -1332,7 +1332,6 @@ class ViewManager(CLIManager):
writer.write(filename)
self.uistate.set_busy_cursor(False)
self.uistate.progress.hide()
filename = get_unicode_path_from_env_var(filename)
self.uistate.push_message(self.dbstate, _("Backup saved to '%s'") % filename)
config.set('paths.quick-backup-directory', path_entry.get_text())
else:
@ -1355,14 +1354,12 @@ class ViewManager(CLIManager):
if not mpath:
mpath = HOME_DIR
f.set_current_folder(os.path.dirname(mpath))
f.set_filename(os.path.join(mpath, "."))
f.set_filename(uni_to_gui(os.path.join(mpath, ".")))
status = f.run()
if status == Gtk.ResponseType.OK:
filename = f.get_filename()
if filename:
val = get_unicode_path_from_file_chooser(filename)
if val:
path_entry.set_text(val)
path_entry.set_text(val)
f.destroy()
return True

View File

@ -62,11 +62,10 @@ from gramps.gen.config import config
from gramps.gen.errors import WindowActiveError
from ..filters import SearchBar
from ..widgets.menuitem import add_menuitem
from gramps.gen.constfunc import UNITYPE
from gramps.gen.constfunc import UNITYPE, conv_to_unicode
from gramps.gen.const import CUSTOM_FILTERS
from gramps.gen.utils.debug import profile
from gramps.gen.utils.string import data_recover_msg
from gramps.gen.utils.file import get_unicode_path_from_file_chooser
from ..dialog import QuestionDialog, QuestionDialog2
from ..editors import FilterEditor
from gramps.gen.const import GRAMPS_LOCALE as glocale
@ -1005,7 +1004,7 @@ class ListView(NavigationView):
while True:
value = chooser.run()
fn = chooser.get_filename()
fn = get_unicode_path_from_file_chooser(fn)
fn = conv_to_unicode(fn)
fl = combobox.get_active()
if value == Gtk.ResponseType.OK:
if fn:

View File

@ -65,8 +65,8 @@ from gi.repository import Gtk
#-------------------------------------------------------------------------
from gramps.gui.plug.export import WriterOptionBox
from gramps.plugins.export.exportxml import XmlWriter
from gramps.gen.utils.file import media_path_full, get_unicode_path_from_file_chooser
from gramps.gen.constfunc import win
from gramps.gen.utils.file import media_path_full
from gramps.gen.constfunc import win, conv_to_unicode
#-------------------------------------------------------------------------
#
@ -161,7 +161,7 @@ class PackageWriter(object):
# pass
# def fs_ok_clicked(obj):
# name = get_unicode_path_from_file_chooser(fs_top.get_filename())
# name = conv_to_unicode(fs_top.get_filename())
# if os.path.isfile(name):
# archive.add(name)

View File

@ -68,8 +68,7 @@ from gramps.gen.config import config
from gramps.gen.utils.id import create_id
from gramps.gen.utils.db import family_name
from gramps.gen.utils.unknown import make_unknown
from gramps.gen.utils.file import (media_path_full, find_file, fix_encoding,
get_unicode_path_from_file_chooser)
from gramps.gen.utils.file import (media_path_full, find_file, fix_encoding)
from gramps.gui.managedwindow import ManagedWindow
from gramps.gui.plug import tool
@ -673,7 +672,7 @@ class CheckIntegrity(object):
logging.warning(' FAIL: references to missing file kept')
def fs_ok_clicked(obj):
name = get_unicode_path_from_file_chooser(fs_top.get_filename())
name = conv_to_unicode(fs_top.get_filename())
if os.path.isfile(name):
obj = self.db.get_object_from_handle(ObjectId)
obj.set_path(name)

View File

@ -47,7 +47,6 @@ from gi.repository import Gtk
from gramps.gen.filters import GenericFilter, rules
from gramps.gui.filters import build_filter_model
from gramps.gen.sort import Sort
from gramps.gen.utils.file import get_unicode_path_from_file_chooser
from gramps.gui.utils import ProgressMeter
from gramps.gen.utils.docgen import ODSTab
from gramps.gen.const import CUSTOM_FILTERS, URL_MANUAL_PAGE
@ -403,7 +402,7 @@ class DisplayChart(ManagedWindow):
f.hide()
if status == Gtk.ResponseType.OK:
name = get_unicode_path_from_file_chooser(f.get_filename())
name = conv_to_unicode(f.get_filename())
doc = ODSTab(len(self.row_data))
doc.creator(self.db.get_researcher().get_name())