mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Merge from trunk
This commit is contained in:
commit
dc0158b488
@ -21,6 +21,7 @@ from calibre.ebooks.metadata.book.base import Metadata
|
|||||||
from calibre.utils.date import parse_date, isoformat
|
from calibre.utils.date import parse_date, isoformat
|
||||||
from calibre.utils.localization import get_lang
|
from calibre.utils.localization import get_lang
|
||||||
from calibre import prints
|
from calibre import prints
|
||||||
|
from calibre.utils.cleantext import clean_ascii_chars
|
||||||
|
|
||||||
class Resource(object): # {{{
|
class Resource(object): # {{{
|
||||||
'''
|
'''
|
||||||
@ -1157,7 +1158,7 @@ class OPFCreator(Metadata):
|
|||||||
|
|
||||||
def DC_ELEM(tag, text, dc_attrs={}, opf_attrs={}):
|
def DC_ELEM(tag, text, dc_attrs={}, opf_attrs={}):
|
||||||
if text:
|
if text:
|
||||||
elem = getattr(DC, tag)(text, **dc_attrs)
|
elem = getattr(DC, tag)(clean_ascii_chars(text), **dc_attrs)
|
||||||
else:
|
else:
|
||||||
elem = getattr(DC, tag)(**dc_attrs)
|
elem = getattr(DC, tag)(**dc_attrs)
|
||||||
for k, v in opf_attrs.items():
|
for k, v in opf_attrs.items():
|
||||||
@ -1260,7 +1261,6 @@ def metadata_to_opf(mi, as_string=True):
|
|||||||
from lxml import etree
|
from lxml import etree
|
||||||
import textwrap
|
import textwrap
|
||||||
from calibre.ebooks.oeb.base import OPF, DC
|
from calibre.ebooks.oeb.base import OPF, DC
|
||||||
from calibre.utils.cleantext import clean_ascii_chars
|
|
||||||
|
|
||||||
if not mi.application_id:
|
if not mi.application_id:
|
||||||
mi.application_id = str(uuid.uuid4())
|
mi.application_id = str(uuid.uuid4())
|
||||||
|
@ -428,7 +428,7 @@ class BooksModel(QAbstractTableModel): # {{{
|
|||||||
au = self.db.authors(row)
|
au = self.db.authors(row)
|
||||||
if not au:
|
if not au:
|
||||||
au = _('Unknown')
|
au = _('Unknown')
|
||||||
au = ', '.join([a.strip() for a in au.split(',')])
|
au = authors_to_string([a.strip().replace('|', ',') for a in au.split(',')])
|
||||||
data[_('Author(s)')] = au
|
data[_('Author(s)')] = au
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ from PyQt4.Qt import Qt, QTreeView, QApplication, pyqtSignal, QFont, QSize, \
|
|||||||
QIcon, QPoint, QVBoxLayout, QHBoxLayout, QComboBox, QTimer,\
|
QIcon, QPoint, QVBoxLayout, QHBoxLayout, QComboBox, QTimer,\
|
||||||
QAbstractItemModel, QVariant, QModelIndex, QMenu, QFrame,\
|
QAbstractItemModel, QVariant, QModelIndex, QMenu, QFrame,\
|
||||||
QPushButton, QWidget, QItemDelegate, QString, QLabel, \
|
QPushButton, QWidget, QItemDelegate, QString, QLabel, \
|
||||||
QShortcut, QKeySequence, SIGNAL, QMimeData
|
QShortcut, QKeySequence, SIGNAL, QMimeData, QSizePolicy
|
||||||
|
|
||||||
from calibre.ebooks.metadata import title_sort
|
from calibre.ebooks.metadata import title_sort
|
||||||
from calibre.gui2 import config, NONE, gprefs
|
from calibre.gui2 import config, NONE, gprefs
|
||||||
@ -2064,7 +2064,8 @@ class TagBrowserWidget(QWidget): # {{{
|
|||||||
self.search_button = QPushButton()
|
self.search_button = QPushButton()
|
||||||
self.search_button.setText(_('F&ind'))
|
self.search_button.setText(_('F&ind'))
|
||||||
self.search_button.setToolTip(_('Find the first/next matching item'))
|
self.search_button.setToolTip(_('Find the first/next matching item'))
|
||||||
self.search_button.setFixedWidth(40)
|
self.search_button.setSizePolicy(QSizePolicy(QSizePolicy.Minimum,
|
||||||
|
QSizePolicy.Minimum))
|
||||||
search_layout.addWidget(self.search_button)
|
search_layout.addWidget(self.search_button)
|
||||||
|
|
||||||
self.expand_button = QPushButton()
|
self.expand_button = QPushButton()
|
||||||
@ -2072,6 +2073,9 @@ class TagBrowserWidget(QWidget): # {{{
|
|||||||
self.expand_button.setFixedWidth(20)
|
self.expand_button.setFixedWidth(20)
|
||||||
self.expand_button.setToolTip(_('Collapse all categories'))
|
self.expand_button.setToolTip(_('Collapse all categories'))
|
||||||
search_layout.addWidget(self.expand_button)
|
search_layout.addWidget(self.expand_button)
|
||||||
|
search_layout.setStretch(0, 10)
|
||||||
|
search_layout.setStretch(1, 1)
|
||||||
|
search_layout.setStretch(2, 1)
|
||||||
|
|
||||||
self.current_find_position = None
|
self.current_find_position = None
|
||||||
self.search_button.clicked.connect(self.find)
|
self.search_button.clicked.connect(self.find)
|
||||||
|
@ -140,8 +140,8 @@ class RecipeModel(QAbstractItemModel, SearchQueryParser):
|
|||||||
self.scheduler_config = SchedulerConfig()
|
self.scheduler_config = SchedulerConfig()
|
||||||
try:
|
try:
|
||||||
with zipfile.ZipFile(P('builtin_recipes.zip'), 'r') as zf:
|
with zipfile.ZipFile(P('builtin_recipes.zip'), 'r') as zf:
|
||||||
self.favicons = dict([(x, zf.getinfo(x)) for x in zf.namelist() if
|
self.favicons = dict([(x.filename, x) for x in zf.infolist() if
|
||||||
x.endswith('.png')])
|
x.filename.endswith('.png')])
|
||||||
except:
|
except:
|
||||||
self.favicons = {}
|
self.favicons = {}
|
||||||
self.do_refresh()
|
self.do_refresh()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user