Add double space before in-line comments
This commit is contained in:
+1
-1
@@ -233,7 +233,7 @@ def main(sysArgs=None):
|
||||
errorCode |= 16
|
||||
|
||||
try:
|
||||
import lxml # noqa: F401
|
||||
import lxml # noqa: F401
|
||||
except ImportError:
|
||||
errorData.append("Python module 'lxml' is missing.")
|
||||
errorCode |= 32
|
||||
|
||||
+10
-10
@@ -262,43 +262,43 @@ def fuzzyTime(secDiff):
|
||||
return QCoreApplication.translate(
|
||||
"Common", "a minute ago"
|
||||
)
|
||||
elif secDiff < 3300: # 55 minutes
|
||||
elif secDiff < 3300: # 55 minutes
|
||||
return QCoreApplication.translate(
|
||||
"Common", "{0} minutes ago"
|
||||
).format(int(round(secDiff/60)))
|
||||
elif secDiff < 5400: # 90 minutes
|
||||
elif secDiff < 5400: # 90 minutes
|
||||
return QCoreApplication.translate(
|
||||
"Common", "an hour ago"
|
||||
)
|
||||
elif secDiff < 84600: # 23.5 hours
|
||||
elif secDiff < 84600: # 23.5 hours
|
||||
return QCoreApplication.translate(
|
||||
"Common", "{0} hours ago"
|
||||
).format(int(round(secDiff/3600)))
|
||||
elif secDiff < 129600: # 1.5 days
|
||||
elif secDiff < 129600: # 1.5 days
|
||||
return QCoreApplication.translate(
|
||||
"Common", "a day ago"
|
||||
)
|
||||
elif secDiff < 561600: # 6.5 days
|
||||
elif secDiff < 561600: # 6.5 days
|
||||
return QCoreApplication.translate(
|
||||
"Common", "{0} days ago"
|
||||
).format(int(round(secDiff/86400)))
|
||||
elif secDiff < 907200: # 10.5 days
|
||||
elif secDiff < 907200: # 10.5 days
|
||||
return QCoreApplication.translate(
|
||||
"Common", "a week ago"
|
||||
)
|
||||
elif secDiff < 2419200: # 28 days
|
||||
elif secDiff < 2419200: # 28 days
|
||||
return QCoreApplication.translate(
|
||||
"Common", "{0} weeks ago"
|
||||
).format(int(round(secDiff/604800)))
|
||||
elif secDiff < 3888000: # 45 days
|
||||
elif secDiff < 3888000: # 45 days
|
||||
return QCoreApplication.translate(
|
||||
"Common", "a month ago"
|
||||
)
|
||||
elif secDiff < 29808000: # 345 days
|
||||
elif secDiff < 29808000: # 345 days
|
||||
return QCoreApplication.translate(
|
||||
"Common", "{0} months ago"
|
||||
).format(int(round(secDiff/2592000)))
|
||||
elif secDiff < 47336400: # 1.5 years
|
||||
elif secDiff < 47336400: # 1.5 years
|
||||
return QCoreApplication.translate(
|
||||
"Common", "a year ago"
|
||||
)
|
||||
|
||||
+47
-47
@@ -82,18 +82,18 @@ class Config:
|
||||
self.helpPath = None # The full path to the novelwriter .qhc help file
|
||||
|
||||
# Runtime Settings and Variables
|
||||
self.confChanged = False # True whenever the config has chenged, false after save
|
||||
self.hasHelp = False # True if the Qt help files are present in the assets folder
|
||||
self.confChanged = False # True whenever the config has chenged, false after save
|
||||
self.hasHelp = False # True if the Qt help files are present in the assets folder
|
||||
|
||||
# General
|
||||
self.guiTheme = "default"
|
||||
self.guiSyntax = "default_light"
|
||||
self.guiIcons = "typicons_colour_light"
|
||||
self.guiDark = False # Load icons for dark backgrounds, if available
|
||||
self.guiFont = "" # Defaults to system default font
|
||||
self.guiFontSize = 11 # Is overridden if system default is loaded
|
||||
self.guiScale = 1.0 # Set automatically by Theme class
|
||||
self.lastNotes = "0x0" # The latest release notes that have been shown
|
||||
self.guiDark = False # Load icons for dark backgrounds, if available
|
||||
self.guiFont = "" # Defaults to system default font
|
||||
self.guiFontSize = 11 # Is overridden if system default is loaded
|
||||
self.guiScale = 1.0 # Set automatically by Theme class
|
||||
self.lastNotes = "0x0" # The latest release notes that have been shown
|
||||
|
||||
# Localisation
|
||||
self.qLocal = QLocale.system()
|
||||
@@ -115,51 +115,51 @@ class Config:
|
||||
self.isFullScreen = False
|
||||
|
||||
# Features
|
||||
self.hideVScroll = False # Hide vertical scroll bars on main widgets
|
||||
self.hideHScroll = False # Hide horizontal scroll bars on main widgets
|
||||
self.hideVScroll = False # Hide vertical scroll bars on main widgets
|
||||
self.hideHScroll = False # Hide horizontal scroll bars on main widgets
|
||||
|
||||
# Project
|
||||
self.autoSaveProj = 60 # Interval for auto-saving project in seconds
|
||||
self.autoSaveDoc = 30 # Interval for auto-saving document in seconds
|
||||
self.autoSaveProj = 60 # Interval for auto-saving project in seconds
|
||||
self.autoSaveDoc = 30 # Interval for auto-saving document in seconds
|
||||
|
||||
# Text Editor
|
||||
self.textFont = None # Editor font
|
||||
self.textSize = 12 # Editor font size
|
||||
self.textFixedW = True # Keep editor text fixed width
|
||||
self.textWidth = 600 # Editor text width
|
||||
self.textMargin = 40 # Editor/viewer text margin
|
||||
self.tabWidth = 40 # Editor tabulator width
|
||||
self.textFont = None # Editor font
|
||||
self.textSize = 12 # Editor font size
|
||||
self.textFixedW = True # Keep editor text fixed width
|
||||
self.textWidth = 600 # Editor text width
|
||||
self.textMargin = 40 # Editor/viewer text margin
|
||||
self.tabWidth = 40 # Editor tabulator width
|
||||
|
||||
self.focusWidth = 800 # Focus Mode text width
|
||||
self.hideFocusFooter = False # Hide document footer in Focus Mode
|
||||
self.showFullPath = True # Show full document path in editor header
|
||||
self.autoSelect = True # Auto-select word when applying format with no selection
|
||||
self.focusWidth = 800 # Focus Mode text width
|
||||
self.hideFocusFooter = False # Hide document footer in Focus Mode
|
||||
self.showFullPath = True # Show full document path in editor header
|
||||
self.autoSelect = True # Auto-select word when applying format with no selection
|
||||
|
||||
self.doJustify = False # Justify text
|
||||
self.showTabsNSpaces = False # Show tabs and spaces in edior
|
||||
self.showLineEndings = False # Show line endings in editor
|
||||
self.showMultiSpaces = True # Highlight multiple spaces in the text
|
||||
self.doJustify = False # Justify text
|
||||
self.showTabsNSpaces = False # Show tabs and spaces in edior
|
||||
self.showLineEndings = False # Show line endings in editor
|
||||
self.showMultiSpaces = True # Highlight multiple spaces in the text
|
||||
|
||||
self.doReplace = True # Enable auto-replace as you type
|
||||
self.doReplaceSQuote = True # Smart single quotes
|
||||
self.doReplaceDQuote = True # Smart double quotes
|
||||
self.doReplaceDash = True # Replace multiple hyphens with dashes
|
||||
self.doReplaceDots = True # Replace three dots with ellipsis
|
||||
self.doReplace = True # Enable auto-replace as you type
|
||||
self.doReplaceSQuote = True # Smart single quotes
|
||||
self.doReplaceDQuote = True # Smart double quotes
|
||||
self.doReplaceDash = True # Replace multiple hyphens with dashes
|
||||
self.doReplaceDots = True # Replace three dots with ellipsis
|
||||
|
||||
self.scrollPastEnd = True # Allow scrolling past end of document
|
||||
self.autoScroll = False # Typewriter-like scrolling
|
||||
self.autoScrollPos = 30 # Start point for typewriter-like scrolling
|
||||
self.scrollPastEnd = True # Allow scrolling past end of document
|
||||
self.autoScroll = False # Typewriter-like scrolling
|
||||
self.autoScrollPos = 30 # Start point for typewriter-like scrolling
|
||||
|
||||
self.wordCountTimer = 5.0 # Interval for word count update in seconds
|
||||
self.bigDocLimit = 800 # Size threshold for heavy editor features in kilobytes
|
||||
self.wordCountTimer = 5.0 # Interval for word count update in seconds
|
||||
self.bigDocLimit = 800 # Size threshold for heavy editor features in kilobytes
|
||||
|
||||
self.highlightQuotes = True # Highlight text in quotes
|
||||
self.allowOpenSQuote = False # Allow open-ended single quotes
|
||||
self.allowOpenDQuote = True # Allow open-ended double quotes
|
||||
self.highlightEmph = True # Add colour to text emphasis
|
||||
self.highlightQuotes = True # Highlight text in quotes
|
||||
self.allowOpenSQuote = False # Allow open-ended single quotes
|
||||
self.allowOpenDQuote = True # Allow open-ended double quotes
|
||||
self.highlightEmph = True # Add colour to text emphasis
|
||||
|
||||
self.stopWhenIdle = True # Stop the status bar clock when the user is idle
|
||||
self.userIdleTime = 300 # Time of inactivity to consider user idle
|
||||
self.stopWhenIdle = True # Stop the status bar clock when the user is idle
|
||||
self.userIdleTime = 300 # Time of inactivity to consider user idle
|
||||
|
||||
# User-Selected Symbols
|
||||
self.fmtApostrophe = nwUnicode.U_RSQUO
|
||||
@@ -235,8 +235,8 @@ class Config:
|
||||
self.kernelVer = "Unknown"
|
||||
|
||||
# Packages
|
||||
self.hasEnchant = False # The pyenchant package
|
||||
self.hasAssistant = False # The Qt Assistant executable
|
||||
self.hasEnchant = False # The pyenchant package
|
||||
self.hasAssistant = False # The Qt Assistant executable
|
||||
|
||||
# Recent Cache
|
||||
self.recentProj = {}
|
||||
@@ -382,9 +382,9 @@ class Config:
|
||||
self.qtTrans = {}
|
||||
|
||||
langList = [
|
||||
(self.qtLangPath, "qtbase"), # Qt 5.x
|
||||
(self.nwLangPath, "qtbase"), # Alternative Qt 5.x
|
||||
(self.nwLangPath, "nw"), # novelWriter
|
||||
(self.qtLangPath, "qtbase"), # Qt 5.x
|
||||
(self.nwLangPath, "qtbase"), # Alternative Qt 5.x
|
||||
(self.nwLangPath, "nw"), # novelWriter
|
||||
]
|
||||
for lngPath, lngBase in langList:
|
||||
for lngCode in self.qLocal.uiLanguages():
|
||||
@@ -1119,7 +1119,7 @@ class Config:
|
||||
"""Cheks if we have the optional packages used by some features.
|
||||
"""
|
||||
try:
|
||||
import enchant # noqa: F401
|
||||
import enchant # noqa: F401
|
||||
self.hasEnchant = True
|
||||
logger.debug("Checking package 'pyenchant': OK")
|
||||
except Exception:
|
||||
|
||||
+59
-59
@@ -37,14 +37,14 @@ def trConst(tString):
|
||||
class nwConst():
|
||||
|
||||
# Date and Time Formats
|
||||
FMT_TSTAMP = "%Y-%m-%d %H:%M:%S" # Default format
|
||||
FMT_FSTAMP = "%Y-%m-%d %H.%M.%S" # FileName safe format
|
||||
FMT_DSTAMP = "%Y-%m-%d" # Date only format
|
||||
FMT_TSTAMP = "%Y-%m-%d %H:%M:%S" # Default format
|
||||
FMT_FSTAMP = "%Y-%m-%d %H.%M.%S" # FileName safe format
|
||||
FMT_DSTAMP = "%Y-%m-%d" # Date only format
|
||||
|
||||
# Various Hard Limits
|
||||
MAX_DEPTH = 30 # Maximum folder depth of a project
|
||||
MAX_DOCSIZE = 5000000 # Maxium size of a single document
|
||||
MAX_BUILDSIZE = 10000000 # Maxium size of a project build
|
||||
MAX_DEPTH = 30 # Maximum folder depth of a project
|
||||
MAX_DOCSIZE = 5000000 # Maxium size of a single document
|
||||
MAX_BUILDSIZE = 10000000 # Maxium size of a project build
|
||||
|
||||
# Spell Check Providers
|
||||
SP_INTERNAL = "internal"
|
||||
@@ -264,67 +264,67 @@ class nwUnicode:
|
||||
# =================
|
||||
|
||||
# Quotation Marks
|
||||
U_QUOT = "\u0022" # Quotation mark
|
||||
U_APOS = "\u0027" # Apostrophe
|
||||
U_LAQUO = "\u00ab" # Left-pointing double angle quotation mark
|
||||
U_RAQUO = "\u00bb" # Right-pointing double angle quotation mark
|
||||
U_LSQUO = "\u2018" # Left single quotation mark
|
||||
U_RSQUO = "\u2019" # Right single quotation mark
|
||||
U_SBQUO = "\u201a" # Single low-9 quotation mark
|
||||
U_SUQUO = "\u201b" # Single high-reversed-9 quotation mark
|
||||
U_LDQUO = "\u201c" # Left double quotation mark
|
||||
U_RDQUO = "\u201d" # Right double quotation mark
|
||||
U_BDQUO = "\u201e" # Double low-9 quotation mark
|
||||
U_UDQUO = "\u201f" # Double high-reversed-9 quotation mark
|
||||
U_LSAQUO = "\u2039" # Single left-pointing angle quotation mark
|
||||
U_RSAQUO = "\u203a" # Single right-pointing angle quotation mark
|
||||
U_BDRQUO = "\u2e42" # Double low-reversed-9 quotation mark
|
||||
U_LCQUO = "\u300c" # Left corner bracket
|
||||
U_RCQUO = "\u300d" # Right corner bracket
|
||||
U_LWCQUO = "\u300e" # Left white corner bracket
|
||||
U_RWCQUO = "\u300f" # Right white corner bracket
|
||||
U_QUOT = "\u0022" # Quotation mark
|
||||
U_APOS = "\u0027" # Apostrophe
|
||||
U_LAQUO = "\u00ab" # Left-pointing double angle quotation mark
|
||||
U_RAQUO = "\u00bb" # Right-pointing double angle quotation mark
|
||||
U_LSQUO = "\u2018" # Left single quotation mark
|
||||
U_RSQUO = "\u2019" # Right single quotation mark
|
||||
U_SBQUO = "\u201a" # Single low-9 quotation mark
|
||||
U_SUQUO = "\u201b" # Single high-reversed-9 quotation mark
|
||||
U_LDQUO = "\u201c" # Left double quotation mark
|
||||
U_RDQUO = "\u201d" # Right double quotation mark
|
||||
U_BDQUO = "\u201e" # Double low-9 quotation mark
|
||||
U_UDQUO = "\u201f" # Double high-reversed-9 quotation mark
|
||||
U_LSAQUO = "\u2039" # Single left-pointing angle quotation mark
|
||||
U_RSAQUO = "\u203a" # Single right-pointing angle quotation mark
|
||||
U_BDRQUO = "\u2e42" # Double low-reversed-9 quotation mark
|
||||
U_LCQUO = "\u300c" # Left corner bracket
|
||||
U_RCQUO = "\u300d" # Right corner bracket
|
||||
U_LWCQUO = "\u300e" # Left white corner bracket
|
||||
U_RWCQUO = "\u300f" # Right white corner bracket
|
||||
|
||||
# Punctuation
|
||||
U_FGDASH = "\u2012" # Figure dash
|
||||
U_ENDASH = "\u2013" # Short dash
|
||||
U_EMDASH = "\u2014" # Long dash
|
||||
U_HBAR = "\u2015" # Horizontal bar
|
||||
U_HELLIP = "\u2026" # Ellipsis
|
||||
U_MAPOSS = "\u02bc" # Modifier letter single apostrophe
|
||||
U_PRIME = "\u2032" # Prime
|
||||
U_DPRIME = "\u2033" # Double prime
|
||||
U_FGDASH = "\u2012" # Figure dash
|
||||
U_ENDASH = "\u2013" # Short dash
|
||||
U_EMDASH = "\u2014" # Long dash
|
||||
U_HBAR = "\u2015" # Horizontal bar
|
||||
U_HELLIP = "\u2026" # Ellipsis
|
||||
U_MAPOSS = "\u02bc" # Modifier letter single apostrophe
|
||||
U_PRIME = "\u2032" # Prime
|
||||
U_DPRIME = "\u2033" # Double prime
|
||||
|
||||
# Spaces and Lines
|
||||
U_NBSP = "\u00a0" # Non-breaking space
|
||||
U_THSP = "\u2009" # Thin space
|
||||
U_THNBSP = "\u202f" # Thin non-breaking space
|
||||
U_ENSP = "\u2002" # Short (en) space
|
||||
U_EMSP = "\u2003" # Long (em) space
|
||||
U_LSEP = "\u2028" # Line separator
|
||||
U_PSEP = "\u2029" # Paragraph separator
|
||||
U_NBSP = "\u00a0" # Non-breaking space
|
||||
U_THSP = "\u2009" # Thin space
|
||||
U_THNBSP = "\u202f" # Thin non-breaking space
|
||||
U_ENSP = "\u2002" # Short (en) space
|
||||
U_EMSP = "\u2003" # Long (em) space
|
||||
U_LSEP = "\u2028" # Line separator
|
||||
U_PSEP = "\u2029" # Paragraph separator
|
||||
|
||||
# Symbols
|
||||
U_CHECK = "\u2714" # Heavy check mark
|
||||
U_CROSS = "\u2715" # Heavy cross mark
|
||||
U_BULL = "\u2022" # List bullet
|
||||
U_TRBULL = "\u2023" # Triangle bullet
|
||||
U_HYBULL = "\u2043" # Hyphen bullet
|
||||
U_FLOWER = "\u2055" # Flower punctuation mark
|
||||
U_PERMIL = "\u2030" # Per mille sign
|
||||
U_DEGREE = "\u00b0" # Degree symbol
|
||||
U_MINUS = "\u2212" # Minus sign
|
||||
U_TIMES = "\u00d7" # Multiplaction sign
|
||||
U_DIVIDE = "\u00f7" # Division sign
|
||||
U_CHECK = "\u2714" # Heavy check mark
|
||||
U_CROSS = "\u2715" # Heavy cross mark
|
||||
U_BULL = "\u2022" # List bullet
|
||||
U_TRBULL = "\u2023" # Triangle bullet
|
||||
U_HYBULL = "\u2043" # Hyphen bullet
|
||||
U_FLOWER = "\u2055" # Flower punctuation mark
|
||||
U_PERMIL = "\u2030" # Per mille sign
|
||||
U_DEGREE = "\u00b0" # Degree symbol
|
||||
U_MINUS = "\u2212" # Minus sign
|
||||
U_TIMES = "\u00d7" # Multiplaction sign
|
||||
U_DIVIDE = "\u00f7" # Division sign
|
||||
|
||||
# Arrows
|
||||
U_UTRI = "\u25b2" # Up-pointing triangle
|
||||
U_UTRIS = "\u25b4" # Up-pointing triangle, small
|
||||
U_RTRI = "\u25b6" # Right-pointing triangle
|
||||
U_RTRIS = "\u25b8" # Right-pointing triangle, small
|
||||
U_DTRI = "\u25bc" # Down-pointing triangle
|
||||
U_DTRIS = "\u25be" # Down-pointing triangle, small
|
||||
U_LTRI = "\u25c0" # Left-pointing triangle
|
||||
U_LTRIS = "\u25c2" # Left-pointing triangle, small
|
||||
U_UTRI = "\u25b2" # Up-pointing triangle
|
||||
U_UTRIS = "\u25b4" # Up-pointing triangle, small
|
||||
U_RTRI = "\u25b6" # Right-pointing triangle
|
||||
U_RTRIS = "\u25b8" # Right-pointing triangle, small
|
||||
U_DTRI = "\u25bc" # Down-pointing triangle
|
||||
U_DTRIS = "\u25be" # Down-pointing triangle, small
|
||||
U_LTRI = "\u25c0" # Left-pointing triangle
|
||||
U_LTRIS = "\u25c2" # Left-pointing triangle, small
|
||||
|
||||
# HTML Equivalents
|
||||
# ================
|
||||
|
||||
+5
-5
@@ -39,11 +39,11 @@ class NWDoc():
|
||||
self.theProject = theProject
|
||||
|
||||
# Internal Variables
|
||||
self._theItem = None # The currently open item
|
||||
self._docHandle = None # The handle of the currently open item
|
||||
self._fileLoc = None # The file location of the currently open item
|
||||
self._docMeta = {} # The meta data of the currently open item
|
||||
self._docError = "" # The latest encountered IO error
|
||||
self._theItem = None # The currently open item
|
||||
self._docHandle = None # The handle of the currently open item
|
||||
self._fileLoc = None # The file location of the currently open item
|
||||
self._docMeta = {} # The meta data of the currently open item
|
||||
self._docError = "" # The latest encountered IO error
|
||||
|
||||
if isHandle(theHandle):
|
||||
self._docHandle = theHandle
|
||||
|
||||
+3
-3
@@ -482,10 +482,10 @@ class NWIndex():
|
||||
"""Scan a line starting with @ to check that it's valid. Then
|
||||
split it up into its elements and positions as two arrays.
|
||||
"""
|
||||
theBits = [] # The elements of the string
|
||||
thePos = [] # The absolute position of each element
|
||||
theBits = [] # The elements of the string
|
||||
thePos = [] # The absolute position of each element
|
||||
|
||||
aLine = aLine.rstrip() # Remove all trailing white spaces
|
||||
aLine = aLine.rstrip() # Remove all trailing white spaces
|
||||
nChar = len(aLine)
|
||||
if nChar < 2:
|
||||
return False, theBits, thePos
|
||||
|
||||
+7
-7
@@ -51,11 +51,11 @@ class NWItem():
|
||||
self.isExported = True
|
||||
|
||||
# Document Meta Data
|
||||
self.charCount = 0 # Current character count
|
||||
self.wordCount = 0 # Current word count
|
||||
self.paraCount = 0 # Current paragraph count
|
||||
self.initCount = 0 # Initial word count
|
||||
self.cursorPos = 0 # Last cursor position
|
||||
self.charCount = 0 # Current character count
|
||||
self.wordCount = 0 # Current word count
|
||||
self.paraCount = 0 # Current paragraph count
|
||||
self.initCount = 0 # Initial word count
|
||||
self.cursorPos = 0 # Last cursor position
|
||||
|
||||
return
|
||||
|
||||
@@ -251,7 +251,7 @@ class NWItem():
|
||||
if isinstance(expState, str):
|
||||
self.isExpanded = (expState == str(True))
|
||||
else:
|
||||
self.isExpanded = (expState == True) # noqa: E712
|
||||
self.isExpanded = (expState == True) # noqa: E712
|
||||
return
|
||||
|
||||
def setExported(self, expState):
|
||||
@@ -260,7 +260,7 @@ class NWItem():
|
||||
if isinstance(expState, str):
|
||||
self.isExported = (expState == str(True))
|
||||
else:
|
||||
self.isExported = (expState == True) # noqa: E712
|
||||
self.isExported = (expState == True) # noqa: E712
|
||||
return
|
||||
|
||||
##
|
||||
|
||||
+35
-35
@@ -59,48 +59,48 @@ class NWProject():
|
||||
self.mainConf = nw.CONFIG
|
||||
|
||||
# Core Elements
|
||||
self.optState = OptionState(self) # Project-specific GUI options
|
||||
self.projTree = NWTree(self) # The project tree
|
||||
self.langData = {} # Localisation data
|
||||
self.optState = OptionState(self) # Project-specific GUI options
|
||||
self.projTree = NWTree(self) # The project tree
|
||||
self.langData = {} # Localisation data
|
||||
|
||||
# Project Status
|
||||
self.projOpened = 0 # The time stamp of when the project file was opened
|
||||
self.projChanged = False # The project has unsaved changes
|
||||
self.projAltered = False # The project has been altered this session
|
||||
self.lockedBy = None # Data on which computer has the project open
|
||||
self.saveCount = 0 # Meta data: number of saves
|
||||
self.autoCount = 0 # Meta data: number of automatic saves
|
||||
self.editTime = 0 # The accumulated edit time read from the project file
|
||||
self.projOpened = 0 # The time stamp of when the project file was opened
|
||||
self.projChanged = False # The project has unsaved changes
|
||||
self.projAltered = False # The project has been altered this session
|
||||
self.lockedBy = None # Data on which computer has the project open
|
||||
self.saveCount = 0 # Meta data: number of saves
|
||||
self.autoCount = 0 # Meta data: number of automatic saves
|
||||
self.editTime = 0 # The accumulated edit time read from the project file
|
||||
|
||||
# Class Settings
|
||||
self.projPath = None # The full path to where the currently open project is saved
|
||||
self.projMeta = None # The full path to the project's meta data folder
|
||||
self.projCache = None # The full path to the project's cache folder
|
||||
self.projContent = None # The full path to the project's content folder
|
||||
self.projDict = None # The spell check dictionary
|
||||
self.projSpell = None # The spell check language, if different than default
|
||||
self.projLang = None # The project language, used for builds
|
||||
self.projFile = None # The file name of the project main XML file
|
||||
self.projPath = None # The full path to where the currently open project is saved
|
||||
self.projMeta = None # The full path to the project's meta data folder
|
||||
self.projCache = None # The full path to the project's cache folder
|
||||
self.projContent = None # The full path to the project's content folder
|
||||
self.projDict = None # The spell check dictionary
|
||||
self.projSpell = None # The spell check language, if different than default
|
||||
self.projLang = None # The project language, used for builds
|
||||
self.projFile = None # The file name of the project main XML file
|
||||
|
||||
# Project Meta
|
||||
self.projName = "" # Project name (working title)
|
||||
self.bookTitle = "" # The final title; should only be used for exports
|
||||
self.bookAuthors = [] # A list of book authors
|
||||
self.projName = "" # Project name (working title)
|
||||
self.bookTitle = "" # The final title; should only be used for exports
|
||||
self.bookAuthors = [] # A list of book authors
|
||||
|
||||
# Project Settings
|
||||
self.autoReplace = {} # Text to auto-replace on exports
|
||||
self.titleFormat = {} # The formatting of titles for exports
|
||||
self.spellCheck = False # Controls the spellcheck-as-you-type feature
|
||||
self.autoOutline = True # If true, the Project Outline is updated automatically
|
||||
self.statusItems = None # Novel file progress status values
|
||||
self.importItems = None # Note file importance values
|
||||
self.lastEdited = None # The handle of the last file to be edited
|
||||
self.lastViewed = None # The handle of the last file to be viewed
|
||||
self.lastWCount = 0 # The project word count from last session
|
||||
self.currWCount = 0 # The project word count in current session
|
||||
self.novelWCount = 0 # Total number of words in novel files
|
||||
self.notesWCount = 0 # Total number of words in note files
|
||||
self.doBackup = True # Run project backup on exit
|
||||
self.autoReplace = {} # Text to auto-replace on exports
|
||||
self.titleFormat = {} # The formatting of titles for exports
|
||||
self.spellCheck = False # Controls the spellcheck-as-you-type feature
|
||||
self.autoOutline = True # If true, the Project Outline is updated automatically
|
||||
self.statusItems = None # Novel file progress status values
|
||||
self.importItems = None # Note file importance values
|
||||
self.lastEdited = None # The handle of the last file to be edited
|
||||
self.lastViewed = None # The handle of the last file to be viewed
|
||||
self.lastWCount = 0 # The project word count from last session
|
||||
self.currWCount = 0 # The project word count in current session
|
||||
self.novelWCount = 0 # Total number of words in novel files
|
||||
self.notesWCount = 0 # Total number of words in note files
|
||||
self.doBackup = True # Run project backup on exit
|
||||
|
||||
# Internal Mapping
|
||||
self.makeAlert = self.theParent.makeAlert
|
||||
@@ -383,7 +383,7 @@ class NWProject():
|
||||
# Check for Old Legacy Data
|
||||
# =========================
|
||||
|
||||
legacyList = [] # Cleanup is done later
|
||||
legacyList = [] # Cleanup is done later
|
||||
for projItem in os.listdir(self.projPath):
|
||||
logger.verbose("Project contains: %s" % projItem)
|
||||
if projItem.startswith("data_"):
|
||||
|
||||
+3
-3
@@ -33,9 +33,9 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
class ToHtml(Tokenizer):
|
||||
|
||||
M_PREVIEW = 0 # Tweak output for the DocViewer
|
||||
M_EXPORT = 1 # Tweak output for saving to HTML or printing
|
||||
M_EBOOK = 2 # Tweak output for converting to epub
|
||||
M_PREVIEW = 0 # Tweak output for the DocViewer
|
||||
M_EXPORT = 1 # Tweak output for saving to HTML or printing
|
||||
M_EBOOK = 2 # Tweak output for converting to epub
|
||||
|
||||
def __init__(self, theProject):
|
||||
Tokenizer.__init__(self, theProject)
|
||||
|
||||
+54
-54
@@ -51,33 +51,33 @@ class Tokenizer():
|
||||
FMT_D_E = 6 # End strikeout
|
||||
|
||||
# Block Type
|
||||
T_EMPTY = 1 # Empty line (new paragraph)
|
||||
T_SYNOPSIS = 2 # Synopsis comment
|
||||
T_COMMENT = 3 # Comment line
|
||||
T_KEYWORD = 4 # Command line
|
||||
T_TITLE = 5 # Title
|
||||
T_HEAD1 = 6 # Header 1
|
||||
T_HEAD2 = 7 # Header 2
|
||||
T_HEAD3 = 8 # Header 3
|
||||
T_HEAD4 = 9 # Header 4
|
||||
T_TEXT = 10 # Text line
|
||||
T_SEP = 11 # Scene separator
|
||||
T_SKIP = 12 # Paragraph break
|
||||
T_EMPTY = 1 # Empty line (new paragraph)
|
||||
T_SYNOPSIS = 2 # Synopsis comment
|
||||
T_COMMENT = 3 # Comment line
|
||||
T_KEYWORD = 4 # Command line
|
||||
T_TITLE = 5 # Title
|
||||
T_HEAD1 = 6 # Header 1
|
||||
T_HEAD2 = 7 # Header 2
|
||||
T_HEAD3 = 8 # Header 3
|
||||
T_HEAD4 = 9 # Header 4
|
||||
T_TEXT = 10 # Text line
|
||||
T_SEP = 11 # Scene separator
|
||||
T_SKIP = 12 # Paragraph break
|
||||
|
||||
# Block Style
|
||||
A_NONE = 0x0000 # No special style
|
||||
A_LEFT = 0x0001 # Left aligned
|
||||
A_RIGHT = 0x0002 # Right aligned
|
||||
A_CENTRE = 0x0004 # Centred
|
||||
A_JUSTIFY = 0x0008 # Justified
|
||||
A_PBB = 0x0010 # Page break before always
|
||||
A_PBB_AUT = 0x0020 # Page break before auto
|
||||
A_PBA = 0x0040 # Page break after always
|
||||
A_PBA_AUT = 0x0080 # Page break after auto
|
||||
A_Z_TOPMRG = 0x0100 # Zero top margin
|
||||
A_Z_BTMMRG = 0x0200 # Zero bottom margin
|
||||
A_IND_L = 0x0400 # Left indentation
|
||||
A_IND_R = 0x0800 # Right indentation
|
||||
A_NONE = 0x0000 # No special style
|
||||
A_LEFT = 0x0001 # Left aligned
|
||||
A_RIGHT = 0x0002 # Right aligned
|
||||
A_CENTRE = 0x0004 # Centred
|
||||
A_JUSTIFY = 0x0008 # Justified
|
||||
A_PBB = 0x0010 # Page break before always
|
||||
A_PBB_AUT = 0x0020 # Page break before auto
|
||||
A_PBA = 0x0040 # Page break after always
|
||||
A_PBA_AUT = 0x0080 # Page break after auto
|
||||
A_Z_TOPMRG = 0x0100 # Zero top margin
|
||||
A_Z_BTMMRG = 0x0200 # Zero bottom margin
|
||||
A_IND_L = 0x0400 # Left indentation
|
||||
A_IND_R = 0x0800 # Right indentation
|
||||
|
||||
def __init__(self, theProject):
|
||||
|
||||
@@ -86,26 +86,26 @@ class Tokenizer():
|
||||
self.mainConf = nw.CONFIG
|
||||
|
||||
# Data Variables
|
||||
self.theText = "" # The raw text to be tokenized
|
||||
self.theHandle = None # The handle associated with the text
|
||||
self.theItem = None # The NWItem associated with the handle
|
||||
self.theTokens = [] # The list of the processed tokens
|
||||
self.theResult = "" # The result of the last document
|
||||
self.theText = "" # The raw text to be tokenized
|
||||
self.theHandle = None # The handle associated with the text
|
||||
self.theItem = None # The NWItem associated with the handle
|
||||
self.theTokens = [] # The list of the processed tokens
|
||||
self.theResult = "" # The result of the last document
|
||||
|
||||
self.keepMarkdown = False # Whether to keep the markdown text
|
||||
self.theMarkdown = [] # The result novelWriter markdown of all documents
|
||||
self.keepMarkdown = False # Whether to keep the markdown text
|
||||
self.theMarkdown = [] # The result novelWriter markdown of all documents
|
||||
|
||||
# User Settings
|
||||
self.textFont = "Serif" # Output text font
|
||||
self.textSize = 11 # Output text size
|
||||
self.textFixed = False # Fixed width text
|
||||
self.lineHeight = 1.15 # Line height in units of em
|
||||
self.blockIndent = 4.00 # Block indent in units of em
|
||||
self.doJustify = False # Justify text
|
||||
self.doBodyText = True # Include body text
|
||||
self.doSynopsis = False # Also process synopsis comments
|
||||
self.doComments = False # Also process comments
|
||||
self.doKeywords = False # Also process keywords like tags and references
|
||||
self.textFont = "Serif" # Output text font
|
||||
self.textSize = 11 # Output text size
|
||||
self.textFixed = False # Fixed width text
|
||||
self.lineHeight = 1.15 # Line height in units of em
|
||||
self.blockIndent = 4.00 # Block indent in units of em
|
||||
self.doJustify = False # Justify text
|
||||
self.doBodyText = True # Include body text
|
||||
self.doSynopsis = False # Also process synopsis comments
|
||||
self.doComments = False # Also process comments
|
||||
self.doKeywords = False # Also process keywords like tags and references
|
||||
|
||||
# Margins
|
||||
self.marginTitle = (1.000, 0.500)
|
||||
@@ -117,22 +117,22 @@ class Tokenizer():
|
||||
self.marginMeta = (0.000, 0.584)
|
||||
|
||||
# Title Formats
|
||||
self.fmtTitle = "%title%" # Formatting for titles
|
||||
self.fmtChapter = "%title%" # Formatting for numbered chapters
|
||||
self.fmtUnNum = "%title%" # Formatting for unnumbered chapters
|
||||
self.fmtScene = "%title%" # Formatting for scenes
|
||||
self.fmtSection = "%title%" # Formatting for sections
|
||||
self.fmtTitle = "%title%" # Formatting for titles
|
||||
self.fmtChapter = "%title%" # Formatting for numbered chapters
|
||||
self.fmtUnNum = "%title%" # Formatting for unnumbered chapters
|
||||
self.fmtScene = "%title%" # Formatting for scenes
|
||||
self.fmtSection = "%title%" # Formatting for sections
|
||||
|
||||
self.hideScene = False # Do not include scene headers
|
||||
self.hideSection = False # Do not include section headers
|
||||
self.hideScene = False # Do not include scene headers
|
||||
self.hideSection = False # Do not include section headers
|
||||
|
||||
self.linkHeaders = False # Add an anchor before headers
|
||||
self.linkHeaders = False # Add an anchor before headers
|
||||
|
||||
# Instance Variables
|
||||
self.numChapter = 0 # Counter for chapter numbers
|
||||
self.numChScene = 0 # Counter for scene number within chapter
|
||||
self.numAbsScene = 0 # Counter for scene number within novel
|
||||
self.firstScene = False # Flag to indicate that the first scene of the chapter
|
||||
self.numChapter = 0 # Counter for chapter numbers
|
||||
self.numChScene = 0 # Counter for scene number within chapter
|
||||
self.numAbsScene = 0 # Counter for scene number within novel
|
||||
self.firstScene = False # Flag to indicate that the first scene of the chapter
|
||||
|
||||
# This File
|
||||
self.isNone = False
|
||||
|
||||
+2
-2
@@ -33,8 +33,8 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
class ToMarkdown(Tokenizer):
|
||||
|
||||
M_STD = 0 # Standard Markdown
|
||||
M_GH = 1 # GitHub Markdown
|
||||
M_STD = 0 # Standard Markdown
|
||||
M_GH = 1 # GitHub Markdown
|
||||
|
||||
def __init__(self, theProject):
|
||||
Tokenizer.__init__(self, theProject)
|
||||
|
||||
+27
-27
@@ -59,36 +59,36 @@ TAG_STNM = "{%s}style-name" % XML_NS["text"]
|
||||
|
||||
class ToOdt(Tokenizer):
|
||||
|
||||
X_BLD = 0x01 # Bold format
|
||||
X_ITA = 0x02 # Italic format
|
||||
X_DEL = 0x04 # Strikethrough format
|
||||
X_BRK = 0x08 # Line break
|
||||
X_TAB = 0x10 # Tab
|
||||
X_BLD = 0x01 # Bold format
|
||||
X_ITA = 0x02 # Italic format
|
||||
X_DEL = 0x04 # Strikethrough format
|
||||
X_BRK = 0x08 # Line break
|
||||
X_TAB = 0x10 # Tab
|
||||
|
||||
def __init__(self, theProject, isFlat):
|
||||
Tokenizer.__init__(self, theProject)
|
||||
|
||||
self.mainConf = nw.CONFIG
|
||||
|
||||
self._isFlat = isFlat # Flat: .fodt, otherwise .odt
|
||||
self._isFlat = isFlat # Flat: .fodt, otherwise .odt
|
||||
|
||||
self._dFlat = None # FODT file XML root
|
||||
self._dCont = None # ODT content.xml root
|
||||
self._dMeta = None # ODT meta.xml root
|
||||
self._dStyl = None # ODT styles.xml root
|
||||
self._dFlat = None # FODT file XML root
|
||||
self._dCont = None # ODT content.xml root
|
||||
self._dMeta = None # ODT meta.xml root
|
||||
self._dStyl = None # ODT styles.xml root
|
||||
|
||||
self._xMeta = None # Office meta root
|
||||
self._xStyl = None # Office styles root
|
||||
self._xAuto = None # Office auto-styles root
|
||||
self._xMast = None # Office master-styles root
|
||||
self._xBody = None # Office body root
|
||||
self._xText = None # Office text root
|
||||
self._xMeta = None # Office meta root
|
||||
self._xStyl = None # Office styles root
|
||||
self._xAuto = None # Office auto-styles root
|
||||
self._xMast = None # Office master-styles root
|
||||
self._xBody = None # Office body root
|
||||
self._xText = None # Office text root
|
||||
|
||||
self._xAut2 = None # Page layout auto-styles for ODT file
|
||||
self._xAut2 = None # Page layout auto-styles for ODT file
|
||||
|
||||
self._mainPara = {} # User-accessible paragraph styles
|
||||
self._autoPara = {} # Auto-generated paragraph styles
|
||||
self._autoText = {} # Auto-generated text styles
|
||||
self._mainPara = {} # User-accessible paragraph styles
|
||||
self._autoPara = {} # Auto-generated paragraph styles
|
||||
self._autoText = {} # Auto-generated text styles
|
||||
|
||||
# Properties
|
||||
self.textFont = "Liberation Serif"
|
||||
@@ -315,15 +315,15 @@ class ToOdt(Tokenizer):
|
||||
def doConvert(self):
|
||||
"""Convert the list of text tokens into XML elements.
|
||||
"""
|
||||
self.theResult = "" # Not used, but cleared just in case
|
||||
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 = []
|
||||
|
||||
+9
-9
@@ -68,16 +68,16 @@ class NWTree():
|
||||
|
||||
self.theProject = theProject
|
||||
|
||||
self._projTree = {} # Holds all the items of the project
|
||||
self._treeOrder = [] # The order of the tree items on the tree view
|
||||
self._treeRoots = [] # The root items of the tree
|
||||
self._trashRoot = None # The handle of the trash root folder
|
||||
self._archRoot = None # The handle of the archive root folder
|
||||
self._theIndex = 0 # The current iterator index
|
||||
self._treeChanged = False # True if tree structure has changed
|
||||
self._projTree = {} # Holds all the items of the project
|
||||
self._treeOrder = [] # The order of the tree items on the tree view
|
||||
self._treeRoots = [] # The root items of the tree
|
||||
self._trashRoot = None # The handle of the trash root folder
|
||||
self._archRoot = None # The handle of the archive root folder
|
||||
self._theIndex = 0 # The current iterator index
|
||||
self._treeChanged = False # True if tree structure has changed
|
||||
|
||||
self._handleSeed = None # Used for generating handles for testing
|
||||
self._handleCount = 0 # A counter that is added to the handle generator
|
||||
self._handleSeed = None # Used for generating handles for testing
|
||||
self._handleCount = 0 # A counter that is added to the handle generator
|
||||
|
||||
return
|
||||
|
||||
|
||||
+20
-20
@@ -84,24 +84,24 @@ class GuiDocEditor(QTextEdit):
|
||||
self._nwDocument = None
|
||||
self._nwItem = None
|
||||
|
||||
self._docChanged = False # Flag for changed status of document
|
||||
self._docHandle = None # The handle of the open file
|
||||
self._docHeaders = [] # Record of headers in the file
|
||||
self._docChanged = False # Flag for changed status of document
|
||||
self._docHandle = None # The handle of the open file
|
||||
self._docHeaders = [] # Record of headers in the file
|
||||
|
||||
self._spellCheck = False # Flag for spell checking enabled
|
||||
self._theDict = None # The current spell check dictionary
|
||||
self._nonWord = "\"'" # Characters to not include in spell checking
|
||||
self._spellCheck = False # Flag for spell checking enabled
|
||||
self._theDict = None # The current spell check dictionary
|
||||
self._nonWord = "\"'" # Characters to not include in spell checking
|
||||
|
||||
# Document Variables
|
||||
self._charCount = 0 # Character count
|
||||
self._wordCount = 0 # Word count
|
||||
self._paraCount = 0 # Paragraph count
|
||||
self._lastEdit = 0 # Time stamp of last edit
|
||||
self._lastActive = 0 # Time stamp of last activity
|
||||
self._lastFind = None # Position of the last found search word
|
||||
self._bigDoc = False # Flag for very large document size
|
||||
self._doReplace = False # Switch to temporarily disable auto-replace
|
||||
self._queuePos = None # Used for delayed change of cursor position
|
||||
self._charCount = 0 # Character count
|
||||
self._wordCount = 0 # Word count
|
||||
self._paraCount = 0 # Paragraph count
|
||||
self._lastEdit = 0 # Time stamp of last edit
|
||||
self._lastActive = 0 # Time stamp of last activity
|
||||
self._lastFind = None # Position of the last found search word
|
||||
self._bigDoc = False # Flag for very large document size
|
||||
self._doReplace = False # Switch to temporarily disable auto-replace
|
||||
self._queuePos = None # Used for delayed change of cursor position
|
||||
|
||||
# Typography
|
||||
self._typDQOpen = '"'
|
||||
@@ -597,8 +597,8 @@ class GuiDocEditor(QTextEdit):
|
||||
"""
|
||||
if self.mainConf.verQtValue >= 50900:
|
||||
theText = self._qDocument.toRawText()
|
||||
theText = theText.replace(nwUnicode.U_LSEP, "\n") # Line separators
|
||||
theText = theText.replace(nwUnicode.U_PSEP, "\n") # Paragraph separators
|
||||
theText = theText.replace(nwUnicode.U_LSEP, "\n") # Line separators
|
||||
theText = theText.replace(nwUnicode.U_PSEP, "\n") # Paragraph separators
|
||||
else:
|
||||
theText = self.toPlainText()
|
||||
return theText
|
||||
@@ -1424,7 +1424,7 @@ class GuiDocEditor(QTextEdit):
|
||||
theTwo = theText[thePos-2:thePos]
|
||||
theThree = theText[thePos-3:thePos]
|
||||
|
||||
if not theOne: # Makes Neo sad
|
||||
if not theOne: # Makes Neo sad
|
||||
return
|
||||
|
||||
nDelete = 0
|
||||
@@ -1961,7 +1961,7 @@ class BackgroundWordCounter(QRunnable):
|
||||
self._isRunning = False
|
||||
return
|
||||
|
||||
## END Class BackgroundWordCounter
|
||||
# END Class BackgroundWordCounter
|
||||
|
||||
|
||||
class BackgroundWordCounterSignals(QObject):
|
||||
@@ -2236,7 +2236,7 @@ class GuiDocEditSearch(QFrame):
|
||||
self._alertSearchValid(theRegEx.isValid())
|
||||
return theRegEx
|
||||
|
||||
else: # >= 50300 to < 51300
|
||||
else: # >= 50300 to < 51300
|
||||
if self.isCaseSense:
|
||||
rxOpt = Qt.CaseSensitive
|
||||
else:
|
||||
|
||||
@@ -288,7 +288,7 @@ class GuiDocHighlighter(QSyntaxHighlighter):
|
||||
if self.theHandle is None or not theText:
|
||||
return
|
||||
|
||||
if theText.startswith("@"): # Keywords and commands
|
||||
if theText.startswith("@"): # Keywords and commands
|
||||
self.setCurrentBlockState(self.BLOCK_META)
|
||||
tItem = self.theParent.theProject.projTree[self.theHandle]
|
||||
isValid, theBits, thePos = self.theIndex.scanThis(theText)
|
||||
@@ -312,27 +312,27 @@ class GuiDocHighlighter(QSyntaxHighlighter):
|
||||
# so we force a return here
|
||||
return
|
||||
|
||||
elif theText.startswith("# "): # Header 1
|
||||
elif theText.startswith("# "): # Header 1
|
||||
self.setCurrentBlockState(self.BLOCK_TITLE)
|
||||
self.setFormat(0, 1, self.hStyles["header1h"])
|
||||
self.setFormat(1, len(theText), self.hStyles["header1"])
|
||||
|
||||
elif theText.startswith("## "): # Header 2
|
||||
elif theText.startswith("## "): # Header 2
|
||||
self.setCurrentBlockState(self.BLOCK_TITLE)
|
||||
self.setFormat(0, 2, self.hStyles["header2h"])
|
||||
self.setFormat(2, len(theText), self.hStyles["header2"])
|
||||
|
||||
elif theText.startswith("### "): # Header 3
|
||||
elif theText.startswith("### "): # Header 3
|
||||
self.setCurrentBlockState(self.BLOCK_TITLE)
|
||||
self.setFormat(0, 3, self.hStyles["header3h"])
|
||||
self.setFormat(3, len(theText), self.hStyles["header3"])
|
||||
|
||||
elif theText.startswith("#### "): # Header 4
|
||||
elif theText.startswith("#### "): # Header 4
|
||||
self.setCurrentBlockState(self.BLOCK_TITLE)
|
||||
self.setFormat(0, 4, self.hStyles["header4h"])
|
||||
self.setFormat(4, len(theText), self.hStyles["header4"])
|
||||
|
||||
elif theText.startswith("%"): # Comments
|
||||
elif theText.startswith("%"): # Comments
|
||||
self.setCurrentBlockState(self.BLOCK_TEXT)
|
||||
toCheck = theText[1:].lstrip()
|
||||
synTag = toCheck[:9].lower()
|
||||
@@ -345,7 +345,7 @@ class GuiDocHighlighter(QSyntaxHighlighter):
|
||||
else:
|
||||
self.setFormat(0, tLen, self.hStyles["hidden"])
|
||||
|
||||
else: # Text Paragraph
|
||||
else: # Text Paragraph
|
||||
self.setCurrentBlockState(self.BLOCK_TEXT)
|
||||
for rX, xFmt in self.rxRules:
|
||||
rxItt = rX.globalMatch(theText, 0)
|
||||
|
||||
@@ -235,10 +235,10 @@ class GuiItemDetails(QWidget):
|
||||
|
||||
itStatus = nwItem.itemStatus
|
||||
if nwItem.itemClass == nwItemClass.NOVEL:
|
||||
itStatus = self.theProject.statusItems.checkEntry(itStatus) # Make sure it's valid
|
||||
itStatus = self.theProject.statusItems.checkEntry(itStatus) # Make sure it's valid
|
||||
flagIcon = self.theParent.statusIcons[itStatus]
|
||||
else:
|
||||
itStatus = self.theProject.importItems.checkEntry(itStatus) # Make sure it's valid
|
||||
itStatus = self.theProject.importItems.checkEntry(itStatus) # Make sure it's valid
|
||||
flagIcon = self.theParent.importIcons[itStatus]
|
||||
|
||||
if nwItem.itemType == nwItemType.FILE:
|
||||
|
||||
+2
-2
@@ -241,7 +241,7 @@ class GuiMainMenu(QMenuBar):
|
||||
self.rootItems[nwItemClass.ARCHIVE] = QAction(self.tr("Outtakes Root"), self.rootMenu)
|
||||
nCount = 0
|
||||
for itemClass in self.rootItems.keys():
|
||||
nCount += 1 # This forces the lambdas to be unique
|
||||
nCount += 1 # This forces the lambdas to be unique
|
||||
self.rootItems[itemClass].triggered.connect(
|
||||
lambda nCount, itemClass=itemClass: self._newTreeItem(nwItemType.ROOT, itemClass)
|
||||
)
|
||||
@@ -982,7 +982,7 @@ class GuiMainMenu(QMenuBar):
|
||||
self.aSpellCheck.setStatusTip(self.tr("Toggle check spelling"))
|
||||
self.aSpellCheck.setCheckable(True)
|
||||
self.aSpellCheck.setChecked(self.theProject.spellCheck)
|
||||
self.aSpellCheck.triggered.connect(self._toggleSpellCheck) # triggered, not toggled!
|
||||
self.aSpellCheck.triggered.connect(self._toggleSpellCheck) # triggered, not toggled!
|
||||
self.aSpellCheck.setShortcut("Ctrl+F7")
|
||||
self.toolsMenu.addAction(self.aSpellCheck)
|
||||
|
||||
|
||||
+3
-3
@@ -620,10 +620,10 @@ class GuiProjectTree(QTreeWidget):
|
||||
|
||||
iStatus = nwItem.itemStatus
|
||||
if nwItem.itemClass == nwItemClass.NOVEL:
|
||||
iStatus = self.theProject.statusItems.checkEntry(iStatus) # Make sure it's valid
|
||||
iStatus = self.theProject.statusItems.checkEntry(iStatus) # Make sure it's valid
|
||||
flagIcon = self.theParent.statusIcons[iStatus]
|
||||
else:
|
||||
iStatus = self.theProject.importItems.checkEntry(iStatus) # Make sure it's valid
|
||||
iStatus = self.theProject.importItems.checkEntry(iStatus) # Make sure it's valid
|
||||
flagIcon = self.theParent.importIcons[iStatus]
|
||||
|
||||
trItem.setText(self.C_NAME, nwItem.itemName)
|
||||
@@ -790,7 +790,7 @@ class GuiProjectTree(QTreeWidget):
|
||||
selItem = self.itemAt(clickPos)
|
||||
if isinstance(selItem, QTreeWidgetItem):
|
||||
tHandle = selItem.data(self.C_NAME, Qt.UserRole)
|
||||
self.setSelectedHandle(tHandle) # Just to be safe
|
||||
self.setSelectedHandle(tHandle) # Just to be safe
|
||||
tItem = self.theProject.projTree[tHandle]
|
||||
if tItem is not None:
|
||||
if self.ctxMenu.filterActions(tItem):
|
||||
|
||||
+3
-3
@@ -613,9 +613,9 @@ class GuiMain(QMainWindow):
|
||||
return False
|
||||
|
||||
self.treeView.flushTreeOrder()
|
||||
nHandle = None # The next handle after tHandle
|
||||
fHandle = None # The first file handle we encounter
|
||||
foundIt = False # We've found tHandle, pick the next we see
|
||||
nHandle = None # The next handle after tHandle
|
||||
fHandle = None # The first file handle we encounter
|
||||
foundIt = False # We've found tHandle, pick the next we see
|
||||
for tItem in self.theProject.projTree:
|
||||
if tItem is None:
|
||||
continue
|
||||
|
||||
+15
-15
@@ -54,17 +54,17 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
class GuiBuildNovel(QDialog):
|
||||
|
||||
FMT_PDF = 1 # Print to PDF
|
||||
FMT_PDF = 1 # Print to PDF
|
||||
|
||||
FMT_ODT = 2 # Open Document file
|
||||
FMT_FODT = 3 # Flat Open Document file
|
||||
FMT_HTM = 4 # HTML5
|
||||
FMT_NWD = 5 # nW Markdown
|
||||
FMT_MD = 6 # Standard Markdown
|
||||
FMT_GH = 7 # GitHub Markdown
|
||||
FMT_ODT = 2 # Open Document file
|
||||
FMT_FODT = 3 # Flat Open Document file
|
||||
FMT_HTM = 4 # HTML5
|
||||
FMT_NWD = 5 # nW Markdown
|
||||
FMT_MD = 6 # Standard Markdown
|
||||
FMT_GH = 7 # GitHub Markdown
|
||||
|
||||
FMT_JSON_H = 8 # HTML5 wrapped in JSON
|
||||
FMT_JSON_M = 9 # nW Markdown wrapped in JSON
|
||||
FMT_JSON_H = 8 # HTML5 wrapped in JSON
|
||||
FMT_JSON_M = 9 # nW Markdown wrapped in JSON
|
||||
|
||||
def __init__(self, theParent):
|
||||
QDialog.__init__(self, theParent)
|
||||
@@ -78,10 +78,10 @@ class GuiBuildNovel(QDialog):
|
||||
self.theProject = theParent.theProject
|
||||
self.optState = theParent.theProject.optState
|
||||
|
||||
self.htmlText = [] # List of html documents
|
||||
self.htmlStyle = [] # List of html styles
|
||||
self.htmlSize = 0 # Size of the html document
|
||||
self.buildTime = 0 # The timestamp of the last build
|
||||
self.htmlText = [] # List of html documents
|
||||
self.htmlStyle = [] # List of html styles
|
||||
self.htmlSize = 0 # Size of the html document
|
||||
self.buildTime = 0 # The timestamp of the last build
|
||||
|
||||
self.setWindowTitle(self.tr("Build Novel Project"))
|
||||
self.setMinimumWidth(self.mainConf.pxInt(700))
|
||||
@@ -991,7 +991,7 @@ class GuiBuildNovel(QDialog):
|
||||
else:
|
||||
# If the if statements above and here match, it should not
|
||||
# be possible to reach this else statement.
|
||||
return False # pragma: no cover
|
||||
return False # pragma: no cover
|
||||
|
||||
# Report to User
|
||||
# ==============
|
||||
@@ -1035,7 +1035,7 @@ class GuiBuildNovel(QDialog):
|
||||
self.textFont.setText(theFont.family())
|
||||
self.textSize.setValue(theFont.pointSize())
|
||||
|
||||
self.raise_() # Move the dialog to front (fixes a bug on macOS)
|
||||
self.raise_() # Move the dialog to front (fixes a bug on macOS)
|
||||
|
||||
return
|
||||
|
||||
|
||||
@@ -570,7 +570,7 @@ class GuiWritingStats(QDialog):
|
||||
if isFirst:
|
||||
# Subtract the offset from the first list entry
|
||||
dwTotal -= self.wordOffset
|
||||
dwTotal = max(dwTotal, 1) # Don't go zero or negative
|
||||
dwTotal = max(dwTotal, 1) # Don't go zero or negative
|
||||
isFirst = False
|
||||
|
||||
if groupByDay:
|
||||
|
||||
Reference in New Issue
Block a user