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.

This commit is contained in:
Mathieu Virbel 2012-12-29 02:40:23 +01:00 committed by Dusty Phillips
parent b1192d8bf3
commit d36e92459e
2 changed files with 5 additions and 10 deletions

View File

@ -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())
<FileChooserIconView>:
@ -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'

View File

@ -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