Add editor toolbar icons

This commit is contained in:
Veronica Berglyd Olsen
2023-11-08 16:54:42 +01:00
parent 9282b39f2a
commit 1a6072be2c
19 changed files with 168 additions and 38 deletions
@@ -46,6 +46,14 @@ cross = typ_times.svg
down = typ_chevron-down.svg down = typ_chevron-down.svg
edit = typ_pencil.svg edit = typ_pencil.svg
export = typ_export.svg export = typ_export.svg
fmt_bold = nw_tb-bold.svg
fmt_italic = nw_tb-italic.svg
fmt_mode-md = nw_tb-markdown.svg
fmt_mode-sc = nw_tb-shortcode.svg
fmt_strike = nw_tb-strike.svg
fmt_subscript = nw_tb-subscript.svg
fmt_superscript = nw_tb-superscript.svg
fmt_underline = nw_tb-underline.svg
forward = typ_chevron-right.svg forward = typ_chevron-right.svg
maximise = typ_arrow-maximise.svg maximise = typ_arrow-maximise.svg
menu = typ_th-dot-menu.svg menu = typ_th-dot-menu.svg
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="24" height="24" version="1.1" viewBox="0 0 6.35 6.35" xmlns="http://www.w3.org/2000/svg">
<path d="m1.3672 5.5562v-4.7625h1.6289q0.37252 0 0.68662 0.058435 0.32139 0.051131 0.55513 0.18991 0.24104 0.13878 0.37252 0.36522 0.13878 0.22644 0.13878 0.56975 0 0.1607-0.043826 0.32139-0.043826 0.16069-0.12417 0.29948-0.080349 0.13878-0.19721 0.24835-0.10957 0.10957-0.25565 0.1607v0.029218q0.18261 0.043827 0.33601 0.13878 0.1534 0.087653 0.27027 0.22644 0.11687 0.13878 0.18261 0.3287 0.065739 0.18261 0.065739 0.42365 0 0.36522-0.14608 0.62818-0.13878 0.26295-0.39444 0.43826-0.24835 0.168-0.58435 0.25565-0.33601 0.080349-0.72313 0.080349zm1.0737-2.8561h0.50401q0.39444 0 0.56975-0.1534 0.18261-0.1534 0.18261-0.40905 0-0.27757-0.18261-0.39444-0.18261-0.11687-0.56244-0.11687h-0.51131zm0 2.0233h0.60626q0.88383 0 0.88383-0.64279 0-0.31408-0.21914-0.44557-0.21914-0.13878-0.6647-0.13878h-0.60626z" fill="#aeaeae" stroke-opacity=".78039" stroke-width=".54782"/>
</svg>

After

Width:  |  Height:  |  Size: 1017 B

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="24" height="24" version="1.1" viewBox="0 0 6.35 6.35" xmlns="http://www.w3.org/2000/svg">
<path d="m2.3084 5.5562 0.94666-4.7625h0.78646l-0.94666 4.7625z" fill="#aeaeae" stroke-opacity=".78039" stroke-width=".54615"/>
</svg>

After

Width:  |  Height:  |  Size: 277 B

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="24" height="24" version="1.1" viewBox="0 0 6.35 6.35" xmlns="http://www.w3.org/2000/svg">
<g fill="#aeaeae" stroke-width="1.1">
<path d="m0.79397 2.8846-0.29357-0.21175 0.28393-0.5005-0.51975-0.23582 0.11068-0.3465 0.55825 0.1155 0.062562-0.56787h0.37057l0.062562 0.57268 0.55343-0.12032 0.1155 0.3465-0.51975 0.23582 0.28393 0.5005-0.29356 0.21175-0.385-0.42832z"/>
<path d="m2.8219 3.15-0.09999 0.37496h0.86866l-0.09374-0.37496q-0.08749-0.30622-0.16873-0.64993-0.081241-0.34372-0.16248-0.66243h-0.024997q-0.074992 0.32496-0.15623 0.66868-0.074992 0.33747-0.16248 0.64369zm-1.4749 2.0623 1.2749-4.0746h1.1062l1.2749 4.0746h-0.97489l-0.24997-0.96865h-1.2437l-0.24997 0.96865z"/>
<path d="m4.7812 2.8846-0.29357-0.21175 0.28394-0.5005-0.51975-0.23582 0.11069-0.3465 0.55825 0.1155 0.062562-0.56787h0.37056l0.062562 0.57268 0.55343-0.12032 0.1155 0.3465-0.51975 0.23582 0.28393 0.5005-0.29356 0.21175-0.385-0.42832z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 988 B

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="24" height="24" version="1.1" viewBox="0 0 6.35 6.35" xmlns="http://www.w3.org/2000/svg">
<g fill="#aeaeae" stroke-width="1.3799">
<path d="m0.52917 5.2683v-4.1866h1.0272v0.37972h-0.49167v3.4272h0.49167v0.37972z"/>
<path d="m2.9 2.9219-0.077889 0.29209h0.67667l-0.073022-0.29209q-0.068154-0.23854-0.13144-0.50628-0.063285-0.26775-0.12657-0.51601h-0.019472q-0.058417 0.25314-0.1217 0.52088-0.058417 0.26288-0.12657 0.50141zm-1.1489 1.6065 0.9931-3.174h0.86166l0.9931 3.174h-0.75942l-0.19472-0.75455h-0.96876l-0.19472 0.75455z"/>
<path d="m4.7937 5.2683v-0.37972h0.49654v-3.4272h-0.49654v-0.37972h1.0272v4.1866z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 684 B

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="24" height="24" version="1.1" viewBox="0 0 6.35 6.35" xmlns="http://www.w3.org/2000/svg">
<path d="m3.1785 5.5562q-0.46361 0-0.89912-0.17561-0.42848-0.17561-0.75863-0.49873l0.47766-0.55492q0.24585 0.2318 0.56195 0.37931 0.3161 0.14049 0.63219 0.14049 0.39336 0 0.59707-0.16156 0.20371-0.16156 0.20371-0.42848 0-0.14049-0.056194-0.23883-0.04917-0.098341-0.14751-0.16858-0.091316-0.077267-0.22478-0.14049-0.12644-0.063219-0.28097-0.12644l-0.63219-0.27395q-0.16858-0.070243-0.33717-0.17561-0.16156-0.10537-0.29502-0.25288-0.13346-0.14751-0.21775-0.34419-0.077268-0.19668-0.077268-0.44956 0-0.27395 0.11239-0.50575 0.11941-0.23883 0.32312-0.41444 0.20371-0.17561 0.48468-0.27395 0.288-0.098341 0.62517-0.098341 0.40039 0 0.77268 0.16156 0.37229 0.15454 0.63921 0.42146l-0.41444 0.5198q-0.22478-0.18263-0.46361-0.288-0.23883-0.10537-0.53385-0.10537-0.33014 0-0.52683 0.14751-0.19668 0.14049-0.19668 0.39336 0 0.13346 0.056194 0.2318 0.063219 0.091316 0.16156 0.16858 0.10537 0.070244 0.23883 0.13346 0.13346 0.056194 0.27395 0.11239l0.62516 0.2599q0.20371 0.084291 0.37229 0.19668 0.16858 0.11239 0.288 0.2599 0.12644 0.14751 0.19668 0.34419 0.070244 0.18966 0.070244 0.44253 0 0.28097-0.11239 0.52683-0.11239 0.24585-0.33015 0.43551-0.21073 0.18263-0.5198 0.29502-0.30205 0.10536-0.68838 0.10536zm-2.3848-2.6458h4.7625v0.52917h-4.7625z" fill="#aeaeae" stroke-opacity=".78039" stroke-width=".52683"/>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="24" height="24" version="1.1" viewBox="0 0 6.35 6.35" xmlns="http://www.w3.org/2000/svg">
<path d="m1.9519 3.0221-0.16749 0.58257h1.2161l-0.16749-0.58257q-0.11651-0.37867-0.22575-0.77919-0.10195-0.40052-0.2039-0.79375h-0.029128q-0.10195 0.40052-0.2039 0.80103-0.10195 0.39323-0.21846 0.7719zm-1.5948 2.5342 1.5511-4.7625h0.99037l1.5511 4.7625h-0.88842l-0.37139-1.2889h-1.6021l-0.37139 1.2889z" fill="#aeaeae" stroke-opacity=".78039" stroke-width=".54616"/>
<path d="m4.4491 5.5562v-2.1167h0.67643q0.16506 0 0.30099 0.029128 0.13917 0.025892 0.2395 0.087385 0.10357 0.058257 0.15859 0.15859 0.058257 0.10033 0.058257 0.24597 0 0.15212-0.077675 0.28157-0.077675 0.12946-0.21684 0.17801v0.012947q0.17477 0.038837 0.28805 0.16506 0.11651 0.12299 0.11651 0.3366 0 0.15859-0.061493 0.2751-0.061493 0.11651-0.17153 0.19419-0.10681 0.077675-0.25568 0.11651-0.14888 0.035601-0.32365 0.035601zm0.37543-1.2428h0.26863q0.22332 0 0.32041-0.080912 0.10033-0.080912 0.10033-0.21684 0-0.15535-0.10357-0.22008-0.10357-0.064729-0.3107-0.064729h-0.2751zm0 0.95153h0.31718q0.23303 0 0.35925-0.084149 0.12622-0.087385 0.12622-0.26539 0-0.1683-0.12299-0.24274-0.12299-0.077676-0.36249-0.077676h-0.31718z" fill="#aeaeae" stroke-opacity=".78039" stroke-width=".24274"/>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="24" height="24" version="1.1" viewBox="0 0 6.35 6.35" xmlns="http://www.w3.org/2000/svg">
<path d="m2.1082 3.0221-0.16749 0.58257h1.2161l-0.16749-0.58257q-0.11651-0.37867-0.22575-0.77919-0.10195-0.40052-0.2039-0.79375h-0.029128q-0.10195 0.40052-0.2039 0.80103-0.10195 0.39323-0.21846 0.7719zm-1.5948 2.5342 1.5511-4.7625h0.99037l1.5511 4.7625h-0.88842l-0.37139-1.2889h-1.6021l-0.37139 1.2889z" fill="#aeaeae" stroke-opacity=".78039" stroke-width=".54616"/>
<path d="m4.2928 2.9104v-2.1167h0.67642q0.16507 0 0.301 0.029128 0.13917 0.025892 0.2395 0.087385 0.10357 0.058257 0.15859 0.15859 0.058257 0.10033 0.058257 0.24597 0 0.15212-0.077674 0.28157-0.077674 0.12946-0.21684 0.17801v0.012947q0.17477 0.038837 0.28805 0.16507 0.11651 0.12299 0.11651 0.3366 0 0.15859-0.061493 0.2751-0.061493 0.11651-0.17153 0.19418-0.1068 0.077674-0.25568 0.11651-0.14888 0.035601-0.32365 0.035601zm0.37544-1.2428h0.26862q0.22332 0 0.32041-0.080912 0.10033-0.080911 0.10033-0.21684 0-0.15535-0.10357-0.22008-0.10357-0.064728-0.3107-0.064728h-0.2751zm0 0.95153h0.31717q0.23303 0 0.35925-0.084149 0.12622-0.087385 0.12622-0.26538 0-0.16829-0.12299-0.24273-0.12299-0.077675-0.36249-0.077675h-0.31717z" fill="#aeaeae" stroke-opacity=".78039" stroke-width=".24273"/>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="24" height="24" version="1.1" viewBox="0 0 6.35 6.35" xmlns="http://www.w3.org/2000/svg">
<path d="m3.1782 5.0271q-0.36231 0-0.6547-0.1017-0.28603-0.10806-0.49579-0.33689-0.2034-0.22883-0.31782-0.58479-0.10806-0.36231-0.10806-0.87717v-2.3328h0.73733v2.3899q0 0.33689 0.057206 0.57207 0.063563 0.22883 0.17162 0.36866 0.11441 0.13984 0.26697 0.2034 0.15255 0.057206 0.34324 0.057206 0.19068 0 0.3496-0.057206 0.15891-0.063564 0.27332-0.2034 0.11441-0.13984 0.17798-0.36866 0.063564-0.23519 0.063564-0.57207v-2.3899h0.70555v2.3328q0 0.51487-0.10806 0.87717-0.10806 0.35595-0.31782 0.58479-0.2034 0.22883-0.49579 0.33689-0.28603 0.1017-0.64835 0.1017z" fill="#aeaeae" stroke-opacity=".78039" stroke-width=".47673"/>
<rect x="1.0583" y="5.2917" width="4.2333" height=".52917" fill="#aeaeae" stroke-width="1.2172"/>
</svg>

After

Width:  |  Height:  |  Size: 871 B

@@ -46,6 +46,14 @@ cross = typ_times.svg
down = typ_chevron-down.svg down = typ_chevron-down.svg
edit = typ_pencil.svg edit = typ_pencil.svg
export = typ_export.svg export = typ_export.svg
fmt_bold = nw_tb-bold.svg
fmt_italic = nw_tb-italic.svg
fmt_mode-md = nw_tb-markdown.svg
fmt_mode-sc = nw_tb-shortcode.svg
fmt_strike = nw_tb-strike.svg
fmt_subscript = nw_tb-subscript.svg
fmt_superscript = nw_tb-superscript.svg
fmt_underline = nw_tb-underline.svg
forward = typ_chevron-right.svg forward = typ_chevron-right.svg
maximise = typ_arrow-maximise.svg maximise = typ_arrow-maximise.svg
menu = typ_th-dot-menu.svg menu = typ_th-dot-menu.svg
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="24" height="24" version="1.1" viewBox="0 0 6.35 6.35" xmlns="http://www.w3.org/2000/svg">
<path d="m1.3672 5.5562v-4.7625h1.6289q0.37252 0 0.68662 0.058435 0.32139 0.051131 0.55513 0.18991 0.24104 0.13878 0.37252 0.36522 0.13878 0.22644 0.13878 0.56975 0 0.1607-0.043826 0.32139-0.043826 0.16069-0.12417 0.29948-0.080349 0.13878-0.19721 0.24835-0.10957 0.10957-0.25565 0.1607v0.029218q0.18261 0.043827 0.33601 0.13878 0.1534 0.087653 0.27027 0.22644 0.11687 0.13878 0.18261 0.3287 0.065739 0.18261 0.065739 0.42365 0 0.36522-0.14608 0.62818-0.13878 0.26295-0.39444 0.43826-0.24835 0.168-0.58435 0.25565-0.33601 0.080349-0.72313 0.080349zm1.0737-2.8561h0.50401q0.39444 0 0.56975-0.1534 0.18261-0.1534 0.18261-0.40905 0-0.27757-0.18261-0.39444-0.18261-0.11687-0.56244-0.11687h-0.51131zm0 2.0233h0.60626q0.88383 0 0.88383-0.64279 0-0.31408-0.21914-0.44557-0.21914-0.13878-0.6647-0.13878h-0.60626z" fill-opacity=".78039" stroke-opacity=".78039" stroke-width=".54782"/>
</svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="24" height="24" version="1.1" viewBox="0 0 6.35 6.35" xmlns="http://www.w3.org/2000/svg">
<path d="m2.3084 5.5562 0.94666-4.7625h0.78646l-0.94666 4.7625z" fill-opacity=".78039" stroke-opacity=".78039" stroke-width=".54615"/>
</svg>

After

Width:  |  Height:  |  Size: 284 B

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="24" height="24" version="1.1" viewBox="0 0 6.35 6.35" xmlns="http://www.w3.org/2000/svg">
<g fill-opacity=".78039" stroke-width="1.1">
<path d="m0.79397 2.8846-0.29357-0.21175 0.28393-0.5005-0.51975-0.23582 0.11068-0.3465 0.55825 0.1155 0.062562-0.56787h0.37057l0.062562 0.57268 0.55343-0.12032 0.1155 0.3465-0.51975 0.23582 0.28393 0.5005-0.29356 0.21175-0.385-0.42832z"/>
<path d="m2.8219 3.15-0.09999 0.37496h0.86866l-0.09374-0.37496q-0.08749-0.30622-0.16873-0.64993-0.081241-0.34372-0.16248-0.66243h-0.024997q-0.074992 0.32496-0.15623 0.66868-0.074992 0.33747-0.16248 0.64369zm-1.4749 2.0623 1.2749-4.0746h1.1062l1.2749 4.0746h-0.97489l-0.24997-0.96865h-1.2437l-0.24997 0.96865z"/>
<path d="m4.7812 2.8846-0.29357-0.21175 0.28394-0.5005-0.51975-0.23582 0.11069-0.3465 0.55825 0.1155 0.062562-0.56787h0.37056l0.062562 0.57268 0.55343-0.12032 0.1155 0.3465-0.51975 0.23582 0.28393 0.5005-0.29356 0.21175-0.385-0.42832z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 995 B

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="24" height="24" version="1.1" viewBox="0 0 6.35 6.35" xmlns="http://www.w3.org/2000/svg">
<g fill-opacity=".78039" stroke-width="1.3799">
<path d="m0.52917 5.2683v-4.1866h1.0272v0.37972h-0.49167v3.4272h0.49167v0.37972z"/>
<path d="m2.9 2.9219-0.077889 0.29209h0.67667l-0.073022-0.29209q-0.068154-0.23854-0.13144-0.50628-0.063285-0.26775-0.12657-0.51601h-0.019472q-0.058417 0.25314-0.1217 0.52088-0.058417 0.26288-0.12657 0.50141zm-1.1489 1.6065 0.9931-3.174h0.86166l0.9931 3.174h-0.75942l-0.19472-0.75455h-0.96876l-0.19472 0.75455z"/>
<path d="m4.7937 5.2683v-0.37972h0.49654v-3.4272h-0.49654v-0.37972h1.0272v4.1866z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 691 B

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="24" height="24" version="1.1" viewBox="0 0 6.35 6.35" xmlns="http://www.w3.org/2000/svg">
<path d="m3.1785 5.5562q-0.46361 0-0.89912-0.17561-0.42848-0.17561-0.75863-0.49873l0.47766-0.55492q0.24585 0.2318 0.56195 0.37931 0.3161 0.14049 0.63219 0.14049 0.39336 0 0.59707-0.16156 0.20371-0.16156 0.20371-0.42848 0-0.14049-0.056194-0.23883-0.04917-0.098341-0.14751-0.16858-0.091316-0.077267-0.22478-0.14049-0.12644-0.063219-0.28097-0.12644l-0.63219-0.27395q-0.16858-0.070243-0.33717-0.17561-0.16156-0.10537-0.29502-0.25288-0.13346-0.14751-0.21775-0.34419-0.077268-0.19668-0.077268-0.44956 0-0.27395 0.11239-0.50575 0.11941-0.23883 0.32312-0.41444 0.20371-0.17561 0.48468-0.27395 0.288-0.098341 0.62517-0.098341 0.40039 0 0.77268 0.16156 0.37229 0.15454 0.63921 0.42146l-0.41444 0.5198q-0.22478-0.18263-0.46361-0.288-0.23883-0.10537-0.53385-0.10537-0.33014 0-0.52683 0.14751-0.19668 0.14049-0.19668 0.39336 0 0.13346 0.056194 0.2318 0.063219 0.091316 0.16156 0.16858 0.10537 0.070244 0.23883 0.13346 0.13346 0.056194 0.27395 0.11239l0.62516 0.2599q0.20371 0.084291 0.37229 0.19668 0.16858 0.11239 0.288 0.2599 0.12644 0.14751 0.19668 0.34419 0.070244 0.18966 0.070244 0.44253 0 0.28097-0.11239 0.52683-0.11239 0.24585-0.33015 0.43551-0.21073 0.18263-0.5198 0.29502-0.30205 0.10536-0.68838 0.10536zm-2.3848-2.6458h4.7625v0.52917h-4.7625z" fill-opacity=".78039" stroke-opacity=".78039" stroke-width=".52683"/>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="24" height="24" version="1.1" viewBox="0 0 6.35 6.35" xmlns="http://www.w3.org/2000/svg">
<path d="m3.1782 5.0271q-0.36231 0-0.6547-0.1017-0.28603-0.10806-0.49579-0.33689-0.2034-0.22883-0.31782-0.58479-0.10806-0.36231-0.10806-0.87717v-2.3328h0.73733v2.3899q0 0.33689 0.057206 0.57207 0.063563 0.22883 0.17162 0.36866 0.11441 0.13984 0.26697 0.2034 0.15255 0.057206 0.34324 0.057206 0.19068 0 0.3496-0.057206 0.15891-0.063564 0.27332-0.2034 0.11441-0.13984 0.17798-0.36866 0.063564-0.23519 0.063564-0.57207v-2.3899h0.70555v2.3328q0 0.51487-0.10806 0.87717-0.10806 0.35595-0.31782 0.58479-0.2034 0.22883-0.49579 0.33689-0.28603 0.1017-0.64835 0.1017z" fill-opacity=".78039" stroke-opacity=".78039" stroke-width=".47673"/>
<rect x="1.0583" y="5.2917" width="4.2333" height=".52917" fill-opacity=".78039" stroke-width="1.2172"/>
</svg>

After

Width:  |  Height:  |  Size: 885 B

+35 -8
View File
@@ -2107,18 +2107,39 @@ class GuiDocToolBar(QWidget):
# General Buttons # General Buttons
# =============== # ===============
self.tbSticky = QToolButton(self) self.tbMode = QToolButton(self)
self.tbSticky.setIconSize(iconSize) self.tbMode.setIconSize(iconSize)
self.tbMode.setCheckable(True)
self.tbEdit = QToolButton(self) self.tbBold = QToolButton(self)
self.tbEdit.setIconSize(iconSize) self.tbBold.setIconSize(iconSize)
self.tbItalic = QToolButton(self)
self.tbItalic.setIconSize(iconSize)
self.tbStrike = QToolButton(self)
self.tbStrike.setIconSize(iconSize)
self.tbUnderline = QToolButton(self)
self.tbUnderline.setIconSize(iconSize)
self.tbSuperscript = QToolButton(self)
self.tbSuperscript.setIconSize(iconSize)
self.tbSubscript = QToolButton(self)
self.tbSubscript.setIconSize(iconSize)
# Assemble # Assemble
# ======== # ========
self.outerBox = QVBoxLayout() self.outerBox = QVBoxLayout()
self.outerBox.addWidget(self.tbSticky) self.outerBox.addWidget(self.tbMode)
self.outerBox.addWidget(self.tbEdit) self.outerBox.addWidget(self.tbBold)
self.outerBox.addWidget(self.tbItalic)
self.outerBox.addWidget(self.tbStrike)
self.outerBox.addWidget(self.tbUnderline)
self.outerBox.addWidget(self.tbSuperscript)
self.outerBox.addWidget(self.tbSubscript)
self.outerBox.setContentsMargins(cM, cM, cM, cM) self.outerBox.setContentsMargins(cM, cM, cM, cM)
self.outerBox.setSpacing(cM) self.outerBox.setSpacing(cM)
@@ -2150,8 +2171,14 @@ class GuiDocToolBar(QWidget):
# buttonStyleMenu = f"{buttonStyle} QToolButton::menu-indicator {{image: none;}}" # buttonStyleMenu = f"{buttonStyle} QToolButton::menu-indicator {{image: none;}}"
# self.tbEdit.setStyleSheet(buttonStyle) # self.tbEdit.setStyleSheet(buttonStyle)
self.tbSticky.setIcon(SHARED.theme.getIcon("sticky-off")) tPx = int(0.8*SHARED.theme.fontPixelSize)
self.tbEdit.setIcon(SHARED.theme.getIcon("edit")) self.tbMode.setIcon(SHARED.theme.getToggleIcon("fmt_mode", (tPx, tPx)))
self.tbBold.setIcon(SHARED.theme.getIcon("fmt_bold"))
self.tbItalic.setIcon(SHARED.theme.getIcon("fmt_italic"))
self.tbStrike.setIcon(SHARED.theme.getIcon("fmt_strike"))
self.tbUnderline.setIcon(SHARED.theme.getIcon("fmt_underline"))
self.tbSuperscript.setIcon(SHARED.theme.getIcon("fmt_superscript"))
self.tbSubscript.setIcon(SHARED.theme.getIcon("fmt_subscript"))
return return
+6 -18
View File
@@ -34,8 +34,8 @@ from typing import TYPE_CHECKING
from PyQt5.QtCore import pyqtSignal, pyqtSlot, QPoint, QSize, Qt, QUrl from PyQt5.QtCore import pyqtSignal, pyqtSlot, QPoint, QSize, Qt, QUrl
from PyQt5.QtGui import ( from PyQt5.QtGui import (
QColor, QCursor, QFont, QIcon, QMouseEvent, QPalette, QResizeEvent, QColor, QCursor, QFont, QMouseEvent, QPalette, QResizeEvent, QTextCursor,
QTextCursor, QTextOption QTextOption
) )
from PyQt5.QtWidgets import ( from PyQt5.QtWidgets import (
QAction, qApp, QFrame, QHBoxLayout, QLabel, QMenu, QScrollArea, QAction, qApp, QFrame, QHBoxLayout, QLabel, QMenu, QScrollArea,
@@ -1020,24 +1020,12 @@ class GuiDocViewFooter(QWidget):
# Methods # Methods
## ##
def updateTheme(self): def updateTheme(self) -> None:
"""Update theme elements. """Update theme elements."""
"""
# Icons # Icons
fPx = int(0.9*SHARED.theme.fontPixelSize) fPx = int(0.9*SHARED.theme.fontPixelSize)
stickyIcon = SHARED.theme.getToggleIcon("sticky", (fPx, fPx))
stickyOn = SHARED.theme.getPixmap("sticky-on", (fPx, fPx)) bulletIcon = SHARED.theme.getToggleIcon("bullet", (fPx, fPx))
stickyOff = SHARED.theme.getPixmap("sticky-off", (fPx, fPx))
stickyIcon = QIcon()
stickyIcon.addPixmap(stickyOn, QIcon.Normal, QIcon.On)
stickyIcon.addPixmap(stickyOff, QIcon.Normal, QIcon.Off)
bulletOn = SHARED.theme.getPixmap("bullet-on", (fPx, fPx))
bulletOff = SHARED.theme.getPixmap("bullet-off", (fPx, fPx))
bulletIcon = QIcon()
bulletIcon.addPixmap(bulletOn, QIcon.Normal, QIcon.On)
bulletIcon.addPixmap(bulletOff, QIcon.Normal, QIcon.Off)
self.showHide.setIcon(SHARED.theme.getIcon("reference")) self.showHide.setIcon(SHARED.theme.getIcon("reference"))
self.stickyRefs.setIcon(stickyIcon) self.stickyRefs.setIcon(stickyIcon)
+35 -12
View File
@@ -130,6 +130,7 @@ class GuiTheme:
self.getIcon = self.iconCache.getIcon self.getIcon = self.iconCache.getIcon
self.getPixmap = self.iconCache.getPixmap self.getPixmap = self.iconCache.getPixmap
self.getItemIcon = self.iconCache.getItemIcon self.getItemIcon = self.iconCache.getItemIcon
self.getToggleIcon = self.iconCache.getToggleIcon
self.loadDecoration = self.iconCache.loadDecoration self.loadDecoration = self.iconCache.loadDecoration
self.getHeaderDecoration = self.iconCache.getHeaderDecoration self.getHeaderDecoration = self.iconCache.getHeaderDecoration
@@ -447,14 +448,22 @@ class GuiIcons:
ICON_KEYS = { ICON_KEYS = {
# Project and GUI Icons # Project and GUI Icons
"novelwriter", "alert_error", "alert_info", "alert_question", "alert_warn", "novelwriter", "alert_error", "alert_info", "alert_question", "alert_warn",
"build_excluded", "build_filtered", "build_included", "cls_archive", "cls_character", "build_excluded", "build_filtered", "build_included", "proj_chapter", "proj_details",
"cls_custom", "cls_entity", "cls_none", "cls_novel", "cls_object", "cls_plot", "proj_document", "proj_folder", "proj_note", "proj_nwx", "proj_section", "proj_scene",
"cls_timeline", "cls_trash", "cls_world", "proj_chapter", "proj_details", "proj_document", "proj_stats", "proj_title", "status_idle", "status_lang", "status_lines", "status_stats",
"proj_folder", "proj_note", "proj_nwx", "proj_section", "proj_scene", "proj_stats", "status_time", "view_build", "view_editor", "view_novel", "view_outline",
"proj_title", "search_cancel", "search_case", "search_loop", "search_preserve",
"search_project", "search_regex", "search_word", "status_idle", "status_lang", # Class Icons
"status_lines", "status_stats", "status_time", "view_build", "view_editor", "view_novel", "cls_archive", "cls_character", "cls_custom", "cls_entity", "cls_none", "cls_novel",
"view_outline", "cls_object", "cls_plot", "cls_timeline", "cls_trash", "cls_world",
# Search Icons
"search_cancel", "search_case", "search_loop", "search_preserve", "search_project",
"search_regex", "search_word",
# Format Icons
"fmt_bold", "fmt_italic", "fmt_mode-md", "fmt_mode-sc", "fmt_strike", "fmt_subscript",
"fmt_superscript", "fmt_underline",
# General Button Icons # General Button Icons
"add", "backward", "bookmark", "browse", "checked", "close", "cross", "down", "edit", "add", "backward", "bookmark", "browse", "checked", "close", "cross", "down", "edit",
@@ -469,6 +478,12 @@ class GuiIcons:
"deco_doc_h0", "deco_doc_h1", "deco_doc_h2", "deco_doc_h3", "deco_doc_h4", "deco_doc_more", "deco_doc_h0", "deco_doc_h1", "deco_doc_h2", "deco_doc_h3", "deco_doc_h4", "deco_doc_more",
} }
TOGGLE_ICON_KEYS = {
"sticky": ("sticky-on", "sticky-off"),
"bullet": ("bullet-on", "bullet-off"),
"fmt_mode": ("fmt_mode-sc", "fmt_mode-md"),
}
IMAGE_MAP = { IMAGE_MAP = {
"wiz-back": "wizard-back.jpg", "wiz-back": "wizard-back.jpg",
} }
@@ -602,10 +617,7 @@ class GuiIcons:
return theDeco return theDeco
def getIcon(self, iconKey): def getIcon(self, iconKey):
"""Return an icon from the icon buffer. If it doesn't exist, """Return an icon from the icon buffer, or load it."""
return, load it, and if it still doesn't exist, return an empty
icon.
"""
if iconKey in self._qIcons: if iconKey in self._qIcons:
return self._qIcons[iconKey] return self._qIcons[iconKey]
else: else:
@@ -613,6 +625,17 @@ class GuiIcons:
self._qIcons[iconKey] = qIcon self._qIcons[iconKey] = qIcon
return qIcon return qIcon
def getToggleIcon(self, iconKey: str, iconSize: tuple[int, int]) -> QIcon:
"""Return a toggle icon from the icon buffer. or load it."""
if iconKey in self.TOGGLE_ICON_KEYS:
pixOne = self.getPixmap(self.TOGGLE_ICON_KEYS[iconKey][0], iconSize)
pixTwo = self.getPixmap(self.TOGGLE_ICON_KEYS[iconKey][1], iconSize)
qIcon = QIcon()
qIcon.addPixmap(pixOne, QIcon.Normal, QIcon.On)
qIcon.addPixmap(pixTwo, QIcon.Normal, QIcon.Off)
return qIcon
return QIcon()
def getPixmap(self, iconKey, iconSize): def getPixmap(self, iconKey, iconSize):
"""Return an icon from the icon buffer as a QPixmap. If it """Return an icon from the icon buffer as a QPixmap. If it
doesn't exist, return an empty QPixmap. doesn't exist, return an empty QPixmap.