Drop dictionary alignment by colon

This commit is contained in:
Veronica Berglyd Olsen
2021-06-25 23:14:13 +02:00
parent 486af84107
commit e1dcfaa1e3
20 changed files with 393 additions and 396 deletions
+2 -2
View File
@@ -25,5 +25,5 @@ jobs:
flake8 tests --count --select=E9,F63,F7,F82 --show-source --statistics flake8 tests --count --select=E9,F63,F7,F82 --show-source --statistics
- name: Coding Style Violations - name: Coding Style Violations
run: | run: |
flake8 nw --count --max-line-length=99 --ignore E203,E221,E226,E228,E241,E251 --show-source --statistics flake8 nw --count --max-line-length=99 --ignore E221,E226,E228,E241,E251 --show-source --statistics
flake8 tests --count --max-line-length=99 --ignore E203,E221,E226,E228,E241,E251 --show-source --statistics flake8 tests --count --max-line-length=99 --ignore E221,E226,E228,E241,E251 --show-source --statistics
-3
View File
@@ -106,9 +106,6 @@ readable than lists. They should be used sparingly though.
The ignored errors are all `pycodestyle` errors, and they are documented The ignored errors are all `pycodestyle` errors, and they are documented
[here](https://pycodestyle.pycqa.org/en/latest/intro.html#error-codes). [here](https://pycodestyle.pycqa.org/en/latest/intro.html#error-codes).
**E203:** whitespace before :
**Reason:** Column alignment.
**E221:** multiple spaces before operator **E221:** multiple spaces before operator
**Reason:** Column alignment. **Reason:** Column alignment.
+6 -6
View File
@@ -846,9 +846,9 @@ class Config:
if "words" in theEntry.keys(): if "words" in theEntry.keys():
wordCount = int(theEntry["words"]) wordCount = int(theEntry["words"])
self.recentProj[projPath] = { self.recentProj[projPath] = {
"title" : theTitle, "title": theTitle,
"time" : lastTime, "time": lastTime,
"words" : wordCount, "words": wordCount,
} }
except Exception as e: except Exception as e:
@@ -887,9 +887,9 @@ class Config:
"""Add or update recent cache information o9n a given project. """Add or update recent cache information o9n a given project.
""" """
self.recentProj[os.path.abspath(projPath)] = { self.recentProj[os.path.abspath(projPath)] = {
"title" : projTitle, "title": projTitle,
"time" : int(saveTime), "time": int(saveTime),
"words" : int(wordCount), "words": int(wordCount),
} }
return True return True
+149 -149
View File
@@ -113,15 +113,15 @@ class nwKeyWords:
# Map from Keys to Item Class # Map from Keys to Item Class
KEY_CLASS = { KEY_CLASS = {
POV_KEY : nwItemClass.CHARACTER, POV_KEY: nwItemClass.CHARACTER,
FOCUS_KEY : nwItemClass.CHARACTER, FOCUS_KEY: nwItemClass.CHARACTER,
CHAR_KEY : nwItemClass.CHARACTER, CHAR_KEY: nwItemClass.CHARACTER,
PLOT_KEY : nwItemClass.PLOT, PLOT_KEY: nwItemClass.PLOT,
TIME_KEY : nwItemClass.TIMELINE, TIME_KEY: nwItemClass.TIMELINE,
WORLD_KEY : nwItemClass.WORLD, WORLD_KEY: nwItemClass.WORLD,
OBJECT_KEY : nwItemClass.OBJECT, OBJECT_KEY: nwItemClass.OBJECT,
ENTITY_KEY : nwItemClass.ENTITY, ENTITY_KEY: nwItemClass.ENTITY,
CUSTOM_KEY : nwItemClass.CUSTOM, CUSTOM_KEY: nwItemClass.CUSTOM,
} }
# END Class nwKeyWords # END Class nwKeyWords
@@ -130,96 +130,96 @@ class nwKeyWords:
class nwLabels(): class nwLabels():
CLASS_NAME = { CLASS_NAME = {
nwItemClass.NO_CLASS : QT_TRANSLATE_NOOP("Constant", "None"), nwItemClass.NO_CLASS: QT_TRANSLATE_NOOP("Constant", "None"),
nwItemClass.NOVEL : QT_TRANSLATE_NOOP("Constant", "Novel"), nwItemClass.NOVEL: QT_TRANSLATE_NOOP("Constant", "Novel"),
nwItemClass.PLOT : QT_TRANSLATE_NOOP("Constant", "Plot"), nwItemClass.PLOT: QT_TRANSLATE_NOOP("Constant", "Plot"),
nwItemClass.CHARACTER : QT_TRANSLATE_NOOP("Constant", "Characters"), nwItemClass.CHARACTER: QT_TRANSLATE_NOOP("Constant", "Characters"),
nwItemClass.WORLD : QT_TRANSLATE_NOOP("Constant", "Locations"), nwItemClass.WORLD: QT_TRANSLATE_NOOP("Constant", "Locations"),
nwItemClass.TIMELINE : QT_TRANSLATE_NOOP("Constant", "Timeline"), nwItemClass.TIMELINE: QT_TRANSLATE_NOOP("Constant", "Timeline"),
nwItemClass.OBJECT : QT_TRANSLATE_NOOP("Constant", "Objects"), nwItemClass.OBJECT: QT_TRANSLATE_NOOP("Constant", "Objects"),
nwItemClass.ENTITY : QT_TRANSLATE_NOOP("Constant", "Entity"), nwItemClass.ENTITY: QT_TRANSLATE_NOOP("Constant", "Entity"),
nwItemClass.CUSTOM : QT_TRANSLATE_NOOP("Constant", "Custom"), nwItemClass.CUSTOM: QT_TRANSLATE_NOOP("Constant", "Custom"),
nwItemClass.ARCHIVE : QT_TRANSLATE_NOOP("Constant", "Outtakes"), nwItemClass.ARCHIVE: QT_TRANSLATE_NOOP("Constant", "Outtakes"),
nwItemClass.TRASH : QT_TRANSLATE_NOOP("Constant", "Trash"), nwItemClass.TRASH: QT_TRANSLATE_NOOP("Constant", "Trash"),
} }
CLASS_FLAG = { CLASS_FLAG = {
nwItemClass.NO_CLASS : "0", nwItemClass.NO_CLASS: "0",
nwItemClass.NOVEL : "N", nwItemClass.NOVEL: "N",
nwItemClass.PLOT : "P", nwItemClass.PLOT: "P",
nwItemClass.CHARACTER : "C", nwItemClass.CHARACTER: "C",
nwItemClass.WORLD : "L", nwItemClass.WORLD: "L",
nwItemClass.TIMELINE : "T", nwItemClass.TIMELINE: "T",
nwItemClass.OBJECT : "O", nwItemClass.OBJECT: "O",
nwItemClass.ENTITY : "E", nwItemClass.ENTITY: "E",
nwItemClass.CUSTOM : "X", nwItemClass.CUSTOM: "X",
nwItemClass.ARCHIVE : "U", nwItemClass.ARCHIVE: "U",
nwItemClass.TRASH : "R", nwItemClass.TRASH: "R",
} }
CLASS_ICON = { CLASS_ICON = {
nwItemClass.NO_CLASS : "cls_none", nwItemClass.NO_CLASS: "cls_none",
nwItemClass.NOVEL : "cls_novel", nwItemClass.NOVEL: "cls_novel",
nwItemClass.PLOT : "cls_plot", nwItemClass.PLOT: "cls_plot",
nwItemClass.CHARACTER : "cls_character", nwItemClass.CHARACTER: "cls_character",
nwItemClass.WORLD : "cls_world", nwItemClass.WORLD: "cls_world",
nwItemClass.TIMELINE : "cls_timeline", nwItemClass.TIMELINE: "cls_timeline",
nwItemClass.OBJECT : "cls_object", nwItemClass.OBJECT: "cls_object",
nwItemClass.ENTITY : "cls_entity", nwItemClass.ENTITY: "cls_entity",
nwItemClass.CUSTOM : "cls_custom", nwItemClass.CUSTOM: "cls_custom",
nwItemClass.ARCHIVE : "cls_archive", nwItemClass.ARCHIVE: "cls_archive",
nwItemClass.TRASH : "cls_trash", nwItemClass.TRASH: "cls_trash",
} }
LAYOUT_NAME = { LAYOUT_NAME = {
nwItemLayout.NO_LAYOUT : QT_TRANSLATE_NOOP("Constant", "None"), nwItemLayout.NO_LAYOUT: QT_TRANSLATE_NOOP("Constant", "None"),
nwItemLayout.TITLE : QT_TRANSLATE_NOOP("Constant", "Title Page"), nwItemLayout.TITLE: QT_TRANSLATE_NOOP("Constant", "Title Page"),
nwItemLayout.BOOK : QT_TRANSLATE_NOOP("Constant", "Book"), nwItemLayout.BOOK: QT_TRANSLATE_NOOP("Constant", "Book"),
nwItemLayout.PAGE : QT_TRANSLATE_NOOP("Constant", "Plain Page"), nwItemLayout.PAGE: QT_TRANSLATE_NOOP("Constant", "Plain Page"),
nwItemLayout.PARTITION : QT_TRANSLATE_NOOP("Constant", "Partition"), nwItemLayout.PARTITION: QT_TRANSLATE_NOOP("Constant", "Partition"),
nwItemLayout.UNNUMBERED : QT_TRANSLATE_NOOP("Constant", "Unnumbered"), nwItemLayout.UNNUMBERED: QT_TRANSLATE_NOOP("Constant", "Unnumbered"),
nwItemLayout.CHAPTER : QT_TRANSLATE_NOOP("Constant", "Chapter"), nwItemLayout.CHAPTER: QT_TRANSLATE_NOOP("Constant", "Chapter"),
nwItemLayout.SCENE : QT_TRANSLATE_NOOP("Constant", "Scene"), nwItemLayout.SCENE: QT_TRANSLATE_NOOP("Constant", "Scene"),
nwItemLayout.NOTE : QT_TRANSLATE_NOOP("Constant", "Note"), nwItemLayout.NOTE: QT_TRANSLATE_NOOP("Constant", "Note"),
} }
LAYOUT_FLAG = { LAYOUT_FLAG = {
nwItemLayout.NO_LAYOUT : "Xo", nwItemLayout.NO_LAYOUT: "Xo",
nwItemLayout.TITLE : "Tt", nwItemLayout.TITLE: "Tt",
nwItemLayout.BOOK : "Bk", nwItemLayout.BOOK: "Bk",
nwItemLayout.PAGE : "Pg", nwItemLayout.PAGE: "Pg",
nwItemLayout.PARTITION : "Pt", nwItemLayout.PARTITION: "Pt",
nwItemLayout.UNNUMBERED : "Un", nwItemLayout.UNNUMBERED: "Un",
nwItemLayout.CHAPTER : "Ch", nwItemLayout.CHAPTER: "Ch",
nwItemLayout.SCENE : "Sc", nwItemLayout.SCENE: "Sc",
nwItemLayout.NOTE : "Nt", nwItemLayout.NOTE: "Nt",
} }
KEY_NAME = { KEY_NAME = {
nwKeyWords.TAG_KEY : QT_TRANSLATE_NOOP("Constant", "Tag"), nwKeyWords.TAG_KEY: QT_TRANSLATE_NOOP("Constant", "Tag"),
nwKeyWords.POV_KEY : QT_TRANSLATE_NOOP("Constant", "Point of View"), nwKeyWords.POV_KEY: QT_TRANSLATE_NOOP("Constant", "Point of View"),
nwKeyWords.FOCUS_KEY : QT_TRANSLATE_NOOP("Constant", "Focus"), nwKeyWords.FOCUS_KEY: QT_TRANSLATE_NOOP("Constant", "Focus"),
nwKeyWords.CHAR_KEY : QT_TRANSLATE_NOOP("Constant", "Characters"), nwKeyWords.CHAR_KEY: QT_TRANSLATE_NOOP("Constant", "Characters"),
nwKeyWords.PLOT_KEY : QT_TRANSLATE_NOOP("Constant", "Plot"), nwKeyWords.PLOT_KEY: QT_TRANSLATE_NOOP("Constant", "Plot"),
nwKeyWords.TIME_KEY : QT_TRANSLATE_NOOP("Constant", "Timeline"), nwKeyWords.TIME_KEY: QT_TRANSLATE_NOOP("Constant", "Timeline"),
nwKeyWords.WORLD_KEY : QT_TRANSLATE_NOOP("Constant", "Locations"), nwKeyWords.WORLD_KEY: QT_TRANSLATE_NOOP("Constant", "Locations"),
nwKeyWords.OBJECT_KEY : QT_TRANSLATE_NOOP("Constant", "Objects"), nwKeyWords.OBJECT_KEY: QT_TRANSLATE_NOOP("Constant", "Objects"),
nwKeyWords.ENTITY_KEY : QT_TRANSLATE_NOOP("Constant", "Entities"), nwKeyWords.ENTITY_KEY: QT_TRANSLATE_NOOP("Constant", "Entities"),
nwKeyWords.CUSTOM_KEY : QT_TRANSLATE_NOOP("Constant", "Custom"), nwKeyWords.CUSTOM_KEY: QT_TRANSLATE_NOOP("Constant", "Custom"),
} }
OUTLINE_COLS = { OUTLINE_COLS = {
nwOutline.TITLE : QT_TRANSLATE_NOOP("Constant", "Title"), nwOutline.TITLE: QT_TRANSLATE_NOOP("Constant", "Title"),
nwOutline.LEVEL : QT_TRANSLATE_NOOP("Constant", "Level"), nwOutline.LEVEL: QT_TRANSLATE_NOOP("Constant", "Level"),
nwOutline.LABEL : QT_TRANSLATE_NOOP("Constant", "Document"), nwOutline.LABEL: QT_TRANSLATE_NOOP("Constant", "Document"),
nwOutline.LINE : QT_TRANSLATE_NOOP("Constant", "Line"), nwOutline.LINE: QT_TRANSLATE_NOOP("Constant", "Line"),
nwOutline.CCOUNT : QT_TRANSLATE_NOOP("Constant", "Chars"), nwOutline.CCOUNT: QT_TRANSLATE_NOOP("Constant", "Chars"),
nwOutline.WCOUNT : QT_TRANSLATE_NOOP("Constant", "Words"), nwOutline.WCOUNT: QT_TRANSLATE_NOOP("Constant", "Words"),
nwOutline.PCOUNT : QT_TRANSLATE_NOOP("Constant", "Pars"), nwOutline.PCOUNT: QT_TRANSLATE_NOOP("Constant", "Pars"),
nwOutline.POV : QT_TRANSLATE_NOOP("Constant", "POV"), nwOutline.POV: QT_TRANSLATE_NOOP("Constant", "POV"),
nwOutline.FOCUS : QT_TRANSLATE_NOOP("Constant", "Focus"), nwOutline.FOCUS: QT_TRANSLATE_NOOP("Constant", "Focus"),
nwOutline.CHAR : KEY_NAME[nwKeyWords.CHAR_KEY], nwOutline.CHAR: KEY_NAME[nwKeyWords.CHAR_KEY],
nwOutline.PLOT : KEY_NAME[nwKeyWords.PLOT_KEY], nwOutline.PLOT: KEY_NAME[nwKeyWords.PLOT_KEY],
nwOutline.TIME : KEY_NAME[nwKeyWords.TIME_KEY], nwOutline.TIME: KEY_NAME[nwKeyWords.TIME_KEY],
nwOutline.WORLD : KEY_NAME[nwKeyWords.WORLD_KEY], nwOutline.WORLD: KEY_NAME[nwKeyWords.WORLD_KEY],
nwOutline.OBJECT : KEY_NAME[nwKeyWords.OBJECT_KEY], nwOutline.OBJECT: KEY_NAME[nwKeyWords.OBJECT_KEY],
nwOutline.ENTITY : KEY_NAME[nwKeyWords.ENTITY_KEY], nwOutline.ENTITY: KEY_NAME[nwKeyWords.ENTITY_KEY],
nwOutline.CUSTOM : KEY_NAME[nwKeyWords.CUSTOM_KEY], nwOutline.CUSTOM: KEY_NAME[nwKeyWords.CUSTOM_KEY],
nwOutline.SYNOP : QT_TRANSLATE_NOOP("Constant", "Synopsis"), nwOutline.SYNOP: QT_TRANSLATE_NOOP("Constant", "Synopsis"),
} }
# END Class nwLabels # END Class nwLabels
@@ -230,28 +230,28 @@ class nwQuotes():
Source: https://en.wikipedia.org/wiki/Quotation_mark Source: https://en.wikipedia.org/wiki/Quotation_mark
""" """
SYMBOLS = { SYMBOLS = {
"\u0027" : QT_TRANSLATE_NOOP("Constant", "Straight single quotation mark"), "\u0027": QT_TRANSLATE_NOOP("Constant", "Straight single quotation mark"),
"\u0022" : QT_TRANSLATE_NOOP("Constant", "Straight double quotation mark"), "\u0022": QT_TRANSLATE_NOOP("Constant", "Straight double quotation mark"),
"\u2018" : QT_TRANSLATE_NOOP("Constant", "Left single quotation mark"), "\u2018": QT_TRANSLATE_NOOP("Constant", "Left single quotation mark"),
"\u2019" : QT_TRANSLATE_NOOP("Constant", "Right single quotation mark"), "\u2019": QT_TRANSLATE_NOOP("Constant", "Right single quotation mark"),
"\u201a" : QT_TRANSLATE_NOOP("Constant", "Single low-9 quotation mark"), "\u201a": QT_TRANSLATE_NOOP("Constant", "Single low-9 quotation mark"),
"\u201b" : QT_TRANSLATE_NOOP("Constant", "Single high-reversed-9 quotation mark"), "\u201b": QT_TRANSLATE_NOOP("Constant", "Single high-reversed-9 quotation mark"),
"\u201c" : QT_TRANSLATE_NOOP("Constant", "Left double quotation mark"), "\u201c": QT_TRANSLATE_NOOP("Constant", "Left double quotation mark"),
"\u201d" : QT_TRANSLATE_NOOP("Constant", "Right double quotation mark"), "\u201d": QT_TRANSLATE_NOOP("Constant", "Right double quotation mark"),
"\u201e" : QT_TRANSLATE_NOOP("Constant", "Double low-9 quotation mark"), "\u201e": QT_TRANSLATE_NOOP("Constant", "Double low-9 quotation mark"),
"\u201f" : QT_TRANSLATE_NOOP("Constant", "Double high-reversed-9 quotation mark"), "\u201f": QT_TRANSLATE_NOOP("Constant", "Double high-reversed-9 quotation mark"),
"\u2e42" : QT_TRANSLATE_NOOP("Constant", "Double low-reversed-9 quotation mark"), "\u2e42": QT_TRANSLATE_NOOP("Constant", "Double low-reversed-9 quotation mark"),
"\u2039" : QT_TRANSLATE_NOOP("Constant", "Single left-pointing angle quotation mark"), "\u2039": QT_TRANSLATE_NOOP("Constant", "Single left-pointing angle quotation mark"),
"\u203a" : QT_TRANSLATE_NOOP("Constant", "Single right-pointing angle quotation mark"), "\u203a": QT_TRANSLATE_NOOP("Constant", "Single right-pointing angle quotation mark"),
"\u00ab" : QT_TRANSLATE_NOOP("Constant", "Double left-pointing angle quotation mark"), "\u00ab": QT_TRANSLATE_NOOP("Constant", "Double left-pointing angle quotation mark"),
"\u00bb" : QT_TRANSLATE_NOOP("Constant", "Double right-pointing angle quotation mark"), "\u00bb": QT_TRANSLATE_NOOP("Constant", "Double right-pointing angle quotation mark"),
"\u300c" : QT_TRANSLATE_NOOP("Constant", "Left corner bracket"), "\u300c": QT_TRANSLATE_NOOP("Constant", "Left corner bracket"),
"\u300d" : QT_TRANSLATE_NOOP("Constant", "Right corner bracket"), "\u300d": QT_TRANSLATE_NOOP("Constant", "Right corner bracket"),
"\u300e" : QT_TRANSLATE_NOOP("Constant", "Left white corner bracket"), "\u300e": QT_TRANSLATE_NOOP("Constant", "Left white corner bracket"),
"\u300f" : QT_TRANSLATE_NOOP("Constant", "Right white corner bracket"), "\u300f": QT_TRANSLATE_NOOP("Constant", "Right white corner bracket"),
} }
# END Class nwQuotes # END Class nwQuotes
@@ -397,55 +397,55 @@ class nwHtmlUnicode():
U_TO_H = { U_TO_H = {
# Quotes # Quotes
nwUnicode.U_QUOT : nwUnicode.H_QUOT, nwUnicode.U_QUOT: nwUnicode.H_QUOT,
nwUnicode.U_APOS : nwUnicode.H_APOS, nwUnicode.U_APOS: nwUnicode.H_APOS,
nwUnicode.U_LAQUO : nwUnicode.H_LAQUO, nwUnicode.U_LAQUO: nwUnicode.H_LAQUO,
nwUnicode.U_RAQUO : nwUnicode.H_RAQUO, nwUnicode.U_RAQUO: nwUnicode.H_RAQUO,
nwUnicode.U_LSQUO : nwUnicode.H_LSQUO, nwUnicode.U_LSQUO: nwUnicode.H_LSQUO,
nwUnicode.U_RSQUO : nwUnicode.H_RSQUO, nwUnicode.U_RSQUO: nwUnicode.H_RSQUO,
nwUnicode.U_SBQUO : nwUnicode.H_SBQUO, nwUnicode.U_SBQUO: nwUnicode.H_SBQUO,
nwUnicode.U_SUQUO : nwUnicode.H_SUQUO, nwUnicode.U_SUQUO: nwUnicode.H_SUQUO,
nwUnicode.U_LDQUO : nwUnicode.H_LDQUO, nwUnicode.U_LDQUO: nwUnicode.H_LDQUO,
nwUnicode.U_RDQUO : nwUnicode.H_RDQUO, nwUnicode.U_RDQUO: nwUnicode.H_RDQUO,
nwUnicode.U_BDQUO : nwUnicode.H_BDQUO, nwUnicode.U_BDQUO: nwUnicode.H_BDQUO,
nwUnicode.U_UDQUO : nwUnicode.H_UDQUO, nwUnicode.U_UDQUO: nwUnicode.H_UDQUO,
nwUnicode.U_LSAQUO : nwUnicode.H_LSAQUO, nwUnicode.U_LSAQUO: nwUnicode.H_LSAQUO,
nwUnicode.U_RSAQUO : nwUnicode.H_RSAQUO, nwUnicode.U_RSAQUO: nwUnicode.H_RSAQUO,
nwUnicode.U_BDRQUO : nwUnicode.H_BDRQUO, nwUnicode.U_BDRQUO: nwUnicode.H_BDRQUO,
nwUnicode.U_LCQUO : nwUnicode.H_LCQUO, nwUnicode.U_LCQUO: nwUnicode.H_LCQUO,
nwUnicode.U_RCQUO : nwUnicode.H_RCQUO, nwUnicode.U_RCQUO: nwUnicode.H_RCQUO,
nwUnicode.U_LWCQUO : nwUnicode.H_LWCQUO, nwUnicode.U_LWCQUO: nwUnicode.H_LWCQUO,
nwUnicode.U_RWCQUO : nwUnicode.H_RWCQUO, nwUnicode.U_RWCQUO: nwUnicode.H_RWCQUO,
# Punctuation # Punctuation
nwUnicode.U_FGDASH : nwUnicode.H_FGDASH, nwUnicode.U_FGDASH: nwUnicode.H_FGDASH,
nwUnicode.U_ENDASH : nwUnicode.H_ENDASH, nwUnicode.U_ENDASH: nwUnicode.H_ENDASH,
nwUnicode.U_EMDASH : nwUnicode.H_EMDASH, nwUnicode.U_EMDASH: nwUnicode.H_EMDASH,
nwUnicode.U_HBAR : nwUnicode.H_HBAR, nwUnicode.U_HBAR: nwUnicode.H_HBAR,
nwUnicode.U_HELLIP : nwUnicode.H_HELLIP, nwUnicode.U_HELLIP: nwUnicode.H_HELLIP,
nwUnicode.U_MAPOSS : nwUnicode.H_MAPOSS, nwUnicode.U_MAPOSS: nwUnicode.H_MAPOSS,
nwUnicode.U_PRIME : nwUnicode.H_PRIME, nwUnicode.U_PRIME: nwUnicode.H_PRIME,
nwUnicode.U_DPRIME : nwUnicode.H_DPRIME, nwUnicode.U_DPRIME: nwUnicode.H_DPRIME,
# Spaces # Spaces
nwUnicode.U_NBSP : nwUnicode.H_NBSP, nwUnicode.U_NBSP: nwUnicode.H_NBSP,
nwUnicode.U_THSP : nwUnicode.H_THSP, nwUnicode.U_THSP: nwUnicode.H_THSP,
nwUnicode.U_THNBSP : nwUnicode.H_THNBSP, nwUnicode.U_THNBSP: nwUnicode.H_THNBSP,
nwUnicode.U_ENSP : nwUnicode.H_ENSP, nwUnicode.U_ENSP: nwUnicode.H_ENSP,
nwUnicode.U_EMSP : nwUnicode.H_EMSP, nwUnicode.U_EMSP: nwUnicode.H_EMSP,
# Symbols # Symbols
nwUnicode.U_CHECK : nwUnicode.H_CHECK, nwUnicode.U_CHECK: nwUnicode.H_CHECK,
nwUnicode.U_CROSS : nwUnicode.H_CROSS, nwUnicode.U_CROSS: nwUnicode.H_CROSS,
nwUnicode.U_BULL : nwUnicode.H_BULL, nwUnicode.U_BULL: nwUnicode.H_BULL,
nwUnicode.U_TRBULL : nwUnicode.H_TRBULL, nwUnicode.U_TRBULL: nwUnicode.H_TRBULL,
nwUnicode.U_HYBULL : nwUnicode.H_HYBULL, nwUnicode.U_HYBULL: nwUnicode.H_HYBULL,
nwUnicode.U_FLOWER : nwUnicode.H_FLOWER, nwUnicode.U_FLOWER: nwUnicode.H_FLOWER,
nwUnicode.U_PERMIL : nwUnicode.H_PERMIL, nwUnicode.U_PERMIL: nwUnicode.H_PERMIL,
nwUnicode.U_DEGREE : nwUnicode.H_DEGREE, nwUnicode.U_DEGREE: nwUnicode.H_DEGREE,
nwUnicode.U_MINUS : nwUnicode.H_MINUS, nwUnicode.U_MINUS: nwUnicode.H_MINUS,
nwUnicode.U_TIMES : nwUnicode.H_TIMES, nwUnicode.U_TIMES: nwUnicode.H_TIMES,
nwUnicode.U_DIVIDE : nwUnicode.H_DIVIDE, nwUnicode.U_DIVIDE: nwUnicode.H_DIVIDE,
} }
# END Class nwHtmlUnicode # END Class nwHtmlUnicode
+25 -25
View File
@@ -183,11 +183,11 @@ class NWIndex():
try: try:
with open(indexFile, mode="w+", encoding="utf8") as outFile: with open(indexFile, mode="w+", encoding="utf8") as outFile:
json.dump({ json.dump({
"tagIndex" : self._tagIndex, "tagIndex": self._tagIndex,
"refIndex" : self._refIndex, "refIndex": self._refIndex,
"novelIndex" : self._novelIndex, "novelIndex": self._novelIndex,
"noteIndex" : self._noteIndex, "noteIndex": self._noteIndex,
"textCounts" : self._textCounts, "textCounts": self._textCounts,
}, outFile, indent=2) }, outFile, indent=2)
except Exception: except Exception:
logger.error("Failed to save index file") logger.error("Failed to save index file")
@@ -272,8 +272,8 @@ class NWIndex():
# Also add a default entry T000000 in case the file has no title # Also add a default entry T000000 in case the file has no title
self._refIndex[tHandle] = {} self._refIndex[tHandle] = {}
self._refIndex[tHandle]["T000000"] = { self._refIndex[tHandle]["T000000"] = {
"tags" : [], "tags": [],
"updated" : round(time()), "updated": round(time()),
} }
if itemLayout == nwItemLayout.NOTE: if itemLayout == nwItemLayout.NOTE:
self._novelIndex.pop(tHandle, None) self._novelIndex.pop(tHandle, None)
@@ -367,18 +367,18 @@ class NWIndex():
sTitle = "T%06d" % nLine sTitle = "T%06d" % nLine
self._refIndex[tHandle][sTitle] = { self._refIndex[tHandle][sTitle] = {
"tags" : [], "tags": [],
"updated" : round(time()), "updated": round(time()),
} }
theData = { theData = {
"level" : hDepth, "level": hDepth,
"title" : hText, "title": hText,
"layout" : itemLayout.name, "layout": itemLayout.name,
"synopsis" : "", "synopsis": "",
"cCount" : 0, "cCount": 0,
"wCount" : 0, "wCount": 0,
"pCount" : 0, "pCount": 0,
"updated" : round(time()), "updated": round(time()),
} }
if hText != "": if hText != "":
@@ -395,14 +395,14 @@ class NWIndex():
"""Index a page with no title. """Index a page with no title.
""" """
theData = { theData = {
"level" : "H0", "level": "H0",
"title" : "Untitled Page", "title": "Untitled Page",
"layout" : itemLayout.name, "layout": itemLayout.name,
"synopsis" : "", "synopsis": "",
"cCount" : 0, "cCount": 0,
"wCount" : 0, "wCount": 0,
"pCount" : 0, "pCount": 0,
"updated" : round(time()), "updated": round(time()),
} }
if isNovel: if isNovel:
+3 -3
View File
@@ -67,9 +67,9 @@ class NWItem():
"""Packs all the data in the class instance into an XML object. """Packs all the data in the class instance into an XML object.
""" """
xPack = etree.SubElement(xParent, "item", attrib={ xPack = etree.SubElement(xParent, "item", attrib={
"handle" : str(self.itemHandle), "handle": str(self.itemHandle),
"order" : str(self.itemOrder), "order": str(self.itemOrder),
"parent" : str(self.itemParent), "parent": str(self.itemParent),
}) })
self._subPack(xPack, "name", text=str(self.itemName)) self._subPack(xPack, "name", text=str(self.itemName))
self._subPack(xPack, "type", text=str(self.itemType.name)) self._subPack(xPack, "type", text=str(self.itemType.name))
+9 -9
View File
@@ -203,11 +203,11 @@ class NWProject():
self.bookAuthors = [] self.bookAuthors = []
self.autoReplace = {} self.autoReplace = {}
self.titleFormat = { self.titleFormat = {
"title" : r"%title%", "title": "%title%",
"chapter" : self.tr("Chapter")+r" %ch%: %title%", "chapter": self.tr("Chapter")+" %ch%: %title%",
"unnumbered" : r"%title%", "unnumbered": "%title%",
"scene" : r"* * *", "scene": "* * *",
"section" : r"", "section": "",
} }
self.spellCheck = False self.spellCheck = False
self.autoOutline = True self.autoOutline = True
@@ -620,10 +620,10 @@ class NWProject():
# Root element and project details # Root element and project details
logger.debug("Writing project meta") logger.debug("Writing project meta")
nwXML = etree.Element("novelWriterXML", attrib={ nwXML = etree.Element("novelWriterXML", attrib={
"appVersion" : str(nw.__version__), "appVersion": str(nw.__version__),
"hexVersion" : str(nw.__hexversion__), "hexVersion": str(nw.__hexversion__),
"fileVersion" : "1.2", "fileVersion": "1.2",
"timeStamp" : formatTimeStamp(saveTime), "timeStamp": formatTimeStamp(saveTime),
}) })
editTime = int(self.editTime + saveTime - self.projOpened) editTime = int(self.editTime + saveTime - self.projOpened)
+3 -3
View File
@@ -122,9 +122,9 @@ class NWStatus():
""" """
for n in range(self._theLength): for n in range(self._theLength):
xSub = etree.SubElement(xParent, "entry", attrib={ xSub = etree.SubElement(xParent, "entry", attrib={
"blue" : str(self._theColours[n][2]), "blue": str(self._theColours[n][2]),
"green" : str(self._theColours[n][1]), "green": str(self._theColours[n][1]),
"red" : str(self._theColours[n][0]), "red": str(self._theColours[n][0]),
}) })
xSub.text = self._theLabels[n] xSub.text = self._theLabels[n]
return True return True
+17 -17
View File
@@ -82,9 +82,9 @@ class ToHtml(Tokenizer):
# must take this into account when parsing for markup using # must take this into account when parsing for markup using
# angle brackets. # angle brackets.
self._trMap = str.maketrans({ self._trMap = str.maketrans({
"<" : "&lt;", "<": "&lt;",
">" : "&gt;", ">": "&gt;",
"&" : "&amp;", "&": "&amp;",
}) })
if doReplace: if doReplace:
@@ -115,22 +115,22 @@ class ToHtml(Tokenizer):
to theResult. to theResult.
""" """
if self.genMode == self.M_PREVIEW: if self.genMode == self.M_PREVIEW:
htmlTags = { # HTML4 + CSS2 htmlTags = { # HTML4 + CSS2
self.FMT_B_B : "<b>", self.FMT_B_B: "<b>",
self.FMT_B_E : "</b>", self.FMT_B_E: "</b>",
self.FMT_I_B : "<i>", self.FMT_I_B: "<i>",
self.FMT_I_E : "</i>", self.FMT_I_E: "</i>",
self.FMT_D_B : "<span style='text-decoration: line-through;'>", self.FMT_D_B: "<span style='text-decoration: line-through;'>",
self.FMT_D_E : "</span>", self.FMT_D_E: "</span>",
} }
else: else:
htmlTags = { # HTML5 htmlTags = { # HTML5
self.FMT_B_B : "<strong>", self.FMT_B_B: "<strong>",
self.FMT_B_E : "</strong>", self.FMT_B_E: "</strong>",
self.FMT_I_B : "<em>", self.FMT_I_B: "<em>",
self.FMT_I_E : "</em>", self.FMT_I_E: "</em>",
self.FMT_D_B : "<del>", self.FMT_D_B: "<del>",
self.FMT_D_E : "</del>", self.FMT_D_E: "</del>",
} }
if self.isNovel and self.genMode != self.M_PREVIEW: if self.isNovel and self.genMode != self.M_PREVIEW:
+3 -3
View File
@@ -341,9 +341,9 @@ class Tokenizer():
does the standard escaped characters. does the standard escaped characters.
""" """
escapeDict = { escapeDict = {
r"\*" : "*", r"\*": "*",
r"\~" : "~", r"\~": "~",
r"\_" : "_", r"\_": "_",
} }
escReplace = re.compile( escReplace = re.compile(
"|".join([re.escape(k) for k in escapeDict.keys()]), flags=re.DOTALL "|".join([re.escape(k) for k in escapeDict.keys()]), flags=re.DOTALL
+6 -6
View File
@@ -72,16 +72,16 @@ class ToMarkdown(Tokenizer):
if self.genMode == self.M_STD: if self.genMode == self.M_STD:
# Standard # Standard
mdTags = { mdTags = {
self.FMT_B_B : "**", self.FMT_B_E : "**", self.FMT_B_B: "**", self.FMT_B_E: "**",
self.FMT_I_B : "_", self.FMT_I_E : "_", self.FMT_I_B: "_", self.FMT_I_E: "_",
self.FMT_D_B : "", self.FMT_D_E : "", self.FMT_D_B: "", self.FMT_D_E: "",
} }
else: else:
# GitHub # GitHub
mdTags = { mdTags = {
self.FMT_B_B : "**", self.FMT_B_E : "**", self.FMT_B_B: "**", self.FMT_B_E: "**",
self.FMT_I_B : "_", self.FMT_I_E : "_", self.FMT_I_B: "_", self.FMT_I_E: "_",
self.FMT_D_B : "~~", self.FMT_D_E : "~~", self.FMT_D_B: "~~", self.FMT_D_E: "~~",
} }
self.theResult = "" self.theResult = ""
+14 -14
View File
@@ -38,12 +38,12 @@ logger = logging.getLogger(__name__)
# Main XML NameSpaces # Main XML NameSpaces
XML_NS = { XML_NS = {
"office" : "urn:oasis:names:tc:opendocument:xmlns:office:1.0", "office": "urn:oasis:names:tc:opendocument:xmlns:office:1.0",
"style" : "urn:oasis:names:tc:opendocument:xmlns:style:1.0", "style": "urn:oasis:names:tc:opendocument:xmlns:style:1.0",
"loext" : "urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0", "loext": "urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0",
"text" : "urn:oasis:names:tc:opendocument:xmlns:text:1.0", "text": "urn:oasis:names:tc:opendocument:xmlns:text:1.0",
"meta" : "urn:oasis:names:tc:opendocument:xmlns:meta:1.0", "meta": "urn:oasis:names:tc:opendocument:xmlns:meta:1.0",
"fo" : "urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0", "fo": "urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0",
} }
# Mimetype and Version # Mimetype and Version
@@ -318,12 +318,12 @@ class ToOdt(Tokenizer):
self.theResult = "" # Not used, but cleared just in case self.theResult = "" # Not used, but cleared just in case
odtTags = { odtTags = {
self.FMT_B_B : "_B", # Bold open format self.FMT_B_B: "_B", # Bold open format
self.FMT_B_E : "b_", # Bold close format self.FMT_B_E: "b_", # Bold close format
self.FMT_I_B : "I", # Italic open format self.FMT_I_B: "I", # Italic open format
self.FMT_I_E : "i", # Italic close format self.FMT_I_E: "i", # Italic close format
self.FMT_D_B : "_S", # Strikethrough open format self.FMT_D_B: "_S", # Strikethrough open format
self.FMT_D_E : "s_", # Strikethrough close format self.FMT_D_E: "s_", # Strikethrough close format
} }
thisPar = [] thisPar = []
@@ -459,7 +459,7 @@ class ToOdt(Tokenizer):
def saveOpenDocText(self, savePath): def saveOpenDocText(self, savePath):
"""Save the data to an .odt file. """Save the data to an .odt file.
""" """
mMap = {"manifest" : "urn:oasis:names:tc:opendocument:xmlns:manifest:1.0"} mMap = {"manifest": "urn:oasis:names:tc:opendocument:xmlns:manifest:1.0"}
mMani = "{%s}manifest" % mMap["manifest"] mMani = "{%s}manifest" % mMap["manifest"]
mVers = "{%s}version" % mMap["manifest"] mVers = "{%s}version" % mMap["manifest"]
mPath = "{%s}full-path" % mMap["manifest"] mPath = "{%s}full-path" % mMap["manifest"]
@@ -473,7 +473,7 @@ class ToOdt(Tokenizer):
etree.SubElement(xMani, mFile, attrib={mPath: "meta.xml", mType: "text/xml"}) etree.SubElement(xMani, mFile, attrib={mPath: "meta.xml", mType: "text/xml"})
etree.SubElement(xMani, mFile, attrib={mPath: "styles.xml", mType: "text/xml"}) etree.SubElement(xMani, mFile, attrib={mPath: "styles.xml", mType: "text/xml"})
sMap = {"office" : "urn:oasis:names:tc:opendocument:xmlns:office:1.0"} sMap = {"office": "urn:oasis:names:tc:opendocument:xmlns:office:1.0"}
oRoot = "{%s}document-settings" % sMap["office"] oRoot = "{%s}document-settings" % sMap["office"]
oSett = "{%s}settings" % sMap["office"] oSett = "{%s}settings" % sMap["office"]
xSett = etree.Element(oRoot, nsmap=sMap) xSett = etree.Element(oRoot, nsmap=sMap)
+3 -3
View File
@@ -123,9 +123,9 @@ class QConfigLayout(QGridLayout):
"""Add a label and a widget as a new row of the grid. """Add a label and a widget as a new row of the grid.
""" """
thisEntry = { thisEntry = {
"label" : None, "label": None,
"help" : None, "help": None,
"widget" : None, "widget": None,
} }
if isinstance(theLabel, QLabel): if isinstance(theLabel, QLabel):
+2 -2
View File
@@ -2149,8 +2149,8 @@ class GuiDocEditSearch(QFrame):
errCol.setBlueF(bCol/mCol) errCol.setBlueF(bCol/mCol)
self.rxCol = { self.rxCol = {
True : baseCol, True: baseCol,
False : errCol False: errCol
} }
logger.debug("GuiDocEditSearch initialisation complete") logger.debug("GuiDocEditSearch initialisation complete")
+37 -37
View File
@@ -106,27 +106,27 @@ class GuiDocHighlighter(QSyntaxHighlighter):
self.colEmph = QColor(*self.theTheme.colEmph) self.colEmph = QColor(*self.theTheme.colEmph)
self.hStyles = { self.hStyles = {
"header1" : self._makeFormat(self.colHead, "bold", 1.8), "header1": self._makeFormat(self.colHead, "bold", 1.8),
"header2" : self._makeFormat(self.colHead, "bold", 1.6), "header2": self._makeFormat(self.colHead, "bold", 1.6),
"header3" : self._makeFormat(self.colHead, "bold", 1.4), "header3": self._makeFormat(self.colHead, "bold", 1.4),
"header4" : self._makeFormat(self.colHead, "bold", 1.2), "header4": self._makeFormat(self.colHead, "bold", 1.2),
"header1h" : self._makeFormat(self.colHeadH, "bold", 1.8), "header1h": self._makeFormat(self.colHeadH, "bold", 1.8),
"header2h" : self._makeFormat(self.colHeadH, "bold", 1.6), "header2h": self._makeFormat(self.colHeadH, "bold", 1.6),
"header3h" : self._makeFormat(self.colHeadH, "bold", 1.4), "header3h": self._makeFormat(self.colHeadH, "bold", 1.4),
"header4h" : self._makeFormat(self.colHeadH, "bold", 1.2), "header4h": self._makeFormat(self.colHeadH, "bold", 1.2),
"bold" : self._makeFormat(self.colEmph, "bold"), "bold": self._makeFormat(self.colEmph, "bold"),
"italic" : self._makeFormat(self.colEmph, "italic"), "italic": self._makeFormat(self.colEmph, "italic"),
"strike" : self._makeFormat(self.colHidden, "strike"), "strike": self._makeFormat(self.colHidden, "strike"),
"mspaces" : self._makeFormat(self.colError, "errline"), "mspaces": self._makeFormat(self.colError, "errline"),
"nobreak" : self._makeFormat(self.colBreak, "background"), "nobreak": self._makeFormat(self.colBreak, "background"),
"dialogue1" : self._makeFormat(self.colDialN), "dialogue1": self._makeFormat(self.colDialN),
"dialogue2" : self._makeFormat(self.colDialD), "dialogue2": self._makeFormat(self.colDialD),
"dialogue3" : self._makeFormat(self.colDialS), "dialogue3": self._makeFormat(self.colDialS),
"replace" : self._makeFormat(self.colRepTag), "replace": self._makeFormat(self.colRepTag),
"hidden" : self._makeFormat(self.colHidden), "hidden": self._makeFormat(self.colHidden),
"keyword" : self._makeFormat(self.colKey), "keyword": self._makeFormat(self.colKey),
"modifier" : self._makeFormat(self.colMod), "modifier": self._makeFormat(self.colMod),
"value" : self._makeFormat(self.colVal, "underline"), "value": self._makeFormat(self.colVal, "underline"),
} }
self.hRules = [] self.hRules = []
@@ -135,14 +135,14 @@ class GuiDocHighlighter(QSyntaxHighlighter):
if self.mainConf.showMultiSpaces: if self.mainConf.showMultiSpaces:
self.hRules.append(( self.hRules.append((
r"[ ]{2,}|[ ]*$", { r"[ ]{2,}|[ ]*$", {
0 : self.hStyles["mspaces"], 0: self.hStyles["mspaces"],
} }
)) ))
# Non-Breaking Spaces # Non-Breaking Spaces
self.hRules.append(( self.hRules.append((
"[%s%s]+" % (nwUnicode.U_NBSP, nwUnicode.U_THNBSP), { "[%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 != ["\"", "\""]: if fmtDbl != ["\"", "\""]:
self.hRules.append(( self.hRules.append((
"(\\B\")(.*?)(\"\\B)", { "(\\B\")(.*?)(\"\\B)", {
0 : self.hStyles["dialogue1"], 0: self.hStyles["dialogue1"],
} }
)) ))
@@ -163,7 +163,7 @@ class GuiDocHighlighter(QSyntaxHighlighter):
dblEnd = "|$" if self.mainConf.allowOpenDQuote else "" dblEnd = "|$" if self.mainConf.allowOpenDQuote else ""
self.hRules.append(( self.hRules.append((
f"(\\B{fmtDbl[0]})(.*?)({fmtDbl[1]}\\B{dblEnd})", { 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 "" sngEnd = "|$" if self.mainConf.allowOpenSQuote else ""
self.hRules.append(( self.hRules.append((
f"(\\B{fmtSng[0]})(.*?)({fmtSng[1]}\\B{sngEnd})", { f"(\\B{fmtSng[0]})(.*?)({fmtSng[1]}\\B{sngEnd})", {
0 : self.hStyles["dialogue3"], 0: self.hStyles["dialogue3"],
} }
)) ))
# Markdown Syntax # Markdown Syntax
self.hRules.append(( self.hRules.append((
nwRegEx.FMT_EI, { nwRegEx.FMT_EI, {
1 : self.hStyles["hidden"], 1: self.hStyles["hidden"],
2 : self.hStyles["italic"], 2: self.hStyles["italic"],
3 : self.hStyles["hidden"], 3: self.hStyles["hidden"],
} }
)) ))
self.hRules.append(( self.hRules.append((
nwRegEx.FMT_EB, { nwRegEx.FMT_EB, {
1 : self.hStyles["hidden"], 1: self.hStyles["hidden"],
2 : self.hStyles["bold"], 2: self.hStyles["bold"],
3 : self.hStyles["hidden"], 3: self.hStyles["hidden"],
} }
)) ))
self.hRules.append(( self.hRules.append((
nwRegEx.FMT_ST, { nwRegEx.FMT_ST, {
1 : self.hStyles["hidden"], 1: self.hStyles["hidden"],
2 : self.hStyles["strike"], 2: self.hStyles["strike"],
3 : self.hStyles["hidden"], 3: self.hStyles["hidden"],
} }
)) ))
# Alignment Tags # Alignment Tags
self.hRules.append(( self.hRules.append((
r"(^>{1,2}|<{1,2}$)", { r"(^>{1,2}|<{1,2}$)", {
1 : self.hStyles["hidden"], 1: self.hStyles["hidden"],
} }
)) ))
# Auto-Replace Tags # Auto-Replace Tags
self.hRules.append(( self.hRules.append((
r"<(\S+?)>", { r"<(\S+?)>", {
0 : self.hStyles["replace"], 0: self.hStyles["replace"],
} }
)) ))
+35 -35
View File
@@ -42,43 +42,43 @@ logger = logging.getLogger(__name__)
class GuiOutline(QTreeWidget): class GuiOutline(QTreeWidget):
DEF_WIDTH = { DEF_WIDTH = {
nwOutline.TITLE : 200, nwOutline.TITLE: 200,
nwOutline.LEVEL : 40, nwOutline.LEVEL: 40,
nwOutline.LABEL : 150, nwOutline.LABEL: 150,
nwOutline.LINE : 40, nwOutline.LINE: 40,
nwOutline.CCOUNT : 50, nwOutline.CCOUNT: 50,
nwOutline.WCOUNT : 50, nwOutline.WCOUNT: 50,
nwOutline.PCOUNT : 50, nwOutline.PCOUNT: 50,
nwOutline.POV : 100, nwOutline.POV: 100,
nwOutline.FOCUS : 100, nwOutline.FOCUS: 100,
nwOutline.CHAR : 100, nwOutline.CHAR: 100,
nwOutline.PLOT : 100, nwOutline.PLOT: 100,
nwOutline.TIME : 100, nwOutline.TIME: 100,
nwOutline.WORLD : 100, nwOutline.WORLD: 100,
nwOutline.OBJECT : 100, nwOutline.OBJECT: 100,
nwOutline.ENTITY : 100, nwOutline.ENTITY: 100,
nwOutline.CUSTOM : 100, nwOutline.CUSTOM: 100,
nwOutline.SYNOP : 200, nwOutline.SYNOP: 200,
} }
DEF_HIDDEN = { DEF_HIDDEN = {
nwOutline.TITLE : False, nwOutline.TITLE: False,
nwOutline.LEVEL : True, nwOutline.LEVEL: True,
nwOutline.LABEL : False, nwOutline.LABEL: False,
nwOutline.LINE : True, nwOutline.LINE: True,
nwOutline.CCOUNT : True, nwOutline.CCOUNT: True,
nwOutline.WCOUNT : False, nwOutline.WCOUNT: False,
nwOutline.PCOUNT : False, nwOutline.PCOUNT: False,
nwOutline.POV : False, nwOutline.POV: False,
nwOutline.FOCUS : True, nwOutline.FOCUS: True,
nwOutline.CHAR : False, nwOutline.CHAR: False,
nwOutline.PLOT : False, nwOutline.PLOT: False,
nwOutline.TIME : True, nwOutline.TIME: True,
nwOutline.WORLD : False, nwOutline.WORLD: False,
nwOutline.OBJECT : True, nwOutline.OBJECT: True,
nwOutline.ENTITY : True, nwOutline.ENTITY: True,
nwOutline.CUSTOM : True, nwOutline.CUSTOM: True,
nwOutline.SYNOP : False, nwOutline.SYNOP: False,
} }
def __init__(self, theParent): def __init__(self, theParent):
@@ -487,7 +487,7 @@ class GuiOutlineHeaderMenu(QMenu):
self.actionMap[hItem] = QAction(trConst(nwLabels.OUTLINE_COLS[hItem]), self) self.actionMap[hItem] = QAction(trConst(nwLabels.OUTLINE_COLS[hItem]), self)
self.actionMap[hItem].setCheckable(True) self.actionMap[hItem].setCheckable(True)
self.actionMap[hItem].toggled.connect( 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]) self.addAction(self.actionMap[hItem])
+4 -4
View File
@@ -40,10 +40,10 @@ logger = logging.getLogger(__name__)
class GuiOutlineDetails(QScrollArea): class GuiOutlineDetails(QScrollArea):
LVL_MAP = { LVL_MAP = {
"H1" : QT_TRANSLATE_NOOP("GuiOutlineDetails", "Title"), "H1": QT_TRANSLATE_NOOP("GuiOutlineDetails", "Title"),
"H2" : QT_TRANSLATE_NOOP("GuiOutlineDetails", "Chapter"), "H2": QT_TRANSLATE_NOOP("GuiOutlineDetails", "Chapter"),
"H3" : QT_TRANSLATE_NOOP("GuiOutlineDetails", "Scene"), "H3": QT_TRANSLATE_NOOP("GuiOutlineDetails", "Scene"),
"H4" : QT_TRANSLATE_NOOP("GuiOutlineDetails", "Section"), "H4": QT_TRANSLATE_NOOP("GuiOutlineDetails", "Section"),
} }
def __init__(self, theParent): def __init__(self, theParent):
+58 -58
View File
@@ -529,71 +529,71 @@ class GuiIcons:
ICON_MAP = { ICON_MAP = {
# Project and GUI icons # Project and GUI icons
"novelwriter" : (None, None), "novelwriter": (None, None),
"cls_none" : (QStyle.SP_DriveHDIcon, "drive-harddisk"), "cls_none": (QStyle.SP_DriveHDIcon, "drive-harddisk"),
"cls_novel" : (QStyle.SP_DriveHDIcon, "drive-harddisk"), "cls_novel": (QStyle.SP_DriveHDIcon, "drive-harddisk"),
"cls_plot" : (QStyle.SP_DriveHDIcon, "drive-harddisk"), "cls_plot": (QStyle.SP_DriveHDIcon, "drive-harddisk"),
"cls_character" : (QStyle.SP_DriveHDIcon, "drive-harddisk"), "cls_character": (QStyle.SP_DriveHDIcon, "drive-harddisk"),
"cls_world" : (QStyle.SP_DriveHDIcon, "drive-harddisk"), "cls_world": (QStyle.SP_DriveHDIcon, "drive-harddisk"),
"cls_timeline" : (QStyle.SP_DriveHDIcon, "drive-harddisk"), "cls_timeline": (QStyle.SP_DriveHDIcon, "drive-harddisk"),
"cls_object" : (QStyle.SP_DriveHDIcon, "drive-harddisk"), "cls_object": (QStyle.SP_DriveHDIcon, "drive-harddisk"),
"cls_entity" : (QStyle.SP_DriveHDIcon, "drive-harddisk"), "cls_entity": (QStyle.SP_DriveHDIcon, "drive-harddisk"),
"cls_custom" : (QStyle.SP_DriveHDIcon, "drive-harddisk"), "cls_custom": (QStyle.SP_DriveHDIcon, "drive-harddisk"),
"cls_archive" : (QStyle.SP_DriveHDIcon, "drive-harddisk"), "cls_archive": (QStyle.SP_DriveHDIcon, "drive-harddisk"),
"cls_trash" : (QStyle.SP_DriveHDIcon, "drive-harddisk"), "cls_trash": (QStyle.SP_DriveHDIcon, "drive-harddisk"),
"proj_document" : (QStyle.SP_FileIcon, "x-office-document"), "proj_document": (QStyle.SP_FileIcon, "x-office-document"),
"proj_folder" : (QStyle.SP_DirIcon, "folder"), "proj_folder": (QStyle.SP_DirIcon, "folder"),
"proj_nwx" : (None, None), "proj_nwx": (None, None),
"status_lang" : (None, None), "status_lang": (None, None),
"status_time" : (None, None), "status_time": (None, None),
"status_idle" : (None, None), "status_idle": (None, None),
"status_stats" : (None, None), "status_stats": (None, None),
"status_lines" : (None, None), "status_lines": (None, None),
"doc_h0" : (QStyle.SP_FileIcon, "x-office-document"), "doc_h0": (QStyle.SP_FileIcon, "x-office-document"),
"doc_h1" : (QStyle.SP_FileIcon, "x-office-document"), "doc_h1": (QStyle.SP_FileIcon, "x-office-document"),
"doc_h2" : (QStyle.SP_FileIcon, "x-office-document"), "doc_h2": (QStyle.SP_FileIcon, "x-office-document"),
"doc_h3" : (QStyle.SP_FileIcon, "x-office-document"), "doc_h3": (QStyle.SP_FileIcon, "x-office-document"),
"doc_h4" : (QStyle.SP_FileIcon, "x-office-document"), "doc_h4": (QStyle.SP_FileIcon, "x-office-document"),
"search_case" : (None, None), "search_case": (None, None),
"search_regex" : (None, None), "search_regex": (None, None),
"search_word" : (None, None), "search_word": (None, None),
"search_loop" : (None, None), "search_loop": (None, None),
"search_project" : (None, None), "search_project": (None, None),
"search_cancel" : (None, None), "search_cancel": (None, None),
"search_preserve" : (None, None), "search_preserve": (None, None),
# General Button Icons # General Button Icons
"folder-open" : (QStyle.SP_DirOpenIcon, "folder-open"), "folder-open": (QStyle.SP_DirOpenIcon, "folder-open"),
"delete" : (QStyle.SP_DialogDiscardButton, "edit-delete"), "delete": (QStyle.SP_DialogDiscardButton, "edit-delete"),
"close" : (QStyle.SP_DialogCloseButton, "window-close"), "close": (QStyle.SP_DialogCloseButton, "window-close"),
"done" : (QStyle.SP_DialogApplyButton, None), "done": (QStyle.SP_DialogApplyButton, None),
"clear" : (QStyle.SP_LineEditClearButton, "clear_left"), "clear": (QStyle.SP_LineEditClearButton, "clear_left"),
"save" : (QStyle.SP_DialogSaveButton, "document-save"), "save": (QStyle.SP_DialogSaveButton, "document-save"),
"add" : (None, "list-add"), "add": (None, "list-add"),
"remove" : (None, "list-remove"), "remove": (None, "list-remove"),
"search" : (None, "edit-find"), "search": (None, "edit-find"),
"search-replace" : (None, "edit-find-replace"), "search-replace": (None, "edit-find-replace"),
"edit" : (None, None), "edit": (None, None),
"check" : (None, None), "check": (None, None),
"cross" : (None, None), "cross": (None, None),
"hash" : (None, None), "hash": (None, None),
"maximise" : (None, None), "maximise": (None, None),
"minimise" : (None, None), "minimise": (None, None),
"refresh" : (None, None), "refresh": (None, None),
"reference" : (None, None), "reference": (None, None),
"backward" : (None, None), "backward": (None, None),
"forward" : (None, None), "forward": (None, None),
"settings" : (None, None), "settings": (None, None),
# Switches # Switches
"sticky-on" : (None, None), "sticky-on": (None, None),
"sticky-off" : (None, None), "sticky-off": (None, None),
"bullet-on" : (None, None), "bullet-on": (None, None),
"bullet-off" : (None, None), "bullet-off": (None, None),
} }
DECO_MAP = { DECO_MAP = {
"wiz-back" : "wizard-back.jpg", "wiz-back": "wizard-back.jpg",
} }
def __init__(self, theParent): def __init__(self, theParent):
+16 -16
View File
@@ -930,11 +930,11 @@ class GuiBuildNovel(QDialog):
elif theFmt == self.FMT_JSON_H or theFmt == self.FMT_JSON_M: elif theFmt == self.FMT_JSON_H or theFmt == self.FMT_JSON_M:
jsonData = { jsonData = {
"meta" : { "meta": {
"workingTitle" : self.theProject.projName, "workingTitle": self.theProject.projName,
"novelTitle" : self.theProject.bookTitle, "novelTitle": self.theProject.bookTitle,
"authors" : self.theProject.bookAuthors, "authors": self.theProject.bookAuthors,
"buildTime" : self.buildTime, "buildTime": self.buildTime,
} }
} }
@@ -948,8 +948,8 @@ class GuiBuildNovel(QDialog):
for htmlPage in makeHtml.fullHTML: for htmlPage in makeHtml.fullHTML:
theBody.append(htmlPage.rstrip("\n").split("\n")) theBody.append(htmlPage.rstrip("\n").split("\n"))
jsonData["text"] = { jsonData["text"] = {
"css" : self.htmlStyle, "css": self.htmlStyle,
"html" : theBody, "html": theBody,
} }
elif theFmt == self.FMT_JSON_M: elif theFmt == self.FMT_JSON_M:
@@ -963,7 +963,7 @@ class GuiBuildNovel(QDialog):
for nwdPage in makeMd.theMarkdown: for nwdPage in makeMd.theMarkdown:
theBody.append(nwdPage.split("\n")) theBody.append(nwdPage.split("\n"))
jsonData["text"] = { jsonData["text"] = {
"nwd" : theBody, "nwd": theBody,
} }
try: try:
@@ -1076,9 +1076,9 @@ class GuiBuildNovel(QDialog):
try: try:
with open(buildCache, mode="w+", encoding="utf8") as outFile: with open(buildCache, mode="w+", encoding="utf8") as outFile:
outFile.write(json.dumps({ outFile.write(json.dumps({
"buildTime" : self.buildTime, "buildTime": self.buildTime,
"htmlStyle" : self.htmlStyle, "htmlStyle": self.htmlStyle,
"htmlText" : self.htmlText, "htmlText": self.htmlText,
}, indent=2)) }, indent=2))
except Exception: except Exception:
logger.error("Failed to save build cache") logger.error("Failed to save build cache")
@@ -1116,11 +1116,11 @@ class GuiBuildNovel(QDialog):
# Formatting # Formatting
self.theProject.setTitleFormat({ self.theProject.setTitleFormat({
"title" : self.fmtTitle.text().strip(), "title": self.fmtTitle.text().strip(),
"chapter" : self.fmtChapter.text().strip(), "chapter": self.fmtChapter.text().strip(),
"unnumbered" : self.fmtUnnumbered.text().strip(), "unnumbered": self.fmtUnnumbered.text().strip(),
"scene" : self.fmtScene.text().strip(), "scene": self.fmtScene.text().strip(),
"section" : self.fmtSection.text().strip(), "section": self.fmtSection.text().strip(),
}) })
buildLang = self.buildLang.currentData() buildLang = self.buildLang.currentData()
+1 -1
View File
@@ -49,6 +49,6 @@ gui_scripts =
universal = 0 universal = 0
[flake8] [flake8]
ignore = E203,E221,E226,E228,E241,E251 ignore = E221,E226,E228,E241,E251
max-line-length = 99 max-line-length = 99
exclude = docs/* exclude = docs/*