mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
Make more space available vertically for tag browser
This commit is contained in:
parent
4b66da2fe6
commit
928f7b8db8
@ -231,7 +231,7 @@
|
|||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>3</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="library">
|
<widget class="QWidget" name="library">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
@ -239,33 +239,6 @@
|
|||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
|
||||||
<widget class="QRadioButton" name="match_any">
|
|
||||||
<property name="text">
|
|
||||||
<string>Match any</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QRadioButton" name="match_all">
|
|
||||||
<property name="text">
|
|
||||||
<string>Match all</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="popularity">
|
|
||||||
<property name="text">
|
|
||||||
<string>Sort by &popularity</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="TagsView" name="tags_view">
|
<widget class="TagsView" name="tags_view">
|
||||||
<property name="tabKeyNavigation">
|
<property name="tabKeyNavigation">
|
||||||
@ -282,6 +255,30 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="popularity">
|
||||||
|
<property name="text">
|
||||||
|
<string>Sort by &popularity</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="tag_match">
|
||||||
|
<property name="currentIndex">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Match any</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Match all</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
@ -21,16 +21,21 @@ class TagsView(QTreeView):
|
|||||||
self.setUniformRowHeights(True)
|
self.setUniformRowHeights(True)
|
||||||
self.setCursor(Qt.PointingHandCursor)
|
self.setCursor(Qt.PointingHandCursor)
|
||||||
self.setIconSize(QSize(30, 30))
|
self.setIconSize(QSize(30, 30))
|
||||||
|
self.tag_match = None
|
||||||
|
|
||||||
def set_database(self, db, match_all, popularity):
|
def set_database(self, db, tag_match, popularity):
|
||||||
self._model = TagsModel(db, parent=self)
|
self._model = TagsModel(db, parent=self)
|
||||||
self.popularity = popularity
|
self.popularity = popularity
|
||||||
self.match_all = match_all
|
self.tag_match = tag_match
|
||||||
self.setModel(self._model)
|
self.setModel(self._model)
|
||||||
self.connect(self, SIGNAL('clicked(QModelIndex)'), self.toggle)
|
self.connect(self, SIGNAL('clicked(QModelIndex)'), self.toggle)
|
||||||
self.popularity.setChecked(config['sort_by_popularity'])
|
self.popularity.setChecked(config['sort_by_popularity'])
|
||||||
self.connect(self.popularity, SIGNAL('stateChanged(int)'), self.sort_changed)
|
self.connect(self.popularity, SIGNAL('stateChanged(int)'), self.sort_changed)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def match_all(self):
|
||||||
|
return self.tag_match and self.tag_match.currentIndex() > 0
|
||||||
|
|
||||||
def sort_changed(self, state):
|
def sort_changed(self, state):
|
||||||
config.set('sort_by_popularity', state == Qt.Checked)
|
config.set('sort_by_popularity', state == Qt.Checked)
|
||||||
self.model().refresh()
|
self.model().refresh()
|
||||||
@ -40,7 +45,7 @@ class TagsView(QTreeView):
|
|||||||
exclusive = modifiers not in (Qt.CTRL, Qt.SHIFT)
|
exclusive = modifiers not in (Qt.CTRL, Qt.SHIFT)
|
||||||
if self._model.toggle(index, exclusive):
|
if self._model.toggle(index, exclusive):
|
||||||
self.emit(SIGNAL('tags_marked(PyQt_PyObject, PyQt_PyObject)'),
|
self.emit(SIGNAL('tags_marked(PyQt_PyObject, PyQt_PyObject)'),
|
||||||
self._model.tokens(), self.match_all.isChecked())
|
self._model.tokens(), self.match_all)
|
||||||
|
|
||||||
def clear(self):
|
def clear(self):
|
||||||
self.model().clear_state()
|
self.model().clear_state()
|
||||||
|
@ -498,10 +498,9 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
|
|||||||
self.cover_cache.start()
|
self.cover_cache.start()
|
||||||
self.library_view.model().cover_cache = self.cover_cache
|
self.library_view.model().cover_cache = self.cover_cache
|
||||||
self.tags_view.setVisible(False)
|
self.tags_view.setVisible(False)
|
||||||
self.match_all.setVisible(False)
|
self.tag_match.setVisible(False)
|
||||||
self.match_any.setVisible(False)
|
|
||||||
self.popularity.setVisible(False)
|
self.popularity.setVisible(False)
|
||||||
self.tags_view.set_database(db, self.match_all, self.popularity)
|
self.tags_view.set_database(db, self.tag_match, self.popularity)
|
||||||
self.connect(self.tags_view,
|
self.connect(self.tags_view,
|
||||||
SIGNAL('tags_marked(PyQt_PyObject, PyQt_PyObject)'),
|
SIGNAL('tags_marked(PyQt_PyObject, PyQt_PyObject)'),
|
||||||
self.search.search_from_tags)
|
self.search.search_from_tags)
|
||||||
@ -708,14 +707,12 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
|
|||||||
def toggle_tags_view(self, show):
|
def toggle_tags_view(self, show):
|
||||||
if show:
|
if show:
|
||||||
self.tags_view.setVisible(True)
|
self.tags_view.setVisible(True)
|
||||||
self.match_all.setVisible(True)
|
self.tag_match.setVisible(True)
|
||||||
self.match_any.setVisible(True)
|
|
||||||
self.popularity.setVisible(True)
|
self.popularity.setVisible(True)
|
||||||
self.tags_view.setFocus(Qt.OtherFocusReason)
|
self.tags_view.setFocus(Qt.OtherFocusReason)
|
||||||
else:
|
else:
|
||||||
self.tags_view.setVisible(False)
|
self.tags_view.setVisible(False)
|
||||||
self.match_all.setVisible(False)
|
self.tag_match.setVisible(False)
|
||||||
self.match_any.setVisible(False)
|
|
||||||
self.popularity.setVisible(False)
|
self.popularity.setVisible(False)
|
||||||
|
|
||||||
def search_done(self, view, ok):
|
def search_done(self, view, ok):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user