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
- name: Coding Style Violations
run: |
flake8 nw --count --max-line-length=99 --ignore E203,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 nw --count --max-line-length=99 --ignore 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
[here](https://pycodestyle.pycqa.org/en/latest/intro.html#error-codes).
**E203:** whitespace before :
**Reason:** Column alignment.
**E221:** multiple spaces before operator
**Reason:** Column alignment.
+6 -6
View File
@@ -846,9 +846,9 @@ class Config:
if "words" in theEntry.keys():
wordCount = int(theEntry["words"])
self.recentProj[projPath] = {
"title" : theTitle,
"time" : lastTime,
"words" : wordCount,
"title": theTitle,
"time": lastTime,
"words": wordCount,
}
except Exception as e:
@@ -887,9 +887,9 @@ class Config:
"""Add or update recent cache information o9n a given project.
"""
self.recentProj[os.path.abspath(projPath)] = {
"title" : projTitle,
"time" : int(saveTime),
"words" : int(wordCount),
"title": projTitle,
"time": int(saveTime),
"words": int(wordCount),
}
return True
+149 -149
View File
@@ -113,15 +113,15 @@ class nwKeyWords:
# Map from Keys to Item Class
KEY_CLASS = {
POV_KEY : nwItemClass.CHARACTER,
FOCUS_KEY : nwItemClass.CHARACTER,
CHAR_KEY : nwItemClass.CHARACTER,
PLOT_KEY : nwItemClass.PLOT,
TIME_KEY : nwItemClass.TIMELINE,
WORLD_KEY : nwItemClass.WORLD,
OBJECT_KEY : nwItemClass.OBJECT,
ENTITY_KEY : nwItemClass.ENTITY,
CUSTOM_KEY : nwItemClass.CUSTOM,
POV_KEY: nwItemClass.CHARACTER,
FOCUS_KEY: nwItemClass.CHARACTER,
CHAR_KEY: nwItemClass.CHARACTER,
PLOT_KEY: nwItemClass.PLOT,
TIME_KEY: nwItemClass.TIMELINE,
WORLD_KEY: nwItemClass.WORLD,
OBJECT_KEY: nwItemClass.OBJECT,
ENTITY_KEY: nwItemClass.ENTITY,
CUSTOM_KEY: nwItemClass.CUSTOM,
}
# END Class nwKeyWords
@@ -130,96 +130,96 @@ class nwKeyWords:
class nwLabels():
CLASS_NAME = {
nwItemClass.NO_CLASS : QT_TRANSLATE_NOOP("Constant", "None"),
nwItemClass.NOVEL : QT_TRANSLATE_NOOP("Constant", "Novel"),
nwItemClass.PLOT : QT_TRANSLATE_NOOP("Constant", "Plot"),
nwItemClass.CHARACTER : QT_TRANSLATE_NOOP("Constant", "Characters"),
nwItemClass.WORLD : QT_TRANSLATE_NOOP("Constant", "Locations"),
nwItemClass.TIMELINE : QT_TRANSLATE_NOOP("Constant", "Timeline"),
nwItemClass.OBJECT : QT_TRANSLATE_NOOP("Constant", "Objects"),
nwItemClass.ENTITY : QT_TRANSLATE_NOOP("Constant", "Entity"),
nwItemClass.CUSTOM : QT_TRANSLATE_NOOP("Constant", "Custom"),
nwItemClass.ARCHIVE : QT_TRANSLATE_NOOP("Constant", "Outtakes"),
nwItemClass.TRASH : QT_TRANSLATE_NOOP("Constant", "Trash"),
nwItemClass.NO_CLASS: QT_TRANSLATE_NOOP("Constant", "None"),
nwItemClass.NOVEL: QT_TRANSLATE_NOOP("Constant", "Novel"),
nwItemClass.PLOT: QT_TRANSLATE_NOOP("Constant", "Plot"),
nwItemClass.CHARACTER: QT_TRANSLATE_NOOP("Constant", "Characters"),
nwItemClass.WORLD: QT_TRANSLATE_NOOP("Constant", "Locations"),
nwItemClass.TIMELINE: QT_TRANSLATE_NOOP("Constant", "Timeline"),
nwItemClass.OBJECT: QT_TRANSLATE_NOOP("Constant", "Objects"),
nwItemClass.ENTITY: QT_TRANSLATE_NOOP("Constant", "Entity"),
nwItemClass.CUSTOM: QT_TRANSLATE_NOOP("Constant", "Custom"),
nwItemClass.ARCHIVE: QT_TRANSLATE_NOOP("Constant", "Outtakes"),
nwItemClass.TRASH: QT_TRANSLATE_NOOP("Constant", "Trash"),
}
CLASS_FLAG = {
nwItemClass.NO_CLASS : "0",
nwItemClass.NOVEL : "N",
nwItemClass.PLOT : "P",
nwItemClass.CHARACTER : "C",
nwItemClass.WORLD : "L",
nwItemClass.TIMELINE : "T",
nwItemClass.OBJECT : "O",
nwItemClass.ENTITY : "E",
nwItemClass.CUSTOM : "X",
nwItemClass.ARCHIVE : "U",
nwItemClass.TRASH : "R",
nwItemClass.NO_CLASS: "0",
nwItemClass.NOVEL: "N",
nwItemClass.PLOT: "P",
nwItemClass.CHARACTER: "C",
nwItemClass.WORLD: "L",
nwItemClass.TIMELINE: "T",
nwItemClass.OBJECT: "O",
nwItemClass.ENTITY: "E",
nwItemClass.CUSTOM: "X",
nwItemClass.ARCHIVE: "U",
nwItemClass.TRASH: "R",
}
CLASS_ICON = {
nwItemClass.NO_CLASS : "cls_none",
nwItemClass.NOVEL : "cls_novel",
nwItemClass.PLOT : "cls_plot",
nwItemClass.CHARACTER : "cls_character",
nwItemClass.WORLD : "cls_world",
nwItemClass.TIMELINE : "cls_timeline",
nwItemClass.OBJECT : "cls_object",
nwItemClass.ENTITY : "cls_entity",
nwItemClass.CUSTOM : "cls_custom",
nwItemClass.ARCHIVE : "cls_archive",
nwItemClass.TRASH : "cls_trash",
nwItemClass.NO_CLASS: "cls_none",
nwItemClass.NOVEL: "cls_novel",
nwItemClass.PLOT: "cls_plot",
nwItemClass.CHARACTER: "cls_character",
nwItemClass.WORLD: "cls_world",
nwItemClass.TIMELINE: "cls_timeline",
nwItemClass.OBJECT: "cls_object",
nwItemClass.ENTITY: "cls_entity",
nwItemClass.CUSTOM: "cls_custom",
nwItemClass.ARCHIVE: "cls_archive",
nwItemClass.TRASH: "cls_trash",
}
LAYOUT_NAME = {
nwItemLayout.NO_LAYOUT : QT_TRANSLATE_NOOP("Constant", "None"),
nwItemLayout.TITLE : QT_TRANSLATE_NOOP("Constant", "Title Page"),
nwItemLayout.BOOK : QT_TRANSLATE_NOOP("Constant", "Book"),
nwItemLayout.PAGE : QT_TRANSLATE_NOOP("Constant", "Plain Page"),
nwItemLayout.PARTITION : QT_TRANSLATE_NOOP("Constant", "Partition"),
nwItemLayout.UNNUMBERED : QT_TRANSLATE_NOOP("Constant", "Unnumbered"),
nwItemLayout.CHAPTER : QT_TRANSLATE_NOOP("Constant", "Chapter"),
nwItemLayout.SCENE : QT_TRANSLATE_NOOP("Constant", "Scene"),
nwItemLayout.NOTE : QT_TRANSLATE_NOOP("Constant", "Note"),
nwItemLayout.NO_LAYOUT: QT_TRANSLATE_NOOP("Constant", "None"),
nwItemLayout.TITLE: QT_TRANSLATE_NOOP("Constant", "Title Page"),
nwItemLayout.BOOK: QT_TRANSLATE_NOOP("Constant", "Book"),
nwItemLayout.PAGE: QT_TRANSLATE_NOOP("Constant", "Plain Page"),
nwItemLayout.PARTITION: QT_TRANSLATE_NOOP("Constant", "Partition"),
nwItemLayout.UNNUMBERED: QT_TRANSLATE_NOOP("Constant", "Unnumbered"),
nwItemLayout.CHAPTER: QT_TRANSLATE_NOOP("Constant", "Chapter"),
nwItemLayout.SCENE: QT_TRANSLATE_NOOP("Constant", "Scene"),
nwItemLayout.NOTE: QT_TRANSLATE_NOOP("Constant", "Note"),
}
LAYOUT_FLAG = {
nwItemLayout.NO_LAYOUT : "Xo",
nwItemLayout.TITLE : "Tt",
nwItemLayout.BOOK : "Bk",
nwItemLayout.PAGE : "Pg",
nwItemLayout.PARTITION : "Pt",
nwItemLayout.UNNUMBERED : "Un",
nwItemLayout.CHAPTER : "Ch",
nwItemLayout.SCENE : "Sc",
nwItemLayout.NOTE : "Nt",
nwItemLayout.NO_LAYOUT: "Xo",
nwItemLayout.TITLE: "Tt",
nwItemLayout.BOOK: "Bk",
nwItemLayout.PAGE: "Pg",
nwItemLayout.PARTITION: "Pt",
nwItemLayout.UNNUMBERED: "Un",
nwItemLayout.CHAPTER: "Ch",
nwItemLayout.SCENE: "Sc",
nwItemLayout.NOTE: "Nt",
}
KEY_NAME = {
nwKeyWords.TAG_KEY : QT_TRANSLATE_NOOP("Constant", "Tag"),
nwKeyWords.POV_KEY : QT_TRANSLATE_NOOP("Constant", "Point of View"),
nwKeyWords.FOCUS_KEY : QT_TRANSLATE_NOOP("Constant", "Focus"),
nwKeyWords.CHAR_KEY : QT_TRANSLATE_NOOP("Constant", "Characters"),
nwKeyWords.PLOT_KEY : QT_TRANSLATE_NOOP("Constant", "Plot"),
nwKeyWords.TIME_KEY : QT_TRANSLATE_NOOP("Constant", "Timeline"),
nwKeyWords.WORLD_KEY : QT_TRANSLATE_NOOP("Constant", "Locations"),
nwKeyWords.OBJECT_KEY : QT_TRANSLATE_NOOP("Constant", "Objects"),
nwKeyWords.ENTITY_KEY : QT_TRANSLATE_NOOP("Constant", "Entities"),
nwKeyWords.CUSTOM_KEY : QT_TRANSLATE_NOOP("Constant", "Custom"),
nwKeyWords.TAG_KEY: QT_TRANSLATE_NOOP("Constant", "Tag"),
nwKeyWords.POV_KEY: QT_TRANSLATE_NOOP("Constant", "Point of View"),
nwKeyWords.FOCUS_KEY: QT_TRANSLATE_NOOP("Constant", "Focus"),
nwKeyWords.CHAR_KEY: QT_TRANSLATE_NOOP("Constant", "Characters"),
nwKeyWords.PLOT_KEY: QT_TRANSLATE_NOOP("Constant", "Plot"),
nwKeyWords.TIME_KEY: QT_TRANSLATE_NOOP("Constant", "Timeline"),
nwKeyWords.WORLD_KEY: QT_TRANSLATE_NOOP("Constant", "Locations"),
nwKeyWords.OBJECT_KEY: QT_TRANSLATE_NOOP("Constant", "Objects"),
nwKeyWords.ENTITY_KEY: QT_TRANSLATE_NOOP("Constant", "Entities"),
nwKeyWords.CUSTOM_KEY: QT_TRANSLATE_NOOP("Constant", "Custom"),
}
OUTLINE_COLS = {
nwOutline.TITLE : QT_TRANSLATE_NOOP("Constant", "Title"),
nwOutline.LEVEL : QT_TRANSLATE_NOOP("Constant", "Level"),
nwOutline.LABEL : QT_TRANSLATE_NOOP("Constant", "Document"),
nwOutline.LINE : QT_TRANSLATE_NOOP("Constant", "Line"),
nwOutline.CCOUNT : QT_TRANSLATE_NOOP("Constant", "Chars"),
nwOutline.WCOUNT : QT_TRANSLATE_NOOP("Constant", "Words"),
nwOutline.PCOUNT : QT_TRANSLATE_NOOP("Constant", "Pars"),
nwOutline.POV : QT_TRANSLATE_NOOP("Constant", "POV"),
nwOutline.FOCUS : QT_TRANSLATE_NOOP("Constant", "Focus"),
nwOutline.CHAR : KEY_NAME[nwKeyWords.CHAR_KEY],
nwOutline.PLOT : KEY_NAME[nwKeyWords.PLOT_KEY],
nwOutline.TIME : KEY_NAME[nwKeyWords.TIME_KEY],
nwOutline.WORLD : KEY_NAME[nwKeyWords.WORLD_KEY],
nwOutline.OBJECT : KEY_NAME[nwKeyWords.OBJECT_KEY],
nwOutline.ENTITY : KEY_NAME[nwKeyWords.ENTITY_KEY],
nwOutline.CUSTOM : KEY_NAME[nwKeyWords.CUSTOM_KEY],
nwOutline.SYNOP : QT_TRANSLATE_NOOP("Constant", "Synopsis"),
nwOutline.TITLE: QT_TRANSLATE_NOOP("Constant", "Title"),
nwOutline.LEVEL: QT_TRANSLATE_NOOP("Constant", "Level"),
nwOutline.LABEL: QT_TRANSLATE_NOOP("Constant", "Document"),
nwOutline.LINE: QT_TRANSLATE_NOOP("Constant", "Line"),
nwOutline.CCOUNT: QT_TRANSLATE_NOOP("Constant", "Chars"),
nwOutline.WCOUNT: QT_TRANSLATE_NOOP("Constant", "Words"),
nwOutline.PCOUNT: QT_TRANSLATE_NOOP("Constant", "Pars"),
nwOutline.POV: QT_TRANSLATE_NOOP("Constant", "POV"),
nwOutline.FOCUS: QT_TRANSLATE_NOOP("Constant", "Focus"),
nwOutline.CHAR: KEY_NAME[nwKeyWords.CHAR_KEY],
nwOutline.PLOT: KEY_NAME[nwKeyWords.PLOT_KEY],
nwOutline.TIME: KEY_NAME[nwKeyWords.TIME_KEY],
nwOutline.WORLD: KEY_NAME[nwKeyWords.WORLD_KEY],
nwOutline.OBJECT: KEY_NAME[nwKeyWords.OBJECT_KEY],
nwOutline.ENTITY: KEY_NAME[nwKeyWords.ENTITY_KEY],
nwOutline.CUSTOM: KEY_NAME[nwKeyWords.CUSTOM_KEY],
nwOutline.SYNOP: QT_TRANSLATE_NOOP("Constant", "Synopsis"),
}
# END Class nwLabels
@@ -230,28 +230,28 @@ class nwQuotes():
Source: https://en.wikipedia.org/wiki/Quotation_mark
"""
SYMBOLS = {
"\u0027" : QT_TRANSLATE_NOOP("Constant", "Straight single quotation mark"),
"\u0022" : QT_TRANSLATE_NOOP("Constant", "Straight double quotation mark"),
"\u0027": QT_TRANSLATE_NOOP("Constant", "Straight single quotation mark"),
"\u0022": QT_TRANSLATE_NOOP("Constant", "Straight double quotation mark"),
"\u2018" : QT_TRANSLATE_NOOP("Constant", "Left single quotation mark"),
"\u2019" : QT_TRANSLATE_NOOP("Constant", "Right single quotation mark"),
"\u201a" : QT_TRANSLATE_NOOP("Constant", "Single low-9 quotation mark"),
"\u201b" : QT_TRANSLATE_NOOP("Constant", "Single high-reversed-9 quotation mark"),
"\u201c" : QT_TRANSLATE_NOOP("Constant", "Left double quotation mark"),
"\u201d" : QT_TRANSLATE_NOOP("Constant", "Right double quotation mark"),
"\u201e" : QT_TRANSLATE_NOOP("Constant", "Double low-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"),
"\u2018": QT_TRANSLATE_NOOP("Constant", "Left single quotation mark"),
"\u2019": QT_TRANSLATE_NOOP("Constant", "Right single quotation mark"),
"\u201a": QT_TRANSLATE_NOOP("Constant", "Single low-9 quotation mark"),
"\u201b": QT_TRANSLATE_NOOP("Constant", "Single high-reversed-9 quotation mark"),
"\u201c": QT_TRANSLATE_NOOP("Constant", "Left double quotation mark"),
"\u201d": QT_TRANSLATE_NOOP("Constant", "Right double quotation mark"),
"\u201e": QT_TRANSLATE_NOOP("Constant", "Double low-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"),
"\u2039" : QT_TRANSLATE_NOOP("Constant", "Single left-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"),
"\u00bb" : QT_TRANSLATE_NOOP("Constant", "Double right-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"),
"\u00ab": QT_TRANSLATE_NOOP("Constant", "Double left-pointing angle quotation mark"),
"\u00bb": QT_TRANSLATE_NOOP("Constant", "Double right-pointing angle quotation mark"),
"\u300c" : QT_TRANSLATE_NOOP("Constant", "Left corner bracket"),
"\u300d" : QT_TRANSLATE_NOOP("Constant", "Right corner bracket"),
"\u300e" : QT_TRANSLATE_NOOP("Constant", "Left white corner bracket"),
"\u300f" : QT_TRANSLATE_NOOP("Constant", "Right white corner bracket"),
"\u300c": QT_TRANSLATE_NOOP("Constant", "Left corner bracket"),
"\u300d": QT_TRANSLATE_NOOP("Constant", "Right corner bracket"),
"\u300e": QT_TRANSLATE_NOOP("Constant", "Left white corner bracket"),
"\u300f": QT_TRANSLATE_NOOP("Constant", "Right white corner bracket"),
}
# END Class nwQuotes
@@ -397,55 +397,55 @@ class nwHtmlUnicode():
U_TO_H = {
# Quotes
nwUnicode.U_QUOT : nwUnicode.H_QUOT,
nwUnicode.U_APOS : nwUnicode.H_APOS,
nwUnicode.U_LAQUO : nwUnicode.H_LAQUO,
nwUnicode.U_RAQUO : nwUnicode.H_RAQUO,
nwUnicode.U_LSQUO : nwUnicode.H_LSQUO,
nwUnicode.U_RSQUO : nwUnicode.H_RSQUO,
nwUnicode.U_SBQUO : nwUnicode.H_SBQUO,
nwUnicode.U_SUQUO : nwUnicode.H_SUQUO,
nwUnicode.U_LDQUO : nwUnicode.H_LDQUO,
nwUnicode.U_RDQUO : nwUnicode.H_RDQUO,
nwUnicode.U_BDQUO : nwUnicode.H_BDQUO,
nwUnicode.U_UDQUO : nwUnicode.H_UDQUO,
nwUnicode.U_LSAQUO : nwUnicode.H_LSAQUO,
nwUnicode.U_RSAQUO : nwUnicode.H_RSAQUO,
nwUnicode.U_BDRQUO : nwUnicode.H_BDRQUO,
nwUnicode.U_LCQUO : nwUnicode.H_LCQUO,
nwUnicode.U_RCQUO : nwUnicode.H_RCQUO,
nwUnicode.U_LWCQUO : nwUnicode.H_LWCQUO,
nwUnicode.U_RWCQUO : nwUnicode.H_RWCQUO,
nwUnicode.U_QUOT: nwUnicode.H_QUOT,
nwUnicode.U_APOS: nwUnicode.H_APOS,
nwUnicode.U_LAQUO: nwUnicode.H_LAQUO,
nwUnicode.U_RAQUO: nwUnicode.H_RAQUO,
nwUnicode.U_LSQUO: nwUnicode.H_LSQUO,
nwUnicode.U_RSQUO: nwUnicode.H_RSQUO,
nwUnicode.U_SBQUO: nwUnicode.H_SBQUO,
nwUnicode.U_SUQUO: nwUnicode.H_SUQUO,
nwUnicode.U_LDQUO: nwUnicode.H_LDQUO,
nwUnicode.U_RDQUO: nwUnicode.H_RDQUO,
nwUnicode.U_BDQUO: nwUnicode.H_BDQUO,
nwUnicode.U_UDQUO: nwUnicode.H_UDQUO,
nwUnicode.U_LSAQUO: nwUnicode.H_LSAQUO,
nwUnicode.U_RSAQUO: nwUnicode.H_RSAQUO,
nwUnicode.U_BDRQUO: nwUnicode.H_BDRQUO,
nwUnicode.U_LCQUO: nwUnicode.H_LCQUO,
nwUnicode.U_RCQUO: nwUnicode.H_RCQUO,
nwUnicode.U_LWCQUO: nwUnicode.H_LWCQUO,
nwUnicode.U_RWCQUO: nwUnicode.H_RWCQUO,
# Punctuation
nwUnicode.U_FGDASH : nwUnicode.H_FGDASH,
nwUnicode.U_ENDASH : nwUnicode.H_ENDASH,
nwUnicode.U_EMDASH : nwUnicode.H_EMDASH,
nwUnicode.U_HBAR : nwUnicode.H_HBAR,
nwUnicode.U_HELLIP : nwUnicode.H_HELLIP,
nwUnicode.U_MAPOSS : nwUnicode.H_MAPOSS,
nwUnicode.U_PRIME : nwUnicode.H_PRIME,
nwUnicode.U_DPRIME : nwUnicode.H_DPRIME,
nwUnicode.U_FGDASH: nwUnicode.H_FGDASH,
nwUnicode.U_ENDASH: nwUnicode.H_ENDASH,
nwUnicode.U_EMDASH: nwUnicode.H_EMDASH,
nwUnicode.U_HBAR: nwUnicode.H_HBAR,
nwUnicode.U_HELLIP: nwUnicode.H_HELLIP,
nwUnicode.U_MAPOSS: nwUnicode.H_MAPOSS,
nwUnicode.U_PRIME: nwUnicode.H_PRIME,
nwUnicode.U_DPRIME: nwUnicode.H_DPRIME,
# Spaces
nwUnicode.U_NBSP : nwUnicode.H_NBSP,
nwUnicode.U_THSP : nwUnicode.H_THSP,
nwUnicode.U_THNBSP : nwUnicode.H_THNBSP,
nwUnicode.U_ENSP : nwUnicode.H_ENSP,
nwUnicode.U_EMSP : nwUnicode.H_EMSP,
nwUnicode.U_NBSP: nwUnicode.H_NBSP,
nwUnicode.U_THSP: nwUnicode.H_THSP,
nwUnicode.U_THNBSP: nwUnicode.H_THNBSP,
nwUnicode.U_ENSP: nwUnicode.H_ENSP,
nwUnicode.U_EMSP: nwUnicode.H_EMSP,
# Symbols
nwUnicode.U_CHECK : nwUnicode.H_CHECK,
nwUnicode.U_CROSS : nwUnicode.H_CROSS,
nwUnicode.U_BULL : nwUnicode.H_BULL,
nwUnicode.U_TRBULL : nwUnicode.H_TRBULL,
nwUnicode.U_HYBULL : nwUnicode.H_HYBULL,
nwUnicode.U_FLOWER : nwUnicode.H_FLOWER,
nwUnicode.U_PERMIL : nwUnicode.H_PERMIL,
nwUnicode.U_DEGREE : nwUnicode.H_DEGREE,
nwUnicode.U_MINUS : nwUnicode.H_MINUS,
nwUnicode.U_TIMES : nwUnicode.H_TIMES,
nwUnicode.U_DIVIDE : nwUnicode.H_DIVIDE,
nwUnicode.U_CHECK: nwUnicode.H_CHECK,
nwUnicode.U_CROSS: nwUnicode.H_CROSS,
nwUnicode.U_BULL: nwUnicode.H_BULL,
nwUnicode.U_TRBULL: nwUnicode.H_TRBULL,
nwUnicode.U_HYBULL: nwUnicode.H_HYBULL,
nwUnicode.U_FLOWER: nwUnicode.H_FLOWER,
nwUnicode.U_PERMIL: nwUnicode.H_PERMIL,
nwUnicode.U_DEGREE: nwUnicode.H_DEGREE,
nwUnicode.U_MINUS: nwUnicode.H_MINUS,
nwUnicode.U_TIMES: nwUnicode.H_TIMES,
nwUnicode.U_DIVIDE: nwUnicode.H_DIVIDE,
}
# END Class nwHtmlUnicode
+25 -25
View File
@@ -183,11 +183,11 @@ class NWIndex():
try:
with open(indexFile, mode="w+", encoding="utf8") as outFile:
json.dump({
"tagIndex" : self._tagIndex,
"refIndex" : self._refIndex,
"novelIndex" : self._novelIndex,
"noteIndex" : self._noteIndex,
"textCounts" : self._textCounts,
"tagIndex": self._tagIndex,
"refIndex": self._refIndex,
"novelIndex": self._novelIndex,
"noteIndex": self._noteIndex,
"textCounts": self._textCounts,
}, outFile, indent=2)
except Exception:
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
self._refIndex[tHandle] = {}
self._refIndex[tHandle]["T000000"] = {
"tags" : [],
"updated" : round(time()),
"tags": [],
"updated": round(time()),
}
if itemLayout == nwItemLayout.NOTE:
self._novelIndex.pop(tHandle, None)
@@ -367,18 +367,18 @@ class NWIndex():
sTitle = "T%06d" % nLine
self._refIndex[tHandle][sTitle] = {
"tags" : [],
"updated" : round(time()),
"tags": [],
"updated": round(time()),
}
theData = {
"level" : hDepth,
"title" : hText,
"layout" : itemLayout.name,
"synopsis" : "",
"cCount" : 0,
"wCount" : 0,
"pCount" : 0,
"updated" : round(time()),
"level": hDepth,
"title": hText,
"layout": itemLayout.name,
"synopsis": "",
"cCount": 0,
"wCount": 0,
"pCount": 0,
"updated": round(time()),
}
if hText != "":
@@ -395,14 +395,14 @@ class NWIndex():
"""Index a page with no title.
"""
theData = {
"level" : "H0",
"title" : "Untitled Page",
"layout" : itemLayout.name,
"synopsis" : "",
"cCount" : 0,
"wCount" : 0,
"pCount" : 0,
"updated" : round(time()),
"level": "H0",
"title": "Untitled Page",
"layout": itemLayout.name,
"synopsis": "",
"cCount": 0,
"wCount": 0,
"pCount": 0,
"updated": round(time()),
}
if isNovel:
+3 -3
View File
@@ -67,9 +67,9 @@ class NWItem():
"""Packs all the data in the class instance into an XML object.
"""
xPack = etree.SubElement(xParent, "item", attrib={
"handle" : str(self.itemHandle),
"order" : str(self.itemOrder),
"parent" : str(self.itemParent),
"handle": str(self.itemHandle),
"order": str(self.itemOrder),
"parent": str(self.itemParent),
})
self._subPack(xPack, "name", text=str(self.itemName))
self._subPack(xPack, "type", text=str(self.itemType.name))
+9 -9
View File
@@ -203,11 +203,11 @@ class NWProject():
self.bookAuthors = []
self.autoReplace = {}
self.titleFormat = {
"title" : r"%title%",
"chapter" : self.tr("Chapter")+r" %ch%: %title%",
"unnumbered" : r"%title%",
"scene" : r"* * *",
"section" : r"",
"title": "%title%",
"chapter": self.tr("Chapter")+" %ch%: %title%",
"unnumbered": "%title%",
"scene": "* * *",
"section": "",
}
self.spellCheck = False
self.autoOutline = True
@@ -620,10 +620,10 @@ class NWProject():
# Root element and project details
logger.debug("Writing project meta")
nwXML = etree.Element("novelWriterXML", attrib={
"appVersion" : str(nw.__version__),
"hexVersion" : str(nw.__hexversion__),
"fileVersion" : "1.2",
"timeStamp" : formatTimeStamp(saveTime),
"appVersion": str(nw.__version__),
"hexVersion": str(nw.__hexversion__),
"fileVersion": "1.2",
"timeStamp": formatTimeStamp(saveTime),
})
editTime = int(self.editTime + saveTime - self.projOpened)
+3 -3
View File
@@ -122,9 +122,9 @@ class NWStatus():
"""
for n in range(self._theLength):
xSub = etree.SubElement(xParent, "entry", attrib={
"blue" : str(self._theColours[n][2]),
"green" : str(self._theColours[n][1]),
"red" : str(self._theColours[n][0]),
"blue": str(self._theColours[n][2]),
"green": str(self._theColours[n][1]),
"red": str(self._theColours[n][0]),
})
xSub.text = self._theLabels[n]
return True
+17 -17
View File
@@ -82,9 +82,9 @@ class ToHtml(Tokenizer):
# must take this into account when parsing for markup using
# angle brackets.
self._trMap = str.maketrans({
"<" : "&lt;",
">" : "&gt;",
"&" : "&amp;",
"<": "&lt;",
">": "&gt;",
"&": "&amp;",
})
if doReplace:
@@ -115,22 +115,22 @@ class ToHtml(Tokenizer):
to theResult.
"""
if self.genMode == self.M_PREVIEW:
htmlTags = { # HTML4 + CSS2
self.FMT_B_B : "<b>",
self.FMT_B_E : "</b>",
self.FMT_I_B : "<i>",
self.FMT_I_E : "</i>",
self.FMT_D_B : "<span style='text-decoration: line-through;'>",
self.FMT_D_E : "</span>",
htmlTags = { # HTML4 + CSS2
self.FMT_B_B: "<b>",
self.FMT_B_E: "</b>",
self.FMT_I_B: "<i>",
self.FMT_I_E: "</i>",
self.FMT_D_B: "<span style='text-decoration: line-through;'>",
self.FMT_D_E: "</span>",
}
else:
htmlTags = { # HTML5
self.FMT_B_B : "<strong>",
self.FMT_B_E : "</strong>",
self.FMT_I_B : "<em>",
self.FMT_I_E : "</em>",
self.FMT_D_B : "<del>",
self.FMT_D_E : "</del>",
htmlTags = { # HTML5
self.FMT_B_B: "<strong>",
self.FMT_B_E: "</strong>",
self.FMT_I_B: "<em>",
self.FMT_I_E: "</em>",
self.FMT_D_B: "<del>",
self.FMT_D_E: "</del>",
}
if self.isNovel and self.genMode != self.M_PREVIEW:
+3 -3
View File
@@ -341,9 +341,9 @@ class Tokenizer():
does the standard escaped characters.
"""
escapeDict = {
r"\*" : "*",
r"\~" : "~",
r"\_" : "_",
r"\*": "*",
r"\~": "~",
r"\_": "_",
}
escReplace = re.compile(
"|".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:
# Standard
mdTags = {
self.FMT_B_B : "**", self.FMT_B_E : "**",
self.FMT_I_B : "_", self.FMT_I_E : "_",
self.FMT_D_B : "", self.FMT_D_E : "",
self.FMT_B_B: "**", self.FMT_B_E: "**",
self.FMT_I_B: "_", self.FMT_I_E: "_",
self.FMT_D_B: "", self.FMT_D_E: "",
}
else:
# GitHub
mdTags = {
self.FMT_B_B : "**", self.FMT_B_E : "**",
self.FMT_I_B : "_", self.FMT_I_E : "_",
self.FMT_D_B : "~~", self.FMT_D_E : "~~",
self.FMT_B_B: "**", self.FMT_B_E: "**",
self.FMT_I_B: "_", self.FMT_I_E: "_",
self.FMT_D_B: "~~", self.FMT_D_E: "~~",
}
self.theResult = ""
+14 -14
View File
@@ -38,12 +38,12 @@ logger = logging.getLogger(__name__)
# Main XML NameSpaces
XML_NS = {
"office" : "urn:oasis:names:tc:opendocument:xmlns:office:1.0",
"style" : "urn:oasis:names:tc:opendocument:xmlns:style:1.0",
"loext" : "urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0",
"text" : "urn:oasis:names:tc:opendocument:xmlns:text:1.0",
"meta" : "urn:oasis:names:tc:opendocument:xmlns:meta:1.0",
"fo" : "urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0",
"office": "urn:oasis:names:tc:opendocument:xmlns:office:1.0",
"style": "urn:oasis:names:tc:opendocument:xmlns:style:1.0",
"loext": "urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0",
"text": "urn:oasis:names:tc:opendocument:xmlns:text:1.0",
"meta": "urn:oasis:names:tc:opendocument:xmlns:meta:1.0",
"fo": "urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0",
}
# Mimetype and Version
@@ -318,12 +318,12 @@ class ToOdt(Tokenizer):
self.theResult = "" # Not used, but cleared just in case
odtTags = {
self.FMT_B_B : "_B", # Bold open format
self.FMT_B_E : "b_", # Bold close format
self.FMT_I_B : "I", # Italic open format
self.FMT_I_E : "i", # Italic close format
self.FMT_D_B : "_S", # Strikethrough open format
self.FMT_D_E : "s_", # Strikethrough close format
self.FMT_B_B: "_B", # Bold open format
self.FMT_B_E: "b_", # Bold close format
self.FMT_I_B: "I", # Italic open format
self.FMT_I_E: "i", # Italic close format
self.FMT_D_B: "_S", # Strikethrough open format
self.FMT_D_E: "s_", # Strikethrough close format
}
thisPar = []
@@ -459,7 +459,7 @@ class ToOdt(Tokenizer):
def saveOpenDocText(self, savePath):
"""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"]
mVers = "{%s}version" % 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: "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"]
oSett = "{%s}settings" % sMap["office"]
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.
"""
thisEntry = {
"label" : None,
"help" : None,
"widget" : None,
"label": None,
"help": None,
"widget": None,
}
if isinstance(theLabel, QLabel):
+2 -2
View File
@@ -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
View File
@@ -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
View File
@@ -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])
+4 -4
View File
@@ -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
View File
@@ -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):
+16 -16
View File
@@ -930,11 +930,11 @@ class GuiBuildNovel(QDialog):
elif theFmt == self.FMT_JSON_H or theFmt == self.FMT_JSON_M:
jsonData = {
"meta" : {
"workingTitle" : self.theProject.projName,
"novelTitle" : self.theProject.bookTitle,
"authors" : self.theProject.bookAuthors,
"buildTime" : self.buildTime,
"meta": {
"workingTitle": self.theProject.projName,
"novelTitle": self.theProject.bookTitle,
"authors": self.theProject.bookAuthors,
"buildTime": self.buildTime,
}
}
@@ -948,8 +948,8 @@ class GuiBuildNovel(QDialog):
for htmlPage in makeHtml.fullHTML:
theBody.append(htmlPage.rstrip("\n").split("\n"))
jsonData["text"] = {
"css" : self.htmlStyle,
"html" : theBody,
"css": self.htmlStyle,
"html": theBody,
}
elif theFmt == self.FMT_JSON_M:
@@ -963,7 +963,7 @@ class GuiBuildNovel(QDialog):
for nwdPage in makeMd.theMarkdown:
theBody.append(nwdPage.split("\n"))
jsonData["text"] = {
"nwd" : theBody,
"nwd": theBody,
}
try:
@@ -1076,9 +1076,9 @@ class GuiBuildNovel(QDialog):
try:
with open(buildCache, mode="w+", encoding="utf8") as outFile:
outFile.write(json.dumps({
"buildTime" : self.buildTime,
"htmlStyle" : self.htmlStyle,
"htmlText" : self.htmlText,
"buildTime": self.buildTime,
"htmlStyle": self.htmlStyle,
"htmlText": self.htmlText,
}, indent=2))
except Exception:
logger.error("Failed to save build cache")
@@ -1116,11 +1116,11 @@ class GuiBuildNovel(QDialog):
# Formatting
self.theProject.setTitleFormat({
"title" : self.fmtTitle.text().strip(),
"chapter" : self.fmtChapter.text().strip(),
"unnumbered" : self.fmtUnnumbered.text().strip(),
"scene" : self.fmtScene.text().strip(),
"section" : self.fmtSection.text().strip(),
"title": self.fmtTitle.text().strip(),
"chapter": self.fmtChapter.text().strip(),
"unnumbered": self.fmtUnnumbered.text().strip(),
"scene": self.fmtScene.text().strip(),
"section": self.fmtSection.text().strip(),
})
buildLang = self.buildLang.currentData()
+1 -1
View File
@@ -49,6 +49,6 @@ gui_scripts =
universal = 0
[flake8]
ignore = E203,E221,E226,E228,E241,E251
ignore = E221,E226,E228,E241,E251
max-line-length = 99
exclude = docs/*