mirror of
https://github.com/ankitects/anki.git
synced 2025-09-23 08:22:24 -04:00
add collection/deck shortcuts, refresh when saved changes
This commit is contained in:
parent
fa2e0e6428
commit
b28eb4fba6
3 changed files with 64 additions and 0 deletions
|
@ -811,12 +811,20 @@ by clicking on one on the left."""))
|
||||||
def buildTree(self):
|
def buildTree(self):
|
||||||
self.sidebarTree.clear()
|
self.sidebarTree.clear()
|
||||||
root = self.sidebarTree
|
root = self.sidebarTree
|
||||||
|
self._stdTree(root)
|
||||||
self._favTree(root)
|
self._favTree(root)
|
||||||
self._decksTree(root)
|
self._decksTree(root)
|
||||||
self._modelTree(root)
|
self._modelTree(root)
|
||||||
self._userTagTree(root)
|
self._userTagTree(root)
|
||||||
self.sidebarTree.setIndentation(15)
|
self.sidebarTree.setIndentation(15)
|
||||||
|
|
||||||
|
def _stdTree(self, root):
|
||||||
|
for name, filt, icon in [[_("Whole Collection"), "", "collection"],
|
||||||
|
[_("Current Deck"), "deck:current", "deck"]]:
|
||||||
|
item = self.CallbackItem(
|
||||||
|
root, name, self._filterFunc(filt))
|
||||||
|
item.setIcon(0, QIcon(":/icons/{}.svg".format(icon)))
|
||||||
|
|
||||||
def _favTree(self, root):
|
def _favTree(self, root):
|
||||||
saved = self.col.conf.get('savedFilters', {})
|
saved = self.col.conf.get('savedFilters', {})
|
||||||
for name, filt in sorted(saved.items()):
|
for name, filt in sorted(saved.items()):
|
||||||
|
@ -1042,6 +1050,7 @@ by clicking on one on the left."""))
|
||||||
filt = self.form.searchEdit.lineEdit().text()
|
filt = self.form.searchEdit.lineEdit().text()
|
||||||
self.col.conf['savedFilters'][name] = filt
|
self.col.conf['savedFilters'][name] = filt
|
||||||
self.col.setMod()
|
self.col.setMod()
|
||||||
|
self.maybeRefreshSidebar()
|
||||||
|
|
||||||
def _onRemoveFilter(self):
|
def _onRemoveFilter(self):
|
||||||
name = self._currentFilterIsSaved()
|
name = self._currentFilterIsSaved()
|
||||||
|
@ -1049,6 +1058,7 @@ by clicking on one on the left."""))
|
||||||
return
|
return
|
||||||
del self.col.conf['savedFilters'][name]
|
del self.col.conf['savedFilters'][name]
|
||||||
self.col.setMod()
|
self.col.setMod()
|
||||||
|
self.maybeRefreshSidebar()
|
||||||
|
|
||||||
# returns name if found
|
# returns name if found
|
||||||
def _currentFilterIsSaved(self):
|
def _currentFilterIsSaved(self):
|
||||||
|
|
|
@ -5,5 +5,6 @@
|
||||||
<file>icons/deck.svg</file>
|
<file>icons/deck.svg</file>
|
||||||
<file>icons/notetype.svg</file>
|
<file>icons/notetype.svg</file>
|
||||||
<file>icons/heart.svg</file>
|
<file>icons/heart.svg</file>
|
||||||
|
<file>icons/collection.svg</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
53
designer/icons/collection.svg
Normal file
53
designer/icons/collection.svg
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||||
|
<svg width="100%" height="100%" viewBox="0 0 60 60" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:1.5;">
|
||||||
|
<g transform="matrix(1,0,0,1,-417,0)">
|
||||||
|
<g id="collection" transform="matrix(1,0,0,1,-1274,0)">
|
||||||
|
<rect x="1691" y="0" width="60" height="60" style="fill:none;"/>
|
||||||
|
<g transform="matrix(0.945433,0,0,0.945433,92.6601,2.16669)">
|
||||||
|
<g transform="matrix(0.655113,0.00163422,-0.00192709,0.772517,1299.93,28.3878)">
|
||||||
|
<path d="M673,7L652,7L652,10.91L668.201,11.013L668.243,32.903L673,32.903L673,7Z" style="fill:none;stroke:black;stroke-width:4px;"/>
|
||||||
|
</g>
|
||||||
|
<g transform="matrix(0.655113,0.00163422,-0.00192709,0.772517,1303.38,25.2565)">
|
||||||
|
<path d="M673,7L652,7L652,10.91L668.201,11.013L668.243,32.903L673,32.903L673,7Z" style="fill:none;stroke:black;stroke-width:4px;"/>
|
||||||
|
</g>
|
||||||
|
<g transform="matrix(0.655113,0.00163422,-0.00192709,0.772517,1296.78,31.5145)">
|
||||||
|
<path d="M673,7L652,7L652,32.903L673,32.903L673,7Z" style="fill:none;stroke:black;stroke-width:4px;"/>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
<g transform="matrix(0.945433,0,0,0.945433,66.6601,2.16669)">
|
||||||
|
<g transform="matrix(0.655113,0.00163422,-0.00192709,0.772517,1299.93,28.3878)">
|
||||||
|
<path d="M673,7L652,7L652,10.91L668.201,11.013L668.243,32.903L673,32.903L673,7Z" style="fill:none;stroke:black;stroke-width:4px;"/>
|
||||||
|
</g>
|
||||||
|
<g transform="matrix(0.655113,0.00163422,-0.00192709,0.772517,1303.38,25.2565)">
|
||||||
|
<path d="M673,7L652,7L652,10.91L668.201,11.013L668.243,32.903L673,32.903L673,7Z" style="fill:none;stroke:black;stroke-width:4px;"/>
|
||||||
|
</g>
|
||||||
|
<g transform="matrix(0.655113,0.00163422,-0.00192709,0.772517,1296.78,31.5145)">
|
||||||
|
<path d="M673,7L652,7L652,32.903L673,32.903L673,7Z" style="fill:none;stroke:black;stroke-width:4px;"/>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
<g transform="matrix(0.945433,0,0,0.945433,96.0696,-27.2686)">
|
||||||
|
<g transform="matrix(0.655113,0.00163422,-0.00192709,0.772517,1299.93,28.3878)">
|
||||||
|
<path d="M673,7L652,7L652,10.91L668.201,11.013L668.243,32.903L673,32.903L673,7Z" style="fill:none;stroke:black;stroke-width:4px;"/>
|
||||||
|
</g>
|
||||||
|
<g transform="matrix(0.655113,0.00163422,-0.00192709,0.772517,1303.38,25.2565)">
|
||||||
|
<path d="M673,7L652,7L652,10.91L668.201,11.013L668.243,32.903L673,32.903L673,7Z" style="fill:none;stroke:black;stroke-width:4px;"/>
|
||||||
|
</g>
|
||||||
|
<g transform="matrix(0.655113,0.00163422,-0.00192709,0.772517,1296.78,31.5145)">
|
||||||
|
<path d="M673,7L652,7L652,32.903L673,32.903L673,7Z" style="fill:none;stroke:black;stroke-width:4px;"/>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
<g transform="matrix(0.945433,0,0,0.945433,70.0475,-27.2686)">
|
||||||
|
<g transform="matrix(0.655113,0.00163422,-0.00192709,0.772517,1299.93,28.3878)">
|
||||||
|
<path d="M673,7L652,7L652,10.91L668.201,11.013L668.243,32.903L673,32.903L673,7Z" style="fill:none;stroke:black;stroke-width:4px;"/>
|
||||||
|
</g>
|
||||||
|
<g transform="matrix(0.655113,0.00163422,-0.00192709,0.772517,1303.38,25.2565)">
|
||||||
|
<path d="M673,7L652,7L652,10.91L668.201,11.013L668.243,32.903L673,32.903L673,7Z" style="fill:none;stroke:black;stroke-width:4px;"/>
|
||||||
|
</g>
|
||||||
|
<g transform="matrix(0.655113,0.00163422,-0.00192709,0.772517,1296.78,31.5145)">
|
||||||
|
<path d="M673,7L652,7L652,32.903L673,32.903L673,7Z" style="fill:none;stroke:black;stroke-width:4px;"/>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 4 KiB |
Loading…
Reference in a new issue