Merge branch 'main' into release_1.0b2

This commit is contained in:
Veronica K. Berglyd Olsen
2020-09-10 21:33:16 +02:00
committed by GitHub
25 changed files with 538 additions and 50 deletions
+5 -5
View File
@@ -70,7 +70,7 @@ The ignored errors are all `pycodestyle` errors, and they are documented
[here](https://pycodestyle.pycqa.org/en/latest/intro.html#error-codes).
**E203:** whitespace before :
**Reason:** Column alignment. It is natural to align dictionary columns along the `:` character,
**Reason:** Column alignment. It is natural to align dictionary columns along the `:` character.
**E221:** multiple spaces before operator
**Reason:** Column alignment.
@@ -88,15 +88,15 @@ dropped. Don't use the `+` operator for appending multiple strings. Use formatti
**Reason:** Column alignment.
**E261:** at least two spaces before inline comment
**Reason:** With syntax highlighting, this one is meaningless and wastes an extra space.
**Reason:** With syntax highlighting, this one doesn't make much sense.
**E266:** too many leading # for block comment
**Reason:** In the source multiple `#`s to indicate importance levels is sometimes used, like
markdown headers.
**Reason:** In the source multiple `#`s is sometimes used to indicate importance or heading level,
like markdown headers.
**E302:** expected 2 blank lines, found 0
**Reason:** Applies to classes. Instead, end classes with a comment like `# END Class ClassName` to
make it easier to se which class just ended. The double line break is then redundant.
make it easier to see which class just ended. The double line break is then redundant.
**E305:** expected 2 blank lines after end of function or class
**Reason:** Instead, _always_ end a function with a `return`, preferrably indented at function
-7
View File
@@ -240,13 +240,6 @@ clickable in the document view pane, and control-clickable in the editor. They m
quickly navigate between the documents while editing.
## Contributing
If you want to contribute to novelWriter, please follow the coding convention laid out in the
[Style Guide](markdown/style.md). They broadly follow Python PEP8, but there are a few
modifications.
## Screenshot
**novelWriter with default system theme:**
@@ -0,0 +1,31 @@
<?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"
id="svg11603"
viewBox="0 0 24 24"
height="24"
width="24"
version="1.2">
<metadata
id="metadata11609">
<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="defs11607" />
<path
style="stroke-width:1.5;fill:#aeaeae;fill-opacity:1"
id="path11601"
d="m 12,6 c 3.3075,0 6,2.691 6,6 0,3.309 -2.6925,6 -6,6 C 8.6925,18 6,15.309 6,12 6,8.691 8.6925,6 12,6 m 0,-3 c -4.971,0 -9,4.029 -9,9 0,4.968 4.029,9 9,9 4.968,0 9,-4.032 9,-9 0,-4.971 -4.032,-9 -9,-9 z" />
</svg>

After

Width:  |  Height:  |  Size: 1011 B

+31
View File
@@ -0,0 +1,31 @@
<?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"
id="svg11603"
viewBox="0 0 24 24"
height="24"
width="24"
version="1.2">
<metadata
id="metadata11609">
<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="defs11607" />
<path
style="stroke-width:1.5;fill:#000000;fill-opacity:0.78039217"
id="path11601"
d="m 12,6 c 3.3075,0 6,2.691 6,6 0,3.309 -2.6925,6 -6,6 C 8.6925,18 6,15.309 6,12 6,8.691 8.6925,6 12,6 m 0,-3 c -4.971,0 -9,4.029 -9,9 0,4.968 4.029,9 9,9 4.968,0 9,-4.032 9,-9 0,-4.971 -4.032,-9 -9,-9 z" />
</svg>

After

Width:  |  Height:  |  Size: 1020 B

@@ -0,0 +1,31 @@
<?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"
id="svg10879"
viewBox="0 0 24 24"
height="24"
width="24"
version="1.2">
<metadata
id="metadata10885">
<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="defs10883" />
<path
style="stroke-width:1.5;fill:#aeaeae;fill-opacity:1"
id="path10877"
d="M 21,12 C 21,9.5145 19.992,7.2645 18.3645,5.6355 16.7355,4.008 14.4855,3 12,3 9.516,3 7.266,4.008 5.637,5.6355 4.008,7.2645 3,9.5145 3,12 3,14.484 4.008,16.734 5.637,18.363 7.266,19.992 9.516,21 12,21 14.4855,21 16.7355,19.992 18.3645,18.363 19.992,16.734 21,14.484 21,12 Z" />
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

+31
View File
@@ -0,0 +1,31 @@
<?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"
id="svg10879"
viewBox="0 0 24 24"
height="24"
width="24"
version="1.2">
<metadata
id="metadata10885">
<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="defs10883" />
<path
style="stroke-width:1.5;fill:#000000;fill-opacity:0.78039217"
id="path10877"
d="M 21,12 C 21,9.5145 19.992,7.2645 18.3645,5.6355 16.7355,4.008 14.4855,3 12,3 9.516,3 7.266,4.008 5.637,5.6355 4.008,7.2645 3,9.5145 3,12 3,14.484 4.008,16.734 5.637,18.363 7.266,19.992 9.516,21 12,21 14.4855,21 16.7355,19.992 18.3645,18.363 19.992,16.734 21,14.484 21,12 Z" />
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

@@ -55,3 +55,5 @@ backward = chevron-left.svg
forward = chevron-right.svg
sticky-on = pin.svg
sticky-off = pin-outline.svg
bullet-on = media-record.svg
bullet-off = media-record-outline.svg
@@ -0,0 +1,31 @@
<?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"
id="svg11603"
viewBox="0 0 24 24"
height="24"
width="24"
version="1.2">
<metadata
id="metadata11609">
<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="defs11607" />
<path
style="stroke-width:1.5;fill:#6699cc;fill-opacity:1"
id="path11601"
d="m 12,6 c 3.3075,0 6,2.691 6,6 0,3.309 -2.6925,6 -6,6 C 8.6925,18 6,15.309 6,12 6,8.691 8.6925,6 12,6 m 0,-3 c -4.971,0 -9,4.029 -9,9 0,4.968 4.029,9 9,9 4.968,0 9,-4.032 9,-9 0,-4.971 -4.032,-9 -9,-9 z" />
</svg>

After

Width:  |  Height:  |  Size: 1011 B

@@ -0,0 +1,31 @@
<?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"
id="svg10879"
viewBox="0 0 24 24"
height="24"
width="24"
version="1.2">
<metadata
id="metadata10885">
<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="defs10883" />
<path
style="stroke-width:1.5;fill:#6699cc;fill-opacity:1"
id="path10877"
d="M 21,12 C 21,9.5145 19.992,7.2645 18.3645,5.6355 16.7355,4.008 14.4855,3 12,3 9.516,3 7.266,4.008 5.637,5.6355 4.008,7.2645 3,9.5145 3,12 3,14.484 4.008,16.734 5.637,18.363 7.266,19.992 9.516,21 12,21 14.4855,21 16.7355,19.992 18.3645,18.363 19.992,16.734 21,14.484 21,12 Z" />
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

@@ -55,3 +55,5 @@ backward = chevron-left.svg
forward = chevron-right.svg
sticky-on = pin.svg
sticky-off = pin-outline.svg
bullet-on = media-record.svg
bullet-off = media-record-outline.svg
@@ -0,0 +1,31 @@
<?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"
id="svg11603"
viewBox="0 0 24 24"
height="24"
width="24"
version="1.2">
<metadata
id="metadata11609">
<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="defs11607" />
<path
style="stroke-width:1.5;fill:#4271ae;fill-opacity:1"
id="path11601"
d="m 12,6 c 3.3075,0 6,2.691 6,6 0,3.309 -2.6925,6 -6,6 C 8.6925,18 6,15.309 6,12 6,8.691 8.6925,6 12,6 m 0,-3 c -4.971,0 -9,4.029 -9,9 0,4.968 4.029,9 9,9 4.968,0 9,-4.032 9,-9 0,-4.971 -4.032,-9 -9,-9 z" />
</svg>

After

Width:  |  Height:  |  Size: 1011 B

@@ -0,0 +1,31 @@
<?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"
id="svg10879"
viewBox="0 0 24 24"
height="24"
width="24"
version="1.2">
<metadata
id="metadata10885">
<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="defs10883" />
<path
style="stroke-width:1.5;fill:#4271ae;fill-opacity:1"
id="path10877"
d="M 21,12 C 21,9.5145 19.992,7.2645 18.3645,5.6355 16.7355,4.008 14.4855,3 12,3 9.516,3 7.266,4.008 5.637,5.6355 4.008,7.2645 3,9.5145 3,12 3,14.484 4.008,16.734 5.637,18.363 7.266,19.992 9.516,21 12,21 14.4855,21 16.7355,19.992 18.3645,18.363 19.992,16.734 21,14.484 21,12 Z" />
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

@@ -55,3 +55,5 @@ backward = chevron-left.svg
forward = chevron-right.svg
sticky-on = pin.svg
sticky-off = pin-outline.svg
bullet-on = media-record.svg
bullet-off = media-record-outline.svg
@@ -0,0 +1,31 @@
<?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"
id="svg11603"
viewBox="0 0 24 24"
height="24"
width="24"
version="1.2">
<metadata
id="metadata11609">
<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="defs11607" />
<path
style="stroke-width:1.5;fill:#aeaeae;fill-opacity:1"
id="path11601"
d="m 12,6 c 3.3075,0 6,2.691 6,6 0,3.309 -2.6925,6 -6,6 C 8.6925,18 6,15.309 6,12 6,8.691 8.6925,6 12,6 m 0,-3 c -4.971,0 -9,4.029 -9,9 0,4.968 4.029,9 9,9 4.968,0 9,-4.032 9,-9 0,-4.971 -4.032,-9 -9,-9 z" />
</svg>

After

Width:  |  Height:  |  Size: 1011 B

@@ -0,0 +1,31 @@
<?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"
id="svg10879"
viewBox="0 0 24 24"
height="24"
width="24"
version="1.2">
<metadata
id="metadata10885">
<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="defs10883" />
<path
style="stroke-width:1.5;fill:#aeaeae;fill-opacity:1"
id="path10877"
d="M 21,12 C 21,9.5145 19.992,7.2645 18.3645,5.6355 16.7355,4.008 14.4855,3 12,3 9.516,3 7.266,4.008 5.637,5.6355 4.008,7.2645 3,9.5145 3,12 3,14.484 4.008,16.734 5.637,18.363 7.266,19.992 9.516,21 12,21 14.4855,21 16.7355,19.992 18.3645,18.363 19.992,16.734 21,14.484 21,12 Z" />
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

@@ -55,3 +55,5 @@ backward = chevron-left.svg
forward = chevron-right.svg
sticky-on = pin.svg
sticky-off = pin-outline.svg
bullet-on = media-record.svg
bullet-off = media-record-outline.svg
@@ -0,0 +1,31 @@
<?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"
id="svg11603"
viewBox="0 0 24 24"
height="24"
width="24"
version="1.2">
<metadata
id="metadata11609">
<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="defs11607" />
<path
style="stroke-width:1.5;fill:#000000;fill-opacity:0.78039217"
id="path11601"
d="m 12,6 c 3.3075,0 6,2.691 6,6 0,3.309 -2.6925,6 -6,6 C 8.6925,18 6,15.309 6,12 6,8.691 8.6925,6 12,6 m 0,-3 c -4.971,0 -9,4.029 -9,9 0,4.968 4.029,9 9,9 4.968,0 9,-4.032 9,-9 0,-4.971 -4.032,-9 -9,-9 z" />
</svg>

After

Width:  |  Height:  |  Size: 1020 B

@@ -0,0 +1,31 @@
<?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"
id="svg10879"
viewBox="0 0 24 24"
height="24"
width="24"
version="1.2">
<metadata
id="metadata10885">
<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="defs10883" />
<path
style="stroke-width:1.5;fill:#000000;fill-opacity:0.78039217"
id="path10877"
d="M 21,12 C 21,9.5145 19.992,7.2645 18.3645,5.6355 16.7355,4.008 14.4855,3 12,3 9.516,3 7.266,4.008 5.637,5.6355 4.008,7.2645 3,9.5145 3,12 3,14.484 4.008,16.734 5.637,18.363 7.266,19.992 9.516,21 12,21 14.4855,21 16.7355,19.992 18.3645,18.363 19.992,16.734 21,14.484 21,12 Z" />
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

+10
View File
@@ -812,6 +812,16 @@ class Config:
self.errData = []
return errMessage
def setViewComments(self, viewState):
self.viewComments = viewState
self.confChanged = True
return self.viewComments
def setViewSynopsis(self, viewState):
self.viewSynopsis = viewState
self.confChanged = True
return self.viewSynopsis
##
# Getters
##
+57 -3
View File
@@ -652,6 +652,15 @@ class GuiDocEditor(QTextEdit):
self.docSearch.closeSearch()
return self.docSearch.isVisible()
def toggleSearch(self):
"""Toggle the visibility of the search box.
"""
if self.docSearch.isVisible():
self.docSearch.closeSearch()
else:
self._beginSearch()
return
##
# Document Events and Maintenance
##
@@ -1853,7 +1862,6 @@ class GuiDocEditHeader(QWidget):
self.buttonSize = fPx + hSp
# Main Widget Settings
self.setContentsMargins(2*self.buttonSize, 0, 0, 0)
self.setAutoFillBackground(True)
self.setPalette(self.thePalette)
@@ -1878,6 +1886,28 @@ class GuiDocEditHeader(QWidget):
).format(*self.theTheme.colText)
# Buttons
self.editButton = QToolButton(self)
self.editButton.setIcon(self.theTheme.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("Edit document meta")
self.editButton.clicked.connect(self._editDocument)
self.searchButton = QToolButton(self)
self.searchButton.setIcon(self.theTheme.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("Search document")
self.searchButton.clicked.connect(self._searchDocument)
self.minmaxButton = QToolButton(self)
self.minmaxButton.setIcon(self.theTheme.getIcon("maximise"))
self.minmaxButton.setContentsMargins(0, 0, 0, 0)
@@ -1903,6 +1933,8 @@ class GuiDocEditHeader(QWidget):
# Assemble Layout
self.outerBox = QHBoxLayout()
self.outerBox.setSpacing(hSp)
self.outerBox.addWidget(self.editButton, 0)
self.outerBox.addWidget(self.searchButton, 0)
self.outerBox.addWidget(self.theTitle, 1)
self.outerBox.addWidget(self.minmaxButton, 0)
self.outerBox.addWidget(self.closeButton, 0)
@@ -1923,6 +1955,8 @@ class GuiDocEditHeader(QWidget):
self.theHandle = tHandle
if tHandle is None:
self.theTitle.setText("")
self.editButton.setVisible(False)
self.searchButton.setVisible(False)
self.closeButton.setVisible(False)
self.minmaxButton.setVisible(False)
return True
@@ -1942,6 +1976,8 @@ class GuiDocEditHeader(QWidget):
return False
self.theTitle.setText(nwItem.itemName)
self.editButton.setVisible(True)
self.searchButton.setVisible(True)
self.closeButton.setVisible(True)
self.minmaxButton.setVisible(True)
@@ -1951,10 +1987,24 @@ class GuiDocEditHeader(QWidget):
# Slots
##
def _editDocument(self):
"""Open the edit item dialog from the main GUI.
"""
self.theParent.editItem(self.theHandle)
return
def _searchDocument(self):
"""Toggle the visibility of the search box.
"""
self.docEditor.toggleSearch()
return
def _closeDocument(self):
"""Trigger the close editor/viewer on the main window.
"""Trigger the close editor on the main window.
"""
self.theParent.closeDocEditor()
self.editButton.setVisible(False)
self.searchButton.setVisible(False)
self.closeButton.setVisible(False)
self.minmaxButton.setVisible(False)
return
@@ -1966,10 +2016,14 @@ class GuiDocEditHeader(QWidget):
if self.theParent.isFocusMode:
self.minmaxButton.setIcon(self.theTheme.getIcon("minimise"))
self.setContentsMargins(self.buttonSize, 0, 0, 0)
self.editButton.setVisible(False)
self.searchButton.setVisible(False)
self.closeButton.setVisible(False)
else:
self.minmaxButton.setIcon(self.theTheme.getIcon("maximise"))
self.setContentsMargins(2*self.buttonSize, 0, 0, 0)
self.setContentsMargins(0, 0, 0, 0)
self.editButton.setVisible(True)
self.searchButton.setVisible(True)
self.closeButton.setVisible(True)
return
+79 -6
View File
@@ -202,7 +202,7 @@ class GuiDocViewer(QTextBrowser):
def reloadText(self):
"""Reload the text in the current document.
"""
self.loadText(self.theHandle)
self.loadText(self.theHandle, updateHistory=False)
return
def loadFromTag(self, theTag):
@@ -879,6 +879,19 @@ class GuiDocViewFooter(QWidget):
bSp = self.mainConf.pxInt(2)
hSp = self.mainConf.pxInt(8)
# Icons
stickyOn = self.theTheme.getPixmap("sticky-on", (fPx, fPx))
stickyOff = self.theTheme.getPixmap("sticky-off", (fPx, fPx))
stickyIcon = QIcon()
stickyIcon.addPixmap(stickyOn, QIcon.Normal, QIcon.On)
stickyIcon.addPixmap(stickyOff, QIcon.Normal, QIcon.Off)
bulletOn = self.theTheme.getPixmap("bullet-on", (fPx, fPx))
bulletOff = self.theTheme.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)
@@ -900,11 +913,6 @@ class GuiDocViewFooter(QWidget):
self.showHide.setToolTip("Show/hide the references panel")
# Sticky Button
stickyOn = self.theTheme.getPixmap("sticky-on", (fPx, fPx))
stickyOff = self.theTheme.getPixmap("sticky-off", (fPx, fPx))
stickyIcon = QIcon()
stickyIcon.addPixmap(stickyOn, QIcon.Normal, QIcon.On)
stickyIcon.addPixmap(stickyOff, QIcon.Normal, QIcon.Off)
self.stickyRefs = QToolButton(self)
self.stickyRefs.setCheckable(True)
self.stickyRefs.setToolButtonStyle(Qt.ToolButtonIconOnly)
@@ -917,6 +925,30 @@ class GuiDocViewFooter(QWidget):
"Activate to freeze the content of the references panel when changing document"
)
# Show Comments
self.showComments = QToolButton(self)
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)
self.showComments.setToolTip("Show comments")
# Show Synopsis
self.showSynopsis = QToolButton(self)
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)
self.showSynopsis.setToolTip("Show synopsis comments")
# Labels
self.lblRefs = QLabel("References")
self.lblRefs.setBuddy(self.showHide)
@@ -938,10 +970,32 @@ class GuiDocViewFooter(QWidget):
self.lblSticky.setAlignment(Qt.AlignLeft | Qt.AlignTop)
self.lblSticky.setPalette(self.thePalette)
self.lblComments = QLabel("Comments")
self.lblComments.setBuddy(self.showComments)
self.lblComments.setIndent(0)
self.lblComments.setMargin(0)
self.lblComments.setContentsMargins(0, 0, 0, 0)
self.lblComments.setAutoFillBackground(True)
self.lblComments.setFixedHeight(fPx)
self.lblComments.setAlignment(Qt.AlignLeft | Qt.AlignTop)
self.lblComments.setPalette(self.thePalette)
self.lblSynopsis = QLabel("Synopsis")
self.lblSynopsis.setBuddy(self.showSynopsis)
self.lblSynopsis.setIndent(0)
self.lblSynopsis.setMargin(0)
self.lblSynopsis.setContentsMargins(0, 0, 0, 0)
self.lblSynopsis.setAutoFillBackground(True)
self.lblSynopsis.setFixedHeight(fPx)
self.lblSynopsis.setAlignment(Qt.AlignLeft | Qt.AlignTop)
self.lblSynopsis.setPalette(self.thePalette)
lblFont = self.font()
lblFont.setPointSizeF(0.9*self.theTheme.fontPointSize)
self.lblRefs.setFont(lblFont)
self.lblSticky.setFont(lblFont)
self.lblComments.setFont(lblFont)
self.lblSynopsis.setFont(lblFont)
# Assemble Layout
self.outerBox = QHBoxLayout()
@@ -952,6 +1006,11 @@ class GuiDocViewFooter(QWidget):
self.outerBox.addWidget(self.stickyRefs, 0)
self.outerBox.addWidget(self.lblSticky, 0)
self.outerBox.addStretch(1)
self.outerBox.addWidget(self.showComments, 0)
self.outerBox.addWidget(self.lblComments, 0)
self.outerBox.addSpacing(hSp)
self.outerBox.addWidget(self.showSynopsis, 0)
self.outerBox.addWidget(self.lblSynopsis, 0)
self.setLayout(self.outerBox)
logger.debug("GuiDocViewFooter initialisation complete")
@@ -978,6 +1037,20 @@ class GuiDocViewFooter(QWidget):
self.viewMeta.refreshReferences(self.docViewer.theHandle)
return
def _doToggleComments(self, theState):
"""Toggle the view comment button and reload the document.
"""
self.mainConf.setViewComments(theState)
self.docViewer.reloadText()
return
def _doToggleSynopsis(self, theState):
"""Toggle the view synopsis button and reload the document.
"""
self.mainConf.setViewSynopsis(theState)
self.docViewer.reloadText()
return
# END Class GuiDocViewFooter
# =============================================================================================== #
+1 -26
View File
@@ -490,32 +490,11 @@ class GuiConfigEditLayoutTab(QWidget):
self.tabWidth.setSingleStep(1)
self.tabWidth.setValue(self.mainConf.tabWidth)
self.mainForm.addRow(
"Editor tab width",
"Document tab width",
self.tabWidth,
"This feature requires Qt 5.9 or later.",
theUnit="px"
)
# Render Options
# ==============
self.mainForm.addGroupLabel("Render Text")
## Render Comments
self.viewComments = QSwitch()
self.viewComments.setChecked(self.mainConf.viewComments)
self.mainForm.addRow(
"Render comments in document view panel",
self.viewComments
)
## Render Synopsis
self.viewSynopsis = QSwitch()
self.viewSynopsis.setChecked(self.mainConf.viewSynopsis)
self.mainForm.addRow(
"Render synopsis in document view panel",
self.viewSynopsis
)
return
def saveValues(self):
@@ -533,8 +512,6 @@ class GuiConfigEditLayoutTab(QWidget):
doJustify = self.textJustify.isChecked()
textMargin = self.textMargin.value()
tabWidth = self.tabWidth.value()
viewComments = self.viewComments.isChecked()
viewSynopsis = self.viewSynopsis.isChecked()
self.mainConf.textFont = textFont
self.mainConf.textSize = textSize
@@ -545,8 +522,6 @@ class GuiConfigEditLayoutTab(QWidget):
self.mainConf.doJustify = doJustify
self.mainConf.textMargin = textMargin
self.mainConf.tabWidth = tabWidth
self.mainConf.viewComments = viewComments
self.mainConf.viewSynopsis = viewSynopsis
self.mainConf.confChanged = True
+1 -1
View File
@@ -237,7 +237,7 @@ class GuiProjectTree(QTreeWidget):
# Add the new item to the tree
self.revealTreeItem(tHandle, nHandle)
self.theParent.editItem()
self.theParent.editItem(tHandle)
return True
+2
View File
@@ -560,6 +560,8 @@ class GuiIcons:
## Switches
"sticky-on" : (None, None),
"sticky-off" : (None, None),
"bullet-on" : (None, None),
"bullet-off" : (None, None),
}
DECO_MAP = {
+3 -2
View File
@@ -674,10 +674,11 @@ class GuiMain(QMainWindow):
return True
def editItem(self):
def editItem(self, tHandle=None):
"""Open the edit item dialog.
"""
tHandle = self.treeView.getSelectedHandle()
if tHandle is None:
tHandle = self.treeView.getSelectedHandle()
if tHandle is None:
logger.warning("No item selected")
return