Browser sidebar icon improvements (#1586)

* Fix cardtype icon, add flag-off icon, remove flag.svg

* This removes the old flag.svg, because mdi-icons also has
  one icon called `flag.svg`, and there was undefined behavior
  which flag icon was being picked, when requesting "flag.svg"

* Sort no-flag to beginning of subtree

* to match tags
This commit is contained in:
Henrik Giesel 2022-01-11 07:35:46 +01:00 committed by GitHub
parent ead75f2898
commit 4e4d12a62a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 22 deletions

View File

@ -687,6 +687,7 @@ class SidebarTreeView(QTreeView):
###########################
def _flags_tree(self, root: SidebarItem) -> None:
icon_off = "icons:flag-off-outline.svg"
icon = "icons:flag.svg"
icon_outline = "icons:flag-outline.svg"
@ -699,6 +700,13 @@ class SidebarTreeView(QTreeView):
)
root.search_node = SearchNode(flag=SearchNode.FLAG_ANY)
root.add_simple(
tr.browsing_no_flag(),
icon=icon_off,
type=SidebarItemType.FLAG_NONE,
search_node=SearchNode(flag=SearchNode.FLAG_NONE),
)
for flag in self.mw.flags.all():
root.add_child(
SidebarItem(
@ -710,13 +718,6 @@ class SidebarTreeView(QTreeView):
)
)
root.add_simple(
tr.browsing_no_flag(),
icon=icon_outline,
type=SidebarItemType.FLAG_NONE,
search_node=SearchNode(flag=SearchNode.FLAG_NONE),
)
# Tree: Tags
###########################
@ -825,7 +826,7 @@ class SidebarTreeView(QTreeView):
def _notetype_tree(self, root: SidebarItem) -> None:
notetype_icon = "icons:newspaper.svg"
template_icon = "icons:iframe-braces-outline.svg"
template_icon = "icons:application-braces-outline.svg"
field_icon = "icons:form-textbox.svg"
root = self._section_root(

View File

@ -16,6 +16,7 @@ copy_mdi_icons(
# flags
"flag.svg",
"flag-outline.svg",
"flag-off-outline.svg",
# decks
"book-outline.svg",
@ -25,7 +26,7 @@ copy_mdi_icons(
# notetypes
"newspaper.svg",
# cardtype
"iframe-braces-outline.svg",
"application-braces-outline.svg",
# fields
"form-textbox.svg",

View File

@ -1,13 +0,0 @@
<?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 64" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
<g id="flag" transform="matrix(1,0,0,1.06667,-268.333,0)">
<rect x="268.333" y="0" width="60" height="60" style="fill:none;"/>
<g transform="matrix(0.8,0,0,0.973558,207.333,-4.03846)">
<rect x="85" y="8" width="5" height="52"/>
</g>
<g transform="matrix(0.914894,0,0,0.837054,196.993,-1.27232)">
<path d="M137,6C137,6 130.12,4.079 122.791,4.88C114.785,5.755 112.375,9.441 103.116,9.36C98.955,9.324 90,6 90,6L90,34C90,34 98.617,37.72 103.116,37.36C112.889,36.577 119.329,32.32 124.977,31.76C129.034,31.358 137,34 137,34L137,6Z"/>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.0 KiB