diff --git a/src/calibre/gui2/main.ui b/src/calibre/gui2/main.ui
index 8849c2fa07..5cf8f9d35e 100644
--- a/src/calibre/gui2/main.ui
+++ b/src/calibre/gui2/main.ui
@@ -231,7 +231,7 @@
- 3
+ 0
@@ -239,33 +239,6 @@
-
-
-
-
-
- Match any
-
-
- false
-
-
-
- -
-
-
- Match all
-
-
- true
-
-
-
- -
-
-
- Sort by &popularity
-
-
-
-
@@ -282,6 +255,30 @@
+ -
+
+
+ Sort by &popularity
+
+
+
+ -
+
+
+ 0
+
+
-
+
+ Match any
+
+
+ -
+
+ Match all
+
+
+
+
-
diff --git a/src/calibre/gui2/tag_view.py b/src/calibre/gui2/tag_view.py
index 6cf5defda4..0f02f2a591 100644
--- a/src/calibre/gui2/tag_view.py
+++ b/src/calibre/gui2/tag_view.py
@@ -21,16 +21,21 @@ class TagsView(QTreeView):
self.setUniformRowHeights(True)
self.setCursor(Qt.PointingHandCursor)
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.popularity = popularity
- self.match_all = match_all
+ self.tag_match = tag_match
self.setModel(self._model)
self.connect(self, SIGNAL('clicked(QModelIndex)'), self.toggle)
self.popularity.setChecked(config['sort_by_popularity'])
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):
config.set('sort_by_popularity', state == Qt.Checked)
self.model().refresh()
@@ -40,7 +45,7 @@ class TagsView(QTreeView):
exclusive = modifiers not in (Qt.CTRL, Qt.SHIFT)
if self._model.toggle(index, exclusive):
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):
self.model().clear_state()
diff --git a/src/calibre/gui2/ui.py b/src/calibre/gui2/ui.py
index b847186c2a..f9fbcbae3a 100644
--- a/src/calibre/gui2/ui.py
+++ b/src/calibre/gui2/ui.py
@@ -498,10 +498,9 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
self.cover_cache.start()
self.library_view.model().cover_cache = self.cover_cache
self.tags_view.setVisible(False)
- self.match_all.setVisible(False)
- self.match_any.setVisible(False)
+ self.tag_match.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,
SIGNAL('tags_marked(PyQt_PyObject, PyQt_PyObject)'),
self.search.search_from_tags)
@@ -708,14 +707,12 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI):
def toggle_tags_view(self, show):
if show:
self.tags_view.setVisible(True)
- self.match_all.setVisible(True)
- self.match_any.setVisible(True)
+ self.tag_match.setVisible(True)
self.popularity.setVisible(True)
self.tags_view.setFocus(Qt.OtherFocusReason)
else:
self.tags_view.setVisible(False)
- self.match_all.setVisible(False)
- self.match_any.setVisible(False)
+ self.tag_match.setVisible(False)
self.popularity.setVisible(False)
def search_done(self, view, ok):