Finished the code for icon themes

This commit is contained in:
Veronica K. B. Olsen
2020-05-14 18:38:41 +02:00
parent 0566df433b
commit 0eb4319fc1
12 changed files with 376 additions and 64 deletions
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.2"
width="24"
height="24"
viewBox="0 0 24 24"
id="svg3369"
sodipodi:docname="globe_max.svg"
inkscape:version="1.0rc1 (09960d6f05, 2020-04-09)">
<metadata
id="metadata3375">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs3373" />
<sodipodi:namedview
inkscape:document-rotation="0"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="2560"
inkscape:window-height="1344"
id="namedview3371"
showgrid="false"
inkscape:zoom="38.125"
inkscape:cx="12"
inkscape:cy="12"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg3369" />
<path
d="m 10.59375,21.6 h -4.8 c -0.6636,0 -1.2,0.5364 -1.2,1.2 0,0.6636 0.5364,1.2 1.2,1.2 h 12 c 0.6636,0 1.2,-0.5364 1.2,-1.2 0,-0.6636 -0.5364,-1.2 -1.2,-1.2 h -4.8 v -1.476 c 1.968,-0.4452 3.7752,-1.4256 5.2356,-2.8872 2.04,-2.04 3.1644,-4.752 3.1644,-7.6368 0,-2.4804 -0.8304,-4.8348 -2.3616,-6.7428 l 0.81,-0.8076 c 0.4692,-0.4692 0.4692,-1.2276 0.0012,-1.698 -0.4692,-0.4692 -1.2288,-0.468 -1.698,-0.0012 l -2.4624,2.4588 0.8496,0.8496 c 1.5864,1.5864 2.4612,3.6972 2.4612,5.9412 0,2.244 -0.8748,4.3524 -2.4612,5.9388 -1.5864,1.5864 -3.6948,2.4612 -5.9388,2.4612 -2.244,0 -4.3524,-0.8748 -5.9388,-2.4612 -0.4692,-0.4692 -1.2276,-0.4692 -1.6968,0 -0.4692,0.468 -0.4692,1.2276 0,1.6968 2.0388,2.04 4.7508,3.1644 7.6356,3.1644 z m 0,-19.2 c 1.9884,0 3.7884,0.8064 5.0916,2.1084 1.302,1.3032 2.1084,3.1032 2.1084,5.0916 0,1.9872 -0.8064,3.7872 -2.1084,5.0904 -1.3032,1.3032 -3.1032,2.1096 -5.0916,2.1096 -1.9896,0 -3.7884,-0.8064 -5.0904,-2.1084 -1.302,-1.3032 -2.1072,-3.1032 -2.1072,-5.0916 0,-1.9884 0.8052,-3.7884 2.1072,-5.0916 C 6.80535,3.2064 8.60415,2.4 10.59375,2.4 Z"
id="path3367"
inkscape:connector-curvature="0"
style="stroke-width:1.2;fill:#aeaeae;fill-opacity:1" />
</svg>

After

Width:  |  Height:  |  Size: 2.7 KiB

+56
View File
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
inkscape:version="1.0rc1 (09960d6f05, 2020-04-09)"
sodipodi:docname="globe_max.svg"
id="svg3369"
viewBox="0 0 24 24"
height="24"
width="24"
version="1.2">
<metadata
id="metadata3375">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs3373" />
<sodipodi:namedview
inkscape:current-layer="svg3369"
inkscape:window-maximized="1"
inkscape:window-y="0"
inkscape:window-x="0"
inkscape:cy="12"
inkscape:cx="12"
inkscape:zoom="38.125"
showgrid="false"
id="namedview3371"
inkscape:window-height="1344"
inkscape:window-width="2560"
inkscape:pageshadow="2"
inkscape:pageopacity="0"
guidetolerance="10"
gridtolerance="10"
objecttolerance="10"
borderopacity="1"
bordercolor="#666666"
pagecolor="#ffffff" />
<path
style="stroke-width:1.2;fill:#000000;fill-opacity:0.77999997"
inkscape:connector-curvature="0"
id="path3367"
d="m 10.59375,21.6 h -4.8 c -0.6636,0 -1.2,0.5364 -1.2,1.2 0,0.6636 0.5364,1.2 1.2,1.2 h 12 c 0.6636,0 1.2,-0.5364 1.2,-1.2 0,-0.6636 -0.5364,-1.2 -1.2,-1.2 h -4.8 v -1.476 c 1.968,-0.4452 3.7752,-1.4256 5.2356,-2.8872 2.04,-2.04 3.1644,-4.752 3.1644,-7.6368 0,-2.4804 -0.8304,-4.8348 -2.3616,-6.7428 l 0.81,-0.8076 c 0.4692,-0.4692 0.4692,-1.2276 0.0012,-1.698 -0.4692,-0.4692 -1.2288,-0.468 -1.698,-0.0012 l -2.4624,2.4588 0.8496,0.8496 c 1.5864,1.5864 2.4612,3.6972 2.4612,5.9412 0,2.244 -0.8748,4.3524 -2.4612,5.9388 -1.5864,1.5864 -3.6948,2.4612 -5.9388,2.4612 -2.244,0 -4.3524,-0.8748 -5.9388,-2.4612 -0.4692,-0.4692 -1.2276,-0.4692 -1.6968,0 -0.4692,0.468 -0.4692,1.2276 0,1.6968 2.0388,2.04 4.7508,3.1644 7.6356,3.1644 z m 0,-19.2 c 1.9884,0 3.7884,0.8064 5.0916,2.1084 1.302,1.3032 2.1084,3.1032 2.1084,5.0916 0,1.9872 -0.8064,3.7872 -2.1084,5.0904 -1.3032,1.3032 -3.1032,2.1096 -5.0916,2.1096 -1.9896,0 -3.7884,-0.8064 -5.0904,-2.1084 -1.302,-1.3032 -2.1072,-3.1032 -2.1072,-5.0916 0,-1.9884 0.8052,-3.7884 2.1072,-5.0916 C 6.80535,3.2064 8.60415,2.4 10.59375,2.4 Z" />
</svg>

After

Width:  |  Height:  |  Size: 2.6 KiB

@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.2"
width="24"
height="24"
viewBox="0 0 24 24"
id="svg7030"
sodipodi:docname="stopwatch_max.svg"
inkscape:version="1.0rc1 (09960d6f05, 2020-04-09)">
<metadata
id="metadata7036">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs7034" />
<sodipodi:namedview
inkscape:document-rotation="0"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="2560"
inkscape:window-height="1344"
id="namedview7032"
showgrid="false"
inkscape:zoom="38.125"
inkscape:cx="12"
inkscape:cy="12"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg7030" />
<g
id="g7028"
transform="matrix(1.1428571,0,0,1.1428571,-1.7142852,-2.2857137)"
style="fill:#aeaeae;fill-opacity:1">
<path
d="M 19.414,8.902 C 19.518,8.854 19.62,8.794 19.707,8.707 l 0.5,-0.5 c 0.391,-0.391 0.391,-1.023 0,-1.414 -0.391,-0.391 -1.023,-0.391 -1.414,0 l -0.5,0.5 -0.115,0.173 C 16.791,6.154 14.99,5.276 12.989,5.056 L 13,5 V 4 h 1 C 14.55,4 15,3.55 15,3 15,2.45 14.55,2 14,2 H 10 C 9.45,2 9,2.45 9,3 9,3.55 9.45,4 10,4 h 1 v 1 l 0.012,0.057 C 6.506,5.549 3,9.364 3,14 c 0,4.971 4.029,9 9,9 4.971,0 9,-4.029 9,-9 0,-1.894 -0.588,-3.648 -1.586,-5.098 z M 12,21 C 8.141,21 5,17.86 5,14 5,10.14 8.141,7 12,7 c 3.859,0 7,3.14 7,7 0,3.86 -3.141,7 -7,7 z m 1,-8 v -2 c 0,-0.55 -0.45,-1 -1,-1 -0.55,0 -1,0.45 -1,1 v 3 c 0,0.55 0.45,1 1,1 h 3 c 0.55,0 1,-0.45 1,-1 0,-0.55 -0.45,-1 -1,-1 z M 12,8 c -3.312,0 -6,2.688 -6,6 0,3.312 2.688,6 6,6 3.312,0 6,-2.688 6,-6 0,-3.312 -2.688,-6 -6,-6 z m 0,11 C 9.243,19 7,16.757 7,14 7,11.243 9.243,9 12,9 c 2.757,0 5,2.243 5,5 0,2.757 -2.243,5 -5,5 z"
id="path7026"
inkscape:connector-curvature="0"
style="fill:#aeaeae;fill-opacity:1" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.6 KiB

+61
View File
@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
inkscape:version="1.0rc1 (09960d6f05, 2020-04-09)"
sodipodi:docname="stopwatch_max.svg"
id="svg7030"
viewBox="0 0 24 24"
height="24"
width="24"
version="1.2">
<metadata
id="metadata7036">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs7034" />
<sodipodi:namedview
inkscape:current-layer="svg7030"
inkscape:window-maximized="1"
inkscape:window-y="0"
inkscape:window-x="0"
inkscape:cy="12"
inkscape:cx="12"
inkscape:zoom="38.125"
showgrid="false"
id="namedview7032"
inkscape:window-height="1344"
inkscape:window-width="2560"
inkscape:pageshadow="2"
inkscape:pageopacity="0"
guidetolerance="10"
gridtolerance="10"
objecttolerance="10"
borderopacity="1"
bordercolor="#666666"
pagecolor="#ffffff" />
<g
style="fill:#000000;fill-opacity:0.77999997"
transform="matrix(1.1428571,0,0,1.1428571,-1.7142852,-2.2857137)"
id="g7028">
<path
style="fill:#000000;fill-opacity:0.77999997"
inkscape:connector-curvature="0"
id="path7026"
d="M 19.414,8.902 C 19.518,8.854 19.62,8.794 19.707,8.707 l 0.5,-0.5 c 0.391,-0.391 0.391,-1.023 0,-1.414 -0.391,-0.391 -1.023,-0.391 -1.414,0 l -0.5,0.5 -0.115,0.173 C 16.791,6.154 14.99,5.276 12.989,5.056 L 13,5 V 4 h 1 C 14.55,4 15,3.55 15,3 15,2.45 14.55,2 14,2 H 10 C 9.45,2 9,2.45 9,3 9,3.55 9.45,4 10,4 h 1 v 1 l 0.012,0.057 C 6.506,5.549 3,9.364 3,14 c 0,4.971 4.029,9 9,9 4.971,0 9,-4.029 9,-9 0,-1.894 -0.588,-3.648 -1.586,-5.098 z M 12,21 C 8.141,21 5,17.86 5,14 5,10.14 8.141,7 12,7 c 3.859,0 7,3.14 7,7 0,3.86 -3.141,7 -7,7 z m 1,-8 v -2 c 0,-0.55 -0.45,-1 -1,-1 -0.55,0 -1,0.45 -1,1 v 3 c 0,0.55 0.45,1 1,1 h 3 c 0.55,0 1,-0.45 1,-1 0,-0.55 -0.45,-1 -1,-1 z M 12,8 c -3.312,0 -6,2.688 -6,6 0,3.312 2.688,6 6,6 3.312,0 6,-2.688 6,-6 0,-3.312 -2.688,-6 -6,-6 z m 0,11 C 9.243,19 7,16.757 7,14 7,11.243 9.243,9 12,9 c 2.757,0 5,2.243 5,5 0,2.757 -2.243,5 -5,5 z" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.6 KiB

@@ -7,13 +7,13 @@
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
inkscape:version="0.92.5 (2060ec1f9f, 2020-04-08)"
sodipodi:docname="input-checked.svg"
id="svg11367"
viewBox="0 0 24 24"
height="24"
version="1.2"
width="24"
version="1.2">
height="24"
viewBox="0 0 24 24"
id="svg11367"
sodipodi:docname="input-checked.svg"
inkscape:version="1.0rc1 (09960d6f05, 2020-04-09)">
<metadata
id="metadata11373">
<rdf:RDF>
@@ -28,38 +28,38 @@
<defs
id="defs11371" />
<sodipodi:namedview
inkscape:current-layer="svg11367"
inkscape:window-maximized="0"
inkscape:window-y="27"
inkscape:window-x="48"
inkscape:cy="12"
inkscape:cx="7.2131148"
inkscape:zoom="38.125"
showgrid="false"
id="namedview11369"
inkscape:window-height="1376"
inkscape:window-width="2374"
inkscape:pageshadow="2"
inkscape:pageopacity="0"
guidetolerance="10"
gridtolerance="10"
objecttolerance="10"
borderopacity="1"
bordercolor="#666666"
inkscape:document-rotation="0"
pagecolor="#ffffff"
inkscape:document-rotation="0" />
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="2560"
inkscape:window-height="1344"
id="namedview11369"
showgrid="false"
inkscape:zoom="38.125"
inkscape:cx="7.2131148"
inkscape:cy="12"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg11367" />
<path
style="display:inline;fill:#99cc99;fill-opacity:1;stroke-width:1.28570998"
inkscape:connector-curvature="0"
id="path11365"
d="m 13.499143,15.642429 c -0.45,0 -0.885857,-0.178715 -1.209857,-0.502715 L 8.859,11.710714 c -0.668571,-0.669857 -0.668571,-1.755 0,-2.423571 0.669857,-0.669857 1.755,-0.669857 2.426143,0 L 13.105714,11.109 17.573571,4.0954286 c 0.459,-0.828 1.504286,-1.1275715 2.332286,-0.6672857 0.826714,0.4602857 1.125,1.5042857 0.666,2.331 l -5.572286,9.0000001 c -0.261,0.470571 -0.727714,0.790714 -1.26,0.865286 z"
inkscape:label="Check"
sodipodi:nodetypes="cccscccccccc"
inkscape:label="Check" />
<path
d="M 17.142857,21 H 6.8571429 C 4.7305714,21 3,19.269429 3,17.142857 V 6.8571429 C 3,4.7305714 4.7305714,3 6.8571429,3 h 6.4285711 c 0.711,0 1.285715,0.576 1.285715,1.2857143 0,0.7097143 -0.574715,1.2857143 -1.285715,1.2857143 H 6.8571429 c -0.7097143,0 -1.2857143,0.5772857 -1.2857143,1.2857143 V 17.142857 c 0,0.708429 0.576,1.285714 1.2857143,1.285714 H 17.142857 c 0.709714,0 1.285714,-0.577285 1.285714,-1.285714 V 13.285714 C 18.428571,12.576 19.003286,12 19.714286,12 20.425286,12 21,12.576 21,13.285714 v 3.857143 C 21,19.269429 19.269429,21 17.142857,21 Z"
id="path16196"
d="m 13.499143,15.642429 c -0.45,0 -0.885857,-0.178715 -1.209857,-0.502715 L 8.859,11.710714 c -0.668571,-0.669857 -0.668571,-1.755 0,-2.423571 0.669857,-0.669857 1.755,-0.669857 2.426143,0 L 13.105714,11.109 17.573571,4.0954286 c 0.459,-0.828 1.504286,-1.1275715 2.332286,-0.6672857 0.826714,0.4602857 1.125,1.5042857 0.666,2.331 l -5.572286,9.0000001 c -0.261,0.470571 -0.727714,0.790714 -1.26,0.865286 z"
id="path11365"
inkscape:connector-curvature="0"
style="display:inline;fill:#aeaeae;fill-opacity:0.39215687;stroke-width:1.28570998"
style="display:inline;fill:#99cc99;fill-opacity:1;stroke-width:1.28570998" />
<path
inkscape:label="Frame"
sodipodi:nodetypes="sssssssssssssssssss"
inkscape:label="Frame" />
style="display:inline;fill:#aeaeae;fill-opacity:1;stroke-width:1.28570998"
inkscape:connector-curvature="0"
id="path16196"
d="M 17.142857,21 H 6.8571429 C 4.7305714,21 3,19.269429 3,17.142857 V 6.8571429 C 3,4.7305714 4.7305714,3 6.8571429,3 h 6.4285711 c 0.711,0 1.285715,0.576 1.285715,1.2857143 0,0.7097143 -0.574715,1.2857143 -1.285715,1.2857143 H 6.8571429 c -0.7097143,0 -1.2857143,0.5772857 -1.2857143,1.2857143 V 17.142857 c 0,0.708429 0.576,1.285714 1.2857143,1.285714 H 17.142857 c 0.709714,0 1.285714,-0.577285 1.285714,-1.285714 V 13.285714 C 18.428571,12.576 19.003286,12 19.714286,12 20.425286,12 21,12.576 21,13.285714 v 3.857143 C 21,19.269429 19.269429,21 17.142857,21 Z" />
</svg>

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

+5 -1
View File
@@ -83,7 +83,7 @@ class Config:
## General
self.guiTheme = "default"
self.guiSyntax = "default_light"
self.guiIcons = "typicons_colour_dark"
self.guiIcons = "default"
self.guiDark = False
## Sizes
@@ -304,6 +304,9 @@ class Config:
self.guiSyntax = self._parseLine(
cnfParse, cnfSec, "syntax", self.CNF_STR, self.guiSyntax
)
self.guiIcons = self._parseLine(
cnfParse, cnfSec, "icons", self.CNF_STR, self.guiIcons
)
self.guiDark = self._parseLine(
cnfParse, cnfSec, "guidark", self.CNF_BOOL, self.guiDark
)
@@ -452,6 +455,7 @@ class Config:
cnfParse.set(cnfSec,"timestamp", formatTimeStamp(time()))
cnfParse.set(cnfSec,"theme", str(self.guiTheme))
cnfParse.set(cnfSec,"syntax", str(self.guiSyntax))
cnfParse.set(cnfSec,"icons", str(self.guiIcons))
cnfParse.set(cnfSec,"guidark", str(self.guiDark))
## Sizes
+26 -6
View File
@@ -58,7 +58,11 @@ class GuiConfigEditor(QDialog):
self.innerBox = QVBoxLayout()
self.setWindowTitle("Preferences")
self.guiDeco = self.theParent.theTheme.loadDecoration("settings",(64,64))
self.guiDeco = self.theParent.theTheme.loadDecoration("settings", (64,64))
self.outerBox.addWidget(self.guiDeco, 0, Qt.AlignTop)
self.outerBox.addLayout(self.innerBox)
self.outerBox.setSpacing(16)
self.setLayout(self.outerBox)
self.tabGeneral = GuiConfigEditGeneralTab(self.theParent)
self.tabLayout = GuiConfigEditLayoutTab(self.theParent)
@@ -72,10 +76,6 @@ class GuiConfigEditor(QDialog):
self.tabWidget.addTab(self.tabEditing, "Editing")
self.tabWidget.addTab(self.tabAutoRep, "Auto-Replace")
self.setLayout(self.outerBox)
self.outerBox.addWidget(self.guiDeco, 0, Qt.AlignTop)
self.outerBox.addLayout(self.innerBox)
self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
self.buttonBox.accepted.connect(self._doSave)
self.buttonBox.rejected.connect(self._doClose)
@@ -169,6 +169,22 @@ class GuiConfigEditGeneralTab(QWidget):
"Changing this requires restarting %s." % nw.__package__
)
## Select Icon Theme
self.selectIcons = QComboBox()
self.selectIcons.setMinimumWidth(200)
self.theIcons = self.theTheme.theIcons.listThemes()
for iconDir, iconName in self.theIcons:
self.selectIcons.addItem(iconName, iconDir)
iconIdx = self.selectIcons.findData(self.mainConf.guiIcons)
if iconIdx != -1:
self.selectIcons.setCurrentIndex(iconIdx)
self.mainForm.addRow(
"Main icon theme",
self.selectIcons,
"Changing this requires restarting %s." % nw.__package__
)
## Syntax Highlighting
self.selectSyntax = QComboBox()
self.selectSyntax.setMinimumWidth(200)
@@ -181,7 +197,8 @@ class GuiConfigEditGeneralTab(QWidget):
self.mainForm.addRow(
"Syntax highlight theme",
self.selectSyntax
self.selectSyntax,
""
)
## Dark Icons
@@ -275,6 +292,7 @@ class GuiConfigEditGeneralTab(QWidget):
guiTheme = self.selectTheme.currentData()
guiSyntax = self.selectSyntax.currentData()
guiIcons = self.selectIcons.currentData()
guiDark = self.preferDarkIcons.isChecked()
showFullPath = self.showFullPath.isChecked()
autoSaveDoc = self.autoSaveDoc.value()
@@ -285,9 +303,11 @@ class GuiConfigEditGeneralTab(QWidget):
# Check if restart is needed
needsRestart |= self.mainConf.guiTheme != guiTheme
needsRestart |= self.mainConf.guiIcons != guiIcons
self.mainConf.guiTheme = guiTheme
self.mainConf.guiSyntax = guiSyntax
self.mainConf.guiIcons = guiIcons
self.mainConf.guiDark = guiDark
self.mainConf.showFullPath = showFullPath
self.mainConf.autoSaveDoc = autoSaveDoc
+1 -2
View File
@@ -60,11 +60,10 @@ class GuiItemEditor(QDialog):
nwLabels.CLASS_ICON[self.theItem.itemClass], (64,64)
)
)
self.setLayout(self.outerBox)
self.outerBox.addWidget(self.guiDeco, 0, Qt.AlignTop)
self.outerBox.addLayout(self.innerBox)
self.outerBox.setSpacing(16)
self.setLayout(self.outerBox)
self.mainGroup = QGroupBox("Item Settings")
self.mainForm = QFormLayout()
+14 -8
View File
@@ -52,12 +52,18 @@ class GuiProjectEditor(QDialog):
self.theParent = theParent
self.theProject = theProject
self.outerBox = QHBoxLayout()
self.innerBox = QVBoxLayout()
self.setWindowTitle("Project Settings")
self.setLayout(self.outerBox)
self.outerBox = QHBoxLayout()
self.innerBox = QVBoxLayout()
self.guiDeco = self.theParent.theTheme.loadDecoration("settings",(64,64))
self.setWindowTitle("Project Settings")
self.guiDeco = QLabel()
self.guiDeco.setPixmap(
self.theParent.theTheme.getPixmap("cls_novel", (64,64))
)
self.outerBox.addWidget(self.guiDeco, 0, Qt.AlignTop)
self.outerBox.addLayout(self.innerBox)
self.outerBox.setSpacing(16)
self.setLayout(self.outerBox)
self.theProject.countStatus()
self.tabMain = GuiProjectEditMain(self.theParent, self.theProject)
@@ -71,9 +77,6 @@ class GuiProjectEditor(QDialog):
self.tabWidget.addTab(self.tabImport, "Importance")
self.tabWidget.addTab(self.tabReplace,"Auto-Replace")
self.outerBox.addWidget(self.guiDeco, 0, Qt.AlignTop)
self.outerBox.addLayout(self.innerBox)
self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
self.buttonBox.accepted.connect(self._doSave)
self.buttonBox.rejected.connect(self._doClose)
@@ -363,6 +366,9 @@ class GuiProjectEditReplace(QWidget):
self.saveButton = QPushButton(self.theTheme.getIcon("done"),"")
self.addButton = QPushButton(self.theTheme.getIcon("add"),"")
self.delButton = QPushButton(self.theTheme.getIcon("remove"),"")
self.saveButton.setToolTip("Save entry")
self.addButton.setToolTip("Add new entry")
self.delButton.setToolTip("Delete selected entry")
self.editKey.setEnabled(False)
self.editKey.setMaxLength(40)
+47 -5
View File
@@ -29,7 +29,7 @@ import logging
import configparser
import nw
from os import path
from os import path, listdir
from PyQt5.QtCore import QSize
from PyQt5.QtSvg import QSvgWidget
@@ -90,8 +90,11 @@ class GuiIcons:
self.theParent = theParent
# Storage
self.qIcons = {}
self.themeMap = {}
self.qIcons = {}
self.themeMap = {}
self.themeList = []
self.fbackName = "fallback"
self.confName = "icons.conf"
# Icon Theme Path
self.iconPath = None
@@ -121,7 +124,7 @@ class GuiIcons:
if path.isdir(checkPath):
logger.debug("Loading icon theme '%s'" % self.mainConf.guiIcons)
self.iconPath = checkPath
self.confFile = path.join(checkPath, "icons.conf")
self.confFile = path.join(checkPath, self.confName)
else:
return False
@@ -170,7 +173,6 @@ class GuiIcons:
"""Load graphical decoration element based on the decoration
map. This function always returns a QSwgWidget.
"""
if decoKey not in self.DECO_MAP:
logger.error("Decoration with name '%s' does not exist" % decoKey)
return QSvgWidget()
@@ -209,6 +211,37 @@ class GuiIcons:
qIcon = self.getIcon(iconKey)
return qIcon.pixmap(iconSize[0], iconSize[1], QIcon.Normal)
def listThemes(self):
"""Scan the icons themes folder and list all themes.
"""
if self.themeList:
return self.themeList
confParser = configparser.ConfigParser()
for themeDir in listdir(self.mainConf.iconPath):
themePath = path.join(self.mainConf.iconPath, themeDir)
if not path.isdir(themePath) or themeDir == self.fbackName:
continue
themeConf = path.join(themePath, self.confName)
logger.verbose("Checking icon theme config for '%s'" % themeDir)
try:
confParser.read_file(open(themeConf, mode="r", encoding="utf8"))
except Exception as e:
self.theParent.makeAlert(["Could not load theme config file.",str(e)],nwAlert.ERROR)
continue
themeName = ""
if confParser.has_section("Main"):
if confParser.has_option("Main", "name"):
themeName = confParser.get("Main", "name")
logger.verbose("Theme name is '%s'" % themeName)
if themeName != "":
self.themeList.append((themeDir, themeName))
self.themeList = sorted(self.themeList, key=lambda x: x[1])
self.themeList.insert(0, ("default", "System Icons"))
return self.themeList
##
# Internal Functions
##
@@ -238,6 +271,15 @@ class GuiIcons:
logger.verbose("Loading icon '%s' from system theme" % iconKey)
return QIcon().fromTheme(self.ICON_MAP[iconKey][1])
# Finally. we check if we have a fallback icon
if self.mainConf.guiDark:
fbackIcon = path.join(self.mainConf.iconPath, self.fbackName, "%s-dark.svg" % iconKey)
else:
fbackIcon = path.join(self.mainConf.iconPath, self.fbackName, "%s.svg" % iconKey)
if path.isfile(fbackIcon):
logger.verbose("Loading icon '%s' from fallback theme" % iconKey)
return QIcon(fbackIcon)
# Give up and return an empty icon
logger.warning("Did not load an icon for '%s'" % iconKey)
+11 -7
View File
@@ -260,8 +260,9 @@ class GuiTheme:
return True
def listThemes(self):
if len(self.themeList) > 0:
"""Scan the gui themes folder and list all themes.
"""
if self.themeList:
return self.themeList
confParser = configparser.ConfigParser()
@@ -275,8 +276,9 @@ class GuiTheme:
continue
themeName = ""
if confParser.has_section("Main"):
themeName = confParser.get("Main","name")
logger.verbose("Theme name is '%s'" % themeName)
if confParser.has_option("Main", "name"):
themeName = confParser.get("Main", "name")
logger.verbose("Theme name is '%s'" % themeName)
if themeName != "":
self.themeList.append((themeDir, themeName))
@@ -285,8 +287,9 @@ class GuiTheme:
return self.themeList
def listSyntax(self):
if len(self.syntaxList) > 0:
"""Scan the syntax themes folder and list all themes.
"""
if self.syntaxList:
return self.syntaxList
confParser = configparser.ConfigParser()
@@ -303,7 +306,8 @@ class GuiTheme:
return []
syntaxName = ""
if confParser.has_section("Main"):
syntaxName = confParser.get("Main","name")
if confParser.has_option("Main", "name"):
syntaxName = confParser.get("Main", "name")
if len(syntaxFile) > 5 and syntaxName != "":
self.syntaxList.append((syntaxFile[:-5], syntaxName))
logger.verbose("Syntax name is '%s'" % syntaxName)
+1
View File
@@ -2,6 +2,7 @@
timestamp = 2020-05-01 21:28:25
theme = default
syntax = default_light
icons = default
guidark = False
[Sizes]