Adjust frontend to normalized search syntax
This commit is contained in:
parent
84061a6e6d
commit
6d6cd87b8f
@ -1214,14 +1214,11 @@ QTableView {{ gridline-color: {grid} }}
|
|||||||
if i % 2 == 0:
|
if i % 2 == 0:
|
||||||
txt += a + ":"
|
txt += a + ":"
|
||||||
else:
|
else:
|
||||||
txt += re.sub(r"[*_\\]", r"\\\g<0>", a)
|
txt += re.sub(r'["*_\\]', r"\\\g<0>", a)
|
||||||
for c in ' ()"':
|
txt = '"{}"'.format(txt.replace('"', '\\"'))
|
||||||
if c in txt:
|
|
||||||
txt = '"{}"'.format(txt.replace('"', '\\"'))
|
|
||||||
break
|
|
||||||
items.append(txt)
|
items.append(txt)
|
||||||
txt = ""
|
txt = ""
|
||||||
txt = " ".join(items)
|
txt = " AND ".join(items)
|
||||||
# is there something to replace or append with?
|
# is there something to replace or append with?
|
||||||
if txt:
|
if txt:
|
||||||
if self.mw.app.keyboardModifiers() & Qt.AltModifier:
|
if self.mw.app.keyboardModifiers() & Qt.AltModifier:
|
||||||
@ -1230,9 +1227,9 @@ QTableView {{ gridline-color: {grid} }}
|
|||||||
cur = str(self.form.searchEdit.lineEdit().text())
|
cur = str(self.form.searchEdit.lineEdit().text())
|
||||||
if cur and cur != self._searchPrompt:
|
if cur and cur != self._searchPrompt:
|
||||||
if self.mw.app.keyboardModifiers() & Qt.ControlModifier:
|
if self.mw.app.keyboardModifiers() & Qt.ControlModifier:
|
||||||
txt = cur + " " + txt
|
txt = cur + " AND " + txt
|
||||||
elif self.mw.app.keyboardModifiers() & Qt.ShiftModifier:
|
elif self.mw.app.keyboardModifiers() & Qt.ShiftModifier:
|
||||||
txt = cur + " or " + txt
|
txt = cur + " OR " + txt
|
||||||
self.form.searchEdit.lineEdit().setText(txt)
|
self.form.searchEdit.lineEdit().setText(txt)
|
||||||
self.onSearchActivated()
|
self.onSearchActivated()
|
||||||
|
|
||||||
@ -1253,7 +1250,7 @@ QTableView {{ gridline-color: {grid} }}
|
|||||||
return self._simpleFilters(
|
return self._simpleFilters(
|
||||||
(
|
(
|
||||||
(tr(TR.BROWSING_WHOLE_COLLECTION), ""),
|
(tr(TR.BROWSING_WHOLE_COLLECTION), ""),
|
||||||
(tr(TR.BROWSING_CURRENT_DECK), "deck:current"),
|
(tr(TR.BROWSING_CURRENT_DECK), '"deck:current"'),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1262,9 +1259,9 @@ QTableView {{ gridline-color: {grid} }}
|
|||||||
subm.addChild(
|
subm.addChild(
|
||||||
self._simpleFilters(
|
self._simpleFilters(
|
||||||
(
|
(
|
||||||
(tr(TR.BROWSING_ADDED_TODAY), "added:1"),
|
(tr(TR.BROWSING_ADDED_TODAY), '"added:1"'),
|
||||||
(tr(TR.BROWSING_STUDIED_TODAY), "rated:1"),
|
(tr(TR.BROWSING_STUDIED_TODAY), '"rated:1"'),
|
||||||
(tr(TR.BROWSING_AGAIN_TODAY), "rated:1:1"),
|
(tr(TR.BROWSING_AGAIN_TODAY), '"rated:1:1"'),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -1275,20 +1272,20 @@ QTableView {{ gridline-color: {grid} }}
|
|||||||
subm.addChild(
|
subm.addChild(
|
||||||
self._simpleFilters(
|
self._simpleFilters(
|
||||||
(
|
(
|
||||||
(tr(TR.ACTIONS_NEW), "is:new"),
|
(tr(TR.ACTIONS_NEW), '"is:new"'),
|
||||||
(tr(TR.SCHEDULING_LEARNING), "is:learn"),
|
(tr(TR.SCHEDULING_LEARNING), '"is:learn"'),
|
||||||
(tr(TR.SCHEDULING_REVIEW), "is:review"),
|
(tr(TR.SCHEDULING_REVIEW), '"is:review"'),
|
||||||
(tr(TR.FILTERING_IS_DUE), "is:due"),
|
(tr(TR.FILTERING_IS_DUE), '"is:due"'),
|
||||||
None,
|
None,
|
||||||
(tr(TR.BROWSING_SUSPENDED), "is:suspended"),
|
(tr(TR.BROWSING_SUSPENDED), '"is:suspended"'),
|
||||||
(tr(TR.BROWSING_BURIED), "is:buried"),
|
(tr(TR.BROWSING_BURIED), '"is:buried"'),
|
||||||
None,
|
None,
|
||||||
(tr(TR.ACTIONS_RED_FLAG), "flag:1"),
|
(tr(TR.ACTIONS_RED_FLAG), '"flag:1"'),
|
||||||
(tr(TR.ACTIONS_ORANGE_FLAG), "flag:2"),
|
(tr(TR.ACTIONS_ORANGE_FLAG), '"flag:2"'),
|
||||||
(tr(TR.ACTIONS_GREEN_FLAG), "flag:3"),
|
(tr(TR.ACTIONS_GREEN_FLAG), '"flag:3"'),
|
||||||
(tr(TR.ACTIONS_BLUE_FLAG), "flag:4"),
|
(tr(TR.ACTIONS_BLUE_FLAG), '"flag:4"'),
|
||||||
(tr(TR.BROWSING_NO_FLAG), "flag:0"),
|
(tr(TR.BROWSING_NO_FLAG), '"flag:0"'),
|
||||||
(tr(TR.BROWSING_ANY_FLAG), "-flag:0"),
|
(tr(TR.BROWSING_ANY_FLAG), '"-flag:0"'),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user