Add insert menu entry for synopsis comment (#1177)
This commit is contained in:
+4
-3
@@ -112,9 +112,10 @@ class nwDocInsert(Enum):
|
|||||||
QUOTE_RS = 2
|
QUOTE_RS = 2
|
||||||
QUOTE_LD = 3
|
QUOTE_LD = 3
|
||||||
QUOTE_RD = 4
|
QUOTE_RD = 4
|
||||||
NEW_PAGE = 5
|
SYNOPSIS = 5
|
||||||
VSPACE_S = 6
|
NEW_PAGE = 6
|
||||||
VSPACE_M = 7
|
VSPACE_S = 7
|
||||||
|
VSPACE_M = 8
|
||||||
|
|
||||||
# END Enum nwDocInsert
|
# END Enum nwDocInsert
|
||||||
|
|
||||||
|
|||||||
@@ -877,6 +877,7 @@ class GuiDocEditor(QTextEdit):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
newBlock = False
|
newBlock = False
|
||||||
|
goAfter = False
|
||||||
|
|
||||||
if isinstance(theInsert, str):
|
if isinstance(theInsert, str):
|
||||||
theText = theInsert
|
theText = theInsert
|
||||||
@@ -889,22 +890,29 @@ class GuiDocEditor(QTextEdit):
|
|||||||
theText = self._typDQOpen
|
theText = self._typDQOpen
|
||||||
elif theInsert == nwDocInsert.QUOTE_RD:
|
elif theInsert == nwDocInsert.QUOTE_RD:
|
||||||
theText = self._typDQClose
|
theText = self._typDQClose
|
||||||
|
elif theInsert == nwDocInsert.SYNOPSIS:
|
||||||
|
theText = "% Synopsis: "
|
||||||
|
newBlock = True
|
||||||
|
goAfter = True
|
||||||
elif theInsert == nwDocInsert.NEW_PAGE:
|
elif theInsert == nwDocInsert.NEW_PAGE:
|
||||||
theText = "[NEW PAGE]"
|
theText = "[NEW PAGE]"
|
||||||
newBlock = True
|
newBlock = True
|
||||||
|
goAfter = False
|
||||||
elif theInsert == nwDocInsert.VSPACE_S:
|
elif theInsert == nwDocInsert.VSPACE_S:
|
||||||
theText = "[VSPACE]"
|
theText = "[VSPACE]"
|
||||||
newBlock = True
|
newBlock = True
|
||||||
|
goAfter = False
|
||||||
elif theInsert == nwDocInsert.VSPACE_M:
|
elif theInsert == nwDocInsert.VSPACE_M:
|
||||||
theText = "[VSPACE:2]"
|
theText = "[VSPACE:2]"
|
||||||
newBlock = True
|
newBlock = True
|
||||||
|
goAfter = False
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if newBlock:
|
if newBlock:
|
||||||
self.insertNewBlock(theText, defaultAfter=False)
|
self.insertNewBlock(theText, defaultAfter=goAfter)
|
||||||
else:
|
else:
|
||||||
theCursor = self.textCursor()
|
theCursor = self.textCursor()
|
||||||
theCursor.beginEditBlock()
|
theCursor.beginEditBlock()
|
||||||
|
|||||||
@@ -554,6 +554,15 @@ class GuiMainMenu(QMenuBar):
|
|||||||
)
|
)
|
||||||
self.mInsKeywords.addAction(self.mInsKWItems[keyWord][0])
|
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
|
# Insert > Symbols
|
||||||
self.mInsBreaks = self.insertMenu.addMenu(self.tr("Page Break and Space"))
|
self.mInsBreaks = self.insertMenu.addMenu(self.tr("Page Break and Space"))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user