Merge branch 'main' into release_0.12
This commit is contained in:
+1
-3
@@ -10,9 +10,7 @@ coverage:
|
|||||||
project:
|
project:
|
||||||
default:
|
default:
|
||||||
threshold: 1%
|
threshold: 1%
|
||||||
patch:
|
patch: no
|
||||||
default:
|
|
||||||
threshold: 1%
|
|
||||||
changes: no
|
changes: no
|
||||||
|
|
||||||
parsers:
|
parsers:
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
name: Flake 8 Checks
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ main ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ main ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
checkSyntax:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Python Setup
|
||||||
|
uses: actions/setup-python@v1
|
||||||
|
with:
|
||||||
|
python-version: 3.7
|
||||||
|
architecture: x64
|
||||||
|
- name: Checkout novelWriter
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Install flake8
|
||||||
|
run: pip install flake8
|
||||||
|
- name: Check for Syntax Error on novelWriter
|
||||||
|
run: flake8 nw --count --select=E9,F63,F7,F82 --show-source --statistics
|
||||||
|
- name: Check for Syntax Error on Tests
|
||||||
|
run: flake8 tests --count --select=E9,F63,F7,F82 --show-source --statistics
|
||||||
|
- name: Check for Code Style on novelWriter
|
||||||
|
run: flake8 nw --count --max-line-length=99 --select E1,E231,E27,E4,E5,E7,E9,W,F --show-source --statistics
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
# Read the Docs configuration file
|
||||||
|
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
|
||||||
|
|
||||||
|
# Required
|
||||||
|
version: 2
|
||||||
|
|
||||||
|
# Build documentation in the docs/ directory with Sphinx
|
||||||
|
sphinx:
|
||||||
|
configuration: docs/source/conf.py
|
||||||
|
|
||||||
|
# Build documentation with MkDocs
|
||||||
|
#mkdocs:
|
||||||
|
# configuration: mkdocs.yml
|
||||||
|
|
||||||
|
# Optionally build your docs in additional formats such as PDF
|
||||||
|
formats:
|
||||||
|
- htmlzip
|
||||||
|
- epub
|
||||||
|
- pdf
|
||||||
|
|
||||||
|
# Optionally set the version of Python and requirements required to build your docs
|
||||||
|
python:
|
||||||
|
version: 3.7
|
||||||
|
install:
|
||||||
|
- requirements: docs/source/requirements.txt
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
sphinx_rtd_theme
|
||||||
+4
-4
@@ -239,13 +239,13 @@ def main(sysArgs=None):
|
|||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import PyQt5.QtSvg
|
import PyQt5.QtSvg # noqa: F401
|
||||||
except:
|
except ImportError:
|
||||||
errorData.append("Python module 'PyQt5.QtSvg' is missing.")
|
errorData.append("Python module 'PyQt5.QtSvg' is missing.")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import lxml
|
import lxml # noqa: F401
|
||||||
except:
|
except ImportError:
|
||||||
errorData.append("Python module 'lxml' is missing.")
|
errorData.append("Python module 'lxml' is missing.")
|
||||||
|
|
||||||
if errorData:
|
if errorData:
|
||||||
|
|||||||
+4
-5
@@ -26,7 +26,6 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import nw
|
|
||||||
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
@@ -38,7 +37,7 @@ def checkString(checkValue, defaultValue, allowNone=False):
|
|||||||
"""Check if a variable is a string or a none.
|
"""Check if a variable is a string or a none.
|
||||||
"""
|
"""
|
||||||
if allowNone:
|
if allowNone:
|
||||||
if checkValue == None:
|
if checkValue is None:
|
||||||
return None
|
return None
|
||||||
if checkValue == "None":
|
if checkValue == "None":
|
||||||
return None
|
return None
|
||||||
@@ -50,20 +49,20 @@ def checkInt(checkValue, defaultValue, allowNone=False):
|
|||||||
"""Check if a variable is an integer or a none.
|
"""Check if a variable is an integer or a none.
|
||||||
"""
|
"""
|
||||||
if allowNone:
|
if allowNone:
|
||||||
if checkValue == None:
|
if checkValue is None:
|
||||||
return None
|
return None
|
||||||
if checkValue == "None":
|
if checkValue == "None":
|
||||||
return None
|
return None
|
||||||
try:
|
try:
|
||||||
return int(checkValue)
|
return int(checkValue)
|
||||||
except:
|
except Exception:
|
||||||
return defaultValue
|
return defaultValue
|
||||||
|
|
||||||
def checkBool(checkValue, defaultValue, allowNone=False):
|
def checkBool(checkValue, defaultValue, allowNone=False):
|
||||||
"""Check if a variable is a boolean or a none.
|
"""Check if a variable is a boolean or a none.
|
||||||
"""
|
"""
|
||||||
if allowNone:
|
if allowNone:
|
||||||
if checkValue == None:
|
if checkValue is None:
|
||||||
return None
|
return None
|
||||||
if checkValue == "None":
|
if checkValue == "None":
|
||||||
return None
|
return None
|
||||||
|
|||||||
+4
-5
@@ -29,7 +29,6 @@ import logging
|
|||||||
import configparser
|
import configparser
|
||||||
import json
|
import json
|
||||||
import sys
|
import sys
|
||||||
import nw
|
|
||||||
|
|
||||||
from os import path, mkdir, unlink, rename
|
from os import path, mkdir, unlink, rename
|
||||||
from time import time
|
from time import time
|
||||||
@@ -862,7 +861,7 @@ class Config:
|
|||||||
for i in range(listLen):
|
for i in range(listLen):
|
||||||
try:
|
try:
|
||||||
outData.append(castTo(inData[i]))
|
outData.append(castTo(inData[i]))
|
||||||
except:
|
except Exception:
|
||||||
outData.append(listDefault[i])
|
outData.append(listDefault[i])
|
||||||
return outData
|
return outData
|
||||||
|
|
||||||
@@ -902,16 +901,16 @@ class Config:
|
|||||||
"""Cheks if we have the optional packages used by some features.
|
"""Cheks if we have the optional packages used by some features.
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
import enchant
|
import enchant # noqa: F401
|
||||||
self.hasEnchant = True
|
self.hasEnchant = True
|
||||||
logger.debug("Checking package 'pyenchant': Ok")
|
logger.debug("Checking package 'pyenchant': Ok")
|
||||||
except:
|
except Exception:
|
||||||
self.hasEnchant = False
|
self.hasEnchant = False
|
||||||
logger.debug("Checking package 'pyenchant': Missing")
|
logger.debug("Checking package 'pyenchant': Missing")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.hasAssistant = which("assistant")
|
self.hasAssistant = which("assistant")
|
||||||
except:
|
except Exception:
|
||||||
self.hasAssistant = False
|
self.hasAssistant = False
|
||||||
if self.hasAssistant:
|
if self.hasAssistant:
|
||||||
logger.debug("Checking executable 'assistant': Ok")
|
logger.debug("Checking executable 'assistant': Ok")
|
||||||
|
|||||||
+1
-4
@@ -27,7 +27,6 @@
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
import json
|
import json
|
||||||
import nw
|
|
||||||
|
|
||||||
from os import path
|
from os import path
|
||||||
from time import time
|
from time import time
|
||||||
@@ -222,7 +221,7 @@ class NWIndex():
|
|||||||
if len(self.textCounts[tHandle]) != 3:
|
if len(self.textCounts[tHandle]) != 3:
|
||||||
self.indexBroken = True
|
self.indexBroken = True
|
||||||
|
|
||||||
except:
|
except Exception:
|
||||||
self.indexBroken = True
|
self.indexBroken = True
|
||||||
|
|
||||||
if self.indexBroken:
|
if self.indexBroken:
|
||||||
@@ -603,8 +602,6 @@ class NWIndex():
|
|||||||
by tHandle.
|
by tHandle.
|
||||||
"""
|
"""
|
||||||
theRefs = {}
|
theRefs = {}
|
||||||
|
|
||||||
tItem = self.theProject.projTree[tHandle]
|
|
||||||
if tHandle is None:
|
if tHandle is None:
|
||||||
return theRefs
|
return theRefs
|
||||||
|
|
||||||
|
|||||||
+17
-18
@@ -26,7 +26,6 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import nw
|
|
||||||
|
|
||||||
from lxml import etree
|
from lxml import etree
|
||||||
|
|
||||||
@@ -73,19 +72,19 @@ class NWItem():
|
|||||||
"order" : str(self.itemOrder),
|
"order" : str(self.itemOrder),
|
||||||
"parent" : str(self.parHandle),
|
"parent" : str(self.parHandle),
|
||||||
})
|
})
|
||||||
xSub = self._subPack(xPack,"name", text=str(self.itemName))
|
self._subPack(xPack, "name", text=str(self.itemName))
|
||||||
xSub = self._subPack(xPack,"type", text=str(self.itemType.name))
|
self._subPack(xPack, "type", text=str(self.itemType.name))
|
||||||
xSub = self._subPack(xPack,"class", text=str(self.itemClass.name))
|
self._subPack(xPack, "class", text=str(self.itemClass.name))
|
||||||
xSub = self._subPack(xPack,"status", text=str(self.itemStatus))
|
self._subPack(xPack, "status", text=str(self.itemStatus))
|
||||||
if self.itemType == nwItemType.FILE:
|
if self.itemType == nwItemType.FILE:
|
||||||
xSub = self._subPack(xPack,"exported", text=str(self.isExported))
|
self._subPack(xPack, "exported", text=str(self.isExported))
|
||||||
xSub = self._subPack(xPack,"layout", text=str(self.itemLayout.name))
|
self._subPack(xPack, "layout", text=str(self.itemLayout.name))
|
||||||
xSub = self._subPack(xPack,"charCount", text=str(self.charCount), none=False)
|
self._subPack(xPack, "charCount", text=str(self.charCount), none=False)
|
||||||
xSub = self._subPack(xPack,"wordCount", text=str(self.wordCount), none=False)
|
self._subPack(xPack, "wordCount", text=str(self.wordCount), none=False)
|
||||||
xSub = self._subPack(xPack,"paraCount", text=str(self.paraCount), none=False)
|
self._subPack(xPack, "paraCount", text=str(self.paraCount), none=False)
|
||||||
xSub = self._subPack(xPack,"cursorPos", text=str(self.cursorPos), none=False)
|
self._subPack(xPack, "cursorPos", text=str(self.cursorPos), none=False)
|
||||||
else:
|
else:
|
||||||
xSub = self._subPack(xPack,"expanded", text=str(self.isExpanded))
|
self._subPack(xPack, "expanded", text=str(self.isExpanded))
|
||||||
return
|
return
|
||||||
|
|
||||||
def unpackXML(self, xItem):
|
def unpackXML(self, xItem):
|
||||||
@@ -130,12 +129,12 @@ class NWItem():
|
|||||||
def _subPack(xParent, name, attrib=None, text=None, none=True):
|
def _subPack(xParent, name, attrib=None, text=None, none=True):
|
||||||
"""Packs the values into an xml element.
|
"""Packs the values into an xml element.
|
||||||
"""
|
"""
|
||||||
if not none and (text == None or text == "None"):
|
if not none and (text is None or text == "None"):
|
||||||
return None
|
return None
|
||||||
xSub = etree.SubElement(xParent, name, attrib=attrib)
|
xSub = etree.SubElement(xParent, name, attrib=attrib)
|
||||||
if text is not None:
|
if text is not None:
|
||||||
xSub.text = text
|
xSub.text = text
|
||||||
return xSub
|
return
|
||||||
|
|
||||||
##
|
##
|
||||||
# Set Item Values
|
# Set Item Values
|
||||||
@@ -233,18 +232,18 @@ class NWItem():
|
|||||||
"""Save the expanded status of an item in the project tree.
|
"""Save the expanded status of an item in the project tree.
|
||||||
"""
|
"""
|
||||||
if isinstance(expState, str):
|
if isinstance(expState, str):
|
||||||
self.isExpanded = expState == str(True)
|
self.isExpanded = (expState == str(True))
|
||||||
else:
|
else:
|
||||||
self.isExpanded = expState == True
|
self.isExpanded = (expState == True) # noqa: E712
|
||||||
return
|
return
|
||||||
|
|
||||||
def setExported(self, expState):
|
def setExported(self, expState):
|
||||||
"""Save the export flag.
|
"""Save the export flag.
|
||||||
"""
|
"""
|
||||||
if isinstance(expState, str):
|
if isinstance(expState, str):
|
||||||
self.isExported = expState == str(True)
|
self.isExported = (expState == str(True))
|
||||||
else:
|
else:
|
||||||
self.isExported = expState == True
|
self.isExported = (expState == True) # noqa: E712
|
||||||
return
|
return
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|||||||
+3
-3
@@ -153,15 +153,15 @@ class OptionState():
|
|||||||
def setValue(self, setGroup, setName, setValue):
|
def setValue(self, setGroup, setName, setValue):
|
||||||
"""Saves a value, with a given group and name.
|
"""Saves a value, with a given group and name.
|
||||||
"""
|
"""
|
||||||
if not setGroup in self.validMap:
|
if setGroup not in self.validMap:
|
||||||
logger.error("Unknown option group '%s'" % setGroup)
|
logger.error("Unknown option group '%s'" % setGroup)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if not setName in self.validMap[setGroup]:
|
if setName not in self.validMap[setGroup]:
|
||||||
logger.error("Unknown option name '%s'" % setName)
|
logger.error("Unknown option name '%s'" % setName)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if not setGroup in self.theState:
|
if setGroup not in self.theState:
|
||||||
self.theState[setGroup] = {}
|
self.theState[setGroup] = {}
|
||||||
|
|
||||||
self.theState[setGroup][setName] = setValue
|
self.theState[setGroup][setName] = setValue
|
||||||
|
|||||||
+17
-17
@@ -26,7 +26,6 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import json
|
|
||||||
import nw
|
import nw
|
||||||
|
|
||||||
from os import path, mkdir, listdir, unlink, rename, rmdir
|
from os import path, mkdir, listdir, unlink, rename, rmdir
|
||||||
@@ -265,27 +264,28 @@ class NWProject():
|
|||||||
if popMinimal:
|
if popMinimal:
|
||||||
# Creating a minimal project with a few root folders and a
|
# Creating a minimal project with a few root folders and a
|
||||||
# single chapter folder with a single file.
|
# single chapter folder with a single file.
|
||||||
nHandle = self.newRoot("Novel", nwItemClass.NOVEL)
|
xHandle = {}
|
||||||
xHandle = self.newRoot("Plot", nwItemClass.PLOT)
|
xHandle[1] = self.newRoot("Novel", nwItemClass.NOVEL)
|
||||||
xHandle = self.newRoot("Characters", nwItemClass.CHARACTER)
|
xHandle[2] = self.newRoot("Plot", nwItemClass.PLOT)
|
||||||
xHandle = self.newRoot("World", nwItemClass.WORLD)
|
xHandle[3] = self.newRoot("Characters", nwItemClass.CHARACTER)
|
||||||
tHandle = self.newFile("Title Page", nwItemClass.NOVEL, nHandle)
|
xHandle[4] = self.newRoot("World", nwItemClass.WORLD)
|
||||||
dHandle = self.newFolder("New Chapter", nwItemClass.NOVEL, nHandle)
|
xHandle[5] = self.newFile("Title Page", nwItemClass.NOVEL, xHandle[1])
|
||||||
cHandle = self.newFile("New Chapter", nwItemClass.NOVEL, dHandle)
|
xHandle[6] = self.newFolder("New Chapter", nwItemClass.NOVEL, xHandle[1])
|
||||||
sHandle = self.newFile("New Scene", nwItemClass.NOVEL, dHandle)
|
xHandle[7] = self.newFile("New Chapter", nwItemClass.NOVEL, xHandle[6])
|
||||||
|
xHandle[8] = self.newFile("New Scene", nwItemClass.NOVEL, xHandle[6])
|
||||||
|
|
||||||
self.projTree.setFileItemLayout(tHandle, nwItemLayout.TITLE)
|
self.projTree.setFileItemLayout(xHandle[5], nwItemLayout.TITLE)
|
||||||
self.projTree.setFileItemLayout(cHandle, nwItemLayout.CHAPTER)
|
self.projTree.setFileItemLayout(xHandle[7], nwItemLayout.CHAPTER)
|
||||||
|
|
||||||
aDoc.openDocument(tHandle, showStatus=False)
|
aDoc.openDocument(xHandle[5], showStatus=False)
|
||||||
aDoc.saveDocument(titlePage)
|
aDoc.saveDocument(titlePage)
|
||||||
aDoc.clearDocument()
|
aDoc.clearDocument()
|
||||||
|
|
||||||
aDoc.openDocument(cHandle, showStatus=False)
|
aDoc.openDocument(xHandle[7], showStatus=False)
|
||||||
aDoc.saveDocument("## New Chapter\n\n")
|
aDoc.saveDocument("## New Chapter\n\n")
|
||||||
aDoc.clearDocument()
|
aDoc.clearDocument()
|
||||||
|
|
||||||
aDoc.openDocument(sHandle, showStatus=False)
|
aDoc.openDocument(xHandle[8], showStatus=False)
|
||||||
aDoc.saveDocument("### New Scene\n\n")
|
aDoc.saveDocument("### New Scene\n\n")
|
||||||
aDoc.clearDocument()
|
aDoc.clearDocument()
|
||||||
|
|
||||||
@@ -838,7 +838,6 @@ class NWProject():
|
|||||||
project path, or if the folder doesn't exist, look for the zip
|
project path, or if the folder doesn't exist, look for the zip
|
||||||
file in the assets folder.
|
file in the assets folder.
|
||||||
"""
|
"""
|
||||||
projName = projData.get("projName", "Sample Project")
|
|
||||||
projPath = projData.get("projPath", None)
|
projPath = projData.get("projPath", None)
|
||||||
if projPath is None:
|
if projPath is None:
|
||||||
logger.error("No project path set for the example project")
|
logger.error("No project path set for the example project")
|
||||||
@@ -1243,7 +1242,8 @@ class NWProject():
|
|||||||
for aValue in theValue:
|
for aValue in theValue:
|
||||||
if not isinstance(aValue, str):
|
if not isinstance(aValue, str):
|
||||||
aValue = str(aValue)
|
aValue = str(aValue)
|
||||||
if aValue == "" and not allowNone: continue
|
if aValue == "" and not allowNone:
|
||||||
|
continue
|
||||||
xItem = etree.SubElement(xParent, theName)
|
xItem = etree.SubElement(xParent, theName)
|
||||||
xItem.text = aValue
|
xItem.text = aValue
|
||||||
return
|
return
|
||||||
@@ -1402,7 +1402,7 @@ class NWProject():
|
|||||||
try:
|
try:
|
||||||
rmdir(theData)
|
rmdir(theData)
|
||||||
logger.info("Removed folder: %s" % theFolder)
|
logger.info("Removed folder: %s" % theFolder)
|
||||||
except:
|
except Exception:
|
||||||
errList.append("Failed to remove: %s" % theFolder)
|
errList.append("Failed to remove: %s" % theFolder)
|
||||||
|
|
||||||
return errList
|
return errList
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ class NWSpellEnchant(NWSpellCheck):
|
|||||||
self.theDict = enchant.Dict(theLang)
|
self.theDict = enchant.Dict(theLang)
|
||||||
self.spellLanguage = theLang
|
self.spellLanguage = theLang
|
||||||
logger.debug("Enchant spell checking for language %s loaded" % theLang)
|
logger.debug("Enchant spell checking for language %s loaded" % theLang)
|
||||||
except:
|
except Exception:
|
||||||
logger.error("Failed to load enchant spell checking for language %s" % theLang)
|
logger.error("Failed to load enchant spell checking for language %s" % theLang)
|
||||||
self.theDict = NWSpellEnchantDummy()
|
self.theDict = NWSpellEnchantDummy()
|
||||||
self.spellLanguage = None
|
self.spellLanguage = None
|
||||||
@@ -186,7 +186,7 @@ class NWSpellEnchant(NWSpellCheck):
|
|||||||
for spTag, spProvider in enchant.list_dicts():
|
for spTag, spProvider in enchant.list_dicts():
|
||||||
spName = "%s [%s]" % (self.expandLanguage(spTag), spProvider.name)
|
spName = "%s [%s]" % (self.expandLanguage(spTag), spProvider.name)
|
||||||
retList.append((spTag, spName))
|
retList.append((spTag, spName))
|
||||||
except:
|
except Exception:
|
||||||
logger.error("Failed to list languages for enchant spell checking")
|
logger.error("Failed to list languages for enchant spell checking")
|
||||||
return retList
|
return retList
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,6 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import nw
|
|
||||||
|
|
||||||
from lxml import etree
|
from lxml import etree
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,6 @@
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
import nw
|
|
||||||
|
|
||||||
from nw.core.tokenizer import Tokenizer
|
from nw.core.tokenizer import Tokenizer
|
||||||
from nw.constants import nwUnicode, nwLabels, nwKeyWords
|
from nw.constants import nwUnicode, nwLabels, nwKeyWords
|
||||||
@@ -153,12 +152,6 @@ class ToHtml(Tokenizer):
|
|||||||
h3 = "h3"
|
h3 = "h3"
|
||||||
h4 = "h4"
|
h4 = "h4"
|
||||||
|
|
||||||
alignHead = self.A_LEFT
|
|
||||||
if self.doJustify:
|
|
||||||
alignPar = self.A_JUSTIFY
|
|
||||||
else:
|
|
||||||
alignPar = self.A_LEFT
|
|
||||||
|
|
||||||
self.theResult = ""
|
self.theResult = ""
|
||||||
|
|
||||||
thisPar = []
|
thisPar = []
|
||||||
|
|||||||
+23
-40
@@ -28,7 +28,6 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import nw
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -78,7 +77,8 @@ def countWords(theText):
|
|||||||
charCount += theLen
|
charCount += theLen
|
||||||
if countPara and prevEmpty:
|
if countPara and prevEmpty:
|
||||||
paraCount += 1
|
paraCount += 1
|
||||||
prevEmpty = countPara == False
|
|
||||||
|
prevEmpty = not countPara
|
||||||
|
|
||||||
return charCount, wordCount, paraCount
|
return charCount, wordCount, paraCount
|
||||||
|
|
||||||
@@ -139,48 +139,31 @@ def _numberToWordEN(numVal):
|
|||||||
tenVal = (numVal-oneVal) % 100
|
tenVal = (numVal-oneVal) % 100
|
||||||
hunVal = (numVal-tenVal-oneVal) % 1000
|
hunVal = (numVal-tenVal-oneVal) % 1000
|
||||||
|
|
||||||
if hunVal == 100: hunWord = "One Hundred"
|
theHundreds = {
|
||||||
if hunVal == 200: hunWord = "Two Hundred"
|
100: "One Hundred", 200: "Two Hundred", 300: "Three Hundred",
|
||||||
if hunVal == 300: hunWord = "Three Hundred"
|
400: "Four Hundred", 500: "Five Hundred", 600: "Six Hundred",
|
||||||
if hunVal == 400: hunWord = "Four Hundred"
|
700: "Seven Hundred", 800: "Eight Hundred", 900: "Nine Hundred",
|
||||||
if hunVal == 500: hunWord = "Five Hundred"
|
}
|
||||||
if hunVal == 600: hunWord = "Six Hundred"
|
theTens = {
|
||||||
if hunVal == 700: hunWord = "Seven Hundred"
|
20: "Twenty", 30: "Thirty", 40: "Forty", 50: "Fifty",
|
||||||
if hunVal == 800: hunWord = "Eight Hundred"
|
60: "Sixty", 70: "Seventy", 80: "Eighty", 90: "Ninety",
|
||||||
if hunVal == 900: hunWord = "Nine Hundred"
|
}
|
||||||
|
theTeens = {
|
||||||
if tenVal == 20: tenWord = "Twenty"
|
0: "Ten", 1: "Eleven", 2: "Twelve", 3: "Thirteen", 4: "Fourteen",
|
||||||
if tenVal == 30: tenWord = "Thirty"
|
5: "Fifteen", 6: "Sixteen", 7: "Seventeen", 8: "Eighteen", 9: "Nineteen",
|
||||||
if tenVal == 40: tenWord = "Forty"
|
}
|
||||||
if tenVal == 50: tenWord = "Fifty"
|
theOnes = {
|
||||||
if tenVal == 60: tenWord = "Sixty"
|
0: "", 1: "One", 2: "Two", 3: "Three", 4: "Four",
|
||||||
if tenVal == 70: tenWord = "Seventy"
|
5: "Five", 6: "Six", 7: "Seven", 8: "Eight", 9: "Nine",
|
||||||
if tenVal == 80: tenWord = "Eighty"
|
}
|
||||||
if tenVal == 90: tenWord = "Ninety"
|
|
||||||
|
|
||||||
|
hunWord = theHundreds.get(hunVal, "")
|
||||||
|
tenWord = theTens.get(tenVal, "")
|
||||||
if tenVal == 10:
|
if tenVal == 10:
|
||||||
if oneVal == 0: oneWord = "Ten"
|
oneWord = theTeens.get(oneVal, "")
|
||||||
if oneVal == 1: oneWord = "Eleven"
|
|
||||||
if oneVal == 2: oneWord = "Twelve"
|
|
||||||
if oneVal == 3: oneWord = "Thirteen"
|
|
||||||
if oneVal == 4: oneWord = "Fourteen"
|
|
||||||
if oneVal == 5: oneWord = "Fifteen"
|
|
||||||
if oneVal == 6: oneWord = "Sixteen"
|
|
||||||
if oneVal == 7: oneWord = "Seventeen"
|
|
||||||
if oneVal == 8: oneWord = "Eighteen"
|
|
||||||
if oneVal == 9: oneWord = "Nineteen"
|
|
||||||
numWord = ("%s %s" % (hunWord, oneWord)).strip()
|
numWord = ("%s %s" % (hunWord, oneWord)).strip()
|
||||||
else:
|
else:
|
||||||
if oneVal == 0: oneWord = ""
|
oneWord = theOnes.get(oneVal, "")
|
||||||
if oneVal == 1: oneWord = "One"
|
|
||||||
if oneVal == 2: oneWord = "Two"
|
|
||||||
if oneVal == 3: oneWord = "Three"
|
|
||||||
if oneVal == 4: oneWord = "Four"
|
|
||||||
if oneVal == 5: oneWord = "Five"
|
|
||||||
if oneVal == 6: oneWord = "Six"
|
|
||||||
if oneVal == 7: oneWord = "Seven"
|
|
||||||
if oneVal == 8: oneWord = "Eight"
|
|
||||||
if oneVal == 9: oneWord = "Nine"
|
|
||||||
if tenVal == 0:
|
if tenVal == 0:
|
||||||
numWord = ("%s %s" % (hunWord, oneWord)).strip()
|
numWord = ("%s %s" % (hunWord, oneWord)).strip()
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -27,7 +27,6 @@
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
import json
|
import json
|
||||||
import nw
|
|
||||||
|
|
||||||
from os import path
|
from os import path
|
||||||
from lxml import etree
|
from lxml import etree
|
||||||
|
|||||||
@@ -964,7 +964,6 @@ class GuiBuildNovelDocView(QTextBrowser):
|
|||||||
lblFont.setPointSizeF(0.9*self.theTheme.fontPointSize)
|
lblFont.setPointSizeF(0.9*self.theTheme.fontPointSize)
|
||||||
|
|
||||||
fPx = int(1.1*self.theTheme.fontPixelSize)
|
fPx = int(1.1*self.theTheme.fontPixelSize)
|
||||||
mPx = self.mainConf.pxInt(4)
|
|
||||||
|
|
||||||
self.theTitle = QLabel("<b>Build Time:</b> Unknown", self)
|
self.theTitle = QLabel("<b>Build Time:</b> Unknown", self)
|
||||||
self.theTitle.setIndent(0)
|
self.theTitle.setIndent(0)
|
||||||
|
|||||||
+3
-9
@@ -963,7 +963,8 @@ class GuiDocEditor(QTextEdit):
|
|||||||
logger.info(
|
logger.info(
|
||||||
"The document size is %d > %d, big doc mode is enabled" % (
|
"The document size is %d > %d, big doc mode is enabled" % (
|
||||||
theSize, self.mainConf.bigDocLimit*1000
|
theSize, self.mainConf.bigDocLimit*1000
|
||||||
))
|
)
|
||||||
|
)
|
||||||
self.bigDoc = True
|
self.bigDoc = True
|
||||||
else:
|
else:
|
||||||
self.bigDoc = False
|
self.bigDoc = False
|
||||||
@@ -1271,7 +1272,7 @@ class GuiDocEditor(QTextEdit):
|
|||||||
try:
|
try:
|
||||||
isFind = self.lastFind[0] == theCursor.selectionStart()
|
isFind = self.lastFind[0] == theCursor.selectionStart()
|
||||||
isFind &= self.lastFind[1] == theCursor.selectionEnd()
|
isFind &= self.lastFind[1] == theCursor.selectionEnd()
|
||||||
except:
|
except Exception:
|
||||||
isFind = False
|
isFind = False
|
||||||
|
|
||||||
if isFind:
|
if isFind:
|
||||||
@@ -1371,7 +1372,6 @@ class GuiDocEditSearch(QFrame):
|
|||||||
self.doMatchCap = self.mainConf.searchMatchCap
|
self.doMatchCap = self.mainConf.searchMatchCap
|
||||||
|
|
||||||
mPx = self.mainConf.pxInt(6)
|
mPx = self.mainConf.pxInt(6)
|
||||||
fPx = int(0.9*self.theTheme.fontPixelSize)
|
|
||||||
tPx = int(0.8*self.theTheme.fontPixelSize)
|
tPx = int(0.8*self.theTheme.fontPixelSize)
|
||||||
boxFont = self.theTheme.guiFont
|
boxFont = self.theTheme.guiFont
|
||||||
boxFont.setPointSizeF(0.9*self.theTheme.fontPointSize)
|
boxFont.setPointSizeF(0.9*self.theTheme.fontPointSize)
|
||||||
@@ -1891,7 +1891,6 @@ class GuiDocEditFooter(QWidget):
|
|||||||
self.sPx = int(round(0.9*self.theTheme.baseIconSize))
|
self.sPx = int(round(0.9*self.theTheme.baseIconSize))
|
||||||
fPx = int(0.9*self.theTheme.fontPixelSize)
|
fPx = int(0.9*self.theTheme.fontPixelSize)
|
||||||
bSp = self.mainConf.pxInt(4)
|
bSp = self.mainConf.pxInt(4)
|
||||||
hSp = self.mainConf.pxInt(8)
|
|
||||||
|
|
||||||
lblFont = self.font()
|
lblFont = self.font()
|
||||||
lblFont.setPointSizeF(0.9*self.theTheme.fontPointSize)
|
lblFont.setPointSizeF(0.9*self.theTheme.fontPointSize)
|
||||||
@@ -1901,11 +1900,6 @@ class GuiDocEditFooter(QWidget):
|
|||||||
self.setAutoFillBackground(True)
|
self.setAutoFillBackground(True)
|
||||||
self.setPalette(self.thePalette)
|
self.setPalette(self.thePalette)
|
||||||
|
|
||||||
buttonStyle = (
|
|
||||||
"QToolButton {{border: none; background: transparent;}} "
|
|
||||||
"QToolButton:hover {{border: none; background: rgba({0},{1},{2},0.2);}}"
|
|
||||||
).format(*self.theTheme.colText)
|
|
||||||
|
|
||||||
# Status
|
# Status
|
||||||
self.statusIcon = QLabel("")
|
self.statusIcon = QLabel("")
|
||||||
self.statusIcon.setContentsMargins(0, 0, 0, 0)
|
self.statusIcon.setContentsMargins(0, 0, 0, 0)
|
||||||
|
|||||||
@@ -366,7 +366,6 @@ class GuiDocViewer(QTextBrowser):
|
|||||||
"}}\n"
|
"}}\n"
|
||||||
).format(
|
).format(
|
||||||
textSize = self.mainConf.textSize,
|
textSize = self.mainConf.textSize,
|
||||||
preSize = self.mainConf.textSize*0.9,
|
|
||||||
tColR = self.theTheme.colText[0],
|
tColR = self.theTheme.colText[0],
|
||||||
tColG = self.theTheme.colText[1],
|
tColG = self.theTheme.colText[1],
|
||||||
tColB = self.theTheme.colText[2],
|
tColB = self.theTheme.colText[2],
|
||||||
@@ -701,7 +700,6 @@ class GuiDocViewDetails(QScrollArea):
|
|||||||
self.refList.setScaledContents(True)
|
self.refList.setScaledContents(True)
|
||||||
self.refList.linkActivated.connect(self._linkClicked)
|
self.refList.linkActivated.connect(self._linkClicked)
|
||||||
|
|
||||||
hCol = self.palette().highlight().color()
|
|
||||||
self.linkStyle = "style='color: rgb({0},{1},{2})'".format(
|
self.linkStyle = "style='color: rgb({0},{1},{2})'".format(
|
||||||
*self.theTheme.colLink
|
*self.theTheme.colLink
|
||||||
)
|
)
|
||||||
|
|||||||
+4
-5
@@ -193,7 +193,7 @@ class GuiOutline(QTreeWidget):
|
|||||||
tHandle = tItem.data(self.colIndex[nwOutline.TITLE], Qt.UserRole)
|
tHandle = tItem.data(self.colIndex[nwOutline.TITLE], Qt.UserRole)
|
||||||
try:
|
try:
|
||||||
tLine = int(tItem.text(self.colIndex[nwOutline.LINE]))
|
tLine = int(tItem.text(self.colIndex[nwOutline.LINE]))
|
||||||
except:
|
except Exception:
|
||||||
tLine = 1
|
tLine = 1
|
||||||
|
|
||||||
logger.verbose("User selected entry with handle %s on line %s" % (tHandle, tLine))
|
logger.verbose("User selected entry with handle %s on line %s" % (tHandle, tLine))
|
||||||
@@ -254,7 +254,7 @@ class GuiOutline(QTreeWidget):
|
|||||||
for hName in tempOrder:
|
for hName in tempOrder:
|
||||||
try:
|
try:
|
||||||
treeOrder.append(nwOutline[hName])
|
treeOrder.append(nwOutline[hName])
|
||||||
except:
|
except Exception:
|
||||||
logger.warning("Ignored unknown outline column '%s'" % str(hName))
|
logger.warning("Ignored unknown outline column '%s'" % str(hName))
|
||||||
|
|
||||||
# Add columns that was not in the file to the treeOrder array.
|
# Add columns that was not in the file to the treeOrder array.
|
||||||
@@ -276,14 +276,14 @@ class GuiOutline(QTreeWidget):
|
|||||||
for hName in tmpWidth:
|
for hName in tmpWidth:
|
||||||
try:
|
try:
|
||||||
self.colWidth[nwOutline[hName]] = self.mainConf.pxInt(tmpWidth[hName])
|
self.colWidth[nwOutline[hName]] = self.mainConf.pxInt(tmpWidth[hName])
|
||||||
except:
|
except Exception:
|
||||||
logger.warning("Ignored unknown outline column '%s'" % str(hName))
|
logger.warning("Ignored unknown outline column '%s'" % str(hName))
|
||||||
|
|
||||||
tmpHidden = self.optState.getValue("GuiOutline", "columnHidden", {})
|
tmpHidden = self.optState.getValue("GuiOutline", "columnHidden", {})
|
||||||
for hName in tmpHidden:
|
for hName in tmpHidden:
|
||||||
try:
|
try:
|
||||||
self.colHidden[nwOutline[hName]] = tmpHidden[hName]
|
self.colHidden[nwOutline[hName]] = tmpHidden[hName]
|
||||||
except:
|
except Exception:
|
||||||
logger.warning("Ignored unknown outline column '%s'" % str(hName))
|
logger.warning("Ignored unknown outline column '%s'" % str(hName))
|
||||||
|
|
||||||
self.headerMenu.setHiddenState(self.colHidden)
|
self.headerMenu.setHiddenState(self.colHidden)
|
||||||
@@ -374,7 +374,6 @@ class GuiOutline(QTreeWidget):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
tLevel = self.theIndex.novelIndex[tHandle][sTitle]["level"]
|
tLevel = self.theIndex.novelIndex[tHandle][sTitle]["level"]
|
||||||
tTime = self.theIndex.novelIndex[tHandle][sTitle]["updated"]
|
|
||||||
tItem = self._createTreeItem(tHandle, sTitle, tLevel)
|
tItem = self._createTreeItem(tHandle, sTitle, tLevel)
|
||||||
self.treeMap[titleKey] = tItem
|
self.treeMap[titleKey] = tItem
|
||||||
|
|
||||||
|
|||||||
@@ -30,8 +30,7 @@ import nw
|
|||||||
|
|
||||||
from PyQt5.QtCore import Qt
|
from PyQt5.QtCore import Qt
|
||||||
from PyQt5.QtWidgets import (
|
from PyQt5.QtWidgets import (
|
||||||
QScrollArea, QWidget, QGridLayout, QHBoxLayout, QGroupBox, QLabel,
|
QScrollArea, QWidget, QGridLayout, QHBoxLayout, QGroupBox, QLabel
|
||||||
QSizePolicy
|
|
||||||
)
|
)
|
||||||
|
|
||||||
from nw.constants import nwLabels, nwKeyWords
|
from nw.constants import nwLabels, nwKeyWords
|
||||||
@@ -237,7 +236,7 @@ class GuiOutlineDetails(QScrollArea):
|
|||||||
nwItem = self.theProject.projTree[tHandle]
|
nwItem = self.theProject.projTree[tHandle]
|
||||||
novIdx = self.theIndex.novelIndex[tHandle][sTitle]
|
novIdx = self.theIndex.novelIndex[tHandle][sTitle]
|
||||||
theRefs = self.theIndex.getReferences(tHandle, sTitle)
|
theRefs = self.theIndex.getReferences(tHandle, sTitle)
|
||||||
except:
|
except Exception:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if novIdx["level"] in self.LVL_MAP:
|
if novIdx["level"] in self.LVL_MAP:
|
||||||
|
|||||||
@@ -720,7 +720,6 @@ class GuiConfigEditEditingTab(QWidget):
|
|||||||
def _disableComboItem(self, theList, theValue):
|
def _disableComboItem(self, theList, theValue):
|
||||||
"""Disable a list item in the combo box.
|
"""Disable a list item in the combo box.
|
||||||
"""
|
"""
|
||||||
theIdx = theList.findData(theValue)
|
|
||||||
theModel = theList.model()
|
theModel = theList.model()
|
||||||
anItem = theModel.item(1)
|
anItem = theModel.item(1)
|
||||||
anItem.setFlags(anItem.flags() ^ Qt.ItemIsEnabled)
|
anItem.setFlags(anItem.flags() ^ Qt.ItemIsEnabled)
|
||||||
|
|||||||
@@ -422,7 +422,6 @@ class GuiProjectEditStatus(QWidget):
|
|||||||
"""
|
"""
|
||||||
logger.verbose("Save item button clicked")
|
logger.verbose("Save item button clicked")
|
||||||
selItem = self._getSelectedItem()
|
selItem = self._getSelectedItem()
|
||||||
iRow = self.listBox.row(selItem)
|
|
||||||
if selItem is not None:
|
if selItem is not None:
|
||||||
selIdx = selItem.data(Qt.UserRole)
|
selIdx = selItem.data(Qt.UserRole)
|
||||||
self.colData[selIdx] = (
|
self.colData[selIdx] = (
|
||||||
|
|||||||
+1
-3
@@ -475,7 +475,6 @@ class GuiProjectTree(QTreeWidget):
|
|||||||
tName = nwItem.itemName
|
tName = nwItem.itemName
|
||||||
tClass = nwItem.itemClass
|
tClass = nwItem.itemClass
|
||||||
tHandle = nwItem.itemHandle
|
tHandle = nwItem.itemHandle
|
||||||
pHandle = nwItem.parHandle
|
|
||||||
|
|
||||||
expIcon = QIcon()
|
expIcon = QIcon()
|
||||||
|
|
||||||
@@ -670,7 +669,6 @@ class GuiProjectTree(QTreeWidget):
|
|||||||
isNote = snItem.itemLayout == nwItemLayout.NOTE
|
isNote = snItem.itemLayout == nwItemLayout.NOTE
|
||||||
onFile = dnItem.itemType == nwItemType.FILE
|
onFile = dnItem.itemType == nwItemType.FILE
|
||||||
isRoot = snItem.itemType == nwItemType.ROOT
|
isRoot = snItem.itemType == nwItemType.ROOT
|
||||||
onRoot = dnItem.itemType == nwItemType.ROOT
|
|
||||||
isOnTop = self.dropIndicatorPosition() == QAbstractItemView.OnItem
|
isOnTop = self.dropIndicatorPosition() == QAbstractItemView.OnItem
|
||||||
if (isSame or isNone or isNote) and not (onFile and isOnTop) and not isRoot:
|
if (isSame or isNone or isNote) and not (onFile and isOnTop) and not isRoot:
|
||||||
logger.debug("Drag'n'drop of item %s accepted" % sHandle)
|
logger.debug("Drag'n'drop of item %s accepted" % sHandle)
|
||||||
@@ -756,7 +754,7 @@ class GuiProjectTree(QTreeWidget):
|
|||||||
if nHandle is not None and nHandle in self.theMap:
|
if nHandle is not None and nHandle in self.theMap:
|
||||||
try:
|
try:
|
||||||
byIndex = self.theMap[pHandle].indexOfChild(self.theMap[nHandle])
|
byIndex = self.theMap[pHandle].indexOfChild(self.theMap[nHandle])
|
||||||
except:
|
except Exception:
|
||||||
logger.error("Failed to get index of item with handle %s" % nHandle)
|
logger.error("Failed to get index of item with handle %s" % nHandle)
|
||||||
if byIndex >= 0:
|
if byIndex >= 0:
|
||||||
self.theMap[pHandle].insertChild(byIndex+1, newItem)
|
self.theMap[pHandle].insertChild(byIndex+1, newItem)
|
||||||
|
|||||||
+2
-3
@@ -35,7 +35,6 @@ from PyQt5.QtGui import QColor, QPainter
|
|||||||
from PyQt5.QtWidgets import qApp, QStatusBar, QLabel, QAbstractButton
|
from PyQt5.QtWidgets import qApp, QStatusBar, QLabel, QAbstractButton
|
||||||
|
|
||||||
from nw.core import NWSpellCheck
|
from nw.core import NWSpellCheck
|
||||||
from nw.common import formatInt
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -242,9 +241,9 @@ class StatusLED(QAbstractButton):
|
|||||||
"""
|
"""
|
||||||
if theState is None:
|
if theState is None:
|
||||||
self._theCol = self.colNone
|
self._theCol = self.colNone
|
||||||
elif theState == True:
|
elif theState:
|
||||||
self._theCol = self.colTrue
|
self._theCol = self.colTrue
|
||||||
elif theState == False:
|
elif not theState:
|
||||||
self._theCol = self.colFalse
|
self._theCol = self.colFalse
|
||||||
else:
|
else:
|
||||||
self._theCol = self.colNone
|
self._theCol = self.colNone
|
||||||
|
|||||||
+8
-4
@@ -33,7 +33,7 @@ import nw
|
|||||||
from os import path, listdir
|
from os import path, listdir
|
||||||
from math import ceil
|
from math import ceil
|
||||||
|
|
||||||
from PyQt5.QtCore import Qt, QSize
|
from PyQt5.QtCore import Qt
|
||||||
from PyQt5.QtSvg import QSvgWidget
|
from PyQt5.QtSvg import QSvgWidget
|
||||||
from PyQt5.QtWidgets import QStyle, qApp
|
from PyQt5.QtWidgets import QStyle, qApp
|
||||||
from PyQt5.QtGui import (
|
from PyQt5.QtGui import (
|
||||||
@@ -182,7 +182,7 @@ class GuiTheme:
|
|||||||
for fontFam in listdir(fontAssets):
|
for fontFam in listdir(fontAssets):
|
||||||
fontDir = path.join(fontAssets, fontFam)
|
fontDir = path.join(fontAssets, fontFam)
|
||||||
if path.isdir(fontDir):
|
if path.isdir(fontDir):
|
||||||
if not fontFam in self.guiFontDB.families():
|
if fontFam not in self.guiFontDB.families():
|
||||||
for fontFile in listdir(fontDir):
|
for fontFile in listdir(fontDir):
|
||||||
ttfFile = path.join(fontDir, fontFile)
|
ttfFile = path.join(fontDir, fontFile)
|
||||||
if path.isfile(ttfFile) and fontFile.endswith(".ttf"):
|
if path.isfile(ttfFile) and fontFile.endswith(".ttf"):
|
||||||
@@ -260,6 +260,7 @@ class GuiTheme:
|
|||||||
cssData = inFile.read()
|
cssData = inFile.read()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error("Could not load theme css file")
|
logger.error("Could not load theme css file")
|
||||||
|
logger.error(str(e))
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Config File
|
# Config File
|
||||||
@@ -269,6 +270,7 @@ class GuiTheme:
|
|||||||
confParser.read_file(inFile)
|
confParser.read_file(inFile)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error("Could not load theme settings from: %s" % self.confFile)
|
logger.error("Could not load theme settings from: %s" % self.confFile)
|
||||||
|
logger.error(str(e))
|
||||||
return False
|
return False
|
||||||
|
|
||||||
## Main
|
## Main
|
||||||
@@ -324,6 +326,7 @@ class GuiTheme:
|
|||||||
confParser.read_file(inFile)
|
confParser.read_file(inFile)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error("Could not load syntax colours from: %s" % self.syntaxFile)
|
logger.error("Could not load syntax colours from: %s" % self.syntaxFile)
|
||||||
|
logger.error(str(e))
|
||||||
return False
|
return False
|
||||||
|
|
||||||
## Main
|
## Main
|
||||||
@@ -438,7 +441,7 @@ class GuiTheme:
|
|||||||
outData.append(int(inData[0]))
|
outData.append(int(inData[0]))
|
||||||
outData.append(int(inData[1]))
|
outData.append(int(inData[1]))
|
||||||
outData.append(int(inData[2]))
|
outData.append(int(inData[2]))
|
||||||
except:
|
except Exception:
|
||||||
logger.error("Could not load theme colours for '%s' from config file" % cnfName)
|
logger.error("Could not load theme colours for '%s' from config file" % cnfName)
|
||||||
outData = [0, 0, 0]
|
outData = [0, 0, 0]
|
||||||
else:
|
else:
|
||||||
@@ -456,7 +459,7 @@ class GuiTheme:
|
|||||||
readCol.append(int(inData[0]))
|
readCol.append(int(inData[0]))
|
||||||
readCol.append(int(inData[1]))
|
readCol.append(int(inData[1]))
|
||||||
readCol.append(int(inData[2]))
|
readCol.append(int(inData[2]))
|
||||||
except:
|
except Exception:
|
||||||
logger.error("Could not load theme colours for '%s' from config file" % cnfName)
|
logger.error("Could not load theme colours for '%s' from config file" % cnfName)
|
||||||
return
|
return
|
||||||
if len(readCol) == 3:
|
if len(readCol) == 3:
|
||||||
@@ -615,6 +618,7 @@ class GuiIcons:
|
|||||||
confParser.read_file(inFile)
|
confParser.read_file(inFile)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error("Could not load icon theme settings from: %s" % self.confFile)
|
logger.error("Could not load icon theme settings from: %s" % self.confFile)
|
||||||
|
logger.error(str(e))
|
||||||
return False
|
return False
|
||||||
|
|
||||||
## Main
|
## Main
|
||||||
|
|||||||
+3
-4
@@ -269,7 +269,7 @@ class GuiMain(QMainWindow):
|
|||||||
"""
|
"""
|
||||||
if self.hasProject:
|
if self.hasProject:
|
||||||
msgBox = QMessageBox()
|
msgBox = QMessageBox()
|
||||||
msgRes = msgBox.warning(
|
msgBox.warning(
|
||||||
self, "New Project",
|
self, "New Project",
|
||||||
"Please close the current project before making a new one."
|
"Please close the current project before making a new one."
|
||||||
)
|
)
|
||||||
@@ -288,7 +288,7 @@ class GuiMain(QMainWindow):
|
|||||||
|
|
||||||
if path.isfile(path.join(projPath, self.theProject.projFile)) and not forceNew:
|
if path.isfile(path.join(projPath, self.theProject.projFile)) and not forceNew:
|
||||||
msgBox = QMessageBox()
|
msgBox = QMessageBox()
|
||||||
msgRes = msgBox.critical(
|
msgBox.critical(
|
||||||
self, "New Project",
|
self, "New Project",
|
||||||
"A project already exists in that location. Please choose another folder."
|
"A project already exists in that location. Please choose another folder."
|
||||||
)
|
)
|
||||||
@@ -391,7 +391,7 @@ class GuiMain(QMainWindow):
|
|||||||
int(self.theProject.lockedBy[3])
|
int(self.theProject.lockedBy[3])
|
||||||
).strftime("%x %X")
|
).strftime("%x %X")
|
||||||
)
|
)
|
||||||
except:
|
except Exception:
|
||||||
lockDetails = ""
|
lockDetails = ""
|
||||||
|
|
||||||
msgBox = QMessageBox()
|
msgBox = QMessageBox()
|
||||||
@@ -713,7 +713,6 @@ class GuiMain(QMainWindow):
|
|||||||
|
|
||||||
self.treeView.saveTreeOrder()
|
self.treeView.saveTreeOrder()
|
||||||
self.theIndex.clearIndex()
|
self.theIndex.clearIndex()
|
||||||
nItems = len(self.theProject.projTree)
|
|
||||||
|
|
||||||
theDoc = NWDoc(self.theProject, self)
|
theDoc = NWDoc(self.theProject, self)
|
||||||
for nDone, tItem in enumerate(self.theProject.projTree):
|
for nDone, tItem in enumerate(self.theProject.projTree):
|
||||||
|
|||||||
@@ -12,19 +12,6 @@ class DummyMain():
|
|||||||
return
|
return
|
||||||
|
|
||||||
def makeAlert(self, theMessage, theLevel):
|
def makeAlert(self, theMessage, theLevel):
|
||||||
if theLevel == nwAlert.WARN:
|
|
||||||
lvlMsg = "WARNING: "
|
|
||||||
elif theLevel == nwAlert.ERROR:
|
|
||||||
lvlMsg = "ERROR: "
|
|
||||||
elif theLevel == nwAlert.BUG:
|
|
||||||
lvlMsg = "BUG: "
|
|
||||||
else:
|
|
||||||
lvlMsg = ""
|
|
||||||
if isinstance(theMessage, list):
|
|
||||||
for msgLine in logMsg:
|
|
||||||
print(lvlMsg+msgLine)
|
|
||||||
else:
|
|
||||||
print(lvlMsg+theMessage)
|
|
||||||
return
|
return
|
||||||
|
|
||||||
def setStatus(self, theMessage):
|
def setStatus(self, theMessage):
|
||||||
|
|||||||
Reference in New Issue
Block a user