Merge branch 'main' into xml_rw_class
@@ -21,7 +21,7 @@ backward = typ_chevron-left.svg
|
||||
bookmark = typ_bookmark.svg
|
||||
bullet-off = typ_media-record-outline.svg
|
||||
bullet-on = typ_media-record.svg
|
||||
check = typ_tick.svg
|
||||
checked = mixed_input-checked.svg
|
||||
close = typ_times.svg
|
||||
cls_archive = typ_delete.svg
|
||||
cls_character = typ_user.svg
|
||||
@@ -41,13 +41,14 @@ forward = typ_chevron-right.svg
|
||||
maximise = typ_arrow-maximise.svg
|
||||
menu = typ_th-menu.svg
|
||||
minimise = typ_arrow-minimise.svg
|
||||
noncheckable = mixed_input-none.svg
|
||||
proj_chapter = mixed_document-chapter.svg
|
||||
proj_details = typ_th-list-grey.svg
|
||||
proj_document = typ_document-text.svg
|
||||
proj_folder = typ_folder.svg
|
||||
proj_note = mixed_document-note.svg
|
||||
proj_section = mixed_document-section.svg
|
||||
proj_scene = mixed_document-scene.svg
|
||||
proj_section = mixed_document-section.svg
|
||||
proj_stats = typ_chart-bar-grey.svg
|
||||
proj_title = mixed_document-title.svg
|
||||
reference = typ_at.svg
|
||||
@@ -70,6 +71,7 @@ status_stats = typ_chart-bar-grey.svg
|
||||
status_time = typ_stopwatch-grey.svg
|
||||
sticky-off = typ_pin-outline.svg
|
||||
sticky-on = typ_pin.svg
|
||||
unchecked = mixed_input-unchecked.svg
|
||||
up = typ_chevron-up.svg
|
||||
view_build = typ_export.svg
|
||||
view_editor = mixed_edit.svg
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
<?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"
|
||||
width="24"
|
||||
height="24"
|
||||
version="1.2"
|
||||
viewBox="0 0 24 24"
|
||||
id="svg2287">
|
||||
<defs
|
||||
id="defs2291" />
|
||||
<metadata
|
||||
id="metadata2281">
|
||||
<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>
|
||||
<path
|
||||
d="m17.714 22h-11.429c-2.3629 0-4.2857-1.9229-4.2857-4.2857v-11.429c0-2.3629 1.9229-4.2857 4.2857-4.2857h7.1429c0.79 0 1.4286 0.64 1.4286 1.4286 0 0.78857-0.63857 1.4286-1.4286 1.4286h-7.1429c-0.78857 0-1.4286 0.64143-1.4286 1.4286v11.429c0 0.78714 0.64 1.4286 1.4286 1.4286h11.429c0.78857 0 1.4286-0.64143 1.4286-1.4286v-4.2857c0-0.78857 0.63857-1.4286 1.4286-1.4286s1.4286 0.64 1.4286 1.4286v4.2857c0 2.3629-1.9229 4.2857-4.2857 4.2857z"
|
||||
fill="#848484"
|
||||
stroke-width="1.4286"
|
||||
id="path2283" />
|
||||
<path
|
||||
d="m19.02 3.3503c-0.60933 0.010623-1.2003 0.31545-1.5586 0.86719l-5.0977 7.8477-2.3672-3.6445c-0.57329-0.88278-1.7442-1.1319-2.627-0.55859-0.88278 0.57329-1.1319 1.7461-0.55859 2.6289l3.9199 6.0391c0.38514 0.59307 1.0409 0.88965 1.6973 0.85352 0.03023-2.78e-4 0.05972-0.0041 0.08984-0.0059 0.0556-0.0057 0.11074-0.0088 0.16602-0.01953 0.52104-0.07621 1.0077-0.36147 1.3184-0.83984l6.6445-10.23c0.57329-0.88278 0.32419-2.0556-0.55859-2.6289-0.33104-0.21498-0.70276-0.31497-1.0684-0.30859z"
|
||||
fill="#9c9"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
stroke-width="1.111"
|
||||
id="path2285" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.8 KiB |
@@ -0,0 +1,44 @@
|
||||
<?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"
|
||||
width="24"
|
||||
height="24"
|
||||
version="1.2"
|
||||
viewBox="0 0 24 24"
|
||||
id="svg2931">
|
||||
<defs
|
||||
id="defs2935" />
|
||||
<metadata
|
||||
id="metadata2925">
|
||||
<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>
|
||||
<path
|
||||
d="m2 17.714v-11.429c0-2.3629 1.9229-4.2857 4.2857-4.2857h11.429c2.3629 0 4.2857 1.9229 4.2857 4.2857v7.1429c0 0.79-0.64 1.4286-1.4286 1.4286-0.78857 0-1.4286-0.63857-1.4286-1.4286v-7.1429c0-0.78857-0.64143-1.4286-1.4286-1.4286h-11.429c-0.78714 0-1.4286 0.64-1.4286 1.4286v11.429c0 0.78857 0.64143 1.4286 1.4286 1.4286h4.2857c0.78857 0 1.4286 0.63857 1.4286 1.4286s-0.64 1.4286-1.4286 1.4286h-4.2857c-2.3629 0-4.2857-1.9229-4.2857-4.2857zm15.714 4.2857h-11.429c-2.3629 0-4.2857-1.9229-4.2857-4.2857v-11.429c0-2.3629 1.9229-4.2857 4.2857-4.2857h7.1429c0.79 0 1.4286 0.64 1.4286 1.4286 0 0.78857-0.63857 1.4286-1.4286 1.4286h-7.1429c-0.78857 0-1.4286 0.64143-1.4286 1.4286v11.429c0 0.78714 0.64 1.4286 1.4286 1.4286h11.429c0.78857 0 1.4286-0.64143 1.4286-1.4286v-4.2857c0-0.78857 0.63857-1.4286 1.4286-1.4286s1.4286 0.64 1.4286 1.4286v4.2857c0 2.3629-1.9229 4.2857-4.2857 4.2857z"
|
||||
fill="#848484"
|
||||
stroke-width="1.4286"
|
||||
id="path2927" />
|
||||
<rect
|
||||
x="7"
|
||||
y="10.1"
|
||||
width="10"
|
||||
height="3.8"
|
||||
rx="1.9"
|
||||
ry="1.9"
|
||||
fill="#f99157"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
stroke-width="1.111"
|
||||
id="rect2929" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.8 KiB |
@@ -0,0 +1,39 @@
|
||||
<?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"
|
||||
width="24"
|
||||
height="24"
|
||||
version="1.2"
|
||||
viewBox="0 0 24 24"
|
||||
id="svg3574">
|
||||
<defs
|
||||
id="defs3578" />
|
||||
<metadata
|
||||
id="metadata3568">
|
||||
<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>
|
||||
<path
|
||||
d="m17.714 22h-11.429c-2.3629 0-4.2857-1.9229-4.2857-4.2857v-11.429c0-2.3629 1.9229-4.2857 4.2857-4.2857h7.1429c0.79 0 1.4286 0.64 1.4286 1.4286 0 0.78857-0.63857 1.4286-1.4286 1.4286h-7.1429c-0.78857 0-1.4286 0.64143-1.4286 1.4286v11.429c0 0.78714 0.64 1.4286 1.4286 1.4286h11.429c0.78857 0 1.4286-0.64143 1.4286-1.4286v-4.2857c0-0.78857 0.63857-1.4286 1.4286-1.4286s1.4286 0.64 1.4286 1.4286v4.2857c0 2.3629-1.9229 4.2857-4.2857 4.2857z"
|
||||
fill="#848484"
|
||||
stroke-width="1.4286"
|
||||
id="path3570" />
|
||||
<path
|
||||
d="m17.99 3.3379c-0.48501 0.025418-0.96034 0.23584-1.3125 0.62695l-4.6777 5.1953-1.332-1.4785c-0.70433-0.78223-1.9014-0.84495-2.6836-0.14062-0.78223 0.70433-0.84495 1.9014-0.14062 2.6836l1.5996 1.7754-1.5977 1.7754c-0.70433 0.78223-0.64161 1.9793 0.14062 2.6836 0.78223 0.70433 1.9773 0.64161 2.6816-0.14062l1.332-1.4785 1.332 1.4785c0.70433 0.78224 1.9014 0.84495 2.6836 0.14062 0.78223-0.70433 0.84495-1.9014 0.14062-2.6836l-1.5996-1.7754 4.9453-5.4922c0.70433-0.78223 0.64161-1.9793-0.14062-2.6836-0.39112-0.35216-0.88608-0.51175-1.3711-0.48633z"
|
||||
fill="#d64848"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
stroke-width="1.111"
|
||||
id="path3572" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.9 KiB |
@@ -1,31 +0,0 @@
|
||||
<?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"
|
||||
version="1.2"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
id="svg896">
|
||||
<metadata
|
||||
id="metadata902">
|
||||
<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="defs900" />
|
||||
<path
|
||||
d="M 19.576035,3.3487939 C 18.237131,2.6038813 16.550693,3.0884898 15.809935,4.4246248 L 10.66893,13.676495 7.726664,10.734229 c -1.0813694,-1.0813704 -2.8342677,-1.0813704 -3.9156371,0 -1.0813693,1.081369 -1.0813693,2.834267 0,3.915637 l 5.538383,5.538383 c 0.523378,0.524762 1.2295221,0.812758 1.9578191,0.812758 l 0.383533,-0.02769 c 0.859834,-0.12046 1.614439,-0.636914 2.03674,-1.397057 L 20.650482,7.1148966 C 21.39401,5.777375 20.91217,4.0923218 19.576035,3.3487939 Z"
|
||||
id="path894"
|
||||
style="stroke-width:1.3846;fill:#99cc99;fill-opacity:1" />
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.2 KiB |
@@ -21,7 +21,7 @@ backward = typ_chevron-left.svg
|
||||
bookmark = typ_bookmark.svg
|
||||
bullet-off = typ_media-record-outline.svg
|
||||
bullet-on = typ_media-record.svg
|
||||
check = typ_tick.svg
|
||||
checked = mixed_input-checked.svg
|
||||
close = typ_times.svg
|
||||
cls_archive = typ_delete.svg
|
||||
cls_character = typ_user.svg
|
||||
@@ -41,13 +41,14 @@ forward = typ_chevron-right.svg
|
||||
maximise = typ_arrow-maximise.svg
|
||||
menu = typ_th-menu.svg
|
||||
minimise = typ_arrow-minimise.svg
|
||||
noncheckable = mixed_input-none.svg
|
||||
proj_chapter = mixed_document-chapter.svg
|
||||
proj_details = typ_th-list-grey.svg
|
||||
proj_document = typ_document-text.svg
|
||||
proj_folder = typ_folder.svg
|
||||
proj_note = mixed_document-note.svg
|
||||
proj_section = mixed_document-section.svg
|
||||
proj_scene = mixed_document-scene.svg
|
||||
proj_section = mixed_document-section.svg
|
||||
proj_stats = typ_chart-bar-grey.svg
|
||||
proj_title = mixed_document-title.svg
|
||||
reference = typ_at.svg
|
||||
@@ -70,6 +71,7 @@ status_stats = typ_chart-bar-grey.svg
|
||||
status_time = typ_stopwatch-grey.svg
|
||||
sticky-off = typ_pin-outline.svg
|
||||
sticky-on = typ_pin.svg
|
||||
unchecked = mixed_input-unchecked.svg
|
||||
up = typ_chevron-up.svg
|
||||
view_build = typ_export.svg
|
||||
view_editor = mixed_edit.svg
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
<?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"
|
||||
width="24"
|
||||
height="24"
|
||||
version="1.2"
|
||||
viewBox="0 0 24 24"
|
||||
id="svg879">
|
||||
<defs
|
||||
id="defs883" />
|
||||
<metadata
|
||||
id="metadata873">
|
||||
<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>
|
||||
<path
|
||||
d="m17.714 22h-11.429c-2.3629 0-4.2857-1.9229-4.2857-4.2857v-11.429c0-2.3629 1.9229-4.2857 4.2857-4.2857h7.1429c0.79 0 1.4286 0.64 1.4286 1.4286 0 0.78857-0.63857 1.4286-1.4286 1.4286h-7.1429c-0.78857 0-1.4286 0.64143-1.4286 1.4286v11.429c0 0.78714 0.64 1.4286 1.4286 1.4286h11.429c0.78857 0 1.4286-0.64143 1.4286-1.4286v-4.2857c0-0.78857 0.63857-1.4286 1.4286-1.4286s1.4286 0.64 1.4286 1.4286v4.2857c0 2.3629-1.9229 4.2857-4.2857 4.2857z"
|
||||
fill="#333"
|
||||
stroke-width="1.4286"
|
||||
id="path875" />
|
||||
<path
|
||||
d="m19.02 3.3503c-0.60933 0.010623-1.2003 0.31545-1.5586 0.86719l-5.0977 7.8477-2.3672-3.6445c-0.57329-0.88278-1.7442-1.1319-2.627-0.55859-0.88278 0.57329-1.1319 1.7461-0.55859 2.6289l3.9199 6.0391c0.38514 0.59307 1.0409 0.88965 1.6973 0.85352 0.03023-2.78e-4 0.05972-0.0041 0.08984-0.0059 0.0556-0.0057 0.11074-0.0088 0.16602-0.01953 0.52104-0.07621 1.0077-0.36147 1.3184-0.83984l6.6445-10.23c0.57329-0.88278 0.32419-2.0556-0.55859-2.6289-0.33104-0.21498-0.70276-0.31497-1.0684-0.30859z"
|
||||
fill="#718c00"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
stroke-width="1.111"
|
||||
id="path877" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.8 KiB |
@@ -0,0 +1,44 @@
|
||||
<?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"
|
||||
width="24"
|
||||
height="24"
|
||||
version="1.2"
|
||||
viewBox="0 0 24 24"
|
||||
id="svg973">
|
||||
<defs
|
||||
id="defs977" />
|
||||
<metadata
|
||||
id="metadata967">
|
||||
<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>
|
||||
<path
|
||||
d="m2 17.714v-11.429c0-2.3629 1.9229-4.2857 4.2857-4.2857h11.429c2.3629 0 4.2857 1.9229 4.2857 4.2857v7.1429c0 0.79-0.64 1.4286-1.4286 1.4286-0.78857 0-1.4286-0.63857-1.4286-1.4286v-7.1429c0-0.78857-0.64143-1.4286-1.4286-1.4286h-11.429c-0.78714 0-1.4286 0.64-1.4286 1.4286v11.429c0 0.78857 0.64143 1.4286 1.4286 1.4286h4.2857c0.78857 0 1.4286 0.63857 1.4286 1.4286s-0.64 1.4286-1.4286 1.4286h-4.2857c-2.3629 0-4.2857-1.9229-4.2857-4.2857zm15.714 4.2857h-11.429c-2.3629 0-4.2857-1.9229-4.2857-4.2857v-11.429c0-2.3629 1.9229-4.2857 4.2857-4.2857h7.1429c0.79 0 1.4286 0.64 1.4286 1.4286 0 0.78857-0.63857 1.4286-1.4286 1.4286h-7.1429c-0.78857 0-1.4286 0.64143-1.4286 1.4286v11.429c0 0.78714 0.64 1.4286 1.4286 1.4286h11.429c0.78857 0 1.4286-0.64143 1.4286-1.4286v-4.2857c0-0.78857 0.63857-1.4286 1.4286-1.4286s1.4286 0.64 1.4286 1.4286v4.2857c0 2.3629-1.9229 4.2857-4.2857 4.2857z"
|
||||
fill="#333"
|
||||
stroke-width="1.4286"
|
||||
id="path969" />
|
||||
<rect
|
||||
x="7"
|
||||
y="10.1"
|
||||
width="10"
|
||||
height="3.8"
|
||||
rx="1.9"
|
||||
ry="1.9"
|
||||
fill="#f5871f"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
stroke-width="1.111"
|
||||
id="rect971" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.8 KiB |
@@ -0,0 +1,39 @@
|
||||
<?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"
|
||||
width="24"
|
||||
height="24"
|
||||
version="1.2"
|
||||
viewBox="0 0 24 24"
|
||||
id="svg1616">
|
||||
<defs
|
||||
id="defs1620" />
|
||||
<metadata
|
||||
id="metadata1610">
|
||||
<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>
|
||||
<path
|
||||
d="m17.714 22h-11.429c-2.3629 0-4.2857-1.9229-4.2857-4.2857v-11.429c0-2.3629 1.9229-4.2857 4.2857-4.2857h7.1429c0.79 0 1.4286 0.64 1.4286 1.4286 0 0.78857-0.63857 1.4286-1.4286 1.4286h-7.1429c-0.78857 0-1.4286 0.64143-1.4286 1.4286v11.429c0 0.78714 0.64 1.4286 1.4286 1.4286h11.429c0.78857 0 1.4286-0.64143 1.4286-1.4286v-4.2857c0-0.78857 0.63857-1.4286 1.4286-1.4286s1.4286 0.64 1.4286 1.4286v4.2857c0 2.3629-1.9229 4.2857-4.2857 4.2857z"
|
||||
fill="#333"
|
||||
stroke-width="1.4286"
|
||||
id="path1612" />
|
||||
<path
|
||||
d="m17.99 3.3379c-0.48501 0.025418-0.96034 0.23584-1.3125 0.62695l-4.6777 5.1953-1.332-1.4785c-0.70433-0.78223-1.9014-0.84495-2.6836-0.14062-0.78223 0.70433-0.84495 1.9014-0.14062 2.6836l1.5996 1.7754-1.5977 1.7754c-0.70433 0.78223-0.64161 1.9793 0.14062 2.6836 0.78223 0.70433 1.9773 0.64161 2.6816-0.14062l1.332-1.4785 1.332 1.4785c0.70433 0.78224 1.9014 0.84495 2.6836 0.14062 0.78223-0.70433 0.84495-1.9014 0.14062-2.6836l-1.5996-1.7754 4.9453-5.4922c0.70433-0.78223 0.64161-1.9793-0.14062-2.6836-0.39112-0.35216-0.88608-0.51175-1.3711-0.48633z"
|
||||
fill="#c82829"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
stroke-width="1.111"
|
||||
id="path1614" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.9 KiB |
@@ -1,31 +0,0 @@
|
||||
<?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"
|
||||
version="1.2"
|
||||
width="24"
|
||||
height="24"
|
||||
viewBox="0 0 24 24"
|
||||
id="svg896">
|
||||
<metadata
|
||||
id="metadata902">
|
||||
<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="defs900" />
|
||||
<path
|
||||
d="M 19.576035,3.3487939 C 18.237131,2.6038813 16.550693,3.0884898 15.809935,4.4246248 L 10.66893,13.676495 7.726664,10.734229 c -1.0813694,-1.0813704 -2.8342677,-1.0813704 -3.9156371,0 -1.0813693,1.081369 -1.0813693,2.834267 0,3.915637 l 5.538383,5.538383 c 0.523378,0.524762 1.2295221,0.812758 1.9578191,0.812758 l 0.383533,-0.02769 c 0.859834,-0.12046 1.614439,-0.636914 2.03674,-1.397057 L 20.650482,7.1148966 C 21.39401,5.777375 20.91217,4.0923218 19.576035,3.3487939 Z"
|
||||
id="path894"
|
||||
style="stroke-width:1.3846;fill:#718c00;fill-opacity:1" />
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.2 KiB |
@@ -1,2 +1,4 @@
|
||||
[Main]
|
||||
name = Default System Theme
|
||||
name = Default Theme
|
||||
description = Qt standard colours
|
||||
icontheme = typicons_light
|
||||
@@ -1,10 +1,12 @@
|
||||
[Main]
|
||||
name = Default Dark Theme
|
||||
author = Veronica Berglyd Olsen
|
||||
credit = Veronica Berglyd Olsen
|
||||
url = https://github.com/vkbo/novelWriter
|
||||
license = CC BY-SA 4.0
|
||||
licenseurl = https://creativecommons.org/licenses/by-sa/4.0/
|
||||
name = Default Dark Theme
|
||||
description = The novelWriter standard dark theme
|
||||
author = Veronica Berglyd Olsen
|
||||
credit = Veronica Berglyd Olsen
|
||||
url = https://github.com/vkbo/novelWriter
|
||||
license = CC BY-SA 4.0
|
||||
licenseurl = https://creativecommons.org/licenses/by-sa/4.0/
|
||||
icontheme = typicons_dark
|
||||
|
||||
[Palette]
|
||||
window = 54, 54, 54
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
/**
|
||||
* Default Theme: Dark
|
||||
* This theme doesn't use any custom styles, so the file is only here as
|
||||
* an example. There doesn't have to be a styles.qss file in the folder.
|
||||
*/
|
||||
@@ -5,6 +5,7 @@ credit = Ethan Schoonover
|
||||
url = https://ethanschoonover.com/solarized/
|
||||
license = MIT
|
||||
licenseurl = https://github.com/altercation/solarized/blob/master/LICENSE
|
||||
icontheme = typicons_dark
|
||||
|
||||
[Palette]
|
||||
window = 0, 43, 54
|
||||
|
||||
@@ -5,6 +5,7 @@ credit = Ethan Schoonover
|
||||
url = https://ethanschoonover.com/solarized/
|
||||
license = MIT
|
||||
licenseurl = https://github.com/altercation/solarized/blob/master/LICENSE
|
||||
icontheme = typicons_light
|
||||
|
||||
[Palette]
|
||||
window = 238, 232, 213
|
||||
|
||||
@@ -73,7 +73,6 @@ class Config:
|
||||
# General
|
||||
self.guiTheme = "" # GUI theme
|
||||
self.guiSyntax = "" # Syntax theme
|
||||
self.guiIcons = "" # Icon theme
|
||||
self.guiFont = "" # Defaults to system default font
|
||||
self.guiFontSize = 11 # Is overridden if system default is loaded
|
||||
self.guiScale = 1.0 # Set automatically by Theme class
|
||||
@@ -81,7 +80,6 @@ class Config:
|
||||
|
||||
self.setDefaultGuiTheme()
|
||||
self.setDefaultSyntaxTheme()
|
||||
self.setDefaultIconTheme()
|
||||
|
||||
# Localisation
|
||||
self.qLocal = QLocale.system()
|
||||
@@ -410,7 +408,6 @@ class Config:
|
||||
cnfSec = "Main"
|
||||
self.guiTheme = theConf.rdStr(cnfSec, "theme", self.guiTheme)
|
||||
self.guiSyntax = theConf.rdStr(cnfSec, "syntax", self.guiSyntax)
|
||||
self.guiIcons = theConf.rdStr(cnfSec, "icons", self.guiIcons)
|
||||
self.guiFont = theConf.rdStr(cnfSec, "guifont", self.guiFont)
|
||||
self.guiFontSize = theConf.rdInt(cnfSec, "guifontsize", self.guiFontSize)
|
||||
self.lastNotes = theConf.rdStr(cnfSec, "lastnotes", self.lastNotes)
|
||||
@@ -508,12 +505,6 @@ class Config:
|
||||
logger.info("Using straight double quotes, so disabling auto-replace")
|
||||
self.doReplaceDQuote = False
|
||||
|
||||
# Check deprecated settings
|
||||
if self.guiIcons in ("typicons_colour_dark", "typicons_grey_dark"):
|
||||
self.guiIcons = "typicons_dark"
|
||||
elif self.guiIcons in ("typicons_colour_light", "typicons_grey_light"):
|
||||
self.guiIcons = "typicons_light"
|
||||
|
||||
return True
|
||||
|
||||
def saveConfig(self):
|
||||
@@ -529,7 +520,6 @@ class Config:
|
||||
"timestamp": formatTimeStamp(time()),
|
||||
"theme": str(self.guiTheme),
|
||||
"syntax": str(self.guiSyntax),
|
||||
"icons": str(self.guiIcons),
|
||||
"guifont": str(self.guiFont),
|
||||
"guifontsize": str(self.guiFontSize),
|
||||
"lastnotes": str(self.lastNotes),
|
||||
@@ -816,11 +806,6 @@ class Config:
|
||||
"""
|
||||
self.guiSyntax = "default_light"
|
||||
|
||||
def setDefaultIconTheme(self):
|
||||
"""Reset the icon theme to default value.
|
||||
"""
|
||||
self.guiIcons = "typicons_light"
|
||||
|
||||
##
|
||||
# Getters
|
||||
##
|
||||
|
||||
@@ -192,7 +192,7 @@ class DocSplitter:
|
||||
"""An iterator that will write each document in the buffer, and
|
||||
return its new handle, parent handle, and sibling handle.
|
||||
"""
|
||||
if self._srcHandle is None:
|
||||
if self._srcHandle is None or self._srcItem is None:
|
||||
return
|
||||
|
||||
pHandle = self._parHandle
|
||||
@@ -224,6 +224,10 @@ class DocSplitter:
|
||||
dHandle = self.theProject.newFile(docLabel, pHandle)
|
||||
hHandle[hLevel] = dHandle
|
||||
|
||||
newItem = self.theProject.tree[dHandle]
|
||||
newItem.setStatus(self._srcItem.itemStatus)
|
||||
newItem.setImport(self._srcItem.itemImport)
|
||||
|
||||
outDoc = NWDoc(self.theProject, dHandle)
|
||||
status = outDoc.writeDocument("\n".join(docText))
|
||||
if not status:
|
||||
|
||||
@@ -30,7 +30,8 @@ import novelwriter
|
||||
|
||||
from lxml import etree
|
||||
|
||||
from PyQt5.QtGui import QIcon, QPixmap, QColor
|
||||
from PyQt5.QtGui import QIcon, QPainter, QPainterPath, QPixmap, QColor
|
||||
from PyQt5.QtCore import QRectF, Qt
|
||||
|
||||
from novelwriter.common import checkInt, minmax, simplified
|
||||
|
||||
@@ -49,10 +50,15 @@ class NWStatus:
|
||||
self._reverse = {}
|
||||
self._default = None
|
||||
|
||||
self._iconSize = novelwriter.CONFIG.pxInt(32)
|
||||
pixmap = QPixmap(self._iconSize, self._iconSize)
|
||||
pixmap.fill(QColor(100, 100, 100))
|
||||
self._defaultIcon = QIcon(pixmap)
|
||||
self._iPX = novelwriter.CONFIG.pxInt(24)
|
||||
|
||||
pA = novelwriter.CONFIG.pxInt(2)
|
||||
pB = novelwriter.CONFIG.pxInt(20)
|
||||
pR = float(novelwriter.CONFIG.pxInt(4))
|
||||
self._iconPath = QPainterPath()
|
||||
self._iconPath.addRoundedRect(QRectF(pA, pA, pB, pB), pR, pR)
|
||||
|
||||
self._defaultIcon = self._createIcon([100, 100, 100])
|
||||
|
||||
if self._type == self.STATUS:
|
||||
self._prefix = "s"
|
||||
@@ -63,19 +69,16 @@ class NWStatus:
|
||||
|
||||
return
|
||||
|
||||
def write(self, key, name, cols, count=None):
|
||||
def write(self, key, name, col, count=None):
|
||||
"""Add or update a status entry. If the key is invalid, a new
|
||||
key is generated.
|
||||
"""
|
||||
if not self._isKey(key):
|
||||
key = self._newKey()
|
||||
if not isinstance(cols, tuple):
|
||||
cols = (100, 100, 100)
|
||||
if len(cols) != 3:
|
||||
cols = (100, 100, 100)
|
||||
|
||||
pixmap = QPixmap(self._iconSize, self._iconSize)
|
||||
pixmap.fill(QColor(*cols))
|
||||
if not isinstance(col, tuple):
|
||||
col = (100, 100, 100)
|
||||
if len(col) != 3:
|
||||
col = (100, 100, 100)
|
||||
|
||||
name = simplified(name)
|
||||
if count is None:
|
||||
@@ -83,8 +86,8 @@ class NWStatus:
|
||||
|
||||
self._store[key] = {
|
||||
"name": name,
|
||||
"icon": QIcon(pixmap),
|
||||
"cols": cols,
|
||||
"icon": self._createIcon(col),
|
||||
"cols": col,
|
||||
"count": count,
|
||||
}
|
||||
self._reverse[name] = key
|
||||
@@ -267,6 +270,19 @@ class NWStatus:
|
||||
return False
|
||||
return True
|
||||
|
||||
def _createIcon(self, col):
|
||||
"""Generate an icon for a status label.
|
||||
"""
|
||||
pixmap = QPixmap(self._iPX, self._iPX)
|
||||
pixmap.fill(Qt.transparent)
|
||||
|
||||
painter = QPainter(pixmap)
|
||||
painter.setRenderHint(QPainter.Antialiasing)
|
||||
painter.fillPath(self._iconPath, QColor(*col))
|
||||
painter.end()
|
||||
|
||||
return QIcon(pixmap)
|
||||
|
||||
##
|
||||
# Iterator Bits
|
||||
##
|
||||
|
||||
@@ -421,6 +421,12 @@ class PagedDialog(QDialog):
|
||||
self._buttonBox.addWidget(buttonBar)
|
||||
return
|
||||
|
||||
def setCurrentWidget(self, widget):
|
||||
"""Forward the changing of tab to the QTabWidget.
|
||||
"""
|
||||
self._tabBox.setCurrentWidget(widget)
|
||||
return
|
||||
|
||||
# END Class PagedDialog
|
||||
|
||||
|
||||
|
||||
@@ -103,14 +103,19 @@ class GuiDocSplit(QDialog):
|
||||
self.hierarchySwitch = QSwitch(width=2*iPx, height=iPx)
|
||||
self.hierarchySwitch.setChecked(docHierarchy)
|
||||
|
||||
self.trashLabel = QLabel(self.tr("Move split document to Trash"))
|
||||
self.trashSwitch = QSwitch(width=2*iPx, height=iPx)
|
||||
|
||||
self.optBox = QGridLayout()
|
||||
self.optBox.addWidget(self.folderLabel, 0, 0)
|
||||
self.optBox.addWidget(self.folderSwitch, 0, 1)
|
||||
self.optBox.addWidget(self.hierarchyLabel, 1, 0)
|
||||
self.optBox.addWidget(self.hierarchySwitch, 1, 1)
|
||||
self.optBox.addWidget(self.trashLabel, 2, 0)
|
||||
self.optBox.addWidget(self.trashSwitch, 2, 1)
|
||||
self.optBox.setVerticalSpacing(vSp)
|
||||
self.optBox.setHorizontalSpacing(hSp)
|
||||
self.optBox.setColumnStretch(2, 1)
|
||||
self.optBox.setColumnStretch(3, 1)
|
||||
|
||||
# Buttons
|
||||
self.buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
|
||||
@@ -155,11 +160,13 @@ class GuiDocSplit(QDialog):
|
||||
spLevel = self.splitLevel.currentData()
|
||||
intoFolder = self.folderSwitch.isChecked()
|
||||
docHierarchy = self.hierarchySwitch.isChecked()
|
||||
moveToTrash = self.trashSwitch.isChecked()
|
||||
|
||||
self._data["spLevel"] = spLevel
|
||||
self._data["headerList"] = headerList
|
||||
self._data["intoFolder"] = intoFolder
|
||||
self._data["docHierarchy"] = docHierarchy
|
||||
self._data["moveToTrash"] = moveToTrash
|
||||
|
||||
pOptions = self.theProject.options
|
||||
pOptions.setValue("GuiDocSplit", "spLevel", spLevel)
|
||||
|
||||
@@ -34,7 +34,6 @@ from PyQt5.QtWidgets import (
|
||||
QLineEdit, QFileDialog, QFontDialog, QDoubleSpinBox
|
||||
)
|
||||
|
||||
from novelwriter.enum import nwAlert
|
||||
from novelwriter.custom import QSwitch, QConfigLayout, PagedDialog
|
||||
from novelwriter.dialogs.quotes import GuiQuoteSelect
|
||||
|
||||
@@ -78,10 +77,36 @@ class GuiPreferences(PagedDialog):
|
||||
|
||||
self.resize(*self.mainConf.getPreferencesSize())
|
||||
|
||||
# Settings
|
||||
self._updateTheme = False
|
||||
self._updateSyntax = False
|
||||
self._needsRestart = False
|
||||
self._refreshTree = False
|
||||
|
||||
logger.debug("GuiPreferences initialisation complete")
|
||||
|
||||
return
|
||||
|
||||
##
|
||||
# Properties
|
||||
##
|
||||
|
||||
@property
|
||||
def updateTheme(self):
|
||||
return self._updateTheme
|
||||
|
||||
@property
|
||||
def updateSyntax(self):
|
||||
return self._updateSyntax
|
||||
|
||||
@property
|
||||
def needsRestart(self):
|
||||
return self._needsRestart
|
||||
|
||||
@property
|
||||
def refreshTree(self):
|
||||
return self._refreshTree
|
||||
|
||||
##
|
||||
# Slots
|
||||
##
|
||||
@@ -92,8 +117,7 @@ class GuiPreferences(PagedDialog):
|
||||
"""
|
||||
logger.debug("Saving new preferences")
|
||||
|
||||
needsRestart, refreshTree = self.tabGeneral.saveValues()
|
||||
|
||||
self.tabGeneral.saveValues()
|
||||
self.tabProjects.saveValues()
|
||||
self.tabDocs.saveValues()
|
||||
self.tabEditor.saveValues()
|
||||
@@ -101,14 +125,6 @@ class GuiPreferences(PagedDialog):
|
||||
self.tabAuto.saveValues()
|
||||
self.tabQuote.saveValues()
|
||||
|
||||
if needsRestart:
|
||||
self.mainGui.makeAlert(self.tr(
|
||||
"Some changes will not be applied until novelWriter has been restarted."
|
||||
), nwAlert.INFO)
|
||||
|
||||
if refreshTree:
|
||||
self.mainGui.projView.populateTree()
|
||||
|
||||
self._saveWindowSize()
|
||||
self.accept()
|
||||
|
||||
@@ -140,6 +156,7 @@ class GuiPreferencesGeneral(QWidget):
|
||||
super().__init__(parent=prefsGui)
|
||||
|
||||
self.mainConf = novelwriter.CONFIG
|
||||
self.prefsGui = prefsGui
|
||||
self.mainGui = prefsGui.mainGui
|
||||
self.mainTheme = prefsGui.mainGui.mainTheme
|
||||
|
||||
@@ -166,7 +183,7 @@ class GuiPreferencesGeneral(QWidget):
|
||||
self.mainForm.addRow(
|
||||
self.tr("Main GUI language"),
|
||||
self.guiLang,
|
||||
self.tr("Requires restart.")
|
||||
self.tr("Requires restart to take effect.")
|
||||
)
|
||||
|
||||
# Select Theme
|
||||
@@ -182,23 +199,7 @@ class GuiPreferencesGeneral(QWidget):
|
||||
self.mainForm.addRow(
|
||||
self.tr("Main GUI theme"),
|
||||
self.guiTheme,
|
||||
self.tr("Requires restart.")
|
||||
)
|
||||
|
||||
# Select Icon Theme
|
||||
self.guiIcons = QComboBox()
|
||||
self.guiIcons.setMinimumWidth(minWidth)
|
||||
self.iconCache = self.mainTheme.iconCache.listThemes()
|
||||
for iconDir, iconName in self.iconCache:
|
||||
self.guiIcons.addItem(iconName, iconDir)
|
||||
iconIdx = self.guiIcons.findData(self.mainConf.guiIcons)
|
||||
if iconIdx != -1:
|
||||
self.guiIcons.setCurrentIndex(iconIdx)
|
||||
|
||||
self.mainForm.addRow(
|
||||
self.tr("Main icon theme"),
|
||||
self.guiIcons,
|
||||
self.tr("Requires restart.")
|
||||
self.tr("General colour theme and icons.")
|
||||
)
|
||||
|
||||
# Editor Theme
|
||||
@@ -228,7 +229,7 @@ class GuiPreferencesGeneral(QWidget):
|
||||
self.mainForm.addRow(
|
||||
self.tr("Font family"),
|
||||
self.guiFont,
|
||||
self.tr("Requires restart."),
|
||||
self.tr("Requires restart to take effect."),
|
||||
theButton=self.fontButton
|
||||
)
|
||||
|
||||
@@ -241,7 +242,7 @@ class GuiPreferencesGeneral(QWidget):
|
||||
self.mainForm.addRow(
|
||||
self.tr("Font size"),
|
||||
self.guiFontSize,
|
||||
self.tr("Requires restart."),
|
||||
self.tr("Requires restart to take effect."),
|
||||
theUnit=self.tr("pt")
|
||||
)
|
||||
|
||||
@@ -288,27 +289,21 @@ class GuiPreferencesGeneral(QWidget):
|
||||
"""
|
||||
guiLang = self.guiLang.currentData()
|
||||
guiTheme = self.guiTheme.currentData()
|
||||
guiIcons = self.guiIcons.currentData()
|
||||
guiSyntax = self.guiSyntax.currentData()
|
||||
guiFont = self.guiFont.text()
|
||||
guiFontSize = self.guiFontSize.value()
|
||||
emphLabels = self.emphLabels.isChecked()
|
||||
|
||||
# Check if restart is needed
|
||||
needsRestart = False
|
||||
needsRestart |= self.mainConf.guiLang != guiLang
|
||||
needsRestart |= self.mainConf.guiTheme != guiTheme
|
||||
needsRestart |= self.mainConf.guiIcons != guiIcons
|
||||
needsRestart |= self.mainConf.guiFont != guiFont
|
||||
needsRestart |= self.mainConf.guiFontSize != guiFontSize
|
||||
|
||||
# Check if refreshing project tree is needed
|
||||
refreshTree = False
|
||||
refreshTree |= self.mainConf.emphLabels != emphLabels
|
||||
# Update Flags
|
||||
self.prefsGui._updateTheme |= self.mainConf.guiTheme != guiTheme
|
||||
self.prefsGui._updateSyntax |= self.mainConf.guiSyntax != guiSyntax
|
||||
self.prefsGui._needsRestart |= self.mainConf.guiLang != guiLang
|
||||
self.prefsGui._needsRestart |= self.mainConf.guiFont != guiFont
|
||||
self.prefsGui._needsRestart |= self.mainConf.guiFontSize != guiFontSize
|
||||
self.prefsGui._refreshTree |= self.mainConf.emphLabels != emphLabels
|
||||
|
||||
self.mainConf.guiLang = guiLang
|
||||
self.mainConf.guiTheme = guiTheme
|
||||
self.mainConf.guiIcons = guiIcons
|
||||
self.mainConf.guiSyntax = guiSyntax
|
||||
self.mainConf.guiFont = guiFont
|
||||
self.mainConf.guiFontSize = guiFontSize
|
||||
@@ -319,7 +314,7 @@ class GuiPreferencesGeneral(QWidget):
|
||||
|
||||
self.mainConf.confChanged = True
|
||||
|
||||
return needsRestart, refreshTree
|
||||
return
|
||||
|
||||
##
|
||||
# Slots
|
||||
|
||||
@@ -43,7 +43,12 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
class GuiProjectSettings(PagedDialog):
|
||||
|
||||
def __init__(self, mainGui):
|
||||
TAB_MAIN = 0
|
||||
TAB_STATUS = 1
|
||||
TAB_IMPORT = 2
|
||||
TAB_REPLACE = 3
|
||||
|
||||
def __init__(self, mainGui, focusTab=TAB_MAIN):
|
||||
super().__init__(parent=mainGui)
|
||||
|
||||
logger.debug("Initialising GuiProjectSettings ...")
|
||||
@@ -83,12 +88,19 @@ class GuiProjectSettings(PagedDialog):
|
||||
self.addControls(self.buttonBox)
|
||||
|
||||
# Flags
|
||||
self.spellChanged = False
|
||||
self._spellChanged = False
|
||||
|
||||
# Focus Tab
|
||||
self._focusTab(focusTab)
|
||||
|
||||
logger.debug("GuiProjectSettings initialisation complete")
|
||||
|
||||
return
|
||||
|
||||
@property
|
||||
def spellChanged(self):
|
||||
return self._spellChanged
|
||||
|
||||
##
|
||||
# Slots
|
||||
##
|
||||
@@ -108,7 +120,7 @@ class GuiProjectSettings(PagedDialog):
|
||||
self.theProject.setProjBackup(doBackup)
|
||||
|
||||
# Remember this as updating spell dictionary can be expensive
|
||||
self.spellChanged = self.theProject.setSpellLang(spellLang)
|
||||
self._spellChanged = self.theProject.setSpellLang(spellLang)
|
||||
|
||||
if self.tabStatus.colChanged:
|
||||
newList, delList = self.tabStatus.getNewList()
|
||||
@@ -141,6 +153,19 @@ class GuiProjectSettings(PagedDialog):
|
||||
# Internal Functions
|
||||
##
|
||||
|
||||
def _focusTab(self, tab):
|
||||
"""Change which is the focused tab.
|
||||
"""
|
||||
if tab == self.TAB_MAIN:
|
||||
self.setCurrentWidget(self.tabMain)
|
||||
elif tab == self.TAB_STATUS:
|
||||
self.setCurrentWidget(self.tabStatus)
|
||||
elif tab == self.TAB_IMPORT:
|
||||
self.setCurrentWidget(self.tabImport)
|
||||
elif tab == self.TAB_REPLACE:
|
||||
self.setCurrentWidget(self.tabReplace)
|
||||
return
|
||||
|
||||
def _saveGuiSettings(self):
|
||||
"""Save GUI settings.
|
||||
"""
|
||||
|
||||
@@ -112,9 +112,10 @@ class nwDocInsert(Enum):
|
||||
QUOTE_RS = 2
|
||||
QUOTE_LD = 3
|
||||
QUOTE_RD = 4
|
||||
NEW_PAGE = 5
|
||||
VSPACE_S = 6
|
||||
VSPACE_M = 7
|
||||
SYNOPSIS = 5
|
||||
NEW_PAGE = 6
|
||||
VSPACE_S = 7
|
||||
VSPACE_M = 8
|
||||
|
||||
# END Enum nwDocInsert
|
||||
|
||||
|
||||
@@ -138,24 +138,20 @@ class GuiDocEditor(QTextEdit):
|
||||
self.setFrameStyle(QFrame.NoFrame)
|
||||
|
||||
# Custom Shortcuts
|
||||
QShortcut(
|
||||
QKeySequence("Ctrl+."),
|
||||
self,
|
||||
context=Qt.WidgetShortcut,
|
||||
activated=self._openSpellContext
|
||||
)
|
||||
QShortcut(
|
||||
Qt.Key_Return | Qt.ControlModifier,
|
||||
self,
|
||||
context=Qt.WidgetShortcut,
|
||||
activated=self._followTag
|
||||
)
|
||||
QShortcut(
|
||||
Qt.Key_Enter | Qt.ControlModifier,
|
||||
self,
|
||||
context=Qt.WidgetShortcut,
|
||||
activated=self._followTag
|
||||
)
|
||||
self.keyContext = QShortcut(self)
|
||||
self.keyContext.setKey("Ctrl+.")
|
||||
self.keyContext.setContext(Qt.WidgetShortcut)
|
||||
self.keyContext.activated.connect(self._openSpellContext)
|
||||
|
||||
self.followTag1 = QShortcut(self)
|
||||
self.followTag1.setKey(Qt.Key_Return | Qt.ControlModifier)
|
||||
self.followTag1.setContext(Qt.WidgetShortcut)
|
||||
self.followTag1.activated.connect(self._followTag)
|
||||
|
||||
self.followTag2 = QShortcut(self)
|
||||
self.followTag2.setKey(Qt.Key_Enter | Qt.ControlModifier)
|
||||
self.followTag2.setContext(Qt.WidgetShortcut)
|
||||
self.followTag2.activated.connect(self._followTag)
|
||||
|
||||
# Set Up Document Word Counter
|
||||
self.wcTimerDoc = QTimer()
|
||||
@@ -177,6 +173,7 @@ class GuiDocEditor(QTextEdit):
|
||||
self.wCounterSel.signals.countsReady.connect(self._updateSelCounts)
|
||||
|
||||
# Finalise
|
||||
self.updateSyntaxColours()
|
||||
self.initEditor()
|
||||
|
||||
logger.debug("GuiDocEditor initialisation complete")
|
||||
@@ -210,6 +207,35 @@ class GuiDocEditor(QTextEdit):
|
||||
|
||||
return True
|
||||
|
||||
def updateTheme(self):
|
||||
"""Update theme elements
|
||||
"""
|
||||
self.docSearch.updateTheme()
|
||||
self.docHeader.updateTheme()
|
||||
self.docFooter.updateTheme()
|
||||
return
|
||||
|
||||
def updateSyntaxColours(self):
|
||||
"""Update the syntax highlighting theme.
|
||||
"""
|
||||
mainPalette = self.palette()
|
||||
mainPalette.setColor(QPalette.Window, QColor(*self.mainTheme.colBack))
|
||||
mainPalette.setColor(QPalette.Base, QColor(*self.mainTheme.colBack))
|
||||
mainPalette.setColor(QPalette.Text, QColor(*self.mainTheme.colText))
|
||||
self.setPalette(mainPalette)
|
||||
|
||||
docPalette = self.viewport().palette()
|
||||
docPalette.setColor(QPalette.Base, QColor(*self.mainTheme.colBack))
|
||||
docPalette.setColor(QPalette.Text, QColor(*self.mainTheme.colText))
|
||||
self.viewport().setPalette(docPalette)
|
||||
|
||||
self.docHeader.matchColours()
|
||||
self.docFooter.matchColours()
|
||||
|
||||
self.highLight.initHighlighter()
|
||||
|
||||
return
|
||||
|
||||
def initEditor(self):
|
||||
"""Initialise or re-initialise the editor with the user's
|
||||
settings. This function is both called when the editor is
|
||||
@@ -256,21 +282,6 @@ class GuiDocEditor(QTextEdit):
|
||||
theFont.setPointSize(self.mainConf.textSize)
|
||||
self.setFont(theFont)
|
||||
|
||||
# Set the widget colours to match syntax theme
|
||||
mainPalette = self.palette()
|
||||
mainPalette.setColor(QPalette.Window, QColor(*self.mainTheme.colBack))
|
||||
mainPalette.setColor(QPalette.Base, QColor(*self.mainTheme.colBack))
|
||||
mainPalette.setColor(QPalette.Text, QColor(*self.mainTheme.colText))
|
||||
self.setPalette(mainPalette)
|
||||
|
||||
docPalette = self.viewport().palette()
|
||||
docPalette.setColor(QPalette.Base, QColor(*self.mainTheme.colBack))
|
||||
docPalette.setColor(QPalette.Text, QColor(*self.mainTheme.colText))
|
||||
self.viewport().setPalette(docPalette)
|
||||
|
||||
self.docHeader.matchColours()
|
||||
self.docFooter.matchColours()
|
||||
|
||||
# Set default text margins
|
||||
# Due to cursor visibility, a part of the margin must be
|
||||
# allocated to the document itself. See issue #1112.
|
||||
@@ -305,9 +316,6 @@ class GuiDocEditor(QTextEdit):
|
||||
# Refresh the tab stops
|
||||
self.setTabStopDistance(self.mainConf.getTabWidth())
|
||||
|
||||
# Initialise the syntax highlighter
|
||||
self.highLight.initHighlighter()
|
||||
|
||||
# Configure word count timer
|
||||
self.wcInterval = self.mainConf.wordCountTimer
|
||||
self.wcTimerDoc.setInterval(int(self.wcInterval*1000))
|
||||
@@ -869,6 +877,7 @@ class GuiDocEditor(QTextEdit):
|
||||
return False
|
||||
|
||||
newBlock = False
|
||||
goAfter = False
|
||||
|
||||
if isinstance(theInsert, str):
|
||||
theText = theInsert
|
||||
@@ -881,22 +890,29 @@ class GuiDocEditor(QTextEdit):
|
||||
theText = self._typDQOpen
|
||||
elif theInsert == nwDocInsert.QUOTE_RD:
|
||||
theText = self._typDQClose
|
||||
elif theInsert == nwDocInsert.SYNOPSIS:
|
||||
theText = "% Synopsis: "
|
||||
newBlock = True
|
||||
goAfter = True
|
||||
elif theInsert == nwDocInsert.NEW_PAGE:
|
||||
theText = "[NEW PAGE]"
|
||||
newBlock = True
|
||||
goAfter = False
|
||||
elif theInsert == nwDocInsert.VSPACE_S:
|
||||
theText = "[VSPACE]"
|
||||
newBlock = True
|
||||
goAfter = False
|
||||
elif theInsert == nwDocInsert.VSPACE_M:
|
||||
theText = "[VSPACE:2]"
|
||||
newBlock = True
|
||||
goAfter = False
|
||||
else:
|
||||
return False
|
||||
else:
|
||||
return False
|
||||
|
||||
if newBlock:
|
||||
self.insertNewBlock(theText, defaultAfter=False)
|
||||
self.insertNewBlock(theText, defaultAfter=goAfter)
|
||||
else:
|
||||
theCursor = self.textCursor()
|
||||
theCursor.beginEditBlock()
|
||||
@@ -1162,6 +1178,7 @@ class GuiDocEditor(QTextEdit):
|
||||
|
||||
posCursor = self.cursorForPosition(thePos)
|
||||
spellCheck = self._spellCheck
|
||||
theWord = ""
|
||||
|
||||
if posCursor.block().text().startswith("@"):
|
||||
spellCheck = False
|
||||
@@ -1430,6 +1447,7 @@ class GuiDocEditor(QTextEdit):
|
||||
origB = theCursor.selectionEnd()
|
||||
else:
|
||||
origA = theCursor.position()
|
||||
origB = theCursor.position()
|
||||
|
||||
findOpt = QTextDocument.FindFlag(0)
|
||||
if self.docSearch.isCaseSense:
|
||||
@@ -1699,12 +1717,8 @@ class GuiDocEditor(QTextEdit):
|
||||
logger.debug("Invalid block selected for action '%s'", str(docAction))
|
||||
return False
|
||||
|
||||
theText = theBlock.text()
|
||||
if len(theText.strip()) == 0:
|
||||
logger.debug("Empty block selected for action '%s'", str(docAction))
|
||||
return False
|
||||
|
||||
# Remove existing format first, if any
|
||||
theText = theBlock.text()
|
||||
if theText.startswith("@"):
|
||||
logger.error("Cannot apply block format to keyword/value line")
|
||||
return False
|
||||
@@ -1874,10 +1888,10 @@ class GuiDocEditor(QTextEdit):
|
||||
|
||||
def _followTag(self, theCursor=None, loadTag=True):
|
||||
"""Activated by Ctrl+Enter. Checks that we're in a block
|
||||
starting with '@'. We then find the word under the cursor and
|
||||
check that it is after the ':'. If all this is fine, we have a
|
||||
tag and can tell the document viewer to try and find and load
|
||||
the file where the tag is defined.
|
||||
starting with '@'. We then find the tag under the cursor and
|
||||
check that it is not the tag itself. If all this is fine, we
|
||||
have a tag and can tell the document viewer to try and find and
|
||||
load the file where the tag is defined.
|
||||
"""
|
||||
if theCursor is None:
|
||||
theCursor = self.textCursor()
|
||||
@@ -1890,18 +1904,29 @@ class GuiDocEditor(QTextEdit):
|
||||
|
||||
if theText.startswith("@"):
|
||||
|
||||
theCursor.select(QTextCursor.WordUnderCursor)
|
||||
theWord = theCursor.selectedText()
|
||||
cPos = theText.find(":")
|
||||
wPos = theCursor.selectionStart() - theBlock.position()
|
||||
if wPos <= cPos:
|
||||
isGood, tBits, tPos = self.theProject.index.scanThis(theText)
|
||||
if not isGood:
|
||||
return False
|
||||
|
||||
theTag = ""
|
||||
cPos = theCursor.selectionStart() - theBlock.position()
|
||||
for sTag, sPos in zip(reversed(tBits), reversed(tPos)):
|
||||
if cPos >= sPos:
|
||||
# The cursor is between the start of two tags
|
||||
if cPos <= sPos + len(sTag):
|
||||
# The cursor is inside or at the edge of the tag
|
||||
theTag = sTag
|
||||
break
|
||||
|
||||
if not theTag or theTag.startswith("@"):
|
||||
# The keyword cannot be looked up, so we ignore that
|
||||
return False
|
||||
|
||||
if loadTag:
|
||||
logger.debug("Attempting to follow tag '%s'", theWord)
|
||||
self.loadDocumentTagRequest.emit(theWord, nwDocMode.VIEW)
|
||||
logger.debug("Attempting to follow tag '%s'", theTag)
|
||||
self.loadDocumentTagRequest.emit(theTag, nwDocMode.VIEW)
|
||||
else:
|
||||
logger.debug("Potential tag '%s'", theWord)
|
||||
logger.debug("Potential tag '%s'", theTag)
|
||||
|
||||
return True
|
||||
|
||||
@@ -2242,7 +2267,6 @@ class GuiDocEditSearch(QFrame):
|
||||
self.searchOpt.setToolButtonStyle(Qt.ToolButtonIconOnly)
|
||||
self.searchOpt.setIconSize(QSize(tPx, tPx))
|
||||
self.searchOpt.setContentsMargins(0, 0, 0, 0)
|
||||
self.searchOpt.setStyleSheet("QToolBar {padding: 0;}")
|
||||
|
||||
self.searchLabel = QLabel(self.tr("Search"))
|
||||
self.searchLabel.setFont(self.boxFont)
|
||||
@@ -2253,35 +2277,30 @@ class GuiDocEditSearch(QFrame):
|
||||
self.resultLabel.setMinimumWidth(self.mainTheme.getTextWidth("?/?", self.boxFont))
|
||||
|
||||
self.toggleCase = QAction(self.tr("Case Sensitive"), self)
|
||||
self.toggleCase.setIcon(self.mainTheme.getIcon("search_case"))
|
||||
self.toggleCase.setCheckable(True)
|
||||
self.toggleCase.setChecked(self.isCaseSense)
|
||||
self.toggleCase.toggled.connect(self._doToggleCase)
|
||||
self.searchOpt.addAction(self.toggleCase)
|
||||
|
||||
self.toggleWord = QAction(self.tr("Whole Words Only"), self)
|
||||
self.toggleWord.setIcon(self.mainTheme.getIcon("search_word"))
|
||||
self.toggleWord.setCheckable(True)
|
||||
self.toggleWord.setChecked(self.isWholeWord)
|
||||
self.toggleWord.toggled.connect(self._doToggleWord)
|
||||
self.searchOpt.addAction(self.toggleWord)
|
||||
|
||||
self.toggleRegEx = QAction(self.tr("RegEx Mode"), self)
|
||||
self.toggleRegEx.setIcon(self.mainTheme.getIcon("search_regex"))
|
||||
self.toggleRegEx.setCheckable(True)
|
||||
self.toggleRegEx.setChecked(self.isRegEx)
|
||||
self.toggleRegEx.toggled.connect(self._doToggleRegEx)
|
||||
self.searchOpt.addAction(self.toggleRegEx)
|
||||
|
||||
self.toggleLoop = QAction(self.tr("Loop Search"), self)
|
||||
self.toggleLoop.setIcon(self.mainTheme.getIcon("search_loop"))
|
||||
self.toggleLoop.setCheckable(True)
|
||||
self.toggleLoop.setChecked(self.doLoop)
|
||||
self.toggleLoop.toggled.connect(self._doToggleLoop)
|
||||
self.searchOpt.addAction(self.toggleLoop)
|
||||
|
||||
self.toggleProject = QAction(self.tr("Search Next File"), self)
|
||||
self.toggleProject.setIcon(self.mainTheme.getIcon("search_project"))
|
||||
self.toggleProject.setCheckable(True)
|
||||
self.toggleProject.setChecked(self.doNextFile)
|
||||
self.toggleProject.toggled.connect(self._doToggleProject)
|
||||
@@ -2290,7 +2309,6 @@ class GuiDocEditSearch(QFrame):
|
||||
self.searchOpt.addSeparator()
|
||||
|
||||
self.toggleMatchCap = QAction(self.tr("Preserve Case"), self)
|
||||
self.toggleMatchCap.setIcon(self.mainTheme.getIcon("search_preserve"))
|
||||
self.toggleMatchCap.setCheckable(True)
|
||||
self.toggleMatchCap.setChecked(self.doMatchCap)
|
||||
self.toggleMatchCap.toggled.connect(self._doToggleMatchCap)
|
||||
@@ -2299,7 +2317,6 @@ class GuiDocEditSearch(QFrame):
|
||||
self.searchOpt.addSeparator()
|
||||
|
||||
self.cancelSearch = QAction(self.tr("Close Search"), self)
|
||||
self.cancelSearch.setIcon(self.mainTheme.getIcon("search_cancel"))
|
||||
self.cancelSearch.triggered.connect(self._doClose)
|
||||
self.searchOpt.addAction(self.cancelSearch)
|
||||
|
||||
@@ -2311,15 +2328,14 @@ class GuiDocEditSearch(QFrame):
|
||||
self.showReplace = QToolButton(self)
|
||||
self.showReplace.setArrowType(Qt.RightArrow)
|
||||
self.showReplace.setCheckable(True)
|
||||
self.showReplace.setStyleSheet("QToolButton {border: none; background: transparent;}")
|
||||
self.showReplace.toggled.connect(self._doToggleReplace)
|
||||
|
||||
self.searchButton = QPushButton(self.mainTheme.getIcon("search"), "")
|
||||
self.searchButton = QPushButton("")
|
||||
self.searchButton.setFixedSize(QSize(bPx, bPx))
|
||||
self.searchButton.setToolTip(self.tr("Find in current document"))
|
||||
self.searchButton.clicked.connect(self._doSearch)
|
||||
|
||||
self.replaceButton = QPushButton(self.mainTheme.getIcon("search_replace"), "")
|
||||
self.replaceButton = QPushButton("")
|
||||
self.replaceButton.setFixedSize(QSize(bPx, bPx))
|
||||
self.replaceButton.setToolTip(self.tr("Find and replace in current document"))
|
||||
self.replaceButton.clicked.connect(self._doReplace)
|
||||
@@ -2349,6 +2365,35 @@ class GuiDocEditSearch(QFrame):
|
||||
self.replaceButton.setVisible(False)
|
||||
self.adjustSize()
|
||||
|
||||
self.updateTheme()
|
||||
|
||||
logger.debug("GuiDocEditSearch initialisation complete")
|
||||
|
||||
return
|
||||
|
||||
def updateTheme(self):
|
||||
"""Update theme elements.
|
||||
"""
|
||||
qPalette = qApp.palette()
|
||||
self.setPalette(qPalette)
|
||||
self.searchBox.setPalette(qPalette)
|
||||
self.replaceBox.setPalette(qPalette)
|
||||
|
||||
# Set icons
|
||||
self.toggleCase.setIcon(self.mainTheme.getIcon("search_case"))
|
||||
self.toggleWord.setIcon(self.mainTheme.getIcon("search_word"))
|
||||
self.toggleRegEx.setIcon(self.mainTheme.getIcon("search_regex"))
|
||||
self.toggleLoop.setIcon(self.mainTheme.getIcon("search_loop"))
|
||||
self.toggleProject.setIcon(self.mainTheme.getIcon("search_project"))
|
||||
self.toggleMatchCap.setIcon(self.mainTheme.getIcon("search_preserve"))
|
||||
self.cancelSearch.setIcon(self.mainTheme.getIcon("search_cancel"))
|
||||
self.searchButton.setIcon(self.mainTheme.getIcon("search"))
|
||||
self.replaceButton.setIcon(self.mainTheme.getIcon("search_replace"))
|
||||
|
||||
# Set stylesheets
|
||||
self.searchOpt.setStyleSheet("QToolBar {padding: 0;}")
|
||||
self.showReplace.setStyleSheet("QToolButton {border: none; background: transparent;}")
|
||||
|
||||
# Construct Box Colours
|
||||
qPalette = self.searchBox.palette()
|
||||
baseCol = qPalette.base().color()
|
||||
@@ -2367,8 +2412,6 @@ class GuiDocEditSearch(QFrame):
|
||||
False: errCol
|
||||
}
|
||||
|
||||
logger.debug("GuiDocEditSearch initialisation complete")
|
||||
|
||||
return
|
||||
|
||||
def closeSearch(self):
|
||||
@@ -2394,10 +2437,10 @@ class GuiDocEditSearch(QFrame):
|
||||
"""
|
||||
if self.replaceBox.isVisible():
|
||||
if self.searchBox.hasFocus():
|
||||
self.replaceBox.setFocus(True)
|
||||
self.replaceBox.setFocus()
|
||||
return True
|
||||
elif self.replaceBox.hasFocus():
|
||||
self.searchBox.setFocus(True)
|
||||
self.searchBox.setFocus()
|
||||
return True
|
||||
return False
|
||||
|
||||
@@ -2487,12 +2530,14 @@ class GuiDocEditSearch(QFrame):
|
||||
# Slots
|
||||
##
|
||||
|
||||
@pyqtSlot()
|
||||
def _doClose(self):
|
||||
"""Hide the search/replace bar.
|
||||
"""
|
||||
self.closeSearch()
|
||||
return
|
||||
|
||||
@pyqtSlot()
|
||||
def _doSearch(self):
|
||||
"""Call the search action function for the document editor.
|
||||
"""
|
||||
@@ -2503,12 +2548,14 @@ class GuiDocEditSearch(QFrame):
|
||||
self.docEditor.findNext()
|
||||
return
|
||||
|
||||
@pyqtSlot()
|
||||
def _doReplace(self):
|
||||
"""Call the replace action function for the document editor.
|
||||
"""
|
||||
self.docEditor.replaceNext()
|
||||
return
|
||||
|
||||
@pyqtSlot(bool)
|
||||
def _doToggleReplace(self, theState):
|
||||
"""Toggle the show/hide of the replace box.
|
||||
"""
|
||||
@@ -2523,36 +2570,42 @@ class GuiDocEditSearch(QFrame):
|
||||
self.docEditor.updateDocMargins()
|
||||
return
|
||||
|
||||
@pyqtSlot(bool)
|
||||
def _doToggleCase(self, theState):
|
||||
"""Enable/disable case sensitive mode.
|
||||
"""
|
||||
self.isCaseSense = theState
|
||||
return
|
||||
|
||||
@pyqtSlot(bool)
|
||||
def _doToggleWord(self, theState):
|
||||
"""Enable/disable whole word search mode.
|
||||
"""
|
||||
self.isWholeWord = theState
|
||||
return
|
||||
|
||||
@pyqtSlot(bool)
|
||||
def _doToggleRegEx(self, theState):
|
||||
"""Enable/disable regular expression search mode.
|
||||
"""
|
||||
self.isRegEx = theState
|
||||
return
|
||||
|
||||
@pyqtSlot(bool)
|
||||
def _doToggleLoop(self, theState):
|
||||
"""Enable/disable looping the search.
|
||||
"""
|
||||
self.doLoop = theState
|
||||
return
|
||||
|
||||
@pyqtSlot(bool)
|
||||
def _doToggleProject(self, theState):
|
||||
"""Enable/disable continuing search in next project file.
|
||||
"""
|
||||
self.doNextFile = theState
|
||||
return
|
||||
|
||||
@pyqtSlot(bool)
|
||||
def _doToggleMatchCap(self, theState):
|
||||
"""Enable/disable preserving capitalisation when replacing.
|
||||
"""
|
||||
@@ -2615,51 +2668,38 @@ class GuiDocEditHeader(QWidget):
|
||||
lblFont.setPointSizeF(0.9*self.mainTheme.fontPointSize)
|
||||
self.theTitle.setFont(lblFont)
|
||||
|
||||
buttonStyle = (
|
||||
"QToolButton {{border: none; background: transparent;}} "
|
||||
"QToolButton:hover {{border: none; background: rgba({0},{1},{2},0.2);}}"
|
||||
).format(*self.mainTheme.colText)
|
||||
|
||||
# Buttons
|
||||
self.editButton = QToolButton(self)
|
||||
self.editButton.setIcon(self.mainTheme.getIcon("edit"))
|
||||
self.editButton.setContentsMargins(0, 0, 0, 0)
|
||||
self.editButton.setIconSize(QSize(fPx, fPx))
|
||||
self.editButton.setFixedSize(fPx, fPx)
|
||||
self.editButton.setStyleSheet(buttonStyle)
|
||||
self.editButton.setToolButtonStyle(Qt.ToolButtonIconOnly)
|
||||
self.editButton.setVisible(False)
|
||||
self.editButton.setToolTip(self.tr("Edit document label"))
|
||||
self.editButton.clicked.connect(self._editDocument)
|
||||
|
||||
self.searchButton = QToolButton(self)
|
||||
self.searchButton.setIcon(self.mainTheme.getIcon("search"))
|
||||
self.searchButton.setContentsMargins(0, 0, 0, 0)
|
||||
self.searchButton.setIconSize(QSize(fPx, fPx))
|
||||
self.searchButton.setFixedSize(fPx, fPx)
|
||||
self.searchButton.setStyleSheet(buttonStyle)
|
||||
self.searchButton.setToolButtonStyle(Qt.ToolButtonIconOnly)
|
||||
self.searchButton.setVisible(False)
|
||||
self.searchButton.setToolTip(self.tr("Search document"))
|
||||
self.searchButton.clicked.connect(self._searchDocument)
|
||||
|
||||
self.minmaxButton = QToolButton(self)
|
||||
self.minmaxButton.setIcon(self.mainTheme.getIcon("maximise"))
|
||||
self.minmaxButton.setContentsMargins(0, 0, 0, 0)
|
||||
self.minmaxButton.setIconSize(QSize(fPx, fPx))
|
||||
self.minmaxButton.setFixedSize(fPx, fPx)
|
||||
self.minmaxButton.setStyleSheet(buttonStyle)
|
||||
self.minmaxButton.setToolButtonStyle(Qt.ToolButtonIconOnly)
|
||||
self.minmaxButton.setVisible(False)
|
||||
self.minmaxButton.setToolTip(self.tr("Toggle Focus Mode"))
|
||||
self.minmaxButton.clicked.connect(self._minmaxDocument)
|
||||
|
||||
self.closeButton = QToolButton(self)
|
||||
self.closeButton.setIcon(self.mainTheme.getIcon("close"))
|
||||
self.closeButton.setContentsMargins(0, 0, 0, 0)
|
||||
self.closeButton.setIconSize(QSize(fPx, fPx))
|
||||
self.closeButton.setFixedSize(fPx, fPx)
|
||||
self.closeButton.setStyleSheet(buttonStyle)
|
||||
self.closeButton.setToolButtonStyle(Qt.ToolButtonIconOnly)
|
||||
self.closeButton.setVisible(False)
|
||||
self.closeButton.setToolTip(self.tr("Close the document"))
|
||||
@@ -2682,8 +2722,7 @@ class GuiDocEditHeader(QWidget):
|
||||
self.outerBox.setContentsMargins(cM, cM, cM, cM)
|
||||
self.setMinimumHeight(fPx + 2*cM)
|
||||
|
||||
# Fix the Colours
|
||||
self.matchColours()
|
||||
self.updateTheme()
|
||||
|
||||
logger.debug("GuiDocEditHeader initialisation complete")
|
||||
|
||||
@@ -2693,6 +2732,28 @@ class GuiDocEditHeader(QWidget):
|
||||
# Methods
|
||||
##
|
||||
|
||||
def updateTheme(self):
|
||||
"""Update theme elements.
|
||||
"""
|
||||
self.editButton.setIcon(self.mainTheme.getIcon("edit"))
|
||||
self.searchButton.setIcon(self.mainTheme.getIcon("search"))
|
||||
self.minmaxButton.setIcon(self.mainTheme.getIcon("maximise"))
|
||||
self.closeButton.setIcon(self.mainTheme.getIcon("close"))
|
||||
|
||||
buttonStyle = (
|
||||
"QToolButton {{border: none; background: transparent;}} "
|
||||
"QToolButton:hover {{border: none; background: rgba({0},{1},{2},0.2);}}"
|
||||
).format(*self.mainTheme.colText)
|
||||
|
||||
self.editButton.setStyleSheet(buttonStyle)
|
||||
self.searchButton.setStyleSheet(buttonStyle)
|
||||
self.minmaxButton.setStyleSheet(buttonStyle)
|
||||
self.closeButton.setStyleSheet(buttonStyle)
|
||||
|
||||
self.matchColours()
|
||||
|
||||
return
|
||||
|
||||
def matchColours(self):
|
||||
"""Update the colours of the widget to match those of the syntax
|
||||
theme rather than the main GUI.
|
||||
@@ -2757,18 +2818,21 @@ class GuiDocEditHeader(QWidget):
|
||||
# Slots
|
||||
##
|
||||
|
||||
@pyqtSlot()
|
||||
def _editDocument(self):
|
||||
"""Open the edit item dialog from the main GUI.
|
||||
"""
|
||||
self.mainGui.editItemLabel(self._docHandle)
|
||||
return
|
||||
|
||||
@pyqtSlot()
|
||||
def _searchDocument(self):
|
||||
"""Toggle the visibility of the search box.
|
||||
"""
|
||||
self.docEditor.toggleSearch()
|
||||
return
|
||||
|
||||
@pyqtSlot()
|
||||
def _closeDocument(self):
|
||||
"""Trigger the close editor on the main window.
|
||||
"""
|
||||
@@ -2779,6 +2843,7 @@ class GuiDocEditHeader(QWidget):
|
||||
self.minmaxButton.setVisible(False)
|
||||
return
|
||||
|
||||
@pyqtSlot()
|
||||
def _minmaxDocument(self):
|
||||
"""Switch on or off Focus Mode.
|
||||
"""
|
||||
@@ -2851,7 +2916,6 @@ class GuiDocEditFooter(QWidget):
|
||||
|
||||
# Lines
|
||||
self.linesIcon = QLabel("")
|
||||
self.linesIcon.setPixmap(self.mainTheme.getPixmap("status_lines", (self.sPx, self.sPx)))
|
||||
self.linesIcon.setContentsMargins(0, 0, 0, 0)
|
||||
self.linesIcon.setFixedHeight(self.sPx)
|
||||
self.linesIcon.setAlignment(Qt.AlignLeft | Qt.AlignTop)
|
||||
@@ -2867,7 +2931,6 @@ class GuiDocEditFooter(QWidget):
|
||||
|
||||
# Words
|
||||
self.wordsIcon = QLabel("")
|
||||
self.wordsIcon.setPixmap(self.mainTheme.getPixmap("status_stats", (self.sPx, self.sPx)))
|
||||
self.wordsIcon.setContentsMargins(0, 0, 0, 0)
|
||||
self.wordsIcon.setFixedHeight(self.sPx)
|
||||
self.wordsIcon.setAlignment(Qt.AlignLeft | Qt.AlignTop)
|
||||
@@ -2902,7 +2965,7 @@ class GuiDocEditFooter(QWidget):
|
||||
self.setMinimumHeight(fPx + 2*cM)
|
||||
|
||||
# Fix the Colours
|
||||
self.matchColours()
|
||||
self.updateTheme()
|
||||
self.updateLineCount()
|
||||
self.updateCounts()
|
||||
|
||||
@@ -2914,6 +2977,16 @@ class GuiDocEditFooter(QWidget):
|
||||
# Methods
|
||||
##
|
||||
|
||||
def updateTheme(self):
|
||||
"""Update theme elements.
|
||||
"""
|
||||
self.linesIcon.setPixmap(self.mainTheme.getPixmap("status_lines", (self.sPx, self.sPx)))
|
||||
self.wordsIcon.setPixmap(self.mainTheme.getPixmap("status_stats", (self.sPx, self.sPx)))
|
||||
|
||||
self.matchColours()
|
||||
|
||||
return
|
||||
|
||||
def matchColours(self):
|
||||
"""Update the colours of the widget to match those of the syntax
|
||||
theme rather than the main GUI.
|
||||
|
||||
@@ -102,6 +102,13 @@ class GuiDocViewer(QTextBrowser):
|
||||
self.docHeader.setTitleFromHandle(self._docHandle)
|
||||
return True
|
||||
|
||||
def updateTheme(self):
|
||||
"""Update theme elements.
|
||||
"""
|
||||
self.docHeader.updateTheme()
|
||||
self.docFooter.updateTheme()
|
||||
return
|
||||
|
||||
def initViewer(self):
|
||||
"""Set editor settings from main config.
|
||||
"""
|
||||
@@ -735,51 +742,38 @@ class GuiDocViewHeader(QWidget):
|
||||
lblFont.setPointSizeF(0.9*self.mainTheme.fontPointSize)
|
||||
self.theTitle.setFont(lblFont)
|
||||
|
||||
buttonStyle = (
|
||||
"QToolButton {{border: none; background: transparent;}} "
|
||||
"QToolButton:hover {{border: none; background: rgba({0},{1},{2},0.2);}}"
|
||||
).format(*self.mainTheme.colText)
|
||||
|
||||
# Buttons
|
||||
self.backButton = QToolButton(self)
|
||||
self.backButton.setIcon(self.mainTheme.getIcon("backward"))
|
||||
self.backButton.setContentsMargins(0, 0, 0, 0)
|
||||
self.backButton.setIconSize(QSize(fPx, fPx))
|
||||
self.backButton.setFixedSize(fPx, fPx)
|
||||
self.backButton.setStyleSheet(buttonStyle)
|
||||
self.backButton.setToolButtonStyle(Qt.ToolButtonIconOnly)
|
||||
self.backButton.setVisible(False)
|
||||
self.backButton.setToolTip(self.tr("Go backward"))
|
||||
self.backButton.clicked.connect(self.docViewer.navBackward)
|
||||
|
||||
self.forwardButton = QToolButton(self)
|
||||
self.forwardButton.setIcon(self.mainTheme.getIcon("forward"))
|
||||
self.forwardButton.setContentsMargins(0, 0, 0, 0)
|
||||
self.forwardButton.setIconSize(QSize(fPx, fPx))
|
||||
self.forwardButton.setFixedSize(fPx, fPx)
|
||||
self.forwardButton.setStyleSheet(buttonStyle)
|
||||
self.forwardButton.setToolButtonStyle(Qt.ToolButtonIconOnly)
|
||||
self.forwardButton.setVisible(False)
|
||||
self.forwardButton.setToolTip(self.tr("Go forward"))
|
||||
self.forwardButton.clicked.connect(self.docViewer.navForward)
|
||||
|
||||
self.refreshButton = QToolButton(self)
|
||||
self.refreshButton.setIcon(self.mainTheme.getIcon("refresh"))
|
||||
self.refreshButton.setContentsMargins(0, 0, 0, 0)
|
||||
self.refreshButton.setIconSize(QSize(fPx, fPx))
|
||||
self.refreshButton.setFixedSize(fPx, fPx)
|
||||
self.refreshButton.setStyleSheet(buttonStyle)
|
||||
self.refreshButton.setToolButtonStyle(Qt.ToolButtonIconOnly)
|
||||
self.refreshButton.setVisible(False)
|
||||
self.refreshButton.setToolTip(self.tr("Reload the document"))
|
||||
self.refreshButton.clicked.connect(self._refreshDocument)
|
||||
|
||||
self.closeButton = QToolButton(self)
|
||||
self.closeButton.setIcon(self.mainTheme.getIcon("close"))
|
||||
self.closeButton.setContentsMargins(0, 0, 0, 0)
|
||||
self.closeButton.setIconSize(QSize(fPx, fPx))
|
||||
self.closeButton.setFixedSize(fPx, fPx)
|
||||
self.closeButton.setStyleSheet(buttonStyle)
|
||||
self.closeButton.setToolButtonStyle(Qt.ToolButtonIconOnly)
|
||||
self.closeButton.setVisible(False)
|
||||
self.closeButton.setToolTip(self.tr("Close the document"))
|
||||
@@ -803,7 +797,7 @@ class GuiDocViewHeader(QWidget):
|
||||
self.setMinimumHeight(fPx + 2*cM)
|
||||
|
||||
# Fix the Colours
|
||||
self.matchColours()
|
||||
self.updateTheme()
|
||||
|
||||
logger.debug("GuiDocViewHeader initialisation complete")
|
||||
|
||||
@@ -813,6 +807,28 @@ class GuiDocViewHeader(QWidget):
|
||||
# Methods
|
||||
##
|
||||
|
||||
def updateTheme(self):
|
||||
"""Update theme elements.
|
||||
"""
|
||||
self.backButton.setIcon(self.mainTheme.getIcon("backward"))
|
||||
self.forwardButton.setIcon(self.mainTheme.getIcon("forward"))
|
||||
self.refreshButton.setIcon(self.mainTheme.getIcon("refresh"))
|
||||
self.closeButton.setIcon(self.mainTheme.getIcon("close"))
|
||||
|
||||
buttonStyle = (
|
||||
"QToolButton {{border: none; background: transparent;}} "
|
||||
"QToolButton:hover {{border: none; background: rgba({0},{1},{2},0.2);}}"
|
||||
).format(*self.mainTheme.colText)
|
||||
|
||||
self.backButton.setStyleSheet(buttonStyle)
|
||||
self.forwardButton.setStyleSheet(buttonStyle)
|
||||
self.refreshButton.setStyleSheet(buttonStyle)
|
||||
self.closeButton.setStyleSheet(buttonStyle)
|
||||
|
||||
self.matchColours()
|
||||
|
||||
return
|
||||
|
||||
def matchColours(self):
|
||||
"""Update the colours of the widget to match those of the syntax
|
||||
theme rather than the main GUI.
|
||||
@@ -873,12 +889,14 @@ class GuiDocViewHeader(QWidget):
|
||||
# Slots
|
||||
##
|
||||
|
||||
@pyqtSlot()
|
||||
def _closeDocument(self):
|
||||
"""Trigger the close editor/viewer on the main window.
|
||||
"""
|
||||
self.mainGui.closeDocViewer()
|
||||
return
|
||||
|
||||
@pyqtSlot()
|
||||
def _refreshDocument(self):
|
||||
"""Reload the content of the document.
|
||||
"""
|
||||
@@ -926,33 +944,13 @@ class GuiDocViewFooter(QWidget):
|
||||
bSp = self.mainConf.pxInt(2)
|
||||
hSp = self.mainConf.pxInt(8)
|
||||
|
||||
# Icons
|
||||
stickyOn = self.mainTheme.getPixmap("sticky-on", (fPx, fPx))
|
||||
stickyOff = self.mainTheme.getPixmap("sticky-off", (fPx, fPx))
|
||||
stickyIcon = QIcon()
|
||||
stickyIcon.addPixmap(stickyOn, QIcon.Normal, QIcon.On)
|
||||
stickyIcon.addPixmap(stickyOff, QIcon.Normal, QIcon.Off)
|
||||
|
||||
bulletOn = self.mainTheme.getPixmap("bullet-on", (fPx, fPx))
|
||||
bulletOff = self.mainTheme.getPixmap("bullet-off", (fPx, fPx))
|
||||
bulletIcon = QIcon()
|
||||
bulletIcon.addPixmap(bulletOn, QIcon.Normal, QIcon.On)
|
||||
bulletIcon.addPixmap(bulletOff, QIcon.Normal, QIcon.Off)
|
||||
|
||||
# Main Widget Settings
|
||||
self.setContentsMargins(0, 0, 0, 0)
|
||||
self.setAutoFillBackground(True)
|
||||
|
||||
buttonStyle = (
|
||||
"QToolButton {{border: none; background: transparent;}} "
|
||||
"QToolButton:hover {{border: none; background: rgba({0},{1},{2},0.2);}}"
|
||||
).format(*self.mainTheme.colText)
|
||||
|
||||
# Show/Hide Details
|
||||
self.showHide = QToolButton(self)
|
||||
self.showHide.setToolButtonStyle(Qt.ToolButtonIconOnly)
|
||||
self.showHide.setStyleSheet(buttonStyle)
|
||||
self.showHide.setIcon(self.mainTheme.getIcon("reference"))
|
||||
self.showHide.setIconSize(QSize(fPx, fPx))
|
||||
self.showHide.setFixedSize(QSize(fPx, fPx))
|
||||
self.showHide.clicked.connect(self._doShowHide)
|
||||
@@ -962,8 +960,6 @@ class GuiDocViewFooter(QWidget):
|
||||
self.stickyRefs = QToolButton(self)
|
||||
self.stickyRefs.setCheckable(True)
|
||||
self.stickyRefs.setToolButtonStyle(Qt.ToolButtonIconOnly)
|
||||
self.stickyRefs.setStyleSheet(buttonStyle)
|
||||
self.stickyRefs.setIcon(stickyIcon)
|
||||
self.stickyRefs.setIconSize(QSize(fPx, fPx))
|
||||
self.stickyRefs.setFixedSize(QSize(fPx, fPx))
|
||||
self.stickyRefs.toggled.connect(self._doToggleSticky)
|
||||
@@ -976,8 +972,6 @@ class GuiDocViewFooter(QWidget):
|
||||
self.showComments.setCheckable(True)
|
||||
self.showComments.setChecked(self.mainConf.viewComments)
|
||||
self.showComments.setToolButtonStyle(Qt.ToolButtonIconOnly)
|
||||
self.showComments.setStyleSheet(buttonStyle)
|
||||
self.showComments.setIcon(bulletIcon)
|
||||
self.showComments.setIconSize(QSize(fPx, fPx))
|
||||
self.showComments.setFixedSize(QSize(fPx, fPx))
|
||||
self.showComments.toggled.connect(self._doToggleComments)
|
||||
@@ -988,8 +982,6 @@ class GuiDocViewFooter(QWidget):
|
||||
self.showSynopsis.setCheckable(True)
|
||||
self.showSynopsis.setChecked(self.mainConf.viewSynopsis)
|
||||
self.showSynopsis.setToolButtonStyle(Qt.ToolButtonIconOnly)
|
||||
self.showSynopsis.setStyleSheet(buttonStyle)
|
||||
self.showSynopsis.setIcon(bulletIcon)
|
||||
self.showSynopsis.setIconSize(QSize(fPx, fPx))
|
||||
self.showSynopsis.setFixedSize(QSize(fPx, fPx))
|
||||
self.showSynopsis.toggled.connect(self._doToggleSynopsis)
|
||||
@@ -1063,7 +1055,7 @@ class GuiDocViewFooter(QWidget):
|
||||
self.setMinimumHeight(fPx + 2*cM)
|
||||
|
||||
# Fix the Colours
|
||||
self.matchColours()
|
||||
self.updateTheme()
|
||||
|
||||
logger.debug("GuiDocViewFooter initialisation complete")
|
||||
|
||||
@@ -1073,6 +1065,46 @@ class GuiDocViewFooter(QWidget):
|
||||
# Methods
|
||||
##
|
||||
|
||||
def updateTheme(self):
|
||||
"""Update theme elements.
|
||||
"""
|
||||
# Icons
|
||||
|
||||
fPx = int(0.9*self.mainTheme.fontPixelSize)
|
||||
|
||||
stickyOn = self.mainTheme.getPixmap("sticky-on", (fPx, fPx))
|
||||
stickyOff = self.mainTheme.getPixmap("sticky-off", (fPx, fPx))
|
||||
stickyIcon = QIcon()
|
||||
stickyIcon.addPixmap(stickyOn, QIcon.Normal, QIcon.On)
|
||||
stickyIcon.addPixmap(stickyOff, QIcon.Normal, QIcon.Off)
|
||||
|
||||
bulletOn = self.mainTheme.getPixmap("bullet-on", (fPx, fPx))
|
||||
bulletOff = self.mainTheme.getPixmap("bullet-off", (fPx, fPx))
|
||||
bulletIcon = QIcon()
|
||||
bulletIcon.addPixmap(bulletOn, QIcon.Normal, QIcon.On)
|
||||
bulletIcon.addPixmap(bulletOff, QIcon.Normal, QIcon.Off)
|
||||
|
||||
self.showHide.setIcon(self.mainTheme.getIcon("reference"))
|
||||
self.stickyRefs.setIcon(stickyIcon)
|
||||
self.showComments.setIcon(bulletIcon)
|
||||
self.showSynopsis.setIcon(bulletIcon)
|
||||
|
||||
# StyleSheets
|
||||
|
||||
buttonStyle = (
|
||||
"QToolButton {{border: none; background: transparent;}} "
|
||||
"QToolButton:hover {{border: none; background: rgba({0},{1},{2},0.2);}}"
|
||||
).format(*self.mainTheme.colText)
|
||||
|
||||
self.showHide.setStyleSheet(buttonStyle)
|
||||
self.stickyRefs.setStyleSheet(buttonStyle)
|
||||
self.showComments.setStyleSheet(buttonStyle)
|
||||
self.showSynopsis.setStyleSheet(buttonStyle)
|
||||
|
||||
self.matchColours()
|
||||
|
||||
return
|
||||
|
||||
def matchColours(self):
|
||||
"""Update the colours of the widget to match those of the syntax
|
||||
theme rather than the main GUI.
|
||||
@@ -1094,6 +1126,7 @@ class GuiDocViewFooter(QWidget):
|
||||
# Slots
|
||||
##
|
||||
|
||||
@pyqtSlot()
|
||||
def _doShowHide(self):
|
||||
"""Toggle the expand/collapse of the panel.
|
||||
"""
|
||||
@@ -1101,6 +1134,7 @@ class GuiDocViewFooter(QWidget):
|
||||
self.viewMeta.setVisible(not isVisible)
|
||||
return
|
||||
|
||||
@pyqtSlot(bool)
|
||||
def _doToggleSticky(self, theState):
|
||||
"""Toggle the sticky flag for the reference panel.
|
||||
"""
|
||||
@@ -1110,6 +1144,7 @@ class GuiDocViewFooter(QWidget):
|
||||
self.viewMeta.refreshReferences(self.docViewer.docHandle())
|
||||
return
|
||||
|
||||
@pyqtSlot(bool)
|
||||
def _doToggleComments(self, theState):
|
||||
"""Toggle the view comment button and reload the document.
|
||||
"""
|
||||
@@ -1117,6 +1152,7 @@ class GuiDocViewFooter(QWidget):
|
||||
self.docViewer.reloadText()
|
||||
return
|
||||
|
||||
@pyqtSlot(bool)
|
||||
def _doToggleSynopsis(self, theState):
|
||||
"""Toggle the view synopsis button and reload the document.
|
||||
"""
|
||||
|
||||
@@ -53,12 +53,8 @@ class GuiItemDetails(QWidget):
|
||||
hSp = self.mainConf.pxInt(6)
|
||||
vSp = self.mainConf.pxInt(1)
|
||||
mPx = self.mainConf.pxInt(6)
|
||||
iPx = self.mainTheme.baseIconSize
|
||||
fPt = self.mainTheme.fontPointSize
|
||||
|
||||
self._expCheck = self.mainTheme.getPixmap("check", (iPx, iPx))
|
||||
self._expCross = self.mainTheme.getPixmap("cross", (iPx, iPx))
|
||||
|
||||
fntLabel = QFont()
|
||||
fntLabel.setBold(True)
|
||||
fntLabel.setPointSizeF(0.9*fPt)
|
||||
@@ -179,6 +175,8 @@ class GuiItemDetails(QWidget):
|
||||
|
||||
self.setLayout(self.mainBox)
|
||||
|
||||
self.updateTheme()
|
||||
|
||||
# Make sure the columns for flags and counts don't resize too often
|
||||
flagWidth = self.mainTheme.getTextWidth("Mm", fntValue)
|
||||
countWidth = self.mainTheme.getTextWidth("99,999", fntValue)
|
||||
@@ -219,6 +217,15 @@ class GuiItemDetails(QWidget):
|
||||
"""
|
||||
self.updateViewBox(self._itemHandle)
|
||||
|
||||
def updateTheme(self):
|
||||
"""Update theme elements.
|
||||
"""
|
||||
iPx = self.mainTheme.baseIconSize
|
||||
self._expCheck = self.mainTheme.getPixmap("check", (iPx, iPx))
|
||||
self._expCross = self.mainTheme.getPixmap("cross", (iPx, iPx))
|
||||
self.updateViewBox(self._itemHandle)
|
||||
return
|
||||
|
||||
##
|
||||
# Public Slots
|
||||
##
|
||||
|
||||
@@ -554,6 +554,15 @@ class GuiMainMenu(QMenuBar):
|
||||
)
|
||||
self.mInsKeywords.addAction(self.mInsKWItems[keyWord][0])
|
||||
|
||||
# Insert > Special Comments
|
||||
self.mInsComments = self.insertMenu.addMenu(self.tr("Special Comments"))
|
||||
|
||||
# Insert > Synopsis Comment
|
||||
self.aInsSynopsis = QAction(self.tr("Synopsis Comment"), self)
|
||||
self.aInsSynopsis.setShortcut("Ctrl+K, S")
|
||||
self.aInsSynopsis.triggered.connect(lambda: self._docInsert(nwDocInsert.SYNOPSIS))
|
||||
self.mInsComments.addAction(self.aInsSynopsis)
|
||||
|
||||
# Insert > Symbols
|
||||
self.mInsBreaks = self.insertMenu.addMenu(self.tr("Page Break and Space"))
|
||||
|
||||
|
||||
@@ -92,6 +92,14 @@ class GuiNovelView(QWidget):
|
||||
# Methods
|
||||
##
|
||||
|
||||
def updateTheme(self):
|
||||
"""Update theme elements.
|
||||
"""
|
||||
self.novelBar.updateTheme()
|
||||
self.novelTree.updateTheme()
|
||||
self.refreshTree()
|
||||
return
|
||||
|
||||
def initSettings(self):
|
||||
"""Initialise GUI elements that depend on specific settings.
|
||||
"""
|
||||
@@ -181,16 +189,6 @@ class GuiNovelToolBar(QWidget):
|
||||
self.setContentsMargins(0, 0, 0, 0)
|
||||
self.setAutoFillBackground(True)
|
||||
|
||||
qPalette = self.palette()
|
||||
qPalette.setBrush(QPalette.Window, qPalette.base())
|
||||
self.setPalette(qPalette)
|
||||
|
||||
fadeCol = qPalette.text().color()
|
||||
buttonStyle = (
|
||||
"QToolButton {{padding: {0}px; border: none; background: transparent;}} "
|
||||
"QToolButton:hover {{border: none; background: rgba({1},{2},{3},0.2);}}"
|
||||
).format(mPx, fadeCol.red(), fadeCol.green(), fadeCol.blue())
|
||||
|
||||
# Widget Label
|
||||
self.viewLabel = QLabel("<b>%s</b>" % self.tr("Novel Outline"))
|
||||
self.viewLabel.setContentsMargins(0, 0, 0, 0)
|
||||
@@ -199,9 +197,7 @@ class GuiNovelToolBar(QWidget):
|
||||
# Refresh Button
|
||||
self.tbRefresh = QToolButton(self)
|
||||
self.tbRefresh.setToolTip(self.tr("Refresh"))
|
||||
self.tbRefresh.setIcon(self.mainTheme.getIcon("refresh"))
|
||||
self.tbRefresh.setIconSize(QSize(iPx, iPx))
|
||||
self.tbRefresh.setStyleSheet(buttonStyle)
|
||||
self.tbRefresh.clicked.connect(self._refreshNovelTree)
|
||||
|
||||
# Novel Root Menu
|
||||
@@ -211,9 +207,7 @@ class GuiNovelToolBar(QWidget):
|
||||
|
||||
self.tbRoot = QToolButton(self)
|
||||
self.tbRoot.setToolTip(self.tr("Novel Root"))
|
||||
self.tbRoot.setIcon(self.mainTheme.getIcon(nwLabels.CLASS_ICON[nwItemClass.NOVEL]))
|
||||
self.tbRoot.setIconSize(QSize(iPx, iPx))
|
||||
self.tbRoot.setStyleSheet(buttonStyle)
|
||||
self.tbRoot.setMenu(self.mRoot)
|
||||
self.tbRoot.setPopupMode(QToolButton.InstantPopup)
|
||||
|
||||
@@ -230,9 +224,7 @@ class GuiNovelToolBar(QWidget):
|
||||
|
||||
self.tbMore = QToolButton(self)
|
||||
self.tbMore.setToolTip(self.tr("More Options"))
|
||||
self.tbMore.setIcon(self.mainTheme.getIcon("menu"))
|
||||
self.tbMore.setIconSize(QSize(iPx, iPx))
|
||||
self.tbMore.setStyleSheet(buttonStyle)
|
||||
self.tbMore.setMenu(self.mMore)
|
||||
self.tbMore.setPopupMode(QToolButton.InstantPopup)
|
||||
|
||||
@@ -247,6 +239,8 @@ class GuiNovelToolBar(QWidget):
|
||||
|
||||
self.setLayout(self.outerBox)
|
||||
|
||||
self.updateTheme()
|
||||
|
||||
logger.debug("GuiNovelToolBar initialisation complete")
|
||||
|
||||
return
|
||||
@@ -255,6 +249,31 @@ class GuiNovelToolBar(QWidget):
|
||||
# Methods
|
||||
##
|
||||
|
||||
def updateTheme(self):
|
||||
"""Update theme elements.
|
||||
"""
|
||||
# Icons
|
||||
self.tbRefresh.setIcon(self.mainTheme.getIcon("refresh"))
|
||||
self.tbRoot.setIcon(self.mainTheme.getIcon(nwLabels.CLASS_ICON[nwItemClass.NOVEL]))
|
||||
self.tbMore.setIcon(self.mainTheme.getIcon("menu"))
|
||||
|
||||
qPalette = self.palette()
|
||||
qPalette.setBrush(QPalette.Window, qPalette.base())
|
||||
self.setPalette(qPalette)
|
||||
|
||||
# StyleSheets
|
||||
fadeCol = qPalette.text().color()
|
||||
buttonStyle = (
|
||||
"QToolButton {{padding: {0}px; border: none; background: transparent;}} "
|
||||
"QToolButton:hover {{border: none; background: rgba({1},{2},{3},0.2);}}"
|
||||
).format(self.mainConf.pxInt(2), fadeCol.red(), fadeCol.green(), fadeCol.blue())
|
||||
|
||||
self.tbRefresh.setStyleSheet(buttonStyle)
|
||||
self.tbRoot.setStyleSheet(buttonStyle)
|
||||
self.tbMore.setStyleSheet(buttonStyle)
|
||||
|
||||
return
|
||||
|
||||
def clearContent(self):
|
||||
"""Run clearing project tasks.
|
||||
"""
|
||||
@@ -390,7 +409,6 @@ class GuiNovelTree(QTreeWidget):
|
||||
fH2.setBold(True)
|
||||
|
||||
self._hFonts = [self.font(), fH1, fH2, self.font(), self.font()]
|
||||
self._pMore = self.mainTheme.loadDecoration("deco_doc_more", pxH=iPx)
|
||||
|
||||
# Connect signals
|
||||
self.clicked.connect(self._treeItemClicked)
|
||||
@@ -399,6 +417,7 @@ class GuiNovelTree(QTreeWidget):
|
||||
|
||||
# Set custom settings
|
||||
self.initSettings()
|
||||
self.updateTheme()
|
||||
|
||||
logger.debug("GuiNovelTree initialisation complete")
|
||||
|
||||
@@ -420,6 +439,13 @@ class GuiNovelTree(QTreeWidget):
|
||||
|
||||
return
|
||||
|
||||
def updateTheme(self):
|
||||
"""Update theme elements.
|
||||
"""
|
||||
iPx = self.mainTheme.baseIconSize
|
||||
self._pMore = self.mainTheme.loadDecoration("deco_doc_more", pxH=iPx)
|
||||
return
|
||||
|
||||
##
|
||||
# Properties
|
||||
##
|
||||
|
||||
@@ -97,6 +97,13 @@ class GuiOutlineView(QWidget):
|
||||
# Methods
|
||||
##
|
||||
|
||||
def updateTheme(self):
|
||||
"""Update theme elements.
|
||||
"""
|
||||
self.outlineBar.updateTheme()
|
||||
self.refreshTree()
|
||||
return
|
||||
|
||||
def initSettings(self):
|
||||
"""Initialise GUI elements that depend on specific settings.
|
||||
"""
|
||||
@@ -213,7 +220,6 @@ class GuiOutlineToolBar(QToolBar):
|
||||
self.setMovable(False)
|
||||
self.setIconSize(QSize(iPx, iPx))
|
||||
self.setContentsMargins(0, 0, 0, 0)
|
||||
self.setStyleSheet("QToolBar {border: 0px;}")
|
||||
|
||||
stretch = QWidget(self)
|
||||
stretch.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
|
||||
@@ -228,7 +234,6 @@ class GuiOutlineToolBar(QToolBar):
|
||||
|
||||
# Actions
|
||||
self.aRefresh = QAction(self.tr("Refresh"), self)
|
||||
self.aRefresh.setIcon(self.mainTheme.getIcon("refresh"))
|
||||
self.aRefresh.triggered.connect(self._refreshRequested)
|
||||
|
||||
# Column Menu
|
||||
@@ -238,7 +243,6 @@ class GuiOutlineToolBar(QToolBar):
|
||||
)
|
||||
|
||||
self.tbColumns = QToolButton(self)
|
||||
self.tbColumns.setIcon(self.mainTheme.getIcon("menu"))
|
||||
self.tbColumns.setMenu(self.mColumns)
|
||||
self.tbColumns.setPopupMode(QToolButton.InstantPopup)
|
||||
|
||||
@@ -250,6 +254,8 @@ class GuiOutlineToolBar(QToolBar):
|
||||
self.addWidget(self.tbColumns)
|
||||
self.addWidget(stretch)
|
||||
|
||||
self.updateTheme()
|
||||
|
||||
logger.debug("GuiOutlineToolBar initialisation complete")
|
||||
|
||||
return
|
||||
@@ -258,6 +264,16 @@ class GuiOutlineToolBar(QToolBar):
|
||||
# Methods
|
||||
##
|
||||
|
||||
def updateTheme(self):
|
||||
"""Update theme elements.
|
||||
"""
|
||||
self.setStyleSheet("QToolBar {border: 0px;}")
|
||||
|
||||
self.aRefresh.setIcon(self.mainTheme.getIcon("refresh"))
|
||||
self.tbColumns.setIcon(self.mainTheme.getIcon("menu"))
|
||||
|
||||
return
|
||||
|
||||
def populateNovelList(self):
|
||||
"""Fill the novel combo box with a list of all novel folders.
|
||||
"""
|
||||
|
||||
@@ -41,8 +41,8 @@ from PyQt5.QtWidgets import (
|
||||
|
||||
from novelwriter.core import DocMerger, DocSplitter
|
||||
from novelwriter.enum import nwDocMode, nwItemType, nwItemClass, nwItemLayout, nwAlert
|
||||
from novelwriter.dialogs import GuiDocMerge, GuiDocSplit, GuiEditLabel
|
||||
from novelwriter.constants import nwHeaders, trConst, nwLabels
|
||||
from novelwriter.dialogs import GuiDocMerge, GuiDocSplit, GuiEditLabel, GuiProjectSettings
|
||||
from novelwriter.constants import nwHeaders, nwUnicode, trConst, nwLabels
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -62,6 +62,9 @@ class GuiProjectView(QWidget):
|
||||
selectedItemChanged = pyqtSignal(str)
|
||||
openDocumentRequest = pyqtSignal(str, Enum, int, str)
|
||||
|
||||
# Requests for the main GUI
|
||||
projectSettingsRequest = pyqtSignal(int)
|
||||
|
||||
def __init__(self, mainGui):
|
||||
super().__init__(parent=mainGui)
|
||||
|
||||
@@ -102,9 +105,6 @@ class GuiProjectView(QWidget):
|
||||
self.keyContext.activated.connect(lambda: self.projTree.openContextOnSelected())
|
||||
|
||||
# Function Mappings
|
||||
self.revealNewTreeItem = self.projTree.revealNewTreeItem
|
||||
self.renameTreeItem = self.projTree.renameTreeItem
|
||||
self.getTreeFromHandle = self.projTree.getTreeFromHandle
|
||||
self.emptyTrash = self.projTree.emptyTrash
|
||||
self.requestDeleteItem = self.projTree.requestDeleteItem
|
||||
self.setTreeItemValues = self.projTree.setTreeItemValues
|
||||
@@ -119,6 +119,13 @@ class GuiProjectView(QWidget):
|
||||
# Methods
|
||||
##
|
||||
|
||||
def updateTheme(self):
|
||||
"""Update theme elements.
|
||||
"""
|
||||
self.projBar.updateTheme()
|
||||
self.populateTree()
|
||||
return
|
||||
|
||||
def initSettings(self):
|
||||
"""Initialise GUI elements that depend on specific settings.
|
||||
"""
|
||||
@@ -161,6 +168,16 @@ class GuiProjectView(QWidget):
|
||||
"""
|
||||
return self.projTree.hasFocus()
|
||||
|
||||
def renameTreeItem(self, tHandle=None):
|
||||
"""External request to rename an item or the currently selected
|
||||
item. This is triggered by the global menu or keyboard shortcut.
|
||||
"""
|
||||
if tHandle is None:
|
||||
tHandle = self.projTree.getSelectedHandle()
|
||||
if tHandle:
|
||||
return self.projTree.renameTreeItem(tHandle)
|
||||
return
|
||||
|
||||
##
|
||||
# Public Slots
|
||||
##
|
||||
@@ -203,16 +220,6 @@ class GuiProjectToolBar(QWidget):
|
||||
self.setContentsMargins(0, 0, 0, 0)
|
||||
self.setAutoFillBackground(True)
|
||||
|
||||
qPalette = self.palette()
|
||||
qPalette.setBrush(QPalette.Window, qPalette.base())
|
||||
self.setPalette(qPalette)
|
||||
|
||||
fadeCol = qPalette.text().color()
|
||||
buttonStyle = (
|
||||
"QToolButton {{padding: {0}px; border: none; background: transparent;}} "
|
||||
"QToolButton:hover {{border: none; background: rgba({1},{2},{3},0.2);}}"
|
||||
).format(mPx, fadeCol.red(), fadeCol.green(), fadeCol.blue())
|
||||
|
||||
# Widget Label
|
||||
self.viewLabel = QLabel("<b>%s</b>" % self.tr("Project Content"))
|
||||
self.viewLabel.setContentsMargins(0, 0, 0, 0)
|
||||
@@ -224,78 +231,56 @@ class GuiProjectToolBar(QWidget):
|
||||
self.tbQuick = QToolButton(self)
|
||||
self.tbQuick.setToolTip("%s [Ctrl+L]" % self.tr("Quick Links"))
|
||||
self.tbQuick.setShortcut("Ctrl+L")
|
||||
self.tbQuick.setIcon(self.mainTheme.getIcon("bookmark"))
|
||||
self.tbQuick.setIconSize(QSize(iPx, iPx))
|
||||
self.tbQuick.setStyleSheet(buttonStyle)
|
||||
self.tbQuick.setMenu(self.mQuick)
|
||||
self.tbQuick.setPopupMode(QToolButton.InstantPopup)
|
||||
|
||||
# Move Buttons
|
||||
self.tbMoveU = QToolButton(self)
|
||||
self.tbMoveU.setToolTip("%s [Ctrl+Up]" % self.tr("Move Up"))
|
||||
self.tbMoveU.setIcon(self.mainTheme.getIcon("up"))
|
||||
self.tbMoveU.setIconSize(QSize(iPx, iPx))
|
||||
self.tbMoveU.setStyleSheet(buttonStyle)
|
||||
self.tbMoveU.clicked.connect(lambda: self.projTree.moveTreeItem(-1))
|
||||
|
||||
self.tbMoveD = QToolButton(self)
|
||||
self.tbMoveD.setToolTip("%s [Ctrl+Down]" % self.tr("Move Down"))
|
||||
self.tbMoveD.setIcon(self.mainTheme.getIcon("down"))
|
||||
self.tbMoveD.setIconSize(QSize(iPx, iPx))
|
||||
self.tbMoveD.setStyleSheet(buttonStyle)
|
||||
self.tbMoveD.clicked.connect(lambda: self.projTree.moveTreeItem(1))
|
||||
|
||||
# Add Item Menu
|
||||
self.mAdd = QMenu()
|
||||
|
||||
self.aAddEmpty = self.mAdd.addAction(trConst(nwLabels.ITEM_DESCRIPTION["document"]))
|
||||
self.aAddEmpty.setIcon(self.mainTheme.getIcon("proj_document"))
|
||||
self.aAddEmpty.triggered.connect(
|
||||
lambda: self.projTree.newTreeItem(nwItemType.FILE, hLevel=0, isNote=False)
|
||||
)
|
||||
|
||||
self.aAddChap = self.mAdd.addAction(trConst(nwLabels.ITEM_DESCRIPTION["doc_h2"]))
|
||||
self.aAddChap.setIcon(self.mainTheme.getIcon("proj_chapter"))
|
||||
self.aAddChap.triggered.connect(
|
||||
lambda: self.projTree.newTreeItem(nwItemType.FILE, hLevel=2, isNote=False)
|
||||
)
|
||||
|
||||
self.aAddScene = self.mAdd.addAction(trConst(nwLabels.ITEM_DESCRIPTION["doc_h3"]))
|
||||
self.aAddScene.setIcon(self.mainTheme.getIcon("proj_scene"))
|
||||
self.aAddScene.triggered.connect(
|
||||
lambda: self.projTree.newTreeItem(nwItemType.FILE, hLevel=3, isNote=False)
|
||||
)
|
||||
|
||||
self.aAddNote = self.mAdd.addAction(trConst(nwLabels.ITEM_DESCRIPTION["note"]))
|
||||
self.aAddNote.setIcon(self.mainTheme.getIcon("proj_note"))
|
||||
self.aAddNote.triggered.connect(
|
||||
lambda: self.projTree.newTreeItem(nwItemType.FILE, hLevel=1, isNote=True)
|
||||
)
|
||||
|
||||
self.aAddFolder = self.mAdd.addAction(trConst(nwLabels.ITEM_DESCRIPTION["folder"]))
|
||||
self.aAddFolder.setIcon(self.mainTheme.getIcon("proj_folder"))
|
||||
self.aAddFolder.triggered.connect(
|
||||
lambda: self.projTree.newTreeItem(nwItemType.FOLDER)
|
||||
)
|
||||
|
||||
self.mAddRoot = self.mAdd.addMenu(trConst(nwLabels.ITEM_DESCRIPTION["root"]))
|
||||
self._addRootFolderEntry(nwItemClass.NOVEL)
|
||||
self._addRootFolderEntry(nwItemClass.ARCHIVE)
|
||||
self.mAddRoot.addSeparator()
|
||||
self._addRootFolderEntry(nwItemClass.PLOT)
|
||||
self._addRootFolderEntry(nwItemClass.CHARACTER)
|
||||
self._addRootFolderEntry(nwItemClass.WORLD)
|
||||
self._addRootFolderEntry(nwItemClass.TIMELINE)
|
||||
self._addRootFolderEntry(nwItemClass.OBJECT)
|
||||
self._addRootFolderEntry(nwItemClass.ENTITY)
|
||||
self._addRootFolderEntry(nwItemClass.CUSTOM)
|
||||
self._buildRootMenu()
|
||||
|
||||
self.tbAdd = QToolButton(self)
|
||||
self.tbAdd.setToolTip("%s [Ctrl+N]" % self.tr("Add Item"))
|
||||
self.tbAdd.setShortcut("Ctrl+N")
|
||||
self.tbAdd.setIcon(self.mainTheme.getIcon("add"))
|
||||
self.tbAdd.setIconSize(QSize(iPx, iPx))
|
||||
self.tbAdd.setStyleSheet(buttonStyle)
|
||||
self.tbAdd.setMenu(self.mAdd)
|
||||
self.tbAdd.setPopupMode(QToolButton.InstantPopup)
|
||||
|
||||
@@ -316,9 +301,7 @@ class GuiProjectToolBar(QWidget):
|
||||
|
||||
self.tbMore = QToolButton(self)
|
||||
self.tbMore.setToolTip(self.tr("More Options"))
|
||||
self.tbMore.setIcon(self.mainTheme.getIcon("menu"))
|
||||
self.tbMore.setIconSize(QSize(iPx, iPx))
|
||||
self.tbMore.setStyleSheet(buttonStyle)
|
||||
self.tbMore.setMenu(self.mMore)
|
||||
self.tbMore.setPopupMode(QToolButton.InstantPopup)
|
||||
|
||||
@@ -334,6 +317,7 @@ class GuiProjectToolBar(QWidget):
|
||||
self.outerBox.setSpacing(0)
|
||||
|
||||
self.setLayout(self.outerBox)
|
||||
self.updateTheme()
|
||||
|
||||
logger.debug("GuiProjectToolBar initialisation complete")
|
||||
|
||||
@@ -343,6 +327,41 @@ class GuiProjectToolBar(QWidget):
|
||||
# Methods
|
||||
##
|
||||
|
||||
def updateTheme(self):
|
||||
"""Update theme elements.
|
||||
"""
|
||||
qPalette = self.palette()
|
||||
qPalette.setBrush(QPalette.Window, qPalette.base())
|
||||
self.setPalette(qPalette)
|
||||
|
||||
fadeCol = qPalette.text().color()
|
||||
buttonStyle = (
|
||||
"QToolButton {{padding: {0}px; border: none; background: transparent;}} "
|
||||
"QToolButton:hover {{border: none; background: rgba({1},{2},{3},0.2);}}"
|
||||
).format(self.mainConf.pxInt(2), fadeCol.red(), fadeCol.green(), fadeCol.blue())
|
||||
|
||||
self.tbQuick.setStyleSheet(buttonStyle)
|
||||
self.tbMoveU.setStyleSheet(buttonStyle)
|
||||
self.tbMoveD.setStyleSheet(buttonStyle)
|
||||
self.tbAdd.setStyleSheet(buttonStyle)
|
||||
self.tbMore.setStyleSheet(buttonStyle)
|
||||
|
||||
self.tbQuick.setIcon(self.mainTheme.getIcon("bookmark"))
|
||||
self.tbMoveU.setIcon(self.mainTheme.getIcon("up"))
|
||||
self.tbMoveD.setIcon(self.mainTheme.getIcon("down"))
|
||||
self.aAddEmpty.setIcon(self.mainTheme.getIcon("proj_document"))
|
||||
self.aAddChap.setIcon(self.mainTheme.getIcon("proj_chapter"))
|
||||
self.aAddScene.setIcon(self.mainTheme.getIcon("proj_scene"))
|
||||
self.aAddNote.setIcon(self.mainTheme.getIcon("proj_note"))
|
||||
self.aAddFolder.setIcon(self.mainTheme.getIcon("proj_folder"))
|
||||
self.tbAdd.setIcon(self.mainTheme.getIcon("add"))
|
||||
self.tbMore.setIcon(self.mainTheme.getIcon("menu"))
|
||||
|
||||
self.buildQuickLinkMenu()
|
||||
self._buildRootMenu()
|
||||
|
||||
return
|
||||
|
||||
def clearContent(self):
|
||||
"""Clear dynamic content on the tool bar.
|
||||
"""
|
||||
@@ -369,24 +388,44 @@ class GuiProjectToolBar(QWidget):
|
||||
# Internal Functions
|
||||
##
|
||||
|
||||
def _addRootFolderEntry(self, itemClass):
|
||||
"""Add a menu entry for a root folder of a given class.
|
||||
def _buildRootMenu(self):
|
||||
"""Build the rood folder menu.
|
||||
"""
|
||||
aNew = self.mAddRoot.addAction(trConst(nwLabels.CLASS_NAME[itemClass]))
|
||||
aNew.setIcon(self.mainTheme.getIcon(nwLabels.CLASS_ICON[itemClass]))
|
||||
aNew.triggered.connect(lambda: self.projTree.newTreeItem(nwItemType.ROOT, itemClass))
|
||||
self.mAddRoot.addAction(aNew)
|
||||
def addClass(itemClass):
|
||||
aNew = self.mAddRoot.addAction(trConst(nwLabels.CLASS_NAME[itemClass]))
|
||||
aNew.setIcon(self.mainTheme.getIcon(nwLabels.CLASS_ICON[itemClass]))
|
||||
aNew.triggered.connect(lambda: self.projTree.newTreeItem(nwItemType.ROOT, itemClass))
|
||||
self.mAddRoot.addAction(aNew)
|
||||
return
|
||||
|
||||
self.mAddRoot.clear()
|
||||
addClass(nwItemClass.NOVEL)
|
||||
addClass(nwItemClass.ARCHIVE)
|
||||
self.mAddRoot.addSeparator()
|
||||
addClass(nwItemClass.PLOT)
|
||||
addClass(nwItemClass.CHARACTER)
|
||||
addClass(nwItemClass.WORLD)
|
||||
addClass(nwItemClass.TIMELINE)
|
||||
addClass(nwItemClass.OBJECT)
|
||||
addClass(nwItemClass.ENTITY)
|
||||
addClass(nwItemClass.CUSTOM)
|
||||
|
||||
return
|
||||
|
||||
# END Class GuiProjectToolBar
|
||||
|
||||
|
||||
class GuiProjectTree(QTreeWidget):
|
||||
|
||||
C_DATA = 0
|
||||
C_NAME = 0
|
||||
C_COUNT = 1
|
||||
C_ACTIVE = 2
|
||||
C_STATUS = 3
|
||||
|
||||
D_HANDLE = Qt.UserRole
|
||||
D_WORDS = Qt.UserRole + 1
|
||||
|
||||
def __init__(self, projView):
|
||||
super().__init__(parent=projView)
|
||||
|
||||
@@ -912,10 +951,13 @@ class GuiProjectTree(QTreeWidget):
|
||||
trItem.setToolTip(self.C_STATUS, itemStatus)
|
||||
|
||||
if nwItem.isFileType():
|
||||
iconName = "check" if nwItem.isActive else "cross"
|
||||
iconName = "checked" if nwItem.isActive else "unchecked"
|
||||
toolTip = self._lblActive if nwItem.isActive else self._lblInactive
|
||||
trItem.setIcon(self.C_ACTIVE, self.mainTheme.getIcon(iconName))
|
||||
trItem.setToolTip(self.C_ACTIVE, toolTip)
|
||||
else:
|
||||
iconName = "noncheckable"
|
||||
|
||||
trItem.setIcon(self.C_ACTIVE, self.mainTheme.getIcon(iconName))
|
||||
|
||||
if self.mainConf.emphLabels and nwItem.isDocumentLayout():
|
||||
trFont = trItem.font(self.C_NAME)
|
||||
@@ -939,10 +981,10 @@ class GuiProjectTree(QTreeWidget):
|
||||
|
||||
if countChildren:
|
||||
for i in range(tItem.childCount()):
|
||||
newCount += int(tItem.child(i).data(self.C_COUNT, Qt.UserRole))
|
||||
newCount += int(tItem.child(i).data(self.C_DATA, self.D_WORDS))
|
||||
|
||||
tItem.setText(self.C_COUNT, f"{newCount:n}")
|
||||
tItem.setData(self.C_COUNT, Qt.UserRole, int(newCount))
|
||||
tItem.setData(self.C_DATA, self.D_WORDS, int(newCount))
|
||||
|
||||
pItem = tItem.parent()
|
||||
if pItem is None:
|
||||
@@ -951,8 +993,8 @@ class GuiProjectTree(QTreeWidget):
|
||||
pCount = 0
|
||||
pHandle = None
|
||||
for i in range(pItem.childCount()):
|
||||
pCount += int(pItem.child(i).data(self.C_COUNT, Qt.UserRole))
|
||||
pHandle = pItem.data(self.C_NAME, Qt.UserRole)
|
||||
pCount += int(pItem.child(i).data(self.C_DATA, self.D_WORDS))
|
||||
pHandle = pItem.data(self.C_DATA, self.D_HANDLE)
|
||||
|
||||
if pHandle:
|
||||
if self.theProject.tree.checkType(pHandle, nwItemType.FILE):
|
||||
@@ -1003,8 +1045,8 @@ class GuiProjectTree(QTreeWidget):
|
||||
return False
|
||||
|
||||
dstIndex = min(max(0, dstIndex), dstItem.childCount())
|
||||
sHandle = srcItem.data(self.C_NAME, Qt.UserRole)
|
||||
dHandle = dstItem.data(self.C_NAME, Qt.UserRole)
|
||||
sHandle = srcItem.data(self.C_DATA, self.D_HANDLE)
|
||||
dHandle = dstItem.data(self.C_DATA, self.D_HANDLE)
|
||||
logger.debug("Moving item '%s' back to '%s', index %d", sHandle, dHandle, dstIndex)
|
||||
|
||||
wCount = self._getItemWordCount(sHandle)
|
||||
@@ -1028,7 +1070,7 @@ class GuiProjectTree(QTreeWidget):
|
||||
"""
|
||||
selItem = self.selectedItems()
|
||||
if selItem:
|
||||
return selItem[0].data(self.C_NAME, Qt.UserRole)
|
||||
return selItem[0].data(self.C_DATA, self.D_HANDLE)
|
||||
|
||||
return None
|
||||
|
||||
@@ -1111,10 +1153,12 @@ class GuiProjectTree(QTreeWidget):
|
||||
open a context menu in-place.
|
||||
"""
|
||||
tItem = None
|
||||
hasChild = False
|
||||
selItem = self.itemAt(clickPos)
|
||||
if isinstance(selItem, QTreeWidgetItem):
|
||||
tHandle = selItem.data(self.C_NAME, Qt.UserRole)
|
||||
tHandle = selItem.data(self.C_DATA, self.D_HANDLE)
|
||||
tItem = self.theProject.tree[tHandle]
|
||||
hasChild = selItem.childCount() > 0
|
||||
|
||||
if tItem is None:
|
||||
logger.debug("No item found")
|
||||
@@ -1128,9 +1172,8 @@ class GuiProjectTree(QTreeWidget):
|
||||
trashHandle = self.theProject.tree.trashRoot()
|
||||
if tItem.itemHandle == trashHandle and trashHandle is not None:
|
||||
# The trash folder only has one option
|
||||
ctxMenu.addAction(
|
||||
self.tr("Empty Trash"), lambda: self.emptyTrash()
|
||||
)
|
||||
aEmptyTrash = ctxMenu.addAction(self.tr("Empty Trash"))
|
||||
aEmptyTrash.triggered.connect(lambda: self.emptyTrash())
|
||||
ctxMenu.exec_(self.viewport().mapToGlobal(clickPos))
|
||||
return True
|
||||
|
||||
@@ -1140,15 +1183,14 @@ class GuiProjectTree(QTreeWidget):
|
||||
isRoot = tItem.isRootType()
|
||||
isFolder = tItem.isFolderType()
|
||||
isFile = tItem.isFileType()
|
||||
hasChild = selItem.childCount() > 0
|
||||
|
||||
if isFile:
|
||||
ctxMenu.addAction(
|
||||
self.tr("Open Document"),
|
||||
aOpenDoc = ctxMenu.addAction(self.tr("Open Document"))
|
||||
aOpenDoc.triggered.connect(
|
||||
lambda: self.projView.openDocumentRequest.emit(tHandle, nwDocMode.EDIT, -1, "")
|
||||
)
|
||||
ctxMenu.addAction(
|
||||
self.tr("View Document"),
|
||||
aViewDoc = ctxMenu.addAction(self.tr("View Document"))
|
||||
aViewDoc.triggered.connect(
|
||||
lambda: self.projView.openDocumentRequest.emit(tHandle, nwDocMode.VIEW, -1, "")
|
||||
)
|
||||
ctxMenu.addSeparator()
|
||||
@@ -1156,29 +1198,40 @@ class GuiProjectTree(QTreeWidget):
|
||||
# Edit Item Settings
|
||||
# ==================
|
||||
|
||||
ctxMenu.addAction(
|
||||
self.tr("Change Label"), lambda: self.renameTreeItem(tHandle)
|
||||
)
|
||||
aLabel = ctxMenu.addAction(self.tr("Change Label"))
|
||||
aLabel.triggered.connect(lambda: self.renameTreeItem(tHandle))
|
||||
|
||||
if isFile:
|
||||
ctxMenu.addAction(
|
||||
self.tr("Toggle Active"), lambda: self._toggleItemActive(tHandle)
|
||||
)
|
||||
aActive = ctxMenu.addAction(self.tr("Toggle Active"))
|
||||
aActive.triggered.connect(lambda: self._toggleItemActive(tHandle))
|
||||
|
||||
checkMark = f" ({nwUnicode.U_CHECK})"
|
||||
if tItem.isNovelLike():
|
||||
mStatus = ctxMenu.addMenu(self.tr("Set Status to ..."))
|
||||
for n, (key, entry) in enumerate(self.theProject.statusItems.items()):
|
||||
aStatus = mStatus.addAction(entry["icon"], entry["name"])
|
||||
entryName = entry["name"] + (checkMark if tItem.itemStatus == key else "")
|
||||
aStatus = mStatus.addAction(entry["icon"], entryName)
|
||||
aStatus.triggered.connect(
|
||||
lambda n, key=key: self._changeItemStatus(tHandle, key)
|
||||
)
|
||||
mStatus.addSeparator()
|
||||
aManage1 = mStatus.addAction("Manage Labels ...")
|
||||
aManage1.triggered.connect(
|
||||
lambda: self.projView.projectSettingsRequest.emit(GuiProjectSettings.TAB_STATUS)
|
||||
)
|
||||
else:
|
||||
mImport = ctxMenu.addMenu(self.tr("Set Importance to ..."))
|
||||
for n, (key, entry) in enumerate(self.theProject.importItems.items()):
|
||||
aImport = mImport.addAction(entry["icon"], entry["name"])
|
||||
entryName = entry["name"] + (checkMark if tItem.itemImport == key else "")
|
||||
aImport = mImport.addAction(entry["icon"], entryName)
|
||||
aImport.triggered.connect(
|
||||
lambda n, key=key: self._changeItemImport(tHandle, key)
|
||||
)
|
||||
mImport.addSeparator()
|
||||
aManage2 = mImport.addAction("Manage Labels ...")
|
||||
aManage2.triggered.connect(
|
||||
lambda: self.projView.projectSettingsRequest.emit(GuiProjectSettings.TAB_IMPORT)
|
||||
)
|
||||
|
||||
# Transform Item
|
||||
# ==============
|
||||
@@ -1193,38 +1246,30 @@ class GuiProjectTree(QTreeWidget):
|
||||
isNoteFile = isFile and tItem.isNoteLayout()
|
||||
|
||||
if (isNoteFile or isFolder) and tItem.documentAllowed():
|
||||
mTrans.addAction(
|
||||
self.tr("Convert to {0}").format(trDoc),
|
||||
aConvert1 = mTrans.addAction(self.tr("Convert to {0}").format(trDoc))
|
||||
aConvert1.triggered.connect(
|
||||
lambda: self._changeItemLayout(tHandle, nwItemLayout.DOCUMENT)
|
||||
)
|
||||
|
||||
if isDocFile or isFolder:
|
||||
mTrans.addAction(
|
||||
self.tr("Convert to {0}").format(trNote),
|
||||
aConvert2 = mTrans.addAction(self.tr("Convert to {0}").format(trNote))
|
||||
aConvert2.triggered.connect(
|
||||
lambda: self._changeItemLayout(tHandle, nwItemLayout.NOTE)
|
||||
)
|
||||
|
||||
if hasChild and isFile:
|
||||
mTrans.addAction(
|
||||
self.tr("Merge Child Items into Self"),
|
||||
lambda: self._mergeDocuments(tHandle, False)
|
||||
)
|
||||
mTrans.addAction(
|
||||
self.tr("Merge Child Items into New"),
|
||||
lambda: self._mergeDocuments(tHandle, True)
|
||||
)
|
||||
aMerge1 = mTrans.addAction(self.tr("Merge Child Items into Self"))
|
||||
aMerge1.triggered.connect(lambda: self._mergeDocuments(tHandle, False))
|
||||
aMerge2 = mTrans.addAction(self.tr("Merge Child Items into New"))
|
||||
aMerge2.triggered.connect(lambda: self._mergeDocuments(tHandle, True))
|
||||
|
||||
if hasChild and isFolder:
|
||||
mTrans.addAction(
|
||||
self.tr("Merge Documents in Folder"),
|
||||
lambda: self._mergeDocuments(tHandle, True)
|
||||
)
|
||||
aMerge3 = mTrans.addAction(self.tr("Merge Documents in Folder"))
|
||||
aMerge3.triggered.connect(lambda: self._mergeDocuments(tHandle, True))
|
||||
|
||||
if isFile:
|
||||
mTrans.addAction(
|
||||
self.tr("Split Document by Headers"),
|
||||
lambda: self._splitDocument(tHandle)
|
||||
)
|
||||
aSplit1 = mTrans.addAction(self.tr("Split Document by Headers"))
|
||||
aSplit1.triggered.connect(lambda: self._splitDocument(tHandle))
|
||||
|
||||
# Expand/Collapse/Delete
|
||||
# ======================
|
||||
@@ -1232,23 +1277,17 @@ class GuiProjectTree(QTreeWidget):
|
||||
ctxMenu.addSeparator()
|
||||
|
||||
if hasChild:
|
||||
ctxMenu.addAction(
|
||||
self.tr("Expand All"),
|
||||
lambda: self.setExpandedFromHandle(tHandle, True)
|
||||
)
|
||||
ctxMenu.addAction(
|
||||
self.tr("Collapse All"),
|
||||
lambda: self.setExpandedFromHandle(tHandle, False)
|
||||
)
|
||||
aExpand = ctxMenu.addAction(self.tr("Expand All"))
|
||||
aExpand.triggered.connect(lambda: self.setExpandedFromHandle(tHandle, True))
|
||||
aCollapse = ctxMenu.addAction(self.tr("Collapse All"))
|
||||
aCollapse.triggered.connect(lambda: self.setExpandedFromHandle(tHandle, False))
|
||||
|
||||
if tItem.itemClass == nwItemClass.TRASH or isRoot or (isFolder and not hasChild):
|
||||
ctxMenu.addAction(
|
||||
self.tr("Delete Permanently"), lambda: self.permanentlyDeleteItem(tHandle)
|
||||
)
|
||||
aDelete = ctxMenu.addAction(self.tr("Delete Permanently"))
|
||||
aDelete.triggered.connect(lambda: self.permanentlyDeleteItem(tHandle))
|
||||
else:
|
||||
ctxMenu.addAction(
|
||||
self.tr("Move to Trash"), lambda: self.moveItemToTrash(tHandle)
|
||||
)
|
||||
aMoveTrash = ctxMenu.addAction(self.tr("Move to Trash"))
|
||||
aMoveTrash.triggered.connect(lambda: self.moveItemToTrash(tHandle))
|
||||
|
||||
# Show Context Menu
|
||||
ctxMenu.exec_(self.viewport().mapToGlobal(clickPos))
|
||||
@@ -1276,7 +1315,7 @@ class GuiProjectTree(QTreeWidget):
|
||||
if not isinstance(selItem, QTreeWidgetItem):
|
||||
return
|
||||
|
||||
tHandle = selItem.data(self.C_NAME, Qt.UserRole)
|
||||
tHandle = selItem.data(self.C_DATA, self.D_HANDLE)
|
||||
tItem = self.theProject.tree[tHandle]
|
||||
if tItem is None:
|
||||
return
|
||||
@@ -1335,7 +1374,7 @@ class GuiProjectTree(QTreeWidget):
|
||||
|
||||
# Update item parent handle in the project, make sure meta data
|
||||
# is updated accordingly, and update word count
|
||||
pHandle = trItemP.data(self.C_NAME, Qt.UserRole)
|
||||
pHandle = trItemP.data(self.C_DATA, self.D_HANDLE)
|
||||
nwItemS.setParent(pHandle)
|
||||
trItemP.setExpanded(True)
|
||||
logger.debug("The parent of item '%s' has been changed to '%s'", tHandle, pHandle)
|
||||
@@ -1365,7 +1404,7 @@ class GuiProjectTree(QTreeWidget):
|
||||
tItem = self._getTreeItem(tHandle)
|
||||
if tItem is None:
|
||||
return 0
|
||||
return int(tItem.data(self.C_COUNT, Qt.UserRole))
|
||||
return int(tItem.data(self.C_DATA, self.D_WORDS))
|
||||
|
||||
def _getTreeItem(self, tHandle):
|
||||
"""Return the QTreeWidgetItem of a given item handle.
|
||||
@@ -1573,6 +1612,9 @@ class GuiProjectTree(QTreeWidget):
|
||||
self.tr("Could not write document content."), docSplit.getError()
|
||||
], nwAlert.ERROR)
|
||||
|
||||
if splitData.get("moveToTrash", False):
|
||||
self.moveItemToTrash(tHandle, askFirst=False, flush=True)
|
||||
|
||||
self.saveTreeOrder()
|
||||
|
||||
else:
|
||||
@@ -1585,7 +1627,7 @@ class GuiProjectTree(QTreeWidget):
|
||||
"""This is a recursive function returning all items in a tree
|
||||
starting at a given QTreeWidgetItem.
|
||||
"""
|
||||
tHandle = tItem.data(self.C_NAME, Qt.UserRole)
|
||||
tHandle = tItem.data(self.C_DATA, self.D_HANDLE)
|
||||
cCount = tItem.childCount()
|
||||
|
||||
# Update tree-related meta data
|
||||
@@ -1618,8 +1660,8 @@ class GuiProjectTree(QTreeWidget):
|
||||
newItem.setTextAlignment(self.C_ACTIVE, Qt.AlignLeft)
|
||||
newItem.setTextAlignment(self.C_STATUS, Qt.AlignLeft)
|
||||
|
||||
newItem.setData(self.C_NAME, Qt.UserRole, tHandle)
|
||||
newItem.setData(self.C_COUNT, Qt.UserRole, 0)
|
||||
newItem.setData(self.C_DATA, self.D_HANDLE, tHandle)
|
||||
newItem.setData(self.C_DATA, self.D_WORDS, 0)
|
||||
|
||||
self._treeMap[tHandle] = newItem
|
||||
if pHandle is None:
|
||||
|
||||
@@ -66,7 +66,6 @@ class GuiMainStatus(QStatusBar):
|
||||
# The Spell Checker Language
|
||||
self.langIcon = QLabel("")
|
||||
self.langText = QLabel(self.tr("None"))
|
||||
self.langIcon.setPixmap(self.mainTheme.getPixmap("status_lang", (iPx, iPx)))
|
||||
self.langIcon.setContentsMargins(0, 0, 0, 0)
|
||||
self.langText.setContentsMargins(0, 0, xM, 0)
|
||||
self.addPermanentWidget(self.langIcon)
|
||||
@@ -91,7 +90,6 @@ class GuiMainStatus(QStatusBar):
|
||||
# The Project and Session Stats
|
||||
self.statsIcon = QLabel()
|
||||
self.statsText = QLabel("")
|
||||
self.statsIcon.setPixmap(self.mainTheme.getPixmap("status_stats", (iPx, iPx)))
|
||||
self.statsIcon.setContentsMargins(0, 0, 0, 0)
|
||||
self.statsText.setContentsMargins(0, 0, xM, 0)
|
||||
self.addPermanentWidget(self.statsIcon)
|
||||
@@ -99,12 +97,8 @@ class GuiMainStatus(QStatusBar):
|
||||
|
||||
# The Session Clock
|
||||
# Set the mimimum width so the label doesn't rescale every second
|
||||
self.timePixmap = self.mainTheme.getPixmap("status_time", (iPx, iPx))
|
||||
self.idlePixmap = self.mainTheme.getPixmap("status_idle", (iPx, iPx))
|
||||
|
||||
self.timeIcon = QLabel()
|
||||
self.timeText = QLabel("")
|
||||
self.timeIcon.setPixmap(self.timePixmap)
|
||||
self.timeText.setToolTip(self.tr("Session Time"))
|
||||
self.timeText.setMinimumWidth(self.mainTheme.getTextWidth("00:00:00:"))
|
||||
self.timeIcon.setContentsMargins(0, 0, 0, 0)
|
||||
@@ -117,6 +111,7 @@ class GuiMainStatus(QStatusBar):
|
||||
|
||||
logger.debug("GuiMainStatus initialisation complete")
|
||||
|
||||
self.updateTheme()
|
||||
self.clearStatus()
|
||||
|
||||
return
|
||||
@@ -132,6 +127,21 @@ class GuiMainStatus(QStatusBar):
|
||||
self.updateTime()
|
||||
return True
|
||||
|
||||
def updateTheme(self):
|
||||
"""Update theme elements.
|
||||
"""
|
||||
iPx = self.mainTheme.baseIconSize
|
||||
|
||||
self.langIcon.setPixmap(self.mainTheme.getPixmap("status_lang", (iPx, iPx)))
|
||||
self.statsIcon.setPixmap(self.mainTheme.getPixmap("status_stats", (iPx, iPx)))
|
||||
|
||||
self.timePixmap = self.mainTheme.getPixmap("status_time", (iPx, iPx))
|
||||
self.idlePixmap = self.mainTheme.getPixmap("status_idle", (iPx, iPx))
|
||||
|
||||
self.timeIcon.setPixmap(self.timePixmap)
|
||||
|
||||
return
|
||||
|
||||
##
|
||||
# Setters
|
||||
##
|
||||
|
||||
@@ -38,7 +38,7 @@ from PyQt5.QtGui import (
|
||||
|
||||
from novelwriter.enum import nwItemLayout, nwItemType
|
||||
from novelwriter.error import logException
|
||||
from novelwriter.common import NWConfigParser, minmax, readTextFile
|
||||
from novelwriter.common import NWConfigParser, minmax
|
||||
from novelwriter.constants import nwLabels
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -67,6 +67,7 @@ class GuiTheme:
|
||||
self.themeUrl = ""
|
||||
self.themeLicense = ""
|
||||
self.themeLicenseUrl = ""
|
||||
self.themeIcons = ""
|
||||
|
||||
# GUI
|
||||
self.statNone = [120, 120, 120]
|
||||
@@ -104,16 +105,14 @@ class GuiTheme:
|
||||
self.colRepTag = [0, 0, 0]
|
||||
self.colMod = [0, 0, 0]
|
||||
|
||||
# Changeable Settings
|
||||
self.guiTheme = None
|
||||
self.guiSyntax = None
|
||||
self.syntaxFile = None
|
||||
self.cssFile = None
|
||||
self.guiFontDB = QFontDatabase()
|
||||
|
||||
# Class Setup
|
||||
# ===========
|
||||
|
||||
# Init GUI Font
|
||||
self.guiFontDB = QFontDatabase()
|
||||
self._setGuiFont()
|
||||
|
||||
# Load Themes
|
||||
self._guiPalette = QPalette()
|
||||
self._themeList = []
|
||||
self._syntaxList = []
|
||||
@@ -127,9 +126,8 @@ class GuiTheme:
|
||||
self._listConf(self._availSyntax, os.path.join(self.mainConf.dataPath, "syntax"))
|
||||
self._listConf(self._availThemes, os.path.join(self.mainConf.dataPath, "themes"))
|
||||
|
||||
self.updateFont()
|
||||
self.updateTheme()
|
||||
self.iconCache.updateTheme()
|
||||
self.loadTheme()
|
||||
self.loadSyntax()
|
||||
|
||||
# Icon Functions
|
||||
self.getIcon = self.iconCache.getIcon
|
||||
@@ -183,77 +181,26 @@ class GuiTheme:
|
||||
return int(ceil(qMetrics.boundingRect(theText).width()))
|
||||
|
||||
##
|
||||
# Actions
|
||||
# Theme Methods
|
||||
##
|
||||
|
||||
def updateFont(self):
|
||||
"""Update the GUI's font style from settings.
|
||||
"""
|
||||
theFont = QFont()
|
||||
if self.mainConf.guiFont not in self.guiFontDB.families():
|
||||
if self.mainConf.osWindows and "Arial" in self.guiFontDB.families():
|
||||
# On Windows we default to Arial if possible
|
||||
theFont.setFamily("Arial")
|
||||
theFont.setPointSize(10)
|
||||
else:
|
||||
theFont = self.guiFontDB.systemFont(QFontDatabase.GeneralFont)
|
||||
self.mainConf.guiFont = theFont.family()
|
||||
self.mainConf.guiFontSize = theFont.pointSize()
|
||||
else:
|
||||
theFont.setFamily(self.mainConf.guiFont)
|
||||
theFont.setPointSize(self.mainConf.guiFontSize)
|
||||
|
||||
qApp.setFont(theFont)
|
||||
|
||||
return
|
||||
|
||||
def updateTheme(self):
|
||||
"""Update the GUI theme from theme files.
|
||||
"""
|
||||
self.guiTheme = self.mainConf.guiTheme
|
||||
self.guiSyntax = self.mainConf.guiSyntax
|
||||
|
||||
self.themeFile = self._availThemes.get(self.guiTheme, None)
|
||||
if self.themeFile is None:
|
||||
logger.error("Could not find GUI theme '%s'", self.guiTheme)
|
||||
else:
|
||||
self.cssFile = self.themeFile[:-5]+".css"
|
||||
self.loadTheme()
|
||||
|
||||
self.syntaxFile = self._availSyntax.get(self.guiSyntax, None)
|
||||
if self.syntaxFile is None:
|
||||
logger.error("Could not find syntax theme '%s'", self.guiSyntax)
|
||||
else:
|
||||
self.loadSyntax()
|
||||
|
||||
# Update dependant colours
|
||||
backCol = qApp.palette().window().color()
|
||||
textCol = qApp.palette().windowText().color()
|
||||
|
||||
backLCol = backCol.lightnessF()
|
||||
textLCol = textCol.lightnessF()
|
||||
|
||||
if backLCol > textLCol:
|
||||
helpLCol = textLCol + 0.65*(backLCol - textLCol)
|
||||
else:
|
||||
helpLCol = backLCol + 0.65*(textLCol - backLCol)
|
||||
|
||||
self.helpText = [int(255*helpLCol)]*3
|
||||
|
||||
return True
|
||||
|
||||
def loadTheme(self):
|
||||
"""Load the currently specified GUI theme.
|
||||
"""
|
||||
logger.info("Loading GUI theme '%s'", self.guiTheme)
|
||||
guiTheme = self.mainConf.guiTheme
|
||||
themeFile = self._availThemes.get(guiTheme, None)
|
||||
if themeFile is None:
|
||||
logger.error("Could not find GUI theme '%s'", guiTheme)
|
||||
return False
|
||||
|
||||
# Config File
|
||||
logger.info("Loading GUI theme '%s'", guiTheme)
|
||||
confParser = NWConfigParser()
|
||||
try:
|
||||
with open(self.themeFile, mode="r", encoding="utf-8") as inFile:
|
||||
with open(themeFile, mode="r", encoding="utf-8") as inFile:
|
||||
confParser.read_file(inFile)
|
||||
except Exception:
|
||||
logger.error("Could not load theme settings from: %s", self.themeFile)
|
||||
logger.error("Could not load theme settings from: %s", themeFile)
|
||||
logException()
|
||||
return False
|
||||
|
||||
@@ -267,6 +214,7 @@ class GuiTheme:
|
||||
self.themeUrl = confParser.rdStr(cnfSec, "url", "")
|
||||
self.themeLicense = confParser.rdStr(cnfSec, "license", "N/A")
|
||||
self.themeLicenseUrl = confParser.rdStr(cnfSec, "licenseurl", "")
|
||||
self.themeIcons = confParser.rdStr(cnfSec, "icontheme", "")
|
||||
|
||||
# Palette
|
||||
cnfSec = "Palette"
|
||||
@@ -285,18 +233,32 @@ class GuiTheme:
|
||||
self._setPalette(confParser, cnfSec, "highlightedtext", QPalette.HighlightedText)
|
||||
self._setPalette(confParser, cnfSec, "link", QPalette.Link)
|
||||
self._setPalette(confParser, cnfSec, "linkvisited", QPalette.LinkVisited)
|
||||
else:
|
||||
self._guiPalette = qApp.style().standardPalette()
|
||||
|
||||
# GUI
|
||||
cnfSec = "GUI"
|
||||
if confParser.has_section(cnfSec):
|
||||
self.statNone = self._loadColour(confParser, cnfSec, "statusnone")
|
||||
self.statUnsaved = self._loadColour(confParser, cnfSec, "statusunsaved")
|
||||
self.statSaved = self._loadColour(confParser, cnfSec, "statussaved")
|
||||
self.statNone = self._parseColour(confParser, cnfSec, "statusnone")
|
||||
self.statUnsaved = self._parseColour(confParser, cnfSec, "statusunsaved")
|
||||
self.statSaved = self._parseColour(confParser, cnfSec, "statussaved")
|
||||
|
||||
# CSS File
|
||||
cssData = readTextFile(self.cssFile)
|
||||
if cssData:
|
||||
qApp.setStyleSheet(cssData)
|
||||
# Icons
|
||||
self.iconCache.loadTheme(self.themeIcons)
|
||||
|
||||
# Update Dependant Colours
|
||||
backCol = self._guiPalette.window().color()
|
||||
textCol = self._guiPalette.windowText().color()
|
||||
|
||||
backLCol = backCol.lightnessF()
|
||||
textLCol = textCol.lightnessF()
|
||||
|
||||
if backLCol > textLCol:
|
||||
helpLCol = textLCol + 0.65*(backLCol - textLCol)
|
||||
else:
|
||||
helpLCol = backLCol + 0.65*(textLCol - backLCol)
|
||||
|
||||
self.helpText = [int(255*helpLCol)]*3
|
||||
|
||||
# Apply Styles
|
||||
qApp.setPalette(self._guiPalette)
|
||||
@@ -306,14 +268,20 @@ class GuiTheme:
|
||||
def loadSyntax(self):
|
||||
"""Load the currently specified syntax highlighter theme.
|
||||
"""
|
||||
logger.info("Loading syntax theme '%s'", self.guiSyntax)
|
||||
guiSyntax = self.mainConf.guiSyntax
|
||||
syntaxFile = self._availSyntax.get(guiSyntax, None)
|
||||
if syntaxFile is None:
|
||||
logger.error("Could not find syntax theme '%s'", guiSyntax)
|
||||
return False
|
||||
|
||||
logger.info("Loading syntax theme '%s'", guiSyntax)
|
||||
|
||||
confParser = NWConfigParser()
|
||||
try:
|
||||
with open(self.syntaxFile, mode="r", encoding="utf-8") as inFile:
|
||||
with open(syntaxFile, mode="r", encoding="utf-8") as inFile:
|
||||
confParser.read_file(inFile)
|
||||
except Exception:
|
||||
logger.error("Could not load syntax colours from: %s", self.syntaxFile)
|
||||
logger.error("Could not load syntax colours from: %s", syntaxFile)
|
||||
logException()
|
||||
return False
|
||||
|
||||
@@ -321,32 +289,32 @@ class GuiTheme:
|
||||
cnfSec = "Main"
|
||||
if confParser.has_section(cnfSec):
|
||||
self.syntaxName = confParser.rdStr(cnfSec, "name", "")
|
||||
self.syntaxDescription = confParser.rdStr(cnfSec, "description", "")
|
||||
self.syntaxAuthor = confParser.rdStr(cnfSec, "author", "")
|
||||
self.syntaxCredit = confParser.rdStr(cnfSec, "credit", "")
|
||||
self.syntaxDescription = confParser.rdStr(cnfSec, "description", "N/A")
|
||||
self.syntaxAuthor = confParser.rdStr(cnfSec, "author", "N/A")
|
||||
self.syntaxCredit = confParser.rdStr(cnfSec, "credit", "N/A")
|
||||
self.syntaxUrl = confParser.rdStr(cnfSec, "url", "")
|
||||
self.syntaxLicense = confParser.rdStr(cnfSec, "license", "")
|
||||
self.syntaxLicense = confParser.rdStr(cnfSec, "license", "N/A")
|
||||
self.syntaxLicenseUrl = confParser.rdStr(cnfSec, "licenseurl", "")
|
||||
|
||||
# Syntax
|
||||
cnfSec = "Syntax"
|
||||
if confParser.has_section(cnfSec):
|
||||
self.colBack = self._loadColour(confParser, cnfSec, "background")
|
||||
self.colText = self._loadColour(confParser, cnfSec, "text")
|
||||
self.colLink = self._loadColour(confParser, cnfSec, "link")
|
||||
self.colHead = self._loadColour(confParser, cnfSec, "headertext")
|
||||
self.colHeadH = self._loadColour(confParser, cnfSec, "headertag")
|
||||
self.colEmph = self._loadColour(confParser, cnfSec, "emphasis")
|
||||
self.colDialN = self._loadColour(confParser, cnfSec, "straightquotes")
|
||||
self.colDialD = self._loadColour(confParser, cnfSec, "doublequotes")
|
||||
self.colDialS = self._loadColour(confParser, cnfSec, "singlequotes")
|
||||
self.colHidden = self._loadColour(confParser, cnfSec, "hidden")
|
||||
self.colKey = self._loadColour(confParser, cnfSec, "keyword")
|
||||
self.colVal = self._loadColour(confParser, cnfSec, "value")
|
||||
self.colSpell = self._loadColour(confParser, cnfSec, "spellcheckline")
|
||||
self.colError = self._loadColour(confParser, cnfSec, "errorline")
|
||||
self.colRepTag = self._loadColour(confParser, cnfSec, "replacetag")
|
||||
self.colMod = self._loadColour(confParser, cnfSec, "modifier")
|
||||
self.colBack = self._parseColour(confParser, cnfSec, "background")
|
||||
self.colText = self._parseColour(confParser, cnfSec, "text")
|
||||
self.colLink = self._parseColour(confParser, cnfSec, "link")
|
||||
self.colHead = self._parseColour(confParser, cnfSec, "headertext")
|
||||
self.colHeadH = self._parseColour(confParser, cnfSec, "headertag")
|
||||
self.colEmph = self._parseColour(confParser, cnfSec, "emphasis")
|
||||
self.colDialN = self._parseColour(confParser, cnfSec, "straightquotes")
|
||||
self.colDialD = self._parseColour(confParser, cnfSec, "doublequotes")
|
||||
self.colDialS = self._parseColour(confParser, cnfSec, "singlequotes")
|
||||
self.colHidden = self._parseColour(confParser, cnfSec, "hidden")
|
||||
self.colKey = self._parseColour(confParser, cnfSec, "keyword")
|
||||
self.colVal = self._parseColour(confParser, cnfSec, "value")
|
||||
self.colSpell = self._parseColour(confParser, cnfSec, "spellcheckline")
|
||||
self.colError = self._parseColour(confParser, cnfSec, "errorline")
|
||||
self.colRepTag = self._parseColour(confParser, cnfSec, "replacetag")
|
||||
self.colMod = self._parseColour(confParser, cnfSec, "modifier")
|
||||
|
||||
return True
|
||||
|
||||
@@ -388,52 +356,64 @@ class GuiTheme:
|
||||
# Internal Functions
|
||||
##
|
||||
|
||||
def _setGuiFont(self):
|
||||
"""Update the GUI's font style from settings.
|
||||
"""
|
||||
theFont = QFont()
|
||||
if self.mainConf.guiFont not in self.guiFontDB.families():
|
||||
if self.mainConf.osWindows and "Arial" in self.guiFontDB.families():
|
||||
# On Windows we default to Arial if possible
|
||||
theFont.setFamily("Arial")
|
||||
theFont.setPointSize(10)
|
||||
else:
|
||||
theFont = self.guiFontDB.systemFont(QFontDatabase.GeneralFont)
|
||||
self.mainConf.guiFont = theFont.family()
|
||||
self.mainConf.guiFontSize = theFont.pointSize()
|
||||
else:
|
||||
theFont.setFamily(self.mainConf.guiFont)
|
||||
theFont.setPointSize(self.mainConf.guiFontSize)
|
||||
|
||||
qApp.setFont(theFont)
|
||||
|
||||
return
|
||||
|
||||
def _listConf(self, targetDict, checkDir):
|
||||
"""Scan for syntax and gui themes and populate the dictionary.
|
||||
"""Scan for theme config files and populate the dictionary.
|
||||
"""
|
||||
if not os.path.isdir(checkDir):
|
||||
return
|
||||
return False
|
||||
|
||||
for checkFile in os.listdir(checkDir):
|
||||
confPath = os.path.join(checkDir, checkFile)
|
||||
if os.path.isfile(confPath) and confPath.endswith(".conf"):
|
||||
targetDict[checkFile[:-5]] = confPath
|
||||
|
||||
return
|
||||
return True
|
||||
|
||||
def _loadColour(self, confParser, cnfSec, cnfName):
|
||||
"""Load a colour value from a config string.
|
||||
def _parseColour(self, confParser, cnfSec, cnfName):
|
||||
"""Parse a colour value from a config string.
|
||||
"""
|
||||
if confParser.has_option(cnfSec, cnfName):
|
||||
inData = confParser.get(cnfSec, cnfName).split(",")
|
||||
outData = []
|
||||
values = confParser.get(cnfSec, cnfName).split(",")
|
||||
result = []
|
||||
try:
|
||||
outData.append(int(inData[0]))
|
||||
outData.append(int(inData[1]))
|
||||
outData.append(int(inData[2]))
|
||||
result.append(minmax(int(values[0]), 0, 255))
|
||||
result.append(minmax(int(values[1]), 0, 255))
|
||||
result.append(minmax(int(values[2]), 0, 255))
|
||||
except Exception:
|
||||
logger.error("Could not load theme colours for '%s' from config file", cnfName)
|
||||
outData = [0, 0, 0]
|
||||
result = [0, 0, 0]
|
||||
else:
|
||||
logger.warning("Could not find theme colours for '%s' in config file", cnfName)
|
||||
outData = [0, 0, 0]
|
||||
return outData
|
||||
result = [0, 0, 0]
|
||||
return result
|
||||
|
||||
def _setPalette(self, confParser, cnfSec, cnfName, paletteVal):
|
||||
"""Set a palette colour value from a config string.
|
||||
"""
|
||||
readCol = []
|
||||
if confParser.has_option(cnfSec, cnfName):
|
||||
inData = confParser.get(cnfSec, cnfName).split(",")
|
||||
try:
|
||||
readCol.append(int(inData[0]))
|
||||
readCol.append(int(inData[1]))
|
||||
readCol.append(int(inData[2]))
|
||||
except Exception:
|
||||
logger.error("Could not load theme colours for '%s' from config file", cnfName)
|
||||
return
|
||||
if len(readCol) == 3:
|
||||
self._guiPalette.setColor(paletteVal, QColor(*readCol))
|
||||
self._guiPalette.setColor(
|
||||
paletteVal, QColor(*self._parseColour(confParser, cnfSec, cnfName))
|
||||
)
|
||||
return
|
||||
|
||||
# End Class GuiTheme
|
||||
@@ -468,9 +448,9 @@ class GuiIcons:
|
||||
"view_editor", "view_novel", "view_outline",
|
||||
|
||||
# General Button Icons
|
||||
"add", "backward", "bookmark", "check", "close", "cross", "down", "edit", "forward",
|
||||
"maximise", "menu", "minimise", "reference", "refresh", "remove", "search_replace",
|
||||
"search", "settings", "up",
|
||||
"add", "backward", "bookmark", "checked", "close", "cross", "down", "edit", "forward",
|
||||
"maximise", "menu", "minimise", "noncheckable", "reference", "refresh", "remove",
|
||||
"search_replace", "search", "settings", "unchecked", "up",
|
||||
|
||||
# Switches
|
||||
"sticky-on", "sticky-off",
|
||||
@@ -492,13 +472,11 @@ class GuiIcons:
|
||||
# Storage
|
||||
self._qIcons = {}
|
||||
self._themeMap = {}
|
||||
self._themeList = []
|
||||
self._headerDec = []
|
||||
self._confName = "icons.conf"
|
||||
|
||||
# Icon Theme Path
|
||||
self._iconPath = os.path.join(self.mainConf.assetPath, "icons")
|
||||
self._themePath = os.path.join(self._iconPath, "system")
|
||||
self._iconPath = os.path.join(self.mainConf.assetPath, "icons")
|
||||
|
||||
# Icon Theme Meta
|
||||
self.themeName = ""
|
||||
@@ -515,20 +493,19 @@ class GuiIcons:
|
||||
# Actions
|
||||
##
|
||||
|
||||
def updateTheme(self):
|
||||
def loadTheme(self, iconTheme):
|
||||
"""Update the theme map. This is more of an init, since many of
|
||||
the GUI icons cannot really be replaced without writing specific
|
||||
update functions for the classes where they're used.
|
||||
"""
|
||||
self._themeMap = {}
|
||||
themePath = self._getThemePath()
|
||||
if themePath is None:
|
||||
logger.warning("No icons loaded")
|
||||
themePath = os.path.join(self.mainConf.assetPath, "icons", iconTheme)
|
||||
if not os.path.isdir(themePath):
|
||||
logger.warning("No icons loaded for '%s'", iconTheme)
|
||||
return False
|
||||
|
||||
self._themePath = themePath
|
||||
themeConf = os.path.join(themePath, self._confName)
|
||||
logger.info("Loading icon theme '%s'", self.mainConf.guiIcons)
|
||||
logger.info("Loading icon theme '%s'", iconTheme)
|
||||
|
||||
# Config File
|
||||
confParser = NWConfigParser()
|
||||
@@ -558,7 +535,7 @@ class GuiIcons:
|
||||
if iconName not in self.ICON_KEYS:
|
||||
logger.error("Unknown icon name '%s' in config file", iconName)
|
||||
else:
|
||||
iconPath = os.path.join(self._themePath, iconFile)
|
||||
iconPath = os.path.join(themePath, iconFile)
|
||||
if os.path.isfile(iconPath):
|
||||
self._themeMap[iconName] = iconPath
|
||||
logger.debug("Icon slot '%s' using file '%s'", iconName, iconFile)
|
||||
@@ -574,6 +551,14 @@ class GuiIcons:
|
||||
if iconKey not in self._themeMap:
|
||||
logger.error("No icon file specified for '%s'", iconKey)
|
||||
|
||||
# Refresh icons
|
||||
for iconKey in self._qIcons:
|
||||
logger.debug("Reloading icon: '%s'", iconKey)
|
||||
qIcon = self._loadIcon(iconKey)
|
||||
self._qIcons[iconKey] = qIcon
|
||||
|
||||
self._headerDec = []
|
||||
|
||||
return True
|
||||
|
||||
##
|
||||
@@ -595,7 +580,7 @@ class GuiIcons:
|
||||
return QPixmap()
|
||||
|
||||
if not os.path.isfile(imgPath):
|
||||
logger.error("Asset '%s' not found", self.IMAGE_MAP[decoKey])
|
||||
logger.error("Asset not found: %s", imgPath)
|
||||
return QPixmap()
|
||||
|
||||
theDeco = QPixmap(imgPath)
|
||||
@@ -608,7 +593,7 @@ class GuiIcons:
|
||||
|
||||
return theDeco
|
||||
|
||||
def getIcon(self, iconKey, iconSize=None):
|
||||
def getIcon(self, iconKey):
|
||||
"""Return an icon from the icon buffer. If it doesn't exist,
|
||||
return, load it, and if it still doesn't exist, return an empty
|
||||
icon.
|
||||
@@ -668,49 +653,10 @@ class GuiIcons:
|
||||
]
|
||||
return self._headerDec[minmax(hLevel, 0, 4)]
|
||||
|
||||
def listThemes(self):
|
||||
"""Scan the icons themes folder and list all themes.
|
||||
"""
|
||||
if self._themeList:
|
||||
return self._themeList
|
||||
|
||||
confParser = NWConfigParser()
|
||||
for themeDir in os.listdir(self._iconPath):
|
||||
themePath = os.path.join(self._iconPath, themeDir)
|
||||
if not os.path.isdir(themePath):
|
||||
continue
|
||||
|
||||
logger.debug("Checking icon theme config for '%s'", themeDir)
|
||||
themeConf = os.path.join(themePath, self._confName)
|
||||
themeName = _loadInternalName(confParser, themeConf)
|
||||
if themeName:
|
||||
self._themeList.append((themeDir, themeName))
|
||||
|
||||
self._themeList = sorted(self._themeList, key=lambda x: x[1])
|
||||
|
||||
return self._themeList
|
||||
|
||||
##
|
||||
# Internal Functions
|
||||
##
|
||||
|
||||
def _getThemePath(self):
|
||||
"""Get a valid theme path. Returns None if it fails.
|
||||
"""
|
||||
themePath = os.path.join(self.mainConf.assetPath, "icons", self.mainConf.guiIcons)
|
||||
if not os.path.isdir(themePath):
|
||||
logger.warning(
|
||||
"Icon theme '%s' not found, resetting to default", self.mainConf.guiIcons
|
||||
)
|
||||
self.mainConf.setDefaultIconTheme()
|
||||
|
||||
themePath = os.path.join(self.mainConf.assetPath, "icons", self.mainConf.guiIcons)
|
||||
if not os.path.isdir(themePath):
|
||||
logger.error("Default icon theme not found")
|
||||
return None
|
||||
|
||||
return themePath
|
||||
|
||||
def _loadIcon(self, iconKey):
|
||||
"""Load an icon from the assets themes folder. Is guaranteed to
|
||||
return a QIcon.
|
||||
|
||||
@@ -61,7 +61,6 @@ class GuiViewsBar(QToolBar):
|
||||
self.setIconSize(QSize(iPx, iPx))
|
||||
self.setMaximumWidth(mPx)
|
||||
self.setContentsMargins(0, 0, 0, 0)
|
||||
self.setStyleSheet("QToolBar {border: 0px;}")
|
||||
|
||||
stretch = QWidget(self)
|
||||
stretch.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
|
||||
@@ -70,37 +69,31 @@ class GuiViewsBar(QToolBar):
|
||||
self.aProject = QAction(self.tr("Project"), self)
|
||||
self.aProject.setFont(lblFont)
|
||||
self.aProject.setToolTip(self.tr("Project Tree View"))
|
||||
self.aProject.setIcon(self.mainTheme.getIcon("view_editor"))
|
||||
self.aProject.triggered.connect(lambda: self.viewChangeRequested.emit(nwView.PROJECT))
|
||||
|
||||
self.aNovel = QAction(self.tr("Novel"), self)
|
||||
self.aNovel.setFont(lblFont)
|
||||
self.aNovel.setToolTip(self.tr("Novel Tree View"))
|
||||
self.aNovel.setIcon(self.mainTheme.getIcon("view_novel"))
|
||||
self.aNovel.triggered.connect(lambda: self.viewChangeRequested.emit(nwView.NOVEL))
|
||||
|
||||
self.aOutline = QAction(self.tr("Outline"), self)
|
||||
self.aOutline.setFont(lblFont)
|
||||
self.aOutline.setToolTip(self.tr("Novel Outline View"))
|
||||
self.aOutline.setIcon(self.mainTheme.getIcon("view_outline"))
|
||||
self.aOutline.triggered.connect(lambda: self.viewChangeRequested.emit(nwView.OUTLINE))
|
||||
|
||||
self.aBuild = QAction(self.tr("Build"), self)
|
||||
self.aBuild.setFont(lblFont)
|
||||
self.aBuild.setToolTip(self.tr("Build Novel Project"))
|
||||
self.aBuild.setIcon(self.mainTheme.getIcon("view_build"))
|
||||
self.aBuild.triggered.connect(lambda: self.mainGui.showBuildProjectDialog())
|
||||
|
||||
self.aDetails = QAction(self.tr("Details"), self)
|
||||
self.aDetails.setFont(lblFont)
|
||||
self.aDetails.setToolTip(self.tr("Project Details"))
|
||||
self.aDetails.setIcon(self.mainTheme.getIcon("proj_details"))
|
||||
self.aDetails.triggered.connect(lambda: self.mainGui.showProjectDetailsDialog())
|
||||
|
||||
self.aStats = QAction(self.tr("Stats"), self)
|
||||
self.aStats.setFont(lblFont)
|
||||
self.aStats.setToolTip(self.tr("Writing Statistics"))
|
||||
self.aStats.setIcon(self.mainTheme.getIcon("proj_stats"))
|
||||
self.aStats.triggered.connect(lambda: self.mainGui.showWritingStatsDialog())
|
||||
|
||||
# Settings Menu
|
||||
@@ -114,7 +107,6 @@ class GuiViewsBar(QToolBar):
|
||||
self.tbSettings = QToolButton(self)
|
||||
self.tbSettings.setFont(lblFont)
|
||||
self.tbSettings.setText(self.tr("Settings"))
|
||||
self.tbSettings.setIcon(self.mainTheme.getIcon("settings"))
|
||||
self.tbSettings.setMenu(self.mSettings)
|
||||
self.tbSettings.setToolButtonStyle(Qt.ToolButtonTextUnderIcon)
|
||||
self.tbSettings.setPopupMode(QToolButton.InstantPopup)
|
||||
@@ -129,8 +121,25 @@ class GuiViewsBar(QToolBar):
|
||||
self.addAction(self.aStats)
|
||||
self.addWidget(self.tbSettings)
|
||||
|
||||
self.updateTheme()
|
||||
|
||||
logger.debug("GuiViewsBar initialisation complete")
|
||||
|
||||
return
|
||||
|
||||
def updateTheme(self):
|
||||
"""Initialise GUI elements that depend on specific settings.
|
||||
"""
|
||||
self.setStyleSheet("QToolBar {border: 0px;}")
|
||||
|
||||
self.aProject.setIcon(self.mainTheme.getIcon("view_editor"))
|
||||
self.aNovel.setIcon(self.mainTheme.getIcon("view_novel"))
|
||||
self.aOutline.setIcon(self.mainTheme.getIcon("view_outline"))
|
||||
self.aBuild.setIcon(self.mainTheme.getIcon("view_build"))
|
||||
self.aDetails.setIcon(self.mainTheme.getIcon("proj_details"))
|
||||
self.aStats.setIcon(self.mainTheme.getIcon("proj_stats"))
|
||||
self.tbSettings.setIcon(self.mainTheme.getIcon("settings"))
|
||||
|
||||
return
|
||||
|
||||
# END Class GuiViewsBar
|
||||
|
||||
@@ -208,6 +208,7 @@ class GuiMain(QMainWindow):
|
||||
self.projView.rootFolderChanged.connect(self.outlineView.updateRootItem)
|
||||
self.projView.rootFolderChanged.connect(self.novelView.updateRootItem)
|
||||
self.projView.rootFolderChanged.connect(self.projView.updateRootItem)
|
||||
self.projView.projectSettingsRequest.connect(self.showProjectSettingsDialog)
|
||||
|
||||
self.novelView.selectedItemChanged.connect(self.itemDetails.updateViewBox)
|
||||
self.novelView.openDocumentRequest.connect(self._openDocument)
|
||||
@@ -806,15 +807,11 @@ class GuiMain(QMainWindow):
|
||||
logger.error("No project open")
|
||||
return False
|
||||
|
||||
if tHandle is None:
|
||||
if self.docEditor.anyFocus() or self.isFocusMode:
|
||||
tHandle = self.docEditor.docHandle()
|
||||
else:
|
||||
tHandle = self.projView.getSelectedHandle()
|
||||
if tHandle:
|
||||
return self.projView.renameTreeItem(tHandle)
|
||||
if tHandle is None and (self.docEditor.anyFocus() or self.isFocusMode):
|
||||
tHandle = self.docEditor.docHandle()
|
||||
self.projView.renameTreeItem(tHandle)
|
||||
|
||||
return False
|
||||
return True
|
||||
|
||||
def rebuildTrees(self):
|
||||
"""Rebuild the project tree.
|
||||
@@ -910,25 +907,52 @@ class GuiMain(QMainWindow):
|
||||
if dlgConf.result() == QDialog.Accepted:
|
||||
logger.debug("Applying new preferences")
|
||||
self.initMain()
|
||||
self.mainTheme.updateTheme()
|
||||
self.saveDocument()
|
||||
|
||||
if dlgConf.needsRestart:
|
||||
self.makeAlert(self.tr(
|
||||
"Some changes will not be applied until novelWriter has been restarted."
|
||||
), nwAlert.INFO)
|
||||
|
||||
if dlgConf.refreshTree:
|
||||
self.projView.populateTree()
|
||||
|
||||
if dlgConf.updateTheme:
|
||||
# We are doing this manually instead of connecting to
|
||||
# qApp.paletteChanged since the processing order matters
|
||||
self.mainTheme.loadTheme()
|
||||
self.docEditor.updateTheme()
|
||||
self.docViewer.updateTheme()
|
||||
self.viewsBar.updateTheme()
|
||||
self.projView.updateTheme()
|
||||
self.novelView.updateTheme()
|
||||
self.outlineView.updateTheme()
|
||||
self.itemDetails.updateTheme()
|
||||
self.mainStatus.updateTheme()
|
||||
|
||||
if dlgConf.updateSyntax:
|
||||
self.mainTheme.loadSyntax()
|
||||
self.docEditor.updateSyntaxColours()
|
||||
|
||||
self.docEditor.initEditor()
|
||||
self.docViewer.initViewer()
|
||||
self.projView.initSettings()
|
||||
self.novelView.initSettings()
|
||||
self.outlineView.initSettings()
|
||||
|
||||
self._updateStatusWordCount()
|
||||
|
||||
return
|
||||
|
||||
def showProjectSettingsDialog(self):
|
||||
@pyqtSlot(int)
|
||||
def showProjectSettingsDialog(self, focusTab=GuiProjectSettings.TAB_MAIN):
|
||||
"""Open the project settings dialog.
|
||||
"""
|
||||
if not self.hasProject:
|
||||
logger.error("No project open")
|
||||
return False
|
||||
|
||||
dlgProj = GuiProjectSettings(self)
|
||||
dlgProj = GuiProjectSettings(self, focusTab=focusTab)
|
||||
dlgProj.exec_()
|
||||
|
||||
if dlgProj.result() == QDialog.Accepted:
|
||||
@@ -1316,6 +1340,7 @@ class GuiMain(QMainWindow):
|
||||
self.addAction(self.mainMenu.aInsMinus)
|
||||
self.addAction(self.mainMenu.aInsTimes)
|
||||
self.addAction(self.mainMenu.aInsDivide)
|
||||
self.addAction(self.mainMenu.aInsSynopsis)
|
||||
|
||||
for mAction, _ in self.mainMenu.mInsKWItems.values():
|
||||
self.addAction(mAction)
|
||||
|
||||