Unicode conversion not required for FileChooserDialog methods

This commit is contained in:
Nick Hall 2015-11-28 23:03:29 +00:00
parent 452fbfac80
commit 415540e4a6
11 changed files with 17 additions and 23 deletions

View File

@ -1466,7 +1466,7 @@ 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.path_entry.set_text(val)
f.destroy()

View File

@ -64,7 +64,6 @@ from gramps.gen.db.exceptions import (DbUpgradeRequiredError,
BsddbDowngradeRequiredError,
PythonUpgradeRequiredError,
PythonDowngradeError)
from gramps.gen.constfunc import conv_to_unicode
from .pluginmanager import GuiPluginManager
from .dialog import (DBErrorDialog, ErrorDialog, QuestionDialog2,
WarningDialog)
@ -171,7 +170,7 @@ class DbLoader(CLIDbLoader):
if response == Gtk.ResponseType.CANCEL:
break
elif response == Gtk.ResponseType.OK:
filename = conv_to_unicode(import_dialog.get_filename())
filename = import_dialog.get_filename()
if self.check_errors(filename):
# displays errors if any
continue

View File

@ -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
from gramps.gen.constfunc import get_curr_dir
from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext
@ -1714,7 +1714,7 @@ class GuiDestinationOption(Gtk.Box):
status = fcd.run()
if status == Gtk.ResponseType.OK:
path = conv_to_unicode(fcd.get_filename())
path = fcd.get_filename()
if path:
if not self.__option.get_directory_entry() and \
not path.endswith(self.__option.get_extension()):

View File

@ -67,7 +67,6 @@ from ..editors import EditPerson
from ..glade import Glade
from ..listmodel import ListModel, NOSORT, TOGGLE
from gramps.gen.const import URL_WIKISTRING, USER_HOME, WIKI_EXTRAPLUGINS_RAWDATA
from gramps.gen.constfunc import win, conv_to_unicode
from gramps.gen.config import config
from ..widgets.progressdialog import (LongOpStatus, ProgressMonitor,
GtkProgressDialog)
@ -441,7 +440,7 @@ class PluginStatus(ManagedWindow):
status = fcd.run()
if status == Gtk.ResponseType.OK:
path = conv_to_unicode(fcd.get_filename())
path = fcd.get_filename()
if path:
self.install_addon_path.set_text(path)
fcd.destroy()

View File

@ -57,7 +57,6 @@ from gi.repository import GdkPixbuf
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)
@ -314,11 +313,11 @@ class ExportAssistant(Gtk.Assistant, ManagedWindow) :
Used as normal callback and event callback. For callback, we will have
show=True
"""
filename = conv_to_unicode(filechooser.get_filename())
filename = filechooser.get_filename()
if not filename:
self.set_page_complete(filechooser, False)
else:
folder = conv_to_unicode(filechooser.get_current_folder())
folder = filechooser.get_current_folder()
if not folder:
folder = find_folder(filename)
else:
@ -452,7 +451,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 = conv_to_unicode(self.chooser.get_filename())
filename = self.chooser.get_filename()
name = os.path.split(filename)[1]
folder = os.path.split(filename)[0]
confirm_text = _(
@ -585,7 +584,7 @@ class ExportAssistant(Gtk.Assistant, ManagedWindow) :
hasattr(self.option_box_instance, "no_fileselect")):
filename = ""
else:
filename = conv_to_unicode(self.chooser.get_filename())
filename = 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

@ -77,7 +77,7 @@ class FileEntry(Gtk.Box):
dialog.present()
status = dialog.run()
if status == Gtk.ResponseType.OK:
self.set_filename(conv_to_unicode(dialog.get_filename()))
self.set_filename(dialog.get_filename())
dialog.destroy()
def set_filename(self, path):

View File

@ -57,7 +57,6 @@ 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 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
@ -1018,7 +1017,6 @@ class ListView(NavigationView):
while True:
value = chooser.run()
fn = chooser.get_filename()
fn = conv_to_unicode(fn)
fl = combobox.get_active()
if value == Gtk.ResponseType.OK:
if fn:

View File

@ -60,7 +60,7 @@ 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
from gramps.gen.constfunc import win, conv_to_unicode
from gramps.gen.constfunc import win
#-------------------------------------------------------------------------
#
@ -155,7 +155,7 @@ class PackageWriter(object):
# pass
# def fs_ok_clicked(obj):
# name = conv_to_unicode(fs_top.get_filename())
# name = fs_top.get_filename()
# if os.path.isfile(name):
# archive.add(name)

View File

@ -60,7 +60,6 @@ from gramps.gui.managedwindow import ManagedWindow
from gramps.gen.config import config
from gramps.gui.editors import EditPlace, EditEvent, EditFamily, EditPerson
from gramps.gui.selectors.selectplace import SelectPlace
from gramps.gen.constfunc import conv_to_unicode
import gi
gi.require_version('OsmGpsMap', '1.0')
@ -945,7 +944,7 @@ class GeoGraphyView(OsmGps, NavigationView):
status = kml.run()
if status == Gtk.ResponseType.OK:
val = conv_to_unicode(kml.get_filename())
val = kml.get_filename()
if val:
kmlfile = Kml(val)
points = kmlfile.add_points()
@ -1184,7 +1183,7 @@ class GeoGraphyView(OsmGps, NavigationView):
status = f.run()
if status == Gtk.ResponseType.OK:
val = conv_to_unicode(f.get_filename())
val = f.get_filename()
if val:
self.path_entry.set_text(val)
f.destroy()

View File

@ -677,7 +677,7 @@ class CheckIntegrity(object):
logging.warning(' FAIL: references to missing file kept')
def fs_ok_clicked(obj):
name = conv_to_unicode(fs_top.get_filename())
name = fs_top.get_filename()
if os.path.isfile(name):
obj = self.db.get_object_from_handle(ObjectId)
obj.set_path(name)

View File

@ -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, get_curr_dir
from gramps.gen.constfunc import get_curr_dir
#-------------------------------------------------------------------------
#
@ -403,7 +403,7 @@ class DisplayChart(ManagedWindow):
f.hide()
if status == Gtk.ResponseType.OK:
name = conv_to_unicode(f.get_filename())
name = f.get_filename()
doc = ODSTab(len(self.row_data))
doc.creator(self.db.get_researcher().get_name())