mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 18:54:09 -04:00
Implement #4266 (Double-click to view in main window)
This commit is contained in:
parent
f1952a3fc2
commit
2d5adba731
@ -693,6 +693,8 @@ class BooksView(TableView):
|
||||
self._model.current_changed)
|
||||
self.connect(self._model, SIGNAL('columns_sorted()'),
|
||||
self.columns_sorted, Qt.QueuedConnection)
|
||||
hv = self.verticalHeader()
|
||||
hv.setClickable(True)
|
||||
|
||||
def columns_sorted(self):
|
||||
for i in range(self.model().columnCount(None)):
|
||||
|
@ -552,6 +552,11 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
|
||||
self.connect(self.scheduler,
|
||||
SIGNAL('start_recipe_fetch(PyQt_PyObject)'),
|
||||
self.download_scheduled_recipe, Qt.QueuedConnection)
|
||||
self.library_view.verticalHeader().sectionClicked.connect(self.view_specific_book)
|
||||
|
||||
for view in ('library', 'memory', 'card_a', 'card_b'):
|
||||
view = getattr(self, view+'_view')
|
||||
view.verticalHeader().sectionDoubleClicked.connect(self.view_specific_book)
|
||||
|
||||
self.location_view.setCurrentIndex(self.location_view.model().index(0))
|
||||
|
||||
@ -1442,7 +1447,12 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
|
||||
|
||||
def view_book(self, triggered):
|
||||
rows = self.current_view().selectionModel().selectedRows()
|
||||
self._view_books(rows)
|
||||
|
||||
def view_specific_book(self, index):
|
||||
self._view_books([index])
|
||||
|
||||
def _view_books(self, rows):
|
||||
if not rows or len(rows) == 0:
|
||||
self._launch_viewer()
|
||||
return
|
||||
@ -1458,7 +1468,8 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
|
||||
|
||||
if self.current_view() is self.library_view:
|
||||
for row in rows:
|
||||
row = row.row()
|
||||
if hasattr(row, 'row'):
|
||||
row = row.row()
|
||||
|
||||
formats = self.library_view.model().db.formats(row)
|
||||
title = self.library_view.model().db.title(row)
|
||||
|
Loading…
x
Reference in New Issue
Block a user