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
2bc30f891c
@ -506,7 +506,7 @@ class ITUNES(DriverBase):
|
|||||||
if self.iTunes:
|
if self.iTunes:
|
||||||
# Check for connected book-capable device
|
# Check for connected book-capable device
|
||||||
self.sources = self._get_sources()
|
self.sources = self._get_sources()
|
||||||
if 'iPod' in self.sources:
|
if 'iPod' in self.sources and not self.ejected:
|
||||||
#if DEBUG:
|
#if DEBUG:
|
||||||
#sys.stdout.write('.')
|
#sys.stdout.write('.')
|
||||||
#sys.stdout.flush()
|
#sys.stdout.flush()
|
||||||
@ -2036,16 +2036,17 @@ class ITUNES(DriverBase):
|
|||||||
if 'iPod' in self.sources:
|
if 'iPod' in self.sources:
|
||||||
connected_device = self.sources['iPod']
|
connected_device = self.sources['iPod']
|
||||||
device = self.iTunes.sources[connected_device]
|
device = self.iTunes.sources[connected_device]
|
||||||
|
dev_books = None
|
||||||
for pl in device.playlists():
|
for pl in device.playlists():
|
||||||
if pl.special_kind() == appscript.k.Books:
|
if pl.special_kind() == appscript.k.Books:
|
||||||
if DEBUG:
|
if DEBUG:
|
||||||
self.log.info(" Book playlist: '%s'" % (pl.name()))
|
self.log.info(" Book playlist: '%s'" % (pl.name()))
|
||||||
books = pl.file_tracks()
|
dev_books = pl.file_tracks()
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
self.log.error(" book_playlist not found")
|
self.log.error(" book_playlist not found")
|
||||||
|
|
||||||
for book in books:
|
for book in dev_books:
|
||||||
# This may need additional entries for international iTunes users
|
# This may need additional entries for international iTunes users
|
||||||
if book.kind() in self.Audiobooks:
|
if book.kind() in self.Audiobooks:
|
||||||
if DEBUG:
|
if DEBUG:
|
||||||
|
@ -4,12 +4,12 @@ __docformat__ = 'restructuredtext en'
|
|||||||
__license__ = 'GPL v3'
|
__license__ = 'GPL v3'
|
||||||
|
|
||||||
from PyQt4.Qt import (Qt, QDialog, QTableWidgetItem, QAbstractItemView, QIcon,
|
from PyQt4.Qt import (Qt, QDialog, QTableWidgetItem, QAbstractItemView, QIcon,
|
||||||
QString, QDialogButtonBox, QFrame, QLabel, QTimer)
|
QDialogButtonBox, QFrame, QLabel, QTimer)
|
||||||
|
|
||||||
from calibre.ebooks.metadata import author_to_author_sort
|
from calibre.ebooks.metadata import author_to_author_sort
|
||||||
from calibre.gui2 import error_dialog
|
from calibre.gui2 import error_dialog
|
||||||
from calibre.gui2.dialogs.edit_authors_dialog_ui import Ui_EditAuthorsDialog
|
from calibre.gui2.dialogs.edit_authors_dialog_ui import Ui_EditAuthorsDialog
|
||||||
from calibre.utils.icu import sort_key, strcmp
|
from calibre.utils.icu import sort_key
|
||||||
|
|
||||||
class tableItem(QTableWidgetItem):
|
class tableItem(QTableWidgetItem):
|
||||||
def __ge__(self, other):
|
def __ge__(self, other):
|
||||||
|
@ -8,7 +8,6 @@ __copyright__ = '2011, Kovid Goyal <kovid@kovidgoyal.net>'
|
|||||||
__docformat__ = 'restructuredtext en'
|
__docformat__ = 'restructuredtext en'
|
||||||
|
|
||||||
import textwrap, re, os
|
import textwrap, re, os
|
||||||
from functools import partial
|
|
||||||
|
|
||||||
from PyQt4.Qt import (Qt, QDateEdit, QDate, pyqtSignal, QMessageBox,
|
from PyQt4.Qt import (Qt, QDateEdit, QDate, pyqtSignal, QMessageBox,
|
||||||
QIcon, QToolButton, QWidget, QLabel, QGridLayout,
|
QIcon, QToolButton, QWidget, QLabel, QGridLayout,
|
||||||
@ -23,7 +22,7 @@ from calibre.ebooks.metadata import (title_sort, authors_to_string,
|
|||||||
string_to_authors, check_isbn)
|
string_to_authors, check_isbn)
|
||||||
from calibre.ebooks.metadata.meta import get_metadata
|
from calibre.ebooks.metadata.meta import get_metadata
|
||||||
from calibre.gui2 import (file_icon_provider, UNDEFINED_QDATE, UNDEFINED_DATE,
|
from calibre.gui2 import (file_icon_provider, UNDEFINED_QDATE, UNDEFINED_DATE,
|
||||||
choose_files, error_dialog, choose_images, question_dialog)
|
choose_files, error_dialog, choose_images)
|
||||||
from calibre.utils.date import local_tz, qt_to_dt
|
from calibre.utils.date import local_tz, qt_to_dt
|
||||||
from calibre import strftime
|
from calibre import strftime
|
||||||
from calibre.ebooks import BOOK_EXTENSIONS
|
from calibre.ebooks import BOOK_EXTENSIONS
|
||||||
@ -192,8 +191,8 @@ class AuthorsEdit(MultiCompleteComboBox):
|
|||||||
else:
|
else:
|
||||||
self.current_val = self.original_val
|
self.current_val = self.original_val
|
||||||
first_author = self.current_val[0] if len(self.current_val) else None
|
first_author = self.current_val[0] if len(self.current_val) else None
|
||||||
self.dialog.parent().do_author_sort_edit(self,
|
first_author_id = self.db.get_author_id(first_author) if first_author else None
|
||||||
self.db.get_author_id(first_author),
|
self.dialog.parent().do_author_sort_edit(self, first_author_id,
|
||||||
select_sort=False)
|
select_sort=False)
|
||||||
self.initialize(self.db, self.id_)
|
self.initialize(self.db, self.id_)
|
||||||
self.dialog.author_sort.initialize(self.db, self.id_)
|
self.dialog.author_sort.initialize(self.db, self.id_)
|
||||||
@ -273,13 +272,13 @@ class AuthorSortEdit(EnLineEdit):
|
|||||||
'No action is required if this is what you want.'))
|
'No action is required if this is what you want.'))
|
||||||
self.tooltips = (ok_tooltip, bad_tooltip)
|
self.tooltips = (ok_tooltip, bad_tooltip)
|
||||||
|
|
||||||
self.authors_edit.editTextChanged.connect(partial(self.update_state, True))
|
self.authors_edit.editTextChanged.connect(self.update_state_and_val)
|
||||||
self.textChanged.connect(partial(self.update_state, False))
|
self.textChanged.connect(self.update_state)
|
||||||
|
|
||||||
autogen_button.clicked.connect(self.auto_generate)
|
autogen_button.clicked.connect(self.auto_generate)
|
||||||
copy_a_to_as_action.triggered.connect(self.auto_generate)
|
copy_a_to_as_action.triggered.connect(self.auto_generate)
|
||||||
copy_as_to_a_action.triggered.connect(self.copy_to_authors)
|
copy_as_to_a_action.triggered.connect(self.copy_to_authors)
|
||||||
self.update_state(False)
|
self.update_state()
|
||||||
|
|
||||||
@dynamic_property
|
@dynamic_property
|
||||||
def current_val(self):
|
def current_val(self):
|
||||||
@ -295,12 +294,15 @@ class AuthorSortEdit(EnLineEdit):
|
|||||||
|
|
||||||
return property(fget=fget, fset=fset)
|
return property(fget=fget, fset=fset)
|
||||||
|
|
||||||
def update_state(self, modify_aus, *args):
|
def update_state_and_val(self):
|
||||||
au = unicode(self.authors_edit.text())
|
au = unicode(self.authors_edit.text())
|
||||||
# Handle case change if the authors box changed
|
# Handle case change if the authors box changed
|
||||||
if modify_aus and strcmp(au, self.current_val) == 0:
|
if strcmp(au, self.current_val) == 0:
|
||||||
self.current_val = au
|
self.current_val = au
|
||||||
|
self.update_state()
|
||||||
|
|
||||||
|
def update_state(self, *args):
|
||||||
|
au = unicode(self.authors_edit.text())
|
||||||
au = re.sub(r'\s+et al\.$', '', au)
|
au = re.sub(r'\s+et al\.$', '', au)
|
||||||
au = self.db.author_sort_from_authors(string_to_authors(au))
|
au = self.db.author_sort_from_authors(string_to_authors(au))
|
||||||
|
|
||||||
|
@ -944,6 +944,7 @@ class EPUB_MOBI(CatalogPlugin):
|
|||||||
catalog.createDirectoryStructure()
|
catalog.createDirectoryStructure()
|
||||||
catalog.copyResources()
|
catalog.copyResources()
|
||||||
catalog.buildSources()
|
catalog.buildSources()
|
||||||
|
Options managed in gui2.catalog.catalog_epub_mobi.py
|
||||||
'''
|
'''
|
||||||
|
|
||||||
# A single number creates 'Last x days' only.
|
# A single number creates 'Last x days' only.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user