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() status = f.run()
if status == Gtk.ResponseType.OK: if status == Gtk.ResponseType.OK:
val = conv_to_unicode(f.get_filename()) val = f.get_filename()
if val: if val:
self.path_entry.set_text(val) self.path_entry.set_text(val)
f.destroy() f.destroy()

View File

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

View File

@ -59,7 +59,7 @@ from ..selectors import SelectorFactory
from gramps.gen.display.name import displayer as _nd from gramps.gen.display.name import displayer as _nd
from gramps.gen.display.place import displayer as _pd from gramps.gen.display.place import displayer as _pd
from gramps.gen.filters import GenericFilterFactory, GenericFilter, rules 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 from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext _ = glocale.translation.gettext
@ -1714,7 +1714,7 @@ class GuiDestinationOption(Gtk.Box):
status = fcd.run() status = fcd.run()
if status == Gtk.ResponseType.OK: if status == Gtk.ResponseType.OK:
path = conv_to_unicode(fcd.get_filename()) path = fcd.get_filename()
if path: if path:
if not self.__option.get_directory_entry() and \ if not self.__option.get_directory_entry() and \
not path.endswith(self.__option.get_extension()): not path.endswith(self.__option.get_extension()):

View File

@ -67,7 +67,6 @@ from ..editors import EditPerson
from ..glade import Glade from ..glade import Glade
from ..listmodel import ListModel, NOSORT, TOGGLE from ..listmodel import ListModel, NOSORT, TOGGLE
from gramps.gen.const import URL_WIKISTRING, USER_HOME, WIKI_EXTRAPLUGINS_RAWDATA 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 gramps.gen.config import config
from ..widgets.progressdialog import (LongOpStatus, ProgressMonitor, from ..widgets.progressdialog import (LongOpStatus, ProgressMonitor,
GtkProgressDialog) GtkProgressDialog)
@ -441,7 +440,7 @@ class PluginStatus(ManagedWindow):
status = fcd.run() status = fcd.run()
if status == Gtk.ResponseType.OK: if status == Gtk.ResponseType.OK:
path = conv_to_unicode(fcd.get_filename()) path = fcd.get_filename()
if path: if path:
self.install_addon_path.set_text(path) self.install_addon_path.set_text(path)
fcd.destroy() 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 from gramps.gen.const import USER_HOME, ICON, SPLASH, GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext _ = glocale.translation.gettext
from gramps.gen.constfunc import conv_to_unicode
from gramps.gen.config import config from gramps.gen.config import config
from ...pluginmanager import GuiPluginManager from ...pluginmanager import GuiPluginManager
from gramps.gen.utils.file import (find_folder, get_new_filename) 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 Used as normal callback and event callback. For callback, we will have
show=True show=True
""" """
filename = conv_to_unicode(filechooser.get_filename()) filename = filechooser.get_filename()
if not filename: if not filename:
self.set_page_complete(filechooser, False) self.set_page_complete(filechooser, False)
else: else:
folder = conv_to_unicode(filechooser.get_current_folder()) folder = filechooser.get_current_folder()
if not folder: if not folder:
folder = find_folder(filename) folder = find_folder(filename)
else: else:
@ -452,7 +451,7 @@ class ExportAssistant(Gtk.Assistant, ManagedWindow) :
#Allow for exotic error: file is still not correct #Allow for exotic error: file is still not correct
self.check_fileselect(self.chooser, show=False) self.check_fileselect(self.chooser, show=False)
if self.get_page_complete(self.chooser) : 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] name = os.path.split(filename)[1]
folder = os.path.split(filename)[0] folder = os.path.split(filename)[0]
confirm_text = _( confirm_text = _(
@ -585,7 +584,7 @@ class ExportAssistant(Gtk.Assistant, ManagedWindow) :
hasattr(self.option_box_instance, "no_fileselect")): hasattr(self.option_box_instance, "no_fileselect")):
filename = "" filename = ""
else: 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]) config.set('paths.recent-export-dir', os.path.split(filename)[0])
ix = self.get_selected_format_index() ix = self.get_selected_format_index()
config.set('behavior.recent-export-type', ix) config.set('behavior.recent-export-type', ix)

View File

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

View File

@ -57,7 +57,6 @@ from gramps.gen.config import config
from gramps.gen.errors import WindowActiveError from gramps.gen.errors import WindowActiveError
from ..filters import SearchBar from ..filters import SearchBar
from ..widgets.menuitem import add_menuitem from ..widgets.menuitem import add_menuitem
from gramps.gen.constfunc import conv_to_unicode
from gramps.gen.const import CUSTOM_FILTERS from gramps.gen.const import CUSTOM_FILTERS
from gramps.gen.utils.debug import profile from gramps.gen.utils.debug import profile
from gramps.gen.utils.string import data_recover_msg from gramps.gen.utils.string import data_recover_msg
@ -1018,7 +1017,6 @@ class ListView(NavigationView):
while True: while True:
value = chooser.run() value = chooser.run()
fn = chooser.get_filename() fn = chooser.get_filename()
fn = conv_to_unicode(fn)
fl = combobox.get_active() fl = combobox.get_active()
if value == Gtk.ResponseType.OK: if value == Gtk.ResponseType.OK:
if fn: if fn:

View File

@ -60,7 +60,7 @@ from gi.repository import Gtk
from gramps.gui.plug.export import WriterOptionBox from gramps.gui.plug.export import WriterOptionBox
from gramps.plugins.export.exportxml import XmlWriter from gramps.plugins.export.exportxml import XmlWriter
from gramps.gen.utils.file import media_path_full 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 # pass
# def fs_ok_clicked(obj): # def fs_ok_clicked(obj):
# name = conv_to_unicode(fs_top.get_filename()) # name = fs_top.get_filename()
# if os.path.isfile(name): # if os.path.isfile(name):
# archive.add(name) # archive.add(name)

View File

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

View File

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

View File

@ -59,7 +59,7 @@ from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.sgettext _ = glocale.translation.sgettext
from gramps.gui.glade import Glade from gramps.gui.glade import Glade
from gramps.gui.editors import FilterEditor 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() f.hide()
if status == Gtk.ResponseType.OK: if status == Gtk.ResponseType.OK:
name = conv_to_unicode(f.get_filename()) name = f.get_filename()
doc = ODSTab(len(self.row_data)) doc = ODSTab(len(self.row_data))
doc.creator(self.db.get_researcher().get_name()) doc.creator(self.db.get_researcher().get_name())