mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
py3: make cover grid texture selection work
map() is an iterable, so using it as a shortcut for a proper for loop in order to apply functions, is no longer valid. Also move from the long deprecated string.*() functions -- which no longer exist in python3 -- that are better dealt with through the native str/unicode type methods.
This commit is contained in:
parent
9714f722e7
commit
d9918b5b9c
@ -6,7 +6,7 @@ from __future__ import (unicode_literals, division, absolute_import,
|
|||||||
__license__ = 'GPL v3'
|
__license__ = 'GPL v3'
|
||||||
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
|
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||||
|
|
||||||
import glob, os, string, shutil
|
import glob, os, shutil
|
||||||
from functools import partial
|
from functools import partial
|
||||||
from PyQt5.Qt import (
|
from PyQt5.Qt import (
|
||||||
QDialog, QVBoxLayout, QListWidget, QListWidgetItem, Qt, QIcon,
|
QDialog, QVBoxLayout, QListWidget, QListWidgetItem, Qt, QIcon,
|
||||||
@ -72,7 +72,7 @@ class TextureChooser(QDialog):
|
|||||||
images = [{
|
images = [{
|
||||||
'fname': ':'+os.path.basename(x),
|
'fname': ':'+os.path.basename(x),
|
||||||
'path': x,
|
'path': x,
|
||||||
'name': ' '.join(map(string.capitalize, os.path.splitext(os.path.basename(x))[0].split('_')))
|
'name': ' '.join(map(lambda s: s.capitalize(), os.path.splitext(os.path.basename(x))[0].split('_')))
|
||||||
} for x in glob.glob(I('textures/*.png'))] + [{
|
} for x in glob.glob(I('textures/*.png'))] + [{
|
||||||
'fname': os.path.basename(x),
|
'fname': os.path.basename(x),
|
||||||
'path': x,
|
'path': x,
|
||||||
@ -81,7 +81,8 @@ class TextureChooser(QDialog):
|
|||||||
|
|
||||||
images.sort(key=lambda x:sort_key(x['name']))
|
images.sort(key=lambda x:sort_key(x['name']))
|
||||||
|
|
||||||
map(self.create_item, images)
|
for i in images:
|
||||||
|
self.create_item(i)
|
||||||
self.update_remove_state()
|
self.update_remove_state()
|
||||||
|
|
||||||
if initial:
|
if initial:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user