Drop dictionary alignment by colon
This commit is contained in:
+3
-3
@@ -123,9 +123,9 @@ class QConfigLayout(QGridLayout):
|
||||
"""Add a label and a widget as a new row of the grid.
|
||||
"""
|
||||
thisEntry = {
|
||||
"label" : None,
|
||||
"help" : None,
|
||||
"widget" : None,
|
||||
"label": None,
|
||||
"help": None,
|
||||
"widget": None,
|
||||
}
|
||||
|
||||
if isinstance(theLabel, QLabel):
|
||||
|
||||
+2
-2
@@ -2149,8 +2149,8 @@ class GuiDocEditSearch(QFrame):
|
||||
errCol.setBlueF(bCol/mCol)
|
||||
|
||||
self.rxCol = {
|
||||
True : baseCol,
|
||||
False : errCol
|
||||
True: baseCol,
|
||||
False: errCol
|
||||
}
|
||||
|
||||
logger.debug("GuiDocEditSearch initialisation complete")
|
||||
|
||||
+37
-37
@@ -106,27 +106,27 @@ class GuiDocHighlighter(QSyntaxHighlighter):
|
||||
self.colEmph = QColor(*self.theTheme.colEmph)
|
||||
|
||||
self.hStyles = {
|
||||
"header1" : self._makeFormat(self.colHead, "bold", 1.8),
|
||||
"header2" : self._makeFormat(self.colHead, "bold", 1.6),
|
||||
"header3" : self._makeFormat(self.colHead, "bold", 1.4),
|
||||
"header4" : self._makeFormat(self.colHead, "bold", 1.2),
|
||||
"header1h" : self._makeFormat(self.colHeadH, "bold", 1.8),
|
||||
"header2h" : self._makeFormat(self.colHeadH, "bold", 1.6),
|
||||
"header3h" : self._makeFormat(self.colHeadH, "bold", 1.4),
|
||||
"header4h" : self._makeFormat(self.colHeadH, "bold", 1.2),
|
||||
"bold" : self._makeFormat(self.colEmph, "bold"),
|
||||
"italic" : self._makeFormat(self.colEmph, "italic"),
|
||||
"strike" : self._makeFormat(self.colHidden, "strike"),
|
||||
"mspaces" : self._makeFormat(self.colError, "errline"),
|
||||
"nobreak" : self._makeFormat(self.colBreak, "background"),
|
||||
"dialogue1" : self._makeFormat(self.colDialN),
|
||||
"dialogue2" : self._makeFormat(self.colDialD),
|
||||
"dialogue3" : self._makeFormat(self.colDialS),
|
||||
"replace" : self._makeFormat(self.colRepTag),
|
||||
"hidden" : self._makeFormat(self.colHidden),
|
||||
"keyword" : self._makeFormat(self.colKey),
|
||||
"modifier" : self._makeFormat(self.colMod),
|
||||
"value" : self._makeFormat(self.colVal, "underline"),
|
||||
"header1": self._makeFormat(self.colHead, "bold", 1.8),
|
||||
"header2": self._makeFormat(self.colHead, "bold", 1.6),
|
||||
"header3": self._makeFormat(self.colHead, "bold", 1.4),
|
||||
"header4": self._makeFormat(self.colHead, "bold", 1.2),
|
||||
"header1h": self._makeFormat(self.colHeadH, "bold", 1.8),
|
||||
"header2h": self._makeFormat(self.colHeadH, "bold", 1.6),
|
||||
"header3h": self._makeFormat(self.colHeadH, "bold", 1.4),
|
||||
"header4h": self._makeFormat(self.colHeadH, "bold", 1.2),
|
||||
"bold": self._makeFormat(self.colEmph, "bold"),
|
||||
"italic": self._makeFormat(self.colEmph, "italic"),
|
||||
"strike": self._makeFormat(self.colHidden, "strike"),
|
||||
"mspaces": self._makeFormat(self.colError, "errline"),
|
||||
"nobreak": self._makeFormat(self.colBreak, "background"),
|
||||
"dialogue1": self._makeFormat(self.colDialN),
|
||||
"dialogue2": self._makeFormat(self.colDialD),
|
||||
"dialogue3": self._makeFormat(self.colDialS),
|
||||
"replace": self._makeFormat(self.colRepTag),
|
||||
"hidden": self._makeFormat(self.colHidden),
|
||||
"keyword": self._makeFormat(self.colKey),
|
||||
"modifier": self._makeFormat(self.colMod),
|
||||
"value": self._makeFormat(self.colVal, "underline"),
|
||||
}
|
||||
|
||||
self.hRules = []
|
||||
@@ -135,14 +135,14 @@ class GuiDocHighlighter(QSyntaxHighlighter):
|
||||
if self.mainConf.showMultiSpaces:
|
||||
self.hRules.append((
|
||||
r"[ ]{2,}|[ ]*$", {
|
||||
0 : self.hStyles["mspaces"],
|
||||
0: self.hStyles["mspaces"],
|
||||
}
|
||||
))
|
||||
|
||||
# Non-Breaking Spaces
|
||||
self.hRules.append((
|
||||
"[%s%s]+" % (nwUnicode.U_NBSP, nwUnicode.U_THNBSP), {
|
||||
0 : self.hStyles["nobreak"],
|
||||
0: self.hStyles["nobreak"],
|
||||
}
|
||||
))
|
||||
|
||||
@@ -155,7 +155,7 @@ class GuiDocHighlighter(QSyntaxHighlighter):
|
||||
if fmtDbl != ["\"", "\""]:
|
||||
self.hRules.append((
|
||||
"(\\B\")(.*?)(\"\\B)", {
|
||||
0 : self.hStyles["dialogue1"],
|
||||
0: self.hStyles["dialogue1"],
|
||||
}
|
||||
))
|
||||
|
||||
@@ -163,7 +163,7 @@ class GuiDocHighlighter(QSyntaxHighlighter):
|
||||
dblEnd = "|$" if self.mainConf.allowOpenDQuote else ""
|
||||
self.hRules.append((
|
||||
f"(\\B{fmtDbl[0]})(.*?)({fmtDbl[1]}\\B{dblEnd})", {
|
||||
0 : self.hStyles["dialogue2"],
|
||||
0: self.hStyles["dialogue2"],
|
||||
}
|
||||
))
|
||||
|
||||
@@ -171,44 +171,44 @@ class GuiDocHighlighter(QSyntaxHighlighter):
|
||||
sngEnd = "|$" if self.mainConf.allowOpenSQuote else ""
|
||||
self.hRules.append((
|
||||
f"(\\B{fmtSng[0]})(.*?)({fmtSng[1]}\\B{sngEnd})", {
|
||||
0 : self.hStyles["dialogue3"],
|
||||
0: self.hStyles["dialogue3"],
|
||||
}
|
||||
))
|
||||
|
||||
# Markdown Syntax
|
||||
self.hRules.append((
|
||||
nwRegEx.FMT_EI, {
|
||||
1 : self.hStyles["hidden"],
|
||||
2 : self.hStyles["italic"],
|
||||
3 : self.hStyles["hidden"],
|
||||
1: self.hStyles["hidden"],
|
||||
2: self.hStyles["italic"],
|
||||
3: self.hStyles["hidden"],
|
||||
}
|
||||
))
|
||||
self.hRules.append((
|
||||
nwRegEx.FMT_EB, {
|
||||
1 : self.hStyles["hidden"],
|
||||
2 : self.hStyles["bold"],
|
||||
3 : self.hStyles["hidden"],
|
||||
1: self.hStyles["hidden"],
|
||||
2: self.hStyles["bold"],
|
||||
3: self.hStyles["hidden"],
|
||||
}
|
||||
))
|
||||
self.hRules.append((
|
||||
nwRegEx.FMT_ST, {
|
||||
1 : self.hStyles["hidden"],
|
||||
2 : self.hStyles["strike"],
|
||||
3 : self.hStyles["hidden"],
|
||||
1: self.hStyles["hidden"],
|
||||
2: self.hStyles["strike"],
|
||||
3: self.hStyles["hidden"],
|
||||
}
|
||||
))
|
||||
|
||||
# Alignment Tags
|
||||
self.hRules.append((
|
||||
r"(^>{1,2}|<{1,2}$)", {
|
||||
1 : self.hStyles["hidden"],
|
||||
1: self.hStyles["hidden"],
|
||||
}
|
||||
))
|
||||
|
||||
# Auto-Replace Tags
|
||||
self.hRules.append((
|
||||
r"<(\S+?)>", {
|
||||
0 : self.hStyles["replace"],
|
||||
0: self.hStyles["replace"],
|
||||
}
|
||||
))
|
||||
|
||||
|
||||
+35
-35
@@ -42,43 +42,43 @@ logger = logging.getLogger(__name__)
|
||||
class GuiOutline(QTreeWidget):
|
||||
|
||||
DEF_WIDTH = {
|
||||
nwOutline.TITLE : 200,
|
||||
nwOutline.LEVEL : 40,
|
||||
nwOutline.LABEL : 150,
|
||||
nwOutline.LINE : 40,
|
||||
nwOutline.CCOUNT : 50,
|
||||
nwOutline.WCOUNT : 50,
|
||||
nwOutline.PCOUNT : 50,
|
||||
nwOutline.POV : 100,
|
||||
nwOutline.FOCUS : 100,
|
||||
nwOutline.CHAR : 100,
|
||||
nwOutline.PLOT : 100,
|
||||
nwOutline.TIME : 100,
|
||||
nwOutline.WORLD : 100,
|
||||
nwOutline.OBJECT : 100,
|
||||
nwOutline.ENTITY : 100,
|
||||
nwOutline.CUSTOM : 100,
|
||||
nwOutline.SYNOP : 200,
|
||||
nwOutline.TITLE: 200,
|
||||
nwOutline.LEVEL: 40,
|
||||
nwOutline.LABEL: 150,
|
||||
nwOutline.LINE: 40,
|
||||
nwOutline.CCOUNT: 50,
|
||||
nwOutline.WCOUNT: 50,
|
||||
nwOutline.PCOUNT: 50,
|
||||
nwOutline.POV: 100,
|
||||
nwOutline.FOCUS: 100,
|
||||
nwOutline.CHAR: 100,
|
||||
nwOutline.PLOT: 100,
|
||||
nwOutline.TIME: 100,
|
||||
nwOutline.WORLD: 100,
|
||||
nwOutline.OBJECT: 100,
|
||||
nwOutline.ENTITY: 100,
|
||||
nwOutline.CUSTOM: 100,
|
||||
nwOutline.SYNOP: 200,
|
||||
}
|
||||
|
||||
DEF_HIDDEN = {
|
||||
nwOutline.TITLE : False,
|
||||
nwOutline.LEVEL : True,
|
||||
nwOutline.LABEL : False,
|
||||
nwOutline.LINE : True,
|
||||
nwOutline.CCOUNT : True,
|
||||
nwOutline.WCOUNT : False,
|
||||
nwOutline.PCOUNT : False,
|
||||
nwOutline.POV : False,
|
||||
nwOutline.FOCUS : True,
|
||||
nwOutline.CHAR : False,
|
||||
nwOutline.PLOT : False,
|
||||
nwOutline.TIME : True,
|
||||
nwOutline.WORLD : False,
|
||||
nwOutline.OBJECT : True,
|
||||
nwOutline.ENTITY : True,
|
||||
nwOutline.CUSTOM : True,
|
||||
nwOutline.SYNOP : False,
|
||||
nwOutline.TITLE: False,
|
||||
nwOutline.LEVEL: True,
|
||||
nwOutline.LABEL: False,
|
||||
nwOutline.LINE: True,
|
||||
nwOutline.CCOUNT: True,
|
||||
nwOutline.WCOUNT: False,
|
||||
nwOutline.PCOUNT: False,
|
||||
nwOutline.POV: False,
|
||||
nwOutline.FOCUS: True,
|
||||
nwOutline.CHAR: False,
|
||||
nwOutline.PLOT: False,
|
||||
nwOutline.TIME: True,
|
||||
nwOutline.WORLD: False,
|
||||
nwOutline.OBJECT: True,
|
||||
nwOutline.ENTITY: True,
|
||||
nwOutline.CUSTOM: True,
|
||||
nwOutline.SYNOP: False,
|
||||
}
|
||||
|
||||
def __init__(self, theParent):
|
||||
@@ -487,7 +487,7 @@ class GuiOutlineHeaderMenu(QMenu):
|
||||
self.actionMap[hItem] = QAction(trConst(nwLabels.OUTLINE_COLS[hItem]), self)
|
||||
self.actionMap[hItem].setCheckable(True)
|
||||
self.actionMap[hItem].toggled.connect(
|
||||
lambda isChecked, tItem=hItem : self._columnToggled(isChecked, tItem)
|
||||
lambda isChecked, tItem=hItem: self._columnToggled(isChecked, tItem)
|
||||
)
|
||||
self.addAction(self.actionMap[hItem])
|
||||
|
||||
|
||||
@@ -40,10 +40,10 @@ logger = logging.getLogger(__name__)
|
||||
class GuiOutlineDetails(QScrollArea):
|
||||
|
||||
LVL_MAP = {
|
||||
"H1" : QT_TRANSLATE_NOOP("GuiOutlineDetails", "Title"),
|
||||
"H2" : QT_TRANSLATE_NOOP("GuiOutlineDetails", "Chapter"),
|
||||
"H3" : QT_TRANSLATE_NOOP("GuiOutlineDetails", "Scene"),
|
||||
"H4" : QT_TRANSLATE_NOOP("GuiOutlineDetails", "Section"),
|
||||
"H1": QT_TRANSLATE_NOOP("GuiOutlineDetails", "Title"),
|
||||
"H2": QT_TRANSLATE_NOOP("GuiOutlineDetails", "Chapter"),
|
||||
"H3": QT_TRANSLATE_NOOP("GuiOutlineDetails", "Scene"),
|
||||
"H4": QT_TRANSLATE_NOOP("GuiOutlineDetails", "Section"),
|
||||
}
|
||||
|
||||
def __init__(self, theParent):
|
||||
|
||||
+58
-58
@@ -529,71 +529,71 @@ class GuiIcons:
|
||||
|
||||
ICON_MAP = {
|
||||
# Project and GUI icons
|
||||
"novelwriter" : (None, None),
|
||||
"cls_none" : (QStyle.SP_DriveHDIcon, "drive-harddisk"),
|
||||
"cls_novel" : (QStyle.SP_DriveHDIcon, "drive-harddisk"),
|
||||
"cls_plot" : (QStyle.SP_DriveHDIcon, "drive-harddisk"),
|
||||
"cls_character" : (QStyle.SP_DriveHDIcon, "drive-harddisk"),
|
||||
"cls_world" : (QStyle.SP_DriveHDIcon, "drive-harddisk"),
|
||||
"cls_timeline" : (QStyle.SP_DriveHDIcon, "drive-harddisk"),
|
||||
"cls_object" : (QStyle.SP_DriveHDIcon, "drive-harddisk"),
|
||||
"cls_entity" : (QStyle.SP_DriveHDIcon, "drive-harddisk"),
|
||||
"cls_custom" : (QStyle.SP_DriveHDIcon, "drive-harddisk"),
|
||||
"cls_archive" : (QStyle.SP_DriveHDIcon, "drive-harddisk"),
|
||||
"cls_trash" : (QStyle.SP_DriveHDIcon, "drive-harddisk"),
|
||||
"proj_document" : (QStyle.SP_FileIcon, "x-office-document"),
|
||||
"proj_folder" : (QStyle.SP_DirIcon, "folder"),
|
||||
"proj_nwx" : (None, None),
|
||||
"status_lang" : (None, None),
|
||||
"status_time" : (None, None),
|
||||
"status_idle" : (None, None),
|
||||
"status_stats" : (None, None),
|
||||
"status_lines" : (None, None),
|
||||
"doc_h0" : (QStyle.SP_FileIcon, "x-office-document"),
|
||||
"doc_h1" : (QStyle.SP_FileIcon, "x-office-document"),
|
||||
"doc_h2" : (QStyle.SP_FileIcon, "x-office-document"),
|
||||
"doc_h3" : (QStyle.SP_FileIcon, "x-office-document"),
|
||||
"doc_h4" : (QStyle.SP_FileIcon, "x-office-document"),
|
||||
"search_case" : (None, None),
|
||||
"search_regex" : (None, None),
|
||||
"search_word" : (None, None),
|
||||
"search_loop" : (None, None),
|
||||
"search_project" : (None, None),
|
||||
"search_cancel" : (None, None),
|
||||
"search_preserve" : (None, None),
|
||||
"novelwriter": (None, None),
|
||||
"cls_none": (QStyle.SP_DriveHDIcon, "drive-harddisk"),
|
||||
"cls_novel": (QStyle.SP_DriveHDIcon, "drive-harddisk"),
|
||||
"cls_plot": (QStyle.SP_DriveHDIcon, "drive-harddisk"),
|
||||
"cls_character": (QStyle.SP_DriveHDIcon, "drive-harddisk"),
|
||||
"cls_world": (QStyle.SP_DriveHDIcon, "drive-harddisk"),
|
||||
"cls_timeline": (QStyle.SP_DriveHDIcon, "drive-harddisk"),
|
||||
"cls_object": (QStyle.SP_DriveHDIcon, "drive-harddisk"),
|
||||
"cls_entity": (QStyle.SP_DriveHDIcon, "drive-harddisk"),
|
||||
"cls_custom": (QStyle.SP_DriveHDIcon, "drive-harddisk"),
|
||||
"cls_archive": (QStyle.SP_DriveHDIcon, "drive-harddisk"),
|
||||
"cls_trash": (QStyle.SP_DriveHDIcon, "drive-harddisk"),
|
||||
"proj_document": (QStyle.SP_FileIcon, "x-office-document"),
|
||||
"proj_folder": (QStyle.SP_DirIcon, "folder"),
|
||||
"proj_nwx": (None, None),
|
||||
"status_lang": (None, None),
|
||||
"status_time": (None, None),
|
||||
"status_idle": (None, None),
|
||||
"status_stats": (None, None),
|
||||
"status_lines": (None, None),
|
||||
"doc_h0": (QStyle.SP_FileIcon, "x-office-document"),
|
||||
"doc_h1": (QStyle.SP_FileIcon, "x-office-document"),
|
||||
"doc_h2": (QStyle.SP_FileIcon, "x-office-document"),
|
||||
"doc_h3": (QStyle.SP_FileIcon, "x-office-document"),
|
||||
"doc_h4": (QStyle.SP_FileIcon, "x-office-document"),
|
||||
"search_case": (None, None),
|
||||
"search_regex": (None, None),
|
||||
"search_word": (None, None),
|
||||
"search_loop": (None, None),
|
||||
"search_project": (None, None),
|
||||
"search_cancel": (None, None),
|
||||
"search_preserve": (None, None),
|
||||
|
||||
# General Button Icons
|
||||
"folder-open" : (QStyle.SP_DirOpenIcon, "folder-open"),
|
||||
"delete" : (QStyle.SP_DialogDiscardButton, "edit-delete"),
|
||||
"close" : (QStyle.SP_DialogCloseButton, "window-close"),
|
||||
"done" : (QStyle.SP_DialogApplyButton, None),
|
||||
"clear" : (QStyle.SP_LineEditClearButton, "clear_left"),
|
||||
"save" : (QStyle.SP_DialogSaveButton, "document-save"),
|
||||
"add" : (None, "list-add"),
|
||||
"remove" : (None, "list-remove"),
|
||||
"search" : (None, "edit-find"),
|
||||
"search-replace" : (None, "edit-find-replace"),
|
||||
"edit" : (None, None),
|
||||
"check" : (None, None),
|
||||
"cross" : (None, None),
|
||||
"hash" : (None, None),
|
||||
"maximise" : (None, None),
|
||||
"minimise" : (None, None),
|
||||
"refresh" : (None, None),
|
||||
"reference" : (None, None),
|
||||
"backward" : (None, None),
|
||||
"forward" : (None, None),
|
||||
"settings" : (None, None),
|
||||
"folder-open": (QStyle.SP_DirOpenIcon, "folder-open"),
|
||||
"delete": (QStyle.SP_DialogDiscardButton, "edit-delete"),
|
||||
"close": (QStyle.SP_DialogCloseButton, "window-close"),
|
||||
"done": (QStyle.SP_DialogApplyButton, None),
|
||||
"clear": (QStyle.SP_LineEditClearButton, "clear_left"),
|
||||
"save": (QStyle.SP_DialogSaveButton, "document-save"),
|
||||
"add": (None, "list-add"),
|
||||
"remove": (None, "list-remove"),
|
||||
"search": (None, "edit-find"),
|
||||
"search-replace": (None, "edit-find-replace"),
|
||||
"edit": (None, None),
|
||||
"check": (None, None),
|
||||
"cross": (None, None),
|
||||
"hash": (None, None),
|
||||
"maximise": (None, None),
|
||||
"minimise": (None, None),
|
||||
"refresh": (None, None),
|
||||
"reference": (None, None),
|
||||
"backward": (None, None),
|
||||
"forward": (None, None),
|
||||
"settings": (None, None),
|
||||
|
||||
# Switches
|
||||
"sticky-on" : (None, None),
|
||||
"sticky-off" : (None, None),
|
||||
"bullet-on" : (None, None),
|
||||
"bullet-off" : (None, None),
|
||||
"sticky-on": (None, None),
|
||||
"sticky-off": (None, None),
|
||||
"bullet-on": (None, None),
|
||||
"bullet-off": (None, None),
|
||||
}
|
||||
|
||||
DECO_MAP = {
|
||||
"wiz-back" : "wizard-back.jpg",
|
||||
"wiz-back": "wizard-back.jpg",
|
||||
}
|
||||
|
||||
def __init__(self, theParent):
|
||||
|
||||
Reference in New Issue
Block a user