From d36e92459e7caf452a4fcdb7f677013af9f2267b Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Sat, 29 Dec 2012 02:40:23 +0100 Subject: [PATCH] py3: start to fix filechooser unicode() usage, but a lot bad case is still remaining and not fixed. This require a deeper look on what should be str/unicode by default. --- kivy/data/style.kv | 8 ++++---- kivy/uix/filechooser.py | 7 +------ 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/kivy/data/style.kv b/kivy/data/style.kv index 2e35461e5..47ed93bb9 100644 --- a/kivy/data/style.kv +++ b/kivy/data/style.kv @@ -281,12 +281,12 @@ text_size: self.width, None halign: 'left' shorten: True - text: unicode(ctx.name) + text: ctx.name Label: text_size: self.width, None size_hint_x: None halign: 'right' - text: unicode(ctx.get_nice_size()) + text: '{}'.format(ctx.get_nice_size()) : @@ -336,7 +336,7 @@ source: 'atlas://data/images/defaulttheme/filechooser_%s' % ('folder' if ctx.isdir else 'file') pos: root.x + dp(24), root.y + dp(40) Label: - text: unicode(ctx.name) + text: ctx.name text_size: (root.width, self.height) halign: 'center' shorten: True @@ -344,7 +344,7 @@ pos: root.x, root.y + dp(16) Label: - text: unicode(ctx.get_nice_size()) + text: '{}'.format(ctx.get_nice_size()) font_size: '11sp' color: .8, .8, .8, 1 size: '100dp', '16sp' diff --git a/kivy/uix/filechooser.py b/kivy/uix/filechooser.py index aa2c02622..5e78504a3 100644 --- a/kivy/uix/filechooser.py +++ b/kivy/uix/filechooser.py @@ -384,12 +384,7 @@ class FileChooserController(FloatLayout): # _add_file does, so if it fails here, it would also fail later # on. Do the check here to prevent setting path to an invalid # directory that we cannot list. - try: - path = entry.path.decode('utf-8') - except UnicodeEncodeError: - path = entry.path - pass - listdir(path) + listdir(entry.path) except OSError: #Logger.exception(e) entry.locked = True