Add separate toggle for notes in viewer
This commit is contained in:
@@ -85,8 +85,8 @@ class Config:
|
||||
"showMultiSpaces", "showSessionTime", "showTabsNSpaces", "showViewerPanel",
|
||||
"spellLanguage", "stopWhenIdle", "tabWidth", "textFont", "textMargin", "textWidth",
|
||||
"themeMode", "useCharCount", "userIdleTime", "verPyQtString", "verPyQtValue",
|
||||
"verPyString", "verQtString", "verQtValue", "viewComments", "viewPanePos", "viewSynopsis",
|
||||
"welcomeWinSize",
|
||||
"verPyString", "verQtString", "verQtValue", "viewComments", "viewNotes", "viewPanePos",
|
||||
"viewSynopsis", "welcomeWinSize",
|
||||
)
|
||||
|
||||
LANG_NW = 1
|
||||
@@ -249,6 +249,7 @@ class Config:
|
||||
self.showSessionTime = True # Show the session time in the status bar
|
||||
self.viewComments = True # Comments are shown in the viewer
|
||||
self.viewSynopsis = True # Synopsis is shown in the viewer
|
||||
self.viewNotes = True # Notes are shown in the viewer
|
||||
|
||||
# Search Box States
|
||||
self.searchCase = False
|
||||
@@ -713,6 +714,7 @@ class Config:
|
||||
self.showSessionTime = conf.rdBool(sec, "showsessiontime", self.showSessionTime)
|
||||
self.viewComments = conf.rdBool(sec, "viewcomments", self.viewComments)
|
||||
self.viewSynopsis = conf.rdBool(sec, "viewsynopsis", self.viewSynopsis)
|
||||
self.viewNotes = conf.rdBool(sec, "viewnotes", self.viewNotes)
|
||||
self.searchCase = conf.rdBool(sec, "searchcase", self.searchCase)
|
||||
self.searchWord = conf.rdBool(sec, "searchword", self.searchWord)
|
||||
self.searchRegEx = conf.rdBool(sec, "searchregex", self.searchRegEx)
|
||||
@@ -840,6 +842,7 @@ class Config:
|
||||
"showsessiontime": str(self.showSessionTime),
|
||||
"viewcomments": str(self.viewComments),
|
||||
"viewsynopsis": str(self.viewSynopsis),
|
||||
"viewnotes": str(self.viewNotes),
|
||||
"searchcase": str(self.searchCase),
|
||||
"searchword": str(self.searchWord),
|
||||
"searchregex": str(self.searchRegEx),
|
||||
|
||||
@@ -231,6 +231,8 @@ class GuiDocViewer(QTextBrowser):
|
||||
qDoc.setCommentType(nwComment.PLAIN, CONFIG.viewComments)
|
||||
qDoc.setCommentType(nwComment.SYNOPSIS, CONFIG.viewSynopsis)
|
||||
qDoc.setCommentType(nwComment.SHORT, CONFIG.viewSynopsis)
|
||||
qDoc.setCommentType(nwComment.STORY, CONFIG.viewNotes)
|
||||
qDoc.setCommentType(nwComment.NOTE, CONFIG.viewNotes)
|
||||
|
||||
# Be extra careful here to prevent crashes when first opening a
|
||||
# project as a crash here leaves no way of recovering.
|
||||
@@ -911,12 +913,23 @@ class GuiDocViewFooter(QWidget):
|
||||
self.showSynopsis.toggled.connect(self._doToggleSynopsis)
|
||||
self.showSynopsis.setToolTip(self.tr("Show Synopsis Comments"))
|
||||
|
||||
# Show Notes
|
||||
self.showNotes = QToolButton(self)
|
||||
self.showNotes.setText(self.tr("Notes"))
|
||||
self.showNotes.setCheckable(True)
|
||||
self.showNotes.setChecked(CONFIG.viewNotes)
|
||||
self.showNotes.setToolButtonStyle(Qt.ToolButtonStyle.ToolButtonTextBesideIcon)
|
||||
self.showNotes.setIconSize(iSz)
|
||||
self.showNotes.toggled.connect(self._doToggleNotes)
|
||||
self.showNotes.setToolTip(self.tr("Show Notes"))
|
||||
|
||||
# Assemble Layout
|
||||
self.outerBox = QHBoxLayout()
|
||||
self.outerBox.addWidget(self.showHide, 0)
|
||||
self.outerBox.addStretch(1)
|
||||
self.outerBox.addWidget(self.showComments, 0)
|
||||
self.outerBox.addWidget(self.showSynopsis, 0)
|
||||
self.outerBox.addWidget(self.showNotes, 0)
|
||||
self.outerBox.setSpacing(4)
|
||||
self.setLayout(self.outerBox)
|
||||
|
||||
@@ -942,6 +955,7 @@ class GuiDocViewFooter(QWidget):
|
||||
self.setFont(SHARED.theme.guiFont)
|
||||
self.showComments.setFont(SHARED.theme.guiFontSmall)
|
||||
self.showSynopsis.setFont(SHARED.theme.guiFontSmall)
|
||||
self.showNotes.setFont(SHARED.theme.guiFontSmall)
|
||||
return
|
||||
|
||||
def updateTheme(self) -> None:
|
||||
@@ -953,11 +967,13 @@ class GuiDocViewFooter(QWidget):
|
||||
self.showHide.setThemeIcon("panel")
|
||||
self.showComments.setIcon(bulletIcon)
|
||||
self.showSynopsis.setIcon(bulletIcon)
|
||||
self.showNotes.setIcon(bulletIcon)
|
||||
|
||||
buttonStyle = SHARED.theme.getStyleSheet(STYLES_MIN_TOOLBUTTON)
|
||||
self.showHide.setStyleSheet(buttonStyle)
|
||||
self.showComments.setStyleSheet(buttonStyle)
|
||||
self.showSynopsis.setStyleSheet(buttonStyle)
|
||||
self.showNotes.setStyleSheet(buttonStyle)
|
||||
|
||||
self.matchColors()
|
||||
|
||||
@@ -992,3 +1008,10 @@ class GuiDocViewFooter(QWidget):
|
||||
CONFIG.viewSynopsis = state
|
||||
self.docViewer.reloadText()
|
||||
return
|
||||
|
||||
@pyqtSlot(bool)
|
||||
def _doToggleNotes(self, state: bool) -> None:
|
||||
"""Toggle the view notes button and reload the document."""
|
||||
CONFIG.viewNotes = state
|
||||
self.docViewer.reloadText()
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user