Fix cover browser positioning and only open viewer when doubleclicking on row numbers

This commit is contained in:
Kovid Goyal 2010-06-08 15:35:10 -06:00
parent fb9d327cbf
commit 3d551ff1ab
2 changed files with 40 additions and 34 deletions

View File

@ -329,7 +329,7 @@
<number>0</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="library"> <widget class="QWidget" name="library">
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_4">
<item> <item>
<widget class="Splitter" name="horizontal_splitter"> <widget class="Splitter" name="horizontal_splitter">
<property name="orientation"> <property name="orientation">
@ -389,6 +389,9 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="">
<layout class="QVBoxLayout" name="cb_layout">
<item>
<widget class="BooksView" name="library_view"> <widget class="BooksView" name="library_view">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
@ -421,6 +424,9 @@
<bool>false</bool> <bool>false</bool>
</property> </property>
</widget> </widget>
</item>
</layout>
</widget>
</widget> </widget>
</item> </item>
</layout> </layout>

View File

@ -597,7 +597,7 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
self.cover_flow = CoverFlow(height=cfh, text_height=text_height) self.cover_flow = CoverFlow(height=cfh, text_height=text_height)
self.cover_flow.setVisible(False) self.cover_flow.setVisible(False)
if not config['separate_cover_flow']: if not config['separate_cover_flow']:
self.library.layout().addWidget(self.cover_flow) self.cb_layout.addWidget(self.cover_flow)
self.cover_flow.currentChanged.connect(self.sync_listview_to_cf) self.cover_flow.currentChanged.connect(self.sync_listview_to_cf)
self.library_view.selectionModel().currentRowChanged.connect( self.library_view.selectionModel().currentRowChanged.connect(
self.sync_cf_to_listview) self.sync_cf_to_listview)
@ -638,7 +638,6 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
self.connect(self.scheduler, self.connect(self.scheduler,
SIGNAL('start_recipe_fetch(PyQt_PyObject)'), SIGNAL('start_recipe_fetch(PyQt_PyObject)'),
self.download_scheduled_recipe, Qt.QueuedConnection) 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'): for view in ('library', 'memory', 'card_a', 'card_b'):
view = getattr(self, view+'_view') view = getattr(self, view+'_view')
@ -923,6 +922,7 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
index = m.index(row, 0) index = m.index(row, 0)
if self.library_view.currentIndex().row() != row and index.isValid(): if self.library_view.currentIndex().row() != row and index.isValid():
self.cover_flow_sync_flag = False self.cover_flow_sync_flag = False
self.library_view.scrollTo(index)
sm = self.library_view.selectionModel() sm = self.library_view.selectionModel()
sm.select(index, sm.ClearAndSelect|sm.Rows) sm.select(index, sm.ClearAndSelect|sm.Rows)
self.library_view.setCurrentIndex(index) self.library_view.setCurrentIndex(index)