Further PEP8 compliance changes

This commit is contained in:
Veronica K. B. Olsen
2019-11-03 18:02:47 +01:00
parent 7c95af951a
commit b303eb6539
37 changed files with 408 additions and 380 deletions
+3 -4
View File
@@ -13,12 +13,13 @@
import logging
import nw
from os import path
from os import path
from PyQt5.QtWidgets import QMessageBox
from nw.convert.file.text import TextFile
from nw.convert.tokenizer import Tokenizer
from nw.enum import nwAlert, nwItemLayout
from nw.enum import nwAlert, nwItemLayout
logger = logging.getLogger(__name__)
@@ -26,9 +27,7 @@ class ConcatFile(TextFile):
def __init__(self, theProject, theParent):
TextFile.__init__(self, theProject, theParent)
self.theConv = Tokenizer(self.theProject, self.theParent)
return
def addText(self, tHandle):
+2 -4
View File
@@ -13,9 +13,9 @@
import logging
import nw
from nw.convert.file.text import TextFile
from nw.convert.file.text import TextFile
from nw.convert.text.tohtml import ToHtml
from nw.enum import nwAlert
from nw.enum import nwAlert
logger = logging.getLogger(__name__)
@@ -23,9 +23,7 @@ class HtmlFile(TextFile):
def __init__(self, theProject, theParent):
TextFile.__init__(self, theProject, theParent)
self.theConv = ToHtml(self.theProject, self.theParent)
return
##
+2 -7
View File
@@ -13,9 +13,9 @@
import logging
import nw
from nw.convert.file.text import TextFile
from nw.convert.file.text import TextFile
from nw.convert.text.tolatex import ToLaTeX
from nw.enum import nwAlert
from nw.enum import nwAlert
logger = logging.getLogger(__name__)
@@ -32,7 +32,6 @@ class LaTeXFile(TextFile):
##
def _doOpenFile(self, filePath):
try:
self.outFile = open(filePath,mode="wt+",encoding="utf8")
self.outFile.write("\\documentclass[12pt]{report}\n")
@@ -43,17 +42,13 @@ class LaTeXFile(TextFile):
except Exception as e:
self.makeAlert(["Failed to open file.",str(e)], nwAlert.ERROR)
return False
return True
def _doCloseFile(self):
if self.outFile is not None:
self.outFile.write("\\end{document}\n")
self.outFile.close()
self.texCodecFail = self.theConv.texCodecFail
return True
# END Class LaTeXFile
+2 -4
View File
@@ -13,9 +13,9 @@
import logging
import nw
from nw.convert.file.text import TextFile
from nw.convert.file.text import TextFile
from nw.convert.text.tomarkdown import ToMarkdown
from nw.enum import nwAlert
from nw.enum import nwAlert
logger = logging.getLogger(__name__)
@@ -23,9 +23,7 @@ class MarkdownFile(TextFile):
def __init__(self, theProject, theParent):
TextFile.__init__(self, theProject, theParent)
self.theConv = ToMarkdown(self.theProject, self.theParent)
return
##
+10 -9
View File
@@ -13,11 +13,12 @@
import logging
import nw
from os import path
from os import path
from PyQt5.QtWidgets import QMessageBox
from nw.convert.text.totext import ToText
from nw.enum import nwAlert, nwItemType, nwItemLayout, nwItemClass
from nw.enum import nwAlert, nwItemType, nwItemLayout, nwItemClass
logger = logging.getLogger(__name__)
@@ -29,14 +30,14 @@ class TextFile():
self.theProject = theProject
self.theParent = theParent
self.outFile = None
self.fileName = ""
self.theText = ""
self.expNovel = True
self.expNotes = False
self.outFile = None
self.fileName = ""
self.theText = ""
self.expNovel = True
self.expNotes = False
self.theConv = ToText(self.theProject, self.theParent)
self.makeAlert = self.theParent.makeAlert
self.theConv = ToText(self.theProject, self.theParent)
self.makeAlert = self.theParent.makeAlert
self.setComments(False)
self.setKeywords(False)
+1 -3
View File
@@ -15,7 +15,7 @@ import re
import nw
from nw.convert.tokenizer import Tokenizer
from nw.constants import nwUnicode, nwLabels
from nw.constants import nwUnicode, nwLabels
logger = logging.getLogger(__name__)
@@ -31,12 +31,10 @@ class ToHtml(Tokenizer):
need to make a few changes to formatting, which is selected by
this flag.
"""
self.forPreview = forPreview
if forPreview:
self.doKeywords = True
self.doComments = doComments
return
def doAutoReplace(self):
+1 -1
View File
@@ -16,7 +16,7 @@ import re
import nw
from nw.convert.tokenizer import Tokenizer
from nw.constants import nwUnicode
from nw.constants import nwUnicode
logger = logging.getLogger(__name__)
+1 -1
View File
@@ -16,7 +16,7 @@ import re
import nw
from nw.convert.tokenizer import Tokenizer
from nw.constants import nwUnicode
from nw.constants import nwUnicode
logger = logging.getLogger(__name__)
+6 -5
View File
@@ -15,12 +15,12 @@ import logging
import re
import nw
from operator import itemgetter
from PyQt5.QtCore import QRegularExpression
from operator import itemgetter
from PyQt5.QtCore import QRegularExpression
from nw.project.document import NWDoc
from nw.tools.translate import numberToWord
from nw.enum import nwItemLayout
from nw.tools.translate import numberToWord
from nw.enum import nwItemLayout
logger = logging.getLogger(__name__)
@@ -230,7 +230,8 @@ class Tokenizer():
if isNone: return
if isNote: return
# For novel files, we need to handle chapter numbering and scene breaks
# For novel files, we need to handle chapter numbering and scene
# breaks
if isBook or isUnNum or isChap or isScene:
for n in range(len(self.theTokens)):