mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
Make the capitalize function re-useable
This commit is contained in:
parent
30deb207e4
commit
8d2654a5ec
@ -6,6 +6,8 @@ from __future__ import (unicode_literals, division, absolute_import,
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
import string
|
||||
|
||||
from calibre.utils.config import JSONConfig
|
||||
tprefs = JSONConfig('tweak_book_gui')
|
||||
|
||||
@ -19,6 +21,10 @@ tprefs.defaults['choose_tweak_fmt'] = True
|
||||
tprefs.defaults['tweak_fmt_order'] = ['EPUB', 'AZW3']
|
||||
tprefs.defaults['update_metadata_from_calibre'] = True
|
||||
|
||||
ucase_map = {l:string.ascii_uppercase[i] for i, l in enumerate(string.ascii_lowercase)}
|
||||
def capitalize(x):
|
||||
return ucase_map[x[0]] + x[1:]
|
||||
|
||||
_current_container = None
|
||||
|
||||
def current_container():
|
||||
|
@ -6,7 +6,7 @@ from __future__ import (unicode_literals, division, absolute_import,
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
import sys, string, weakref
|
||||
import sys, weakref
|
||||
from functools import wraps
|
||||
|
||||
from PyQt4.Qt import (
|
||||
@ -16,6 +16,7 @@ from PyQt4.Qt import (
|
||||
from calibre import fit_image
|
||||
from calibre.constants import isosx
|
||||
from calibre.gui2 import error_dialog, pixmap_to_data
|
||||
from calibre.gui2.tweak_book import capitalize
|
||||
from calibre.utils.config_base import tweaks
|
||||
from calibre.utils.magick import Image
|
||||
from calibre.utils.magick.draw import identify_data
|
||||
@ -30,10 +31,6 @@ def painter(func):
|
||||
painter.restore()
|
||||
return ans
|
||||
|
||||
ucase_map = {l:string.ascii_uppercase[i] for i, l in enumerate(string.ascii_lowercase)}
|
||||
def capitalize(x):
|
||||
return ucase_map[x[0]] + x[1:]
|
||||
|
||||
class SelectionState(object):
|
||||
|
||||
__slots__ = ('last_press_point', 'current_mode', 'rect', 'in_selection', 'drag_corner', 'dragging', 'last_drag_pos')
|
||||
|
Loading…
x
Reference in New Issue
Block a user