switch to svg images for better hidpi rendering

This commit is contained in:
Damien Elmes 2017-08-15 13:54:58 +10:00
parent 30e6a34d25
commit a16aa73d6e
13 changed files with 88 additions and 9 deletions

View File

@ -823,13 +823,13 @@ by clicking on one on the left."""))
saved = self.col.conf.get('savedFilters', {})
for name, filt in sorted(saved.items()):
item = self.CallbackItem(root, name, lambda s=filt: self.setFilter(s))
item.setIcon(0, QIcon(":/icons/heart.png"))
item.setIcon(0, QIcon(":/icons/heart.svg"))
def _userTagTree(self, root):
for t in sorted(self.col.tags.all(), key=lambda t: t.lower()):
item = self.CallbackItem(
root, t, lambda t=t: self.setFilter("tag", t))
item.setIcon(0, QIcon(":/icons/tag.png"))
item.setIcon(0, QIcon(":/icons/tag.svg"))
def _decksTree(self, root):
grps = self.col.sched.deckDueTree()
@ -840,7 +840,7 @@ by clicking on one on the left."""))
lambda g=g: self.setFilter("deck", head+g[0]),
lambda g=g: self.mw.col.decks.collapseBrowser(g[1]),
not self.mw.col.decks.get(g[1]).get('browserCollapsed', False))
item.setIcon(0, QIcon(":/icons/deck.png"))
item.setIcon(0, QIcon(":/icons/deck.svg"))
newhead = head + g[0]+"::"
fillGroups(item, g[5], newhead)
fillGroups(root, grps)
@ -849,7 +849,7 @@ by clicking on one on the left."""))
for m in sorted(self.col.models.all(), key=itemgetter("name")):
mitem = self.CallbackItem(
root, m['name'], lambda m=m: self.setFilter("mid", str(m['id'])))
mitem.setIcon(0, QIcon(":/icons/notetype.png"))
mitem.setIcon(0, QIcon(":/icons/notetype.svg"))
# Filter tree
######################################################################

View File

@ -188,7 +188,7 @@ where id > ?""", (self.mw.col.sched.dayCutoff-86400)*1000)
nonzeroColour(new, "#000099"))
# options
buf += ("<td align=center class=opts><a onclick='pycmd(\"opts:%d\");'>"
"<img src='/_anki/imgs/gears.png' class=gears></a></td></tr>" % did)
"<img src='/_anki/imgs/gears.svg' class=gears></a></td></tr>" % did)
# children
buf += self._renderDeckTree(children, depth+1)
return buf

View File

@ -1,9 +1,9 @@
<RCC>
<qresource prefix="/">
<file>icons/anki.png</file>
<file>icons/tag.png</file>
<file>icons/deck.png</file>
<file>icons/notetype.png</file>
<file>icons/heart.png</file>
<file>icons/tag.svg</file>
<file>icons/deck.svg</file>
<file>icons/notetype.svg</file>
<file>icons/heart.svg</file>
</qresource>
</RCC>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

18
designer/icons/deck.svg Normal file
View File

@ -0,0 +1,18 @@
<?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,-210,0)">
<g id="deck" transform="matrix(1,0,0,1,-1481,0)">
<rect x="1691" y="0" width="60" height="60" style="fill:none;"/>
<g transform="matrix(1.34654,0.00335904,-0.00396102,1.58786,829.019,-3.9058)">
<path d="M673,7L652,7L652,10.91L668.201,11.013L668.243,32.903L673,32.903L673,7Z" style="fill:none;stroke:black;stroke-width:1.84px;"/>
</g>
<g transform="matrix(1.34654,0.00335904,-0.00396102,1.58786,836.096,-10.342)">
<path d="M673,7L652,7L652,10.91L668.201,11.013L668.243,32.903L673,32.903L673,7Z" style="fill:none;stroke:black;stroke-width:1.84px;"/>
</g>
<g transform="matrix(1.34654,0.00335904,-0.00396102,1.58786,822.541,2.52091)">
<path d="M673,7L652,7L652,32.903L673,32.903L673,7Z" style="fill:none;stroke:black;stroke-width:1.84px;"/>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

12
designer/icons/heart.svg Normal file
View File

@ -0,0 +1,12 @@
<?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,-280,0)">
<g id="heart" transform="matrix(1,0,0,1,-1411,0)">
<rect x="1691" y="0" width="60" height="60" style="fill:none;"/>
<g transform="matrix(0.960241,0,0,0.960241,1431.01,3.14701)">
<path d="M302,10.8C307.684,0 319.053,0 324.737,5.4C330.421,10.8 330.421,21.6 324.737,32.4C320.758,40.5 310.526,48.6 302,54C293.474,48.6 283.242,40.5 279.263,32.4C273.579,21.6 273.579,10.8 279.263,5.4C284.947,0 296.316,0 302,10.8Z" style="fill:none;stroke:black;stroke-width:2.82px;"/>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 922 B

View File

@ -0,0 +1,21 @@
<?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,-350,0)">
<g id="notetype" transform="matrix(1,0,0,1,-1341,0)">
<rect x="1691" y="0" width="60" height="60" style="fill:none;"/>
<g transform="matrix(1,0,0,1,1341.5,-1.5)">
<rect x="353" y="17" width="53" height="12" style="fill:none;stroke:black;stroke-width:2.08px;"/>
</g>
<g transform="matrix(1,0,0,1,1341.5,25.5)">
<rect x="353" y="17" width="53" height="12" style="fill:none;stroke:black;stroke-width:2.08px;"/>
</g>
<g transform="matrix(1,0,0,1,1341.5,-0.5)">
<rect x="353" y="6" width="25" height="5" style="stroke:black;stroke-width:2.08px;"/>
</g>
<g transform="matrix(1,0,0,1,1341.5,26.5)">
<rect x="353" y="6" width="25" height="5" style="stroke:black;stroke-width:2.08px;"/>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

15
designer/icons/tag.svg Normal file
View File

@ -0,0 +1,15 @@
<?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,-140,0)">
<g id="tag" transform="matrix(1,0,0,1,-746,0)">
<rect x="886" y="0" width="60" height="60" style="fill:none;"/>
<g transform="matrix(1.02613,0,0,1.25926,526.583,-8.40741)">
<path d="M354,17L388,17L405.001,23.75L405.001,37.251L388,44L354,44L354,17Z" style="fill:none;stroke:black;stroke-width:2.18px;"/>
<g transform="matrix(0.896128,0,0,0.896128,39.3092,3.16748)">
<circle cx="400" cy="30.501" r="2.499" style="stroke:black;stroke-width:2.63px;"/>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

13
web/imgs/gears.svg Normal file
View File

@ -0,0 +1,13 @@
<?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-linejoin:round;stroke-miterlimit:1.41421;">
<rect id="gears" x="0" y="0" width="60" height="60" style="fill:none;"/>
<clipPath id="_clip1">
<rect id="gears1" x="0" y="0" width="60" height="60"/>
</clipPath>
<g clip-path="url(#_clip1)">
<g transform="matrix(-1.03571,0,0,-1.03571,60.9474,60.7657)">
<path d="M34.69,2.396C31.586,1.868 28.414,1.868 25.31,2.396C24.89,5.368 24.478,8.342 24.072,11.316C22.306,11.877 20.628,12.685 19.088,13.716C16.51,12.179 13.928,10.647 11.342,9.122C8.994,11.22 7.017,13.7 5.494,16.456C7.556,18.637 9.624,20.814 11.697,22.985C11.033,24.716 10.619,26.532 10.466,28.378C7.656,29.436 4.849,30.499 2.044,31.57C2.221,34.714 2.926,37.806 4.131,40.715C7.123,40.463 10.114,40.203 13.104,39.937C14.043,41.534 15.204,42.99 16.553,44.262C15.627,47.117 14.709,49.975 13.797,52.836C16.365,54.658 19.223,56.034 22.249,56.906C23.916,54.41 25.578,51.909 27.234,49.405C29.069,49.667 30.931,49.667 32.766,49.405C34.422,51.909 36.084,54.41 37.751,56.906C40.777,56.034 43.635,54.658 46.203,52.836C45.291,49.975 44.373,47.117 43.447,44.262C44.796,42.99 45.957,41.534 46.896,39.937C49.886,40.203 52.877,40.463 55.869,40.715C57.074,37.806 57.779,34.714 57.956,31.57C55.151,30.499 52.344,29.436 49.534,28.378C49.381,26.532 48.967,24.716 48.303,22.985C50.376,20.814 52.444,18.637 54.506,16.456C52.983,13.7 51.006,11.22 48.658,9.122C46.072,10.647 43.49,12.179 40.912,13.716C39.372,12.685 37.694,11.877 35.928,11.316C35.522,8.342 35.11,5.368 34.69,2.396ZM30,22.545C34.114,22.545 37.455,25.886 37.455,30C37.455,34.114 34.114,37.455 30,37.455C25.886,37.455 22.545,34.114 22.545,30C22.545,25.886 25.886,22.545 30,22.545Z"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.0 KiB