Implement #2551 (Open book from "Edit meta information" menu)

This commit is contained in:
Kovid Goyal 2009-06-06 19:54:04 -07:00
parent bf0426f15c
commit 1494818cf0
2 changed files with 17 additions and 0 deletions

View File

@ -249,6 +249,8 @@ class MetadataSingleDialog(ResizableDialog, Ui_MetadataSingleDialog):
self.remove_unused_series)
QObject.connect(self.auto_author_sort, SIGNAL('clicked()'),
self.deduce_author_sort)
self.connect(self.formats, SIGNAL('itemDoubleClicked(QListWidgetItem*)'),
self.show_format)
self.connect(self.button_set_cover, SIGNAL('clicked()'), self.set_cover)
self.connect(self.reset_cover, SIGNAL('clicked()'), self.do_reset_cover)
self.connect(self.swap_button, SIGNAL('clicked()'), self.swap_title_author)
@ -303,6 +305,10 @@ class MetadataSingleDialog(ResizableDialog, Ui_MetadataSingleDialog):
if not pm.isNull():
self.cover.setPixmap(pm)
def show_format(self, item, *args):
fmt = item.ext
self.emit(SIGNAL('view_format(PyQt_PyObject)'), fmt)
def deduce_author_sort(self):
au = unicode(self.authors.text())
authors = string_to_authors(au)

View File

@ -953,9 +953,12 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
self.library_view.model().refresh_ids([id])
for row in rows:
self._metadata_view_id = self.library_view.model().db.id(row.row())
d = MetadataSingleDialog(self, row.row(),
self.library_view.model().db,
accepted_callback=accepted)
self.connect(d, SIGNAL('view_format(PyQt_PyObject)'),
self.metadata_view_format)
d.exec_()
if rows:
current = self.library_view.currentIndex()
@ -1269,6 +1272,14 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
if fmt_path:
self._view_file(fmt_path)
def metadata_view_format(self, fmt):
fmt_path = self.library_view.model().db.\
format_abspath(self._metadata_view_id,
fmt, index_is_id=True)
if fmt_path:
self._view_file(fmt_path)
def book_downloaded_for_viewing(self, job):
if job.failed:
self.device_job_exception(job)