Remove all END Class comments
This commit is contained in:
@@ -242,5 +242,3 @@ def main(sysArgs: list | None = None) -> GuiMain | None:
|
|||||||
sys.exit(nwApp.exec())
|
sys.exit(nwApp.exec())
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# END Function main
|
|
||||||
|
|||||||
@@ -603,5 +603,3 @@ class NWConfigParser(ConfigParser):
|
|||||||
for i in range(min(len(data), len(result))):
|
for i in range(min(len(data), len(result))):
|
||||||
result[i] = checkInt(data[i].strip(), result[i])
|
result[i] = checkInt(data[i].strip(), result[i])
|
||||||
return result
|
return result
|
||||||
|
|
||||||
# END Class NWConfigParser
|
|
||||||
|
|||||||
@@ -24,24 +24,24 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||||||
"""
|
"""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import sys
|
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
|
import sys
|
||||||
|
|
||||||
from time import time
|
|
||||||
from pathlib import Path
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
from pathlib import Path
|
||||||
|
from time import time
|
||||||
|
|
||||||
from PyQt5.QtGui import QFontDatabase
|
|
||||||
from PyQt5.QtCore import (
|
from PyQt5.QtCore import (
|
||||||
PYQT_VERSION, PYQT_VERSION_STR, QT_VERSION, QT_VERSION_STR, QLibraryInfo,
|
PYQT_VERSION, PYQT_VERSION_STR, QT_VERSION, QT_VERSION_STR, QLibraryInfo,
|
||||||
QLocale, QStandardPaths, QSysInfo, QTranslator
|
QLocale, QStandardPaths, QSysInfo, QTranslator
|
||||||
)
|
)
|
||||||
|
from PyQt5.QtGui import QFontDatabase
|
||||||
from PyQt5.QtWidgets import QApplication
|
from PyQt5.QtWidgets import QApplication
|
||||||
|
|
||||||
from novelwriter.error import formatException, logException
|
|
||||||
from novelwriter.common import NWConfigParser, checkInt, checkPath, formatTimeStamp
|
from novelwriter.common import NWConfigParser, checkInt, checkPath, formatTimeStamp
|
||||||
from novelwriter.constants import nwFiles, nwUnicode
|
from novelwriter.constants import nwFiles, nwUnicode
|
||||||
|
from novelwriter.error import formatException, logException
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -787,8 +787,6 @@ class Config:
|
|||||||
logger.debug("Checking package 'pyenchant': OK")
|
logger.debug("Checking package 'pyenchant': OK")
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class Config
|
|
||||||
|
|
||||||
|
|
||||||
class RecentProjects:
|
class RecentProjects:
|
||||||
|
|
||||||
@@ -857,5 +855,3 @@ class RecentProjects:
|
|||||||
logger.debug("Removed recent: %s", path)
|
logger.debug("Removed recent: %s", path)
|
||||||
self.saveCache()
|
self.saveCache()
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class RecentProjects
|
|
||||||
|
|||||||
@@ -60,8 +60,6 @@ class nwConst:
|
|||||||
# Dialogs
|
# Dialogs
|
||||||
DLG_FINISHED = 2
|
DLG_FINISHED = 2
|
||||||
|
|
||||||
# END Class nwConst
|
|
||||||
|
|
||||||
|
|
||||||
class nwRegEx:
|
class nwRegEx:
|
||||||
|
|
||||||
@@ -71,8 +69,6 @@ class nwRegEx:
|
|||||||
FMT_SC = r"(?i)(?<!\\)(\[[\/\!]?(?:i|b|s|u|m|sup|sub)\])"
|
FMT_SC = r"(?i)(?<!\\)(\[[\/\!]?(?:i|b|s|u|m|sup|sub)\])"
|
||||||
FMT_SV = r"(?<!\\)(\[(?i)(?:footnote):)(.+?)(?<!\\)(\])"
|
FMT_SV = r"(?<!\\)(\[(?i)(?:footnote):)(.+?)(?<!\\)(\])"
|
||||||
|
|
||||||
# END Class nwRegEx
|
|
||||||
|
|
||||||
|
|
||||||
class nwShortcode:
|
class nwShortcode:
|
||||||
|
|
||||||
@@ -98,16 +94,12 @@ class nwShortcode:
|
|||||||
nwComment.COMMENT: "[comment:{0}]",
|
nwComment.COMMENT: "[comment:{0}]",
|
||||||
}
|
}
|
||||||
|
|
||||||
# END Class nwShortcode
|
|
||||||
|
|
||||||
|
|
||||||
class nwHeaders:
|
class nwHeaders:
|
||||||
|
|
||||||
H_VALID = ("H0", "H1", "H2", "H3", "H4")
|
H_VALID = ("H0", "H1", "H2", "H3", "H4")
|
||||||
H_LEVEL = {"H0": 0, "H1": 1, "H2": 2, "H3": 3, "H4": 4}
|
H_LEVEL = {"H0": 0, "H1": 1, "H2": 2, "H3": 3, "H4": 4}
|
||||||
|
|
||||||
# END Class nwHeaders
|
|
||||||
|
|
||||||
|
|
||||||
class nwFiles:
|
class nwFiles:
|
||||||
|
|
||||||
@@ -127,8 +119,6 @@ class nwFiles:
|
|||||||
DICT_FILE = "userdict.json"
|
DICT_FILE = "userdict.json"
|
||||||
SESS_FILE = "sessions.jsonl"
|
SESS_FILE = "sessions.jsonl"
|
||||||
|
|
||||||
# END Class nwFiles
|
|
||||||
|
|
||||||
|
|
||||||
class nwKeyWords:
|
class nwKeyWords:
|
||||||
|
|
||||||
@@ -162,8 +152,6 @@ class nwKeyWords:
|
|||||||
CUSTOM_KEY: nwItemClass.CUSTOM,
|
CUSTOM_KEY: nwItemClass.CUSTOM,
|
||||||
}
|
}
|
||||||
|
|
||||||
# END Class nwKeyWords
|
|
||||||
|
|
||||||
|
|
||||||
class nwLists:
|
class nwLists:
|
||||||
|
|
||||||
@@ -177,8 +165,6 @@ class nwLists:
|
|||||||
nwItemClass.CUSTOM,
|
nwItemClass.CUSTOM,
|
||||||
]
|
]
|
||||||
|
|
||||||
# END Class nwLists
|
|
||||||
|
|
||||||
|
|
||||||
class nwLabels:
|
class nwLabels:
|
||||||
|
|
||||||
@@ -339,8 +325,6 @@ class nwLabels:
|
|||||||
"Custom": (-1.0, -1.0),
|
"Custom": (-1.0, -1.0),
|
||||||
}
|
}
|
||||||
|
|
||||||
# END Class nwLabels
|
|
||||||
|
|
||||||
|
|
||||||
class nwHeadFmt:
|
class nwHeadFmt:
|
||||||
|
|
||||||
@@ -366,8 +350,6 @@ class nwHeadFmt:
|
|||||||
ODT_PAGE = "{Page}"
|
ODT_PAGE = "{Page}"
|
||||||
ODT_AUTO = "{Project} / {Author} / {Page}"
|
ODT_AUTO = "{Project} / {Author} / {Page}"
|
||||||
|
|
||||||
# END Class nwHeadFmt
|
|
||||||
|
|
||||||
|
|
||||||
class nwQuotes:
|
class nwQuotes:
|
||||||
"""Allowed quotation marks.
|
"""Allowed quotation marks.
|
||||||
@@ -398,8 +380,6 @@ class nwQuotes:
|
|||||||
"\u300f": QT_TRANSLATE_NOOP("Constant", "Right white corner bracket"),
|
"\u300f": QT_TRANSLATE_NOOP("Constant", "Right white corner bracket"),
|
||||||
}
|
}
|
||||||
|
|
||||||
# END Class nwQuotes
|
|
||||||
|
|
||||||
|
|
||||||
class nwUnicode:
|
class nwUnicode:
|
||||||
"""Supported unicode character constants and their HTML equivalents."""
|
"""Supported unicode character constants and their HTML equivalents."""
|
||||||
@@ -534,8 +514,6 @@ class nwUnicode:
|
|||||||
H_LTRI = "◀"
|
H_LTRI = "◀"
|
||||||
H_LTRIS = "◂"
|
H_LTRIS = "◂"
|
||||||
|
|
||||||
# END Class nwUnicode
|
|
||||||
|
|
||||||
|
|
||||||
class nwHtmlUnicode():
|
class nwHtmlUnicode():
|
||||||
|
|
||||||
@@ -591,5 +569,3 @@ class nwHtmlUnicode():
|
|||||||
nwUnicode.U_TIMES: nwUnicode.H_TIMES,
|
nwUnicode.U_TIMES: nwUnicode.H_TIMES,
|
||||||
nwUnicode.U_DIVIDE: nwUnicode.H_DIVIDE,
|
nwUnicode.U_DIVIDE: nwUnicode.H_DIVIDE,
|
||||||
}
|
}
|
||||||
|
|
||||||
# END Class nwHtmlUnicode
|
|
||||||
|
|||||||
@@ -488,8 +488,6 @@ class BuildSettings:
|
|||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class BuildSettings
|
|
||||||
|
|
||||||
|
|
||||||
class BuildCollection:
|
class BuildCollection:
|
||||||
"""Core: Build Collection Class
|
"""Core: Build Collection Class
|
||||||
@@ -637,5 +635,3 @@ class BuildCollection:
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# END Class BuildCollection
|
|
||||||
|
|||||||
@@ -129,8 +129,6 @@ class DocMerger:
|
|||||||
|
|
||||||
return status
|
return status
|
||||||
|
|
||||||
# END Class DocMerger
|
|
||||||
|
|
||||||
|
|
||||||
class DocSplitter:
|
class DocSplitter:
|
||||||
"""Document tool for splitting a document into a set of new
|
"""Document tool for splitting a document into a set of new
|
||||||
@@ -257,8 +255,6 @@ class DocSplitter:
|
|||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class DocSplitter
|
|
||||||
|
|
||||||
|
|
||||||
class DocDuplicator:
|
class DocDuplicator:
|
||||||
"""A class that will duplicate all documents and folders starting
|
"""A class that will duplicate all documents and folders starting
|
||||||
@@ -297,8 +293,6 @@ class DocDuplicator:
|
|||||||
nHandle = None
|
nHandle = None
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class DocDuplicator
|
|
||||||
|
|
||||||
|
|
||||||
class DocSearch:
|
class DocSearch:
|
||||||
|
|
||||||
@@ -375,8 +369,6 @@ class DocSearch:
|
|||||||
search = f"(?:^|\\b){search}(?:$|\\b)"
|
search = f"(?:^|\\b){search}(?:$|\\b)"
|
||||||
return search
|
return search
|
||||||
|
|
||||||
# END Class DocSearch
|
|
||||||
|
|
||||||
|
|
||||||
class ProjectBuilder:
|
class ProjectBuilder:
|
||||||
"""A class to build a new project from a set of user-defined
|
"""A class to build a new project from a set of user-defined
|
||||||
@@ -609,5 +601,3 @@ class ProjectBuilder:
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# END Class ProjectBuilder
|
|
||||||
|
|||||||
@@ -405,5 +405,3 @@ class NWBuildDocument:
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# END Class NWBuildDocument
|
|
||||||
|
|||||||
@@ -26,14 +26,14 @@ from __future__ import annotations
|
|||||||
import hashlib
|
import hashlib
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
from time import time
|
from time import time
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
from novelwriter.enum import nwItemLayout, nwItemClass
|
|
||||||
from novelwriter.error import formatException, logException
|
|
||||||
from novelwriter.common import formatTimeStamp, isHandle
|
from novelwriter.common import formatTimeStamp, isHandle
|
||||||
from novelwriter.core.item import NWItem
|
from novelwriter.core.item import NWItem
|
||||||
|
from novelwriter.enum import nwItemClass, nwItemLayout
|
||||||
|
from novelwriter.error import formatException, logException
|
||||||
|
|
||||||
if TYPE_CHECKING: # pragma: no cover
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from novelwriter.core.project import NWProject
|
from novelwriter.core.project import NWProject
|
||||||
@@ -359,5 +359,3 @@ class NWDocument:
|
|||||||
logger.debug("Unknown meta data: '%s'", metaLine.strip())
|
logger.debug("Unknown meta data: '%s'", metaLine.strip())
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class NWDocument
|
|
||||||
|
|||||||
@@ -707,8 +707,6 @@ class NWIndex:
|
|||||||
return tName, tClass, iItem, None if iItem is None else iItem[tHeading]
|
return tName, tClass, iItem, None if iItem is None else iItem[tHeading]
|
||||||
return "", "", None, None
|
return "", "", None, None
|
||||||
|
|
||||||
# END Class NWIndex
|
|
||||||
|
|
||||||
|
|
||||||
# =============================================================================================== #
|
# =============================================================================================== #
|
||||||
# The Tags Index Object
|
# The Tags Index Object
|
||||||
@@ -832,8 +830,6 @@ class TagsIndex:
|
|||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class TagsIndex
|
|
||||||
|
|
||||||
|
|
||||||
# =============================================================================================== #
|
# =============================================================================================== #
|
||||||
# The Item Index Objects
|
# The Item Index Objects
|
||||||
@@ -1014,8 +1010,6 @@ class ItemIndex:
|
|||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class ItemIndex
|
|
||||||
|
|
||||||
|
|
||||||
class IndexItem:
|
class IndexItem:
|
||||||
"""Core: Single Index Item Class
|
"""Core: Single Index Item Class
|
||||||
@@ -1176,8 +1170,6 @@ class IndexItem:
|
|||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class IndexItem
|
|
||||||
|
|
||||||
|
|
||||||
class IndexHeading:
|
class IndexHeading:
|
||||||
"""Core: Single Index Heading Class
|
"""Core: Single Index Heading Class
|
||||||
@@ -1353,13 +1345,10 @@ class IndexHeading:
|
|||||||
raise ValueError("The itemIndex contains an invalid reference type")
|
raise ValueError("The itemIndex contains an invalid reference type")
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class IndexHeading
|
|
||||||
|
|
||||||
|
|
||||||
# =============================================================================================== #
|
# =============================================================================================== #
|
||||||
# Text Processing Functions
|
# Text Processing Functions
|
||||||
# =============================================================================================== #
|
# =============================================================================================== #
|
||||||
|
|
||||||
MODIFIERS = {
|
MODIFIERS = {
|
||||||
"synopsis": nwComment.SYNOPSIS,
|
"synopsis": nwComment.SYNOPSIS,
|
||||||
"short": nwComment.SHORT,
|
"short": nwComment.SHORT,
|
||||||
|
|||||||
@@ -29,11 +29,12 @@ from typing import TYPE_CHECKING, Any
|
|||||||
|
|
||||||
from PyQt5.QtGui import QIcon
|
from PyQt5.QtGui import QIcon
|
||||||
|
|
||||||
from novelwriter.enum import nwItemType, nwItemClass, nwItemLayout
|
|
||||||
from novelwriter.common import (
|
from novelwriter.common import (
|
||||||
checkInt, isHandle, isItemClass, isItemLayout, isItemType, simplified, yesNo
|
checkInt, isHandle, isItemClass, isItemLayout, isItemType, simplified,
|
||||||
|
yesNo
|
||||||
)
|
)
|
||||||
from novelwriter.constants import nwHeaders, nwLabels, trConst
|
from novelwriter.constants import nwHeaders, nwLabels, trConst
|
||||||
|
from novelwriter.enum import nwItemClass, nwItemLayout, nwItemType
|
||||||
|
|
||||||
if TYPE_CHECKING: # pragma: no cover
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from novelwriter.core.project import NWProject
|
from novelwriter.core.project import NWProject
|
||||||
@@ -557,5 +558,3 @@ class NWItem:
|
|||||||
"""Save the initial word count."""
|
"""Save the initial word count."""
|
||||||
self._initCount = self._wordCount
|
self._initCount = self._wordCount
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class NWItem
|
|
||||||
|
|||||||
@@ -28,12 +28,12 @@ import json
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from typing import TYPE_CHECKING, Any, TypeVar
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from typing import TYPE_CHECKING, Any, TypeVar
|
||||||
|
|
||||||
from novelwriter.error import logException
|
|
||||||
from novelwriter.common import checkBool, checkFloat, checkInt, checkString, jsonEncode
|
from novelwriter.common import checkBool, checkFloat, checkInt, checkString, jsonEncode
|
||||||
from novelwriter.constants import nwFiles
|
from novelwriter.constants import nwFiles
|
||||||
|
from novelwriter.error import logException
|
||||||
|
|
||||||
if TYPE_CHECKING: # pragma: no cover
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from novelwriter.core.project import NWProject
|
from novelwriter.core.project import NWProject
|
||||||
@@ -218,5 +218,3 @@ class OptionState:
|
|||||||
if value in lookup.__members__:
|
if value in lookup.__members__:
|
||||||
return lookup[value]
|
return lookup[value]
|
||||||
return default
|
return default
|
||||||
|
|
||||||
# END Class OptionState
|
|
||||||
|
|||||||
@@ -35,11 +35,12 @@ from typing import TYPE_CHECKING
|
|||||||
|
|
||||||
from PyQt5.QtCore import QCoreApplication
|
from PyQt5.QtCore import QCoreApplication
|
||||||
|
|
||||||
from novelwriter import CONFIG, SHARED, __version__, __hexversion__
|
from novelwriter import CONFIG, SHARED, __hexversion__, __version__
|
||||||
from novelwriter.common import (
|
from novelwriter.common import (
|
||||||
checkStringNone, formatInt, formatTimeStamp, getFileSize, hexToInt, makeFileNameSafe, minmax
|
checkStringNone, formatInt, formatTimeStamp, getFileSize, hexToInt,
|
||||||
|
makeFileNameSafe, minmax
|
||||||
)
|
)
|
||||||
from novelwriter.constants import trConst, nwLabels
|
from novelwriter.constants import nwLabels, trConst
|
||||||
from novelwriter.core.index import NWIndex
|
from novelwriter.core.index import NWIndex
|
||||||
from novelwriter.core.options import OptionState
|
from novelwriter.core.options import OptionState
|
||||||
from novelwriter.core.projectdata import NWProjectData
|
from novelwriter.core.projectdata import NWProjectData
|
||||||
@@ -47,7 +48,7 @@ from novelwriter.core.projectxml import ProjectXMLReader, ProjectXMLWriter, XMLR
|
|||||||
from novelwriter.core.sessions import NWSessionLog
|
from novelwriter.core.sessions import NWSessionLog
|
||||||
from novelwriter.core.storage import NWStorage, NWStorageOpen
|
from novelwriter.core.storage import NWStorage, NWStorageOpen
|
||||||
from novelwriter.core.tree import NWTree
|
from novelwriter.core.tree import NWTree
|
||||||
from novelwriter.enum import nwItemType, nwItemClass, nwItemLayout
|
from novelwriter.enum import nwItemClass, nwItemLayout, nwItemType
|
||||||
from novelwriter.error import logException
|
from novelwriter.error import logException
|
||||||
|
|
||||||
if TYPE_CHECKING: # pragma: no cover
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
@@ -595,5 +596,3 @@ class NWProject:
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# END Class NWProject
|
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||||||
"""
|
"""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import uuid
|
|
||||||
import logging
|
import logging
|
||||||
|
import uuid
|
||||||
|
|
||||||
from typing import TYPE_CHECKING, Any
|
from typing import TYPE_CHECKING, Any
|
||||||
|
|
||||||
@@ -322,5 +322,3 @@ class NWProjectData:
|
|||||||
self._autoReplace[key] = simplified(entry)
|
self._autoReplace[key] = simplified(entry)
|
||||||
self._project.setProjectChanged(True)
|
self._project.setProjectChanged(True)
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class NWProjectData
|
|
||||||
|
|||||||
@@ -29,19 +29,19 @@ import logging
|
|||||||
import xml.etree.ElementTree as ET
|
import xml.etree.ElementTree as ET
|
||||||
|
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
|
from pathlib import Path
|
||||||
from time import time
|
from time import time
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
from novelwriter import __version__, __hexversion__
|
from novelwriter import __hexversion__, __version__
|
||||||
from novelwriter.common import (
|
from novelwriter.common import (
|
||||||
checkBool, checkInt, checkString, checkStringNone, formatTimeStamp,
|
checkBool, checkInt, checkString, checkStringNone, formatTimeStamp,
|
||||||
hexToInt, simplified, xmlIndent, yesNo
|
hexToInt, simplified, xmlIndent, yesNo
|
||||||
)
|
)
|
||||||
|
|
||||||
if TYPE_CHECKING: # pragma: no cover
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from novelwriter.core.status import NWStatus
|
|
||||||
from novelwriter.core.projectdata import NWProjectData
|
from novelwriter.core.projectdata import NWProjectData
|
||||||
|
from novelwriter.core.status import NWStatus
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -70,8 +70,6 @@ class XMLReadState(Enum):
|
|||||||
PARSED_OK = 5
|
PARSED_OK = 5
|
||||||
WAS_LEGACY = 6
|
WAS_LEGACY = 6
|
||||||
|
|
||||||
# END Class XMLReadState
|
|
||||||
|
|
||||||
|
|
||||||
class ProjectXMLReader:
|
class ProjectXMLReader:
|
||||||
"""Core: Project XML Reader
|
"""Core: Project XML Reader
|
||||||
@@ -458,8 +456,6 @@ class ProjectXMLReader:
|
|||||||
"""
|
"""
|
||||||
return {xNode.tag: checkString(xNode.text, "") for xNode in xItem}
|
return {xNode.tag: checkString(xNode.text, "") for xNode in xItem}
|
||||||
|
|
||||||
# END Class ProjectXMLReader
|
|
||||||
|
|
||||||
|
|
||||||
class ProjectXMLWriter:
|
class ProjectXMLWriter:
|
||||||
"""Core: Project XML Writer
|
"""Core: Project XML Writer
|
||||||
@@ -579,5 +575,3 @@ class ProjectXMLWriter:
|
|||||||
xEntry = ET.SubElement(xItem, "entry", attrib={"key": key})
|
xEntry = ET.SubElement(xItem, "entry", attrib={"key": key})
|
||||||
xEntry.text = str(value) or ""
|
xEntry.text = str(value) or ""
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class ProjectXMLWriter
|
|
||||||
|
|||||||
@@ -26,14 +26,14 @@ from __future__ import annotations
|
|||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from collections.abc import Iterable
|
||||||
|
from pathlib import Path
|
||||||
from time import time
|
from time import time
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
from pathlib import Path
|
|
||||||
from collections.abc import Iterable
|
|
||||||
|
|
||||||
from novelwriter.error import logException
|
|
||||||
from novelwriter.common import formatTimeStamp
|
from novelwriter.common import formatTimeStamp
|
||||||
from novelwriter.constants import nwFiles
|
from novelwriter.constants import nwFiles
|
||||||
|
from novelwriter.error import logException
|
||||||
|
|
||||||
if TYPE_CHECKING: # pragma: no cover
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from novelwriter.core.project import NWProject
|
from novelwriter.core.project import NWProject
|
||||||
@@ -135,5 +135,3 @@ class NWSessionLog:
|
|||||||
"novel": novel, "notes": notes, "idle": idle,
|
"novel": novel, "notes": notes, "idle": idle,
|
||||||
})
|
})
|
||||||
return f"{data}\n"
|
return f"{data}\n"
|
||||||
|
|
||||||
# END Class NWSessionLog
|
|
||||||
|
|||||||
@@ -27,14 +27,14 @@ from __future__ import annotations
|
|||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from typing import TYPE_CHECKING
|
|
||||||
from pathlib import Path
|
|
||||||
from collections.abc import Iterator
|
from collections.abc import Iterator
|
||||||
|
from pathlib import Path
|
||||||
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
from PyQt5.QtCore import QLocale
|
from PyQt5.QtCore import QLocale
|
||||||
|
|
||||||
from novelwriter.error import logException
|
|
||||||
from novelwriter.constants import nwFiles
|
from novelwriter.constants import nwFiles
|
||||||
|
from novelwriter.error import logException
|
||||||
|
|
||||||
if TYPE_CHECKING: # pragma: no cover
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from novelwriter.core.project import NWProject
|
from novelwriter.core.project import NWProject
|
||||||
@@ -164,11 +164,10 @@ class NWSpellEnchant:
|
|||||||
name = ""
|
name = ""
|
||||||
return tag, name
|
return tag, name
|
||||||
|
|
||||||
# END Class NWSpellEnchant
|
|
||||||
|
|
||||||
|
|
||||||
class FakeEnchant:
|
class FakeEnchant:
|
||||||
"""Fallback for when Enchant is selected, but not installed."""
|
"""Fallback for when Enchant is selected, but not installed."""
|
||||||
|
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
|
|
||||||
class FakeProvider:
|
class FakeProvider:
|
||||||
@@ -188,8 +187,6 @@ class FakeEnchant:
|
|||||||
def add_to_session(self, word: str) -> None:
|
def add_to_session(self, word: str) -> None:
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class FakeEnchant
|
|
||||||
|
|
||||||
|
|
||||||
class UserDictionary:
|
class UserDictionary:
|
||||||
|
|
||||||
@@ -240,5 +237,3 @@ class UserDictionary:
|
|||||||
logger.error("Failed to save user dictionary")
|
logger.error("Failed to save user dictionary")
|
||||||
logException()
|
logException()
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class UserDictionary
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ from collections.abc import Iterable
|
|||||||
from typing import TYPE_CHECKING, Literal
|
from typing import TYPE_CHECKING, Literal
|
||||||
|
|
||||||
from PyQt5.QtCore import QPointF, Qt
|
from PyQt5.QtCore import QPointF, Qt
|
||||||
from PyQt5.QtGui import QIcon, QPainter, QPainterPath, QPixmap, QColor, QPolygonF
|
from PyQt5.QtGui import QColor, QIcon, QPainter, QPainterPath, QPixmap, QPolygonF
|
||||||
|
|
||||||
from novelwriter import SHARED
|
from novelwriter import SHARED
|
||||||
from novelwriter.common import simplified
|
from novelwriter.common import simplified
|
||||||
@@ -62,8 +62,6 @@ class StatusEntry:
|
|||||||
cls.icon = QIcon(source.icon)
|
cls.icon = QIcon(source.icon)
|
||||||
return cls
|
return cls
|
||||||
|
|
||||||
# END Class StatusEntry
|
|
||||||
|
|
||||||
|
|
||||||
NO_ENTRY = StatusEntry("", QColor(0, 0, 0), nwStatusShape.SQUARE, QIcon(), 0)
|
NO_ENTRY = StatusEntry("", QColor(0, 0, 0), nwStatusShape.SQUARE, QIcon(), 0)
|
||||||
|
|
||||||
@@ -221,8 +219,6 @@ class NWStatus:
|
|||||||
"""Check key is valid, and if not, generate one."""
|
"""Check key is valid, and if not, generate one."""
|
||||||
return key if self._isKey(key) else self._newKey()
|
return key if self._isKey(key) else self._newKey()
|
||||||
|
|
||||||
# END Class NWStatus
|
|
||||||
|
|
||||||
|
|
||||||
class _ShapeCache:
|
class _ShapeCache:
|
||||||
|
|
||||||
@@ -329,8 +325,6 @@ class _ShapeCache:
|
|||||||
|
|
||||||
return path
|
return path
|
||||||
|
|
||||||
# END Class _ShapeCache
|
|
||||||
|
|
||||||
|
|
||||||
# Create Singleton
|
# Create Singleton
|
||||||
_SHAPES = _ShapeCache()
|
_SHAPES = _ShapeCache()
|
||||||
|
|||||||
@@ -391,8 +391,6 @@ class NWStorage:
|
|||||||
self._lockedBy = None
|
self._lockedBy = None
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# END Class NWStorage
|
|
||||||
|
|
||||||
|
|
||||||
class _LegacyStorage:
|
class _LegacyStorage:
|
||||||
"""Core: Legacy Storage Converter Utils
|
"""Core: Legacy Storage Converter Utils
|
||||||
@@ -590,5 +588,3 @@ class _LegacyStorage:
|
|||||||
logException()
|
logException()
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class _LegacyStorage
|
|
||||||
|
|||||||
@@ -536,5 +536,3 @@ class ToHtml(Tokenizer):
|
|||||||
)
|
)
|
||||||
|
|
||||||
return bits[0][1:], result
|
return bits[0][1:], result
|
||||||
|
|
||||||
# END Class ToHtml
|
|
||||||
|
|||||||
@@ -1045,8 +1045,6 @@ class Tokenizer(ABC):
|
|||||||
|
|
||||||
return result, formats
|
return result, formats
|
||||||
|
|
||||||
# END Class Tokenizer
|
|
||||||
|
|
||||||
|
|
||||||
class HeadingFormatter:
|
class HeadingFormatter:
|
||||||
|
|
||||||
@@ -1116,5 +1114,3 @@ class HeadingFormatter:
|
|||||||
hFormat = hFormat.replace(nwHeadFmt.CHAR_FOCUS, fText)
|
hFormat = hFormat.replace(nwHeadFmt.CHAR_FOCUS, fText)
|
||||||
|
|
||||||
return hFormat
|
return hFormat
|
||||||
|
|
||||||
# END Class HeadingFormatter
|
|
||||||
|
|||||||
@@ -272,5 +272,3 @@ class ToMarkdown(Tokenizer):
|
|||||||
result += " \n" if style & self.A_Z_BTMMRG else "\n\n"
|
result += " \n" if style & self.A_Z_BTMMRG else "\n\n"
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
# END Class ToMarkdown
|
|
||||||
|
|||||||
@@ -1079,8 +1079,6 @@ class ToOdt(Tokenizer):
|
|||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class ToOdt
|
|
||||||
|
|
||||||
|
|
||||||
# =============================================================================================== #
|
# =============================================================================================== #
|
||||||
# Auto-Style Classes
|
# Auto-Style Classes
|
||||||
@@ -1332,8 +1330,6 @@ class ODTParagraphStyle:
|
|||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class ODTParagraphStyle
|
|
||||||
|
|
||||||
|
|
||||||
class ODTTextStyle:
|
class ODTTextStyle:
|
||||||
"""Wrapper class for the text style setting used by the exporter.
|
"""Wrapper class for the text style setting used by the exporter.
|
||||||
@@ -1457,13 +1453,10 @@ class ODTTextStyle:
|
|||||||
ET.SubElement(xEntry, _mkTag("style", "text-properties"), attrib=attr)
|
ET.SubElement(xEntry, _mkTag("style", "text-properties"), attrib=attr)
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class ODTTextStyle
|
|
||||||
|
|
||||||
|
|
||||||
# =============================================================================================== #
|
# =============================================================================================== #
|
||||||
# XML Complex Element Helper Class
|
# XML Complex Element Helper Class
|
||||||
# =============================================================================================== #
|
# =============================================================================================== #
|
||||||
|
|
||||||
X_ROOT_TEXT = 0
|
X_ROOT_TEXT = 0
|
||||||
X_ROOT_TAIL = 1
|
X_ROOT_TAIL = 1
|
||||||
X_SPAN_TEXT = 2
|
X_SPAN_TEXT = 2
|
||||||
@@ -1661,5 +1654,3 @@ class XMLParagraph:
|
|||||||
self._chrPos += nSpaces - 1
|
self._chrPos += nSpaces - 1
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class XMLParagraph
|
|
||||||
|
|||||||
@@ -23,18 +23,18 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||||||
"""
|
"""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import random
|
|
||||||
import logging
|
import logging
|
||||||
|
import random
|
||||||
|
|
||||||
from typing import TYPE_CHECKING, Literal, overload
|
|
||||||
from pathlib import Path
|
|
||||||
from collections.abc import Iterable, Iterator
|
from collections.abc import Iterable, Iterator
|
||||||
|
from pathlib import Path
|
||||||
|
from typing import TYPE_CHECKING, Literal, overload
|
||||||
|
|
||||||
from novelwriter.enum import nwItemClass, nwItemLayout, nwItemType
|
|
||||||
from novelwriter.error import logException
|
|
||||||
from novelwriter.common import isHandle
|
from novelwriter.common import isHandle
|
||||||
from novelwriter.constants import nwFiles
|
from novelwriter.constants import nwFiles
|
||||||
from novelwriter.core.item import NWItem
|
from novelwriter.core.item import NWItem
|
||||||
|
from novelwriter.enum import nwItemClass, nwItemLayout, nwItemType
|
||||||
|
from novelwriter.error import logException
|
||||||
|
|
||||||
if TYPE_CHECKING: # pragma: no cover
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
from novelwriter.core.project import NWProject
|
from novelwriter.core.project import NWProject
|
||||||
@@ -520,5 +520,3 @@ class NWTree:
|
|||||||
handle = self._makeHandle()
|
handle = self._makeHandle()
|
||||||
|
|
||||||
return handle
|
return handle
|
||||||
|
|
||||||
# END Class NWTree
|
|
||||||
|
|||||||
@@ -152,5 +152,3 @@ class GuiAbout(NNonBlockingDialog):
|
|||||||
f"QTextBrowser {{border: none; background: {baseCol};}} "
|
f"QTextBrowser {{border: none; background: {baseCol};}} "
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class GuiAbout
|
|
||||||
|
|||||||
@@ -34,8 +34,8 @@ from PyQt5.QtWidgets import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
from novelwriter import CONFIG, SHARED
|
from novelwriter import CONFIG, SHARED
|
||||||
from novelwriter.extensions.switch import NSwitch
|
|
||||||
from novelwriter.extensions.configlayout import NColourLabel
|
from novelwriter.extensions.configlayout import NColourLabel
|
||||||
|
from novelwriter.extensions.switch import NSwitch
|
||||||
from novelwriter.types import QtDialogCancel, QtDialogOk, QtDialogReset, QtUserRole
|
from novelwriter.types import QtDialogCancel, QtDialogOk, QtDialogReset, QtUserRole
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@@ -182,5 +182,3 @@ class GuiDocMerge(QDialog):
|
|||||||
self.listBox.addItem(newItem)
|
self.listBox.addItem(newItem)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class GuiDocMerge
|
|
||||||
|
|||||||
@@ -34,8 +34,8 @@ from PyQt5.QtWidgets import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
from novelwriter import CONFIG, SHARED
|
from novelwriter import CONFIG, SHARED
|
||||||
from novelwriter.extensions.switch import NSwitch
|
|
||||||
from novelwriter.extensions.configlayout import NColourLabel
|
from novelwriter.extensions.configlayout import NColourLabel
|
||||||
|
from novelwriter.extensions.switch import NSwitch
|
||||||
from novelwriter.types import QtDialogCancel, QtDialogOk, QtUserRole
|
from novelwriter.types import QtDialogCancel, QtDialogOk, QtUserRole
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@@ -257,5 +257,3 @@ class GuiDocSplit(QDialog):
|
|||||||
self.listBox.addItem(newItem)
|
self.listBox.addItem(newItem)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class GuiDocSplit
|
|
||||||
|
|||||||
@@ -94,5 +94,3 @@ class GuiEditLabel(QDialog):
|
|||||||
accepted = cls.result() == QDialog.DialogCode.Accepted
|
accepted = cls.result() == QDialog.DialogCode.Accepted
|
||||||
cls.deleteLater()
|
cls.deleteLater()
|
||||||
return label, accepted
|
return label, accepted
|
||||||
|
|
||||||
# END Class GuiEditLabel
|
|
||||||
|
|||||||
@@ -962,5 +962,3 @@ class GuiPreferences(QDialog):
|
|||||||
self.newPreferencesReady.emit(needsRestart, refreshTree, updateTheme, updateSyntax)
|
self.newPreferencesReady.emit(needsRestart, refreshTree, updateTheme, updateSyntax)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class GuiPreferences
|
|
||||||
|
|||||||
@@ -29,8 +29,8 @@ import logging
|
|||||||
from PyQt5.QtCore import Qt, pyqtSignal, pyqtSlot
|
from PyQt5.QtCore import Qt, pyqtSignal, pyqtSlot
|
||||||
from PyQt5.QtGui import QCloseEvent, QColor
|
from PyQt5.QtGui import QCloseEvent, QColor
|
||||||
from PyQt5.QtWidgets import (
|
from PyQt5.QtWidgets import (
|
||||||
QAbstractItemView, QApplication, QColorDialog, QDialog, QDialogButtonBox, QHBoxLayout,
|
QAbstractItemView, QApplication, QColorDialog, QDialog, QDialogButtonBox,
|
||||||
QLineEdit, QMenu, QStackedWidget, QToolButton, QTreeWidget,
|
QHBoxLayout, QLineEdit, QMenu, QStackedWidget, QToolButton, QTreeWidget,
|
||||||
QTreeWidgetItem, QVBoxLayout, QWidget
|
QTreeWidgetItem, QVBoxLayout, QWidget
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -227,8 +227,6 @@ class GuiProjectSettings(QDialog):
|
|||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class GuiProjectSettings
|
|
||||||
|
|
||||||
|
|
||||||
class _SettingsPage(NScrollableForm):
|
class _SettingsPage(NScrollableForm):
|
||||||
|
|
||||||
@@ -302,8 +300,6 @@ class _SettingsPage(NScrollableForm):
|
|||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class _SettingsPage
|
|
||||||
|
|
||||||
|
|
||||||
class _StatusPage(NFixedPage):
|
class _StatusPage(NFixedPage):
|
||||||
|
|
||||||
@@ -622,8 +618,6 @@ class _StatusPage(NFixedPage):
|
|||||||
self.shapeButton.setIcon(self._icons[self._shape])
|
self.shapeButton.setIcon(self._icons[self._shape])
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class _StatusPage
|
|
||||||
|
|
||||||
|
|
||||||
class _ReplacePage(NFixedPage):
|
class _ReplacePage(NFixedPage):
|
||||||
|
|
||||||
@@ -797,5 +791,3 @@ class _ReplacePage(NFixedPage):
|
|||||||
def _stripNotAllowed(self, key: str) -> str:
|
def _stripNotAllowed(self, key: str) -> str:
|
||||||
"""Clean up the replace key string."""
|
"""Clean up the replace key string."""
|
||||||
return "".join(c for c in key if c.isalnum())
|
return "".join(c for c in key if c.isalnum())
|
||||||
|
|
||||||
# END Class _ReplacePage
|
|
||||||
|
|||||||
@@ -25,15 +25,15 @@ from __future__ import annotations
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from PyQt5.QtGui import QFontMetrics
|
|
||||||
from PyQt5.QtCore import QSize, pyqtSlot
|
from PyQt5.QtCore import QSize, pyqtSlot
|
||||||
|
from PyQt5.QtGui import QFontMetrics
|
||||||
from PyQt5.QtWidgets import (
|
from PyQt5.QtWidgets import (
|
||||||
QDialog, QDialogButtonBox, QFrame, QHBoxLayout, QLabel, QListWidget,
|
QDialog, QDialogButtonBox, QFrame, QHBoxLayout, QLabel, QListWidget,
|
||||||
QListWidgetItem, QVBoxLayout, QWidget
|
QListWidgetItem, QVBoxLayout, QWidget
|
||||||
)
|
)
|
||||||
|
|
||||||
from novelwriter import CONFIG
|
from novelwriter import CONFIG
|
||||||
from novelwriter.constants import trConst, nwQuotes
|
from novelwriter.constants import nwQuotes, trConst
|
||||||
from novelwriter.types import QtAlignCenter, QtAlignTop, QtDialogCancel, QtDialogOk, QtUserRole
|
from novelwriter.types import QtAlignCenter, QtAlignTop, QtDialogCancel, QtDialogOk, QtUserRole
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@@ -141,5 +141,3 @@ class GuiQuoteSelect(QDialog):
|
|||||||
self.previewLabel.setText(quote)
|
self.previewLabel.setText(quote)
|
||||||
self._selected = quote
|
self._selected = quote
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class GuiQuoteSelect
|
|
||||||
|
|||||||
@@ -253,5 +253,3 @@ class GuiWordList(QDialog):
|
|||||||
if (item := self.listBox.item(i)) and (word := item.text().strip()):
|
if (item := self.listBox.item(i)) and (word := item.text().strip()):
|
||||||
result.append(word)
|
result.append(word)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
# END Class GuiWordList
|
|
||||||
|
|||||||
@@ -23,17 +23,17 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||||||
"""
|
"""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import sys
|
|
||||||
import random
|
|
||||||
import logging
|
import logging
|
||||||
|
import random
|
||||||
|
import sys
|
||||||
|
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
from PyQt5.QtCore import Qt, pyqtSlot
|
from PyQt5.QtCore import Qt, pyqtSlot
|
||||||
from PyQt5.QtGui import QFont, QFontDatabase
|
from PyQt5.QtGui import QFont, QFontDatabase
|
||||||
from PyQt5.QtWidgets import (
|
from PyQt5.QtWidgets import (
|
||||||
QApplication, QWidget, QDialog, QGridLayout, QStyle, QPlainTextEdit,
|
QApplication, QDialog, QDialogButtonBox, QGridLayout, QLabel,
|
||||||
QLabel, QDialogButtonBox
|
QPlainTextEdit, QStyle, QWidget
|
||||||
)
|
)
|
||||||
|
|
||||||
if TYPE_CHECKING: # pragma: no cover
|
if TYPE_CHECKING: # pragma: no cover
|
||||||
@@ -125,9 +125,11 @@ class NWErrorMessage(QDialog):
|
|||||||
error traceback.
|
error traceback.
|
||||||
"""
|
"""
|
||||||
from traceback import format_tb
|
from traceback import format_tb
|
||||||
|
|
||||||
|
from PyQt5.QtCore import PYQT_VERSION_STR, QT_VERSION_STR, QSysInfo
|
||||||
|
|
||||||
from novelwriter import __version__
|
from novelwriter import __version__
|
||||||
from novelwriter.constants import nwConst
|
from novelwriter.constants import nwConst
|
||||||
from PyQt5.QtCore import QT_VERSION_STR, PYQT_VERSION_STR, QSysInfo
|
|
||||||
|
|
||||||
self.msgHead.setText(
|
self.msgHead.setText(
|
||||||
"<p>An unhandled error has been encountered.</p>"
|
"<p>An unhandled error has been encountered.</p>"
|
||||||
@@ -175,12 +177,11 @@ class NWErrorMessage(QDialog):
|
|||||||
self.close()
|
self.close()
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class NWErrorMessage
|
|
||||||
|
|
||||||
|
|
||||||
def exceptionHandler(exType: type, exValue: BaseException, exTrace: TracebackType) -> None:
|
def exceptionHandler(exType: type, exValue: BaseException, exTrace: TracebackType) -> None:
|
||||||
"""Function to catch unhandled global exceptions."""
|
"""Function to catch unhandled global exceptions."""
|
||||||
from traceback import print_tb
|
from traceback import print_tb
|
||||||
|
|
||||||
from PyQt5.QtWidgets import QApplication
|
from PyQt5.QtWidgets import QApplication
|
||||||
|
|
||||||
logger.critical("%s: %s", exType.__name__, str(exValue))
|
logger.critical("%s: %s", exType.__name__, str(exValue))
|
||||||
|
|||||||
@@ -26,11 +26,11 @@ from __future__ import annotations
|
|||||||
from math import ceil
|
from math import ceil
|
||||||
|
|
||||||
from PyQt5.QtCore import QRect
|
from PyQt5.QtCore import QRect
|
||||||
from PyQt5.QtGui import QBrush, QColor, QPaintEvent, QPainter, QPen
|
from PyQt5.QtGui import QBrush, QColor, QPainter, QPaintEvent, QPen
|
||||||
from PyQt5.QtWidgets import QProgressBar, QWidget
|
from PyQt5.QtWidgets import QProgressBar, QWidget
|
||||||
|
|
||||||
from novelwriter.types import (
|
from novelwriter.types import (
|
||||||
QtPaintAnitAlias, QtAlignCenter, QtRoundCap, QtSizeFixed, QtSolidLine,
|
QtAlignCenter, QtPaintAnitAlias, QtRoundCap, QtSizeFixed, QtSolidLine,
|
||||||
QtTransparent
|
QtTransparent
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -101,5 +101,3 @@ class NProgressCircle(QProgressBar):
|
|||||||
painter.setPen(self._tColor)
|
painter.setPen(self._tColor)
|
||||||
painter.drawText(self._cRect, QtAlignCenter, self._text or f"{progress:.1f} %")
|
painter.drawText(self._cRect, QtAlignCenter, self._text or f"{progress:.1f} %")
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class NProgressCircle
|
|
||||||
|
|||||||
@@ -27,8 +27,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||||||
"""
|
"""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from PyQt5.QtGui import QColor, QFont, QPalette
|
|
||||||
from PyQt5.QtCore import Qt
|
from PyQt5.QtCore import Qt
|
||||||
|
from PyQt5.QtGui import QColor, QFont, QPalette
|
||||||
from PyQt5.QtWidgets import (
|
from PyQt5.QtWidgets import (
|
||||||
QAbstractButton, QFrame, QHBoxLayout, QLabel, QLayout, QScrollArea,
|
QAbstractButton, QFrame, QHBoxLayout, QLabel, QLayout, QScrollArea,
|
||||||
QVBoxLayout, QWidget
|
QVBoxLayout, QWidget
|
||||||
@@ -64,8 +64,6 @@ class NFixedPage(QFrame):
|
|||||||
self.setLayout(layout)
|
self.setLayout(layout)
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class NFixedPage
|
|
||||||
|
|
||||||
|
|
||||||
class NScrollablePage(QScrollArea):
|
class NScrollablePage(QScrollArea):
|
||||||
"""Extension: Scrollable Page Widget
|
"""Extension: Scrollable Page Widget
|
||||||
@@ -89,8 +87,6 @@ class NScrollablePage(QScrollArea):
|
|||||||
self._widget.setLayout(layout)
|
self._widget.setLayout(layout)
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class NScrollablePage
|
|
||||||
|
|
||||||
|
|
||||||
class NScrollableForm(QScrollArea):
|
class NScrollableForm(QScrollArea):
|
||||||
"""Extension: Scrollable Form Widget
|
"""Extension: Scrollable Form Widget
|
||||||
@@ -235,8 +231,6 @@ class NScrollableForm(QScrollArea):
|
|||||||
self._layout.addStretch(1)
|
self._layout.addStretch(1)
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class NScrollableForm
|
|
||||||
|
|
||||||
|
|
||||||
class NColourLabel(QLabel):
|
class NColourLabel(QLabel):
|
||||||
"""Extension: A Coloured Label
|
"""Extension: A Coloured Label
|
||||||
@@ -267,8 +261,6 @@ class NColourLabel(QLabel):
|
|||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class NColourLabel
|
|
||||||
|
|
||||||
|
|
||||||
class NWrappedWidgetBox(QHBoxLayout):
|
class NWrappedWidgetBox(QHBoxLayout):
|
||||||
"""Extension: A Text-Wrapped Widget Box
|
"""Extension: A Text-Wrapped Widget Box
|
||||||
@@ -287,5 +279,3 @@ class NWrappedWidgetBox(QHBoxLayout):
|
|||||||
if after:
|
if after:
|
||||||
self.addWidget(QLabel(after.lstrip()))
|
self.addWidget(QLabel(after.lstrip()))
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class NWrappedWidgetBox
|
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||||||
"""
|
"""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from PyQt5.QtGui import QStatusTipEvent, QWheelEvent
|
|
||||||
from PyQt5.QtCore import QEvent, QObject
|
from PyQt5.QtCore import QEvent, QObject
|
||||||
|
from PyQt5.QtGui import QStatusTipEvent, QWheelEvent
|
||||||
from PyQt5.QtWidgets import QWidget
|
from PyQt5.QtWidgets import QWidget
|
||||||
|
|
||||||
|
|
||||||
@@ -63,13 +63,9 @@ class WheelEventFilter(QObject):
|
|||||||
self._locked = False
|
self._locked = False
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# END Class WheelEventFilter
|
|
||||||
|
|
||||||
|
|
||||||
class StatusTipFilter(QObject):
|
class StatusTipFilter(QObject):
|
||||||
|
|
||||||
def eventFilter(self, obj: QObject, event: QEvent) -> bool:
|
def eventFilter(self, obj: QObject, event: QEvent) -> bool:
|
||||||
"""Filter out status tip events on menus."""
|
"""Filter out status tip events on menus."""
|
||||||
return True if isinstance(event, QStatusTipEvent) else super().eventFilter(obj, event)
|
return True if isinstance(event, QStatusTipEvent) else super().eventFilter(obj, event)
|
||||||
|
|
||||||
# END Class StatusTipFilter
|
|
||||||
|
|||||||
@@ -61,8 +61,6 @@ class NToolDialog(QDialog):
|
|||||||
QApplication.processEvents()
|
QApplication.processEvents()
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class NToolDialog
|
|
||||||
|
|
||||||
|
|
||||||
class NNonBlockingDialog(QDialog):
|
class NNonBlockingDialog(QDialog):
|
||||||
|
|
||||||
@@ -80,8 +78,6 @@ class NNonBlockingDialog(QDialog):
|
|||||||
QApplication.processEvents()
|
QApplication.processEvents()
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class NNonBlockingDialog
|
|
||||||
|
|
||||||
|
|
||||||
class NComboBox(QComboBox):
|
class NComboBox(QComboBox):
|
||||||
|
|
||||||
@@ -103,8 +99,6 @@ class NComboBox(QComboBox):
|
|||||||
self.setCurrentIndex(self.findData(default) if idx < 0 else idx)
|
self.setCurrentIndex(self.findData(default) if idx < 0 else idx)
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class NComboBox
|
|
||||||
|
|
||||||
|
|
||||||
class NSpinBox(QSpinBox):
|
class NSpinBox(QSpinBox):
|
||||||
|
|
||||||
@@ -120,8 +114,6 @@ class NSpinBox(QSpinBox):
|
|||||||
event.ignore()
|
event.ignore()
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class NSpinBox
|
|
||||||
|
|
||||||
|
|
||||||
class NDoubleSpinBox(QDoubleSpinBox):
|
class NDoubleSpinBox(QDoubleSpinBox):
|
||||||
|
|
||||||
@@ -137,8 +129,6 @@ class NDoubleSpinBox(QDoubleSpinBox):
|
|||||||
event.ignore()
|
event.ignore()
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class NDoubleSpinBox
|
|
||||||
|
|
||||||
|
|
||||||
class NIconToolButton(QToolButton):
|
class NIconToolButton(QToolButton):
|
||||||
|
|
||||||
@@ -156,8 +146,6 @@ class NIconToolButton(QToolButton):
|
|||||||
self.setIcon(SHARED.theme.getIcon(iconKey))
|
self.setIcon(SHARED.theme.getIcon(iconKey))
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class NIconToolButton
|
|
||||||
|
|
||||||
|
|
||||||
class NIconToggleButton(QToolButton):
|
class NIconToggleButton(QToolButton):
|
||||||
|
|
||||||
@@ -177,5 +165,3 @@ class NIconToggleButton(QToolButton):
|
|||||||
iconSize = self.iconSize()
|
iconSize = self.iconSize()
|
||||||
self.setIcon(SHARED.theme.getToggleIcon(iconKey, (iconSize.width(), iconSize.height())))
|
self.setIcon(SHARED.theme.getToggleIcon(iconKey, (iconSize.width(), iconSize.height())))
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class NUnfoldButton
|
|
||||||
|
|||||||
@@ -29,8 +29,8 @@ from PyQt5.QtCore import pyqtSignal, pyqtSlot
|
|||||||
from PyQt5.QtWidgets import QComboBox, QWidget
|
from PyQt5.QtWidgets import QComboBox, QWidget
|
||||||
|
|
||||||
from novelwriter import SHARED
|
from novelwriter import SHARED
|
||||||
from novelwriter.enum import nwItemClass
|
|
||||||
from novelwriter.constants import nwLabels
|
from novelwriter.constants import nwLabels
|
||||||
|
from novelwriter.enum import nwItemClass
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -126,5 +126,3 @@ class NovelSelector(QComboBox):
|
|||||||
if not self._blockSignal:
|
if not self._blockSignal:
|
||||||
self.novelSelectionChanged.emit(self.currentData())
|
self.novelSelectionChanged.emit(self.currentData())
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class NovelSelector
|
|
||||||
|
|||||||
@@ -25,15 +25,15 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||||||
"""
|
"""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from PyQt5.QtGui import QColor, QPaintEvent, QPainter, QPolygon
|
|
||||||
from PyQt5.QtCore import QPoint, QRectF, QSize, Qt, pyqtSignal, pyqtSlot
|
from PyQt5.QtCore import QPoint, QRectF, QSize, Qt, pyqtSignal, pyqtSlot
|
||||||
|
from PyQt5.QtGui import QColor, QPainter, QPaintEvent, QPolygon
|
||||||
from PyQt5.QtWidgets import (
|
from PyQt5.QtWidgets import (
|
||||||
QAbstractButton, QAction, QButtonGroup, QLabel, QStyle,
|
QAbstractButton, QAction, QButtonGroup, QLabel, QStyle,
|
||||||
QStyleOptionToolButton, QToolBar, QToolButton, QWidget
|
QStyleOptionToolButton, QToolBar, QToolButton, QWidget
|
||||||
)
|
)
|
||||||
|
|
||||||
from novelwriter.types import (
|
from novelwriter.types import (
|
||||||
QtPaintAnitAlias, QtAlignLeft, QtMouseOver, QtNoBrush, QtNoPen,
|
QtAlignLeft, QtMouseOver, QtNoBrush, QtNoPen, QtPaintAnitAlias,
|
||||||
QtSizeExpanding, QtSizeFixed
|
QtSizeExpanding, QtSizeFixed
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -112,8 +112,6 @@ class NPagedSideBar(QToolBar):
|
|||||||
self.buttonClicked.emit(buttonId)
|
self.buttonClicked.emit(buttonId)
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class NPagedSideBar
|
|
||||||
|
|
||||||
|
|
||||||
class _NPagedToolButton(QToolButton):
|
class _NPagedToolButton(QToolButton):
|
||||||
|
|
||||||
@@ -190,8 +188,6 @@ class _NPagedToolButton(QToolButton):
|
|||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class _NPagedToolButton
|
|
||||||
|
|
||||||
|
|
||||||
class _NPagedToolLabel(QLabel):
|
class _NPagedToolLabel(QLabel):
|
||||||
|
|
||||||
@@ -231,5 +227,3 @@ class _NPagedToolLabel(QLabel):
|
|||||||
paint.drawText(QRectF(self._lM, self._tM, tW, tH), QtAlignLeft, self.text())
|
paint.drawText(QRectF(self._lM, self._tM, tW, tH), QtAlignLeft, self.text())
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class _NPagedToolLabel
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
from math import ceil
|
from math import ceil
|
||||||
|
|
||||||
from PyQt5.QtGui import QPaintEvent, QPainter
|
from PyQt5.QtGui import QPainter, QPaintEvent
|
||||||
from PyQt5.QtWidgets import QProgressBar, QWidget
|
from PyQt5.QtWidgets import QProgressBar, QWidget
|
||||||
|
|
||||||
from novelwriter.types import QtPaintAnitAlias
|
from novelwriter.types import QtPaintAnitAlias
|
||||||
@@ -51,5 +51,3 @@ class NProgressSimple(QProgressBar):
|
|||||||
painter.setBrush(self.palette().highlight())
|
painter.setBrush(self.palette().highlight())
|
||||||
painter.drawRect(0, 0, progress, self.height())
|
painter.drawRect(0, 0, progress, self.height())
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class NProgressSimple
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ import logging
|
|||||||
|
|
||||||
from typing import Literal
|
from typing import Literal
|
||||||
|
|
||||||
from PyQt5.QtGui import QColor, QPaintEvent, QPainter
|
from PyQt5.QtGui import QColor, QPainter, QPaintEvent
|
||||||
from PyQt5.QtWidgets import QAbstractButton, QWidget
|
from PyQt5.QtWidgets import QAbstractButton, QWidget
|
||||||
|
|
||||||
from novelwriter.types import QtPaintAnitAlias
|
from novelwriter.types import QtPaintAnitAlias
|
||||||
@@ -75,5 +75,3 @@ class StatusLED(QAbstractButton):
|
|||||||
painter.setOpacity(1.0)
|
painter.setOpacity(1.0)
|
||||||
painter.drawEllipse(1, 1, self.width() - 2, self.height() - 2)
|
painter.drawEllipse(1, 1, self.width() - 2, self.height() - 2)
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class StatusLED
|
|
||||||
|
|||||||
@@ -23,12 +23,12 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||||||
"""
|
"""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from PyQt5.QtGui import QMouseEvent, QPainter, QPaintEvent, QResizeEvent
|
|
||||||
from PyQt5.QtCore import QEvent, QPropertyAnimation, Qt, pyqtProperty
|
from PyQt5.QtCore import QEvent, QPropertyAnimation, Qt, pyqtProperty
|
||||||
|
from PyQt5.QtGui import QMouseEvent, QPainter, QPaintEvent, QResizeEvent
|
||||||
from PyQt5.QtWidgets import QAbstractButton, QWidget
|
from PyQt5.QtWidgets import QAbstractButton, QWidget
|
||||||
|
|
||||||
from novelwriter import CONFIG, SHARED
|
from novelwriter import CONFIG, SHARED
|
||||||
from novelwriter.types import QtPaintAnitAlias, QtMouseLeft, QtNoPen, QtSizeFixed
|
from novelwriter.types import QtMouseLeft, QtNoPen, QtPaintAnitAlias, QtSizeFixed
|
||||||
|
|
||||||
|
|
||||||
class NSwitch(QAbstractButton):
|
class NSwitch(QAbstractButton):
|
||||||
@@ -133,5 +133,3 @@ class NSwitch(QAbstractButton):
|
|||||||
self.setCursor(Qt.CursorShape.PointingHandCursor)
|
self.setCursor(Qt.CursorShape.PointingHandCursor)
|
||||||
super().enterEvent(event)
|
super().enterEvent(event)
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class NSwitch
|
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||||||
"""
|
"""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from PyQt5.QtGui import QIcon
|
|
||||||
from PyQt5.QtCore import pyqtSignal
|
from PyQt5.QtCore import pyqtSignal
|
||||||
|
from PyQt5.QtGui import QIcon
|
||||||
from PyQt5.QtWidgets import QGridLayout, QLabel, QScrollArea, QWidget
|
from PyQt5.QtWidgets import QGridLayout, QLabel, QScrollArea, QWidget
|
||||||
|
|
||||||
from novelwriter.extensions.switch import NSwitch
|
from novelwriter.extensions.switch import NSwitch
|
||||||
@@ -127,5 +127,3 @@ class NSwitchBox(QScrollArea):
|
|||||||
self._content.setRowStretch(self._index + 1, 1)
|
self._content.setRowStretch(self._index + 1, 1)
|
||||||
self._index += 1
|
self._index += 1
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class NSwitchBox
|
|
||||||
|
|||||||
@@ -26,16 +26,16 @@ from __future__ import annotations
|
|||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from time import sleep
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
from time import sleep
|
||||||
from urllib.error import HTTPError
|
from urllib.error import HTTPError
|
||||||
from urllib.request import Request, urlopen
|
from urllib.request import Request, urlopen
|
||||||
|
|
||||||
from PyQt5.QtGui import QDesktopServices
|
|
||||||
from PyQt5.QtCore import QObject, QRunnable, QUrl, pyqtSignal, pyqtSlot
|
from PyQt5.QtCore import QObject, QRunnable, QUrl, pyqtSignal, pyqtSlot
|
||||||
|
from PyQt5.QtGui import QDesktopServices
|
||||||
from PyQt5.QtWidgets import QLabel, QVBoxLayout, QWidget
|
from PyQt5.QtWidgets import QLabel, QVBoxLayout, QWidget
|
||||||
|
|
||||||
from novelwriter import CONFIG, SHARED, __version__, __date__, __domain__
|
from novelwriter import CONFIG, SHARED, __date__, __domain__, __version__
|
||||||
from novelwriter.common import formatVersion
|
from novelwriter.common import formatVersion
|
||||||
from novelwriter.constants import nwConst
|
from novelwriter.constants import nwConst
|
||||||
|
|
||||||
@@ -111,8 +111,6 @@ class VersionInfoWidget(QWidget):
|
|||||||
self._lblRelease.setText(self._trLatest.format(reason or self.tr("Failed")))
|
self._lblRelease.setText(self._trLatest.format(reason or self.tr("Failed")))
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class VersionInfoWidget
|
|
||||||
|
|
||||||
|
|
||||||
class _Retriever(QRunnable):
|
class _Retriever(QRunnable):
|
||||||
|
|
||||||
@@ -144,10 +142,6 @@ class _Retriever(QRunnable):
|
|||||||
self.signals.dataReady.emit("", str(e))
|
self.signals.dataReady.emit("", str(e))
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class _Retriever
|
|
||||||
|
|
||||||
|
|
||||||
class _RetrieverSignal(QObject):
|
class _RetrieverSignal(QObject):
|
||||||
dataReady = pyqtSignal(str, str)
|
dataReady = pyqtSignal(str, str)
|
||||||
|
|
||||||
# END Class _RetrieverSignal
|
|
||||||
|
|||||||
@@ -78,9 +78,7 @@ class _SelectAction(Enum):
|
|||||||
KEEP_POSITION = 2
|
KEEP_POSITION = 2
|
||||||
MOVE_AFTER = 3
|
MOVE_AFTER = 3
|
||||||
|
|
||||||
# END Class _SelectAction
|
|
||||||
|
|
||||||
|
|
||||||
class GuiDocEditor(QPlainTextEdit):
|
class GuiDocEditor(QPlainTextEdit):
|
||||||
"""Gui Widget: Main Document Editor"""
|
"""Gui Widget: Main Document Editor"""
|
||||||
|
|
||||||
@@ -2131,7 +2129,7 @@ class GuiDocEditor(QPlainTextEdit):
|
|||||||
self._doReplace = False
|
self._doReplace = False
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class GuiDocEditor
|
|
||||||
|
|
||||||
|
|
||||||
class MetaCompleter(QMenu):
|
class MetaCompleter(QMenu):
|
||||||
@@ -2210,7 +2208,7 @@ class MetaCompleter(QMenu):
|
|||||||
self.complete.emit(pos, length, value)
|
self.complete.emit(pos, length, value)
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class MetaCompleter
|
|
||||||
|
|
||||||
|
|
||||||
# =============================================================================================== #
|
# =============================================================================================== #
|
||||||
@@ -2251,7 +2249,7 @@ class BackgroundWordCounter(QRunnable):
|
|||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class BackgroundWordCounter
|
|
||||||
|
|
||||||
|
|
||||||
class BackgroundWordCounterSignals(QObject):
|
class BackgroundWordCounterSignals(QObject):
|
||||||
@@ -2260,7 +2258,7 @@ class BackgroundWordCounterSignals(QObject):
|
|||||||
"""
|
"""
|
||||||
countsReady = pyqtSignal(int, int, int)
|
countsReady = pyqtSignal(int, int, int)
|
||||||
|
|
||||||
# END Class BackgroundWordCounterSignals
|
|
||||||
|
|
||||||
|
|
||||||
# =============================================================================================== #
|
# =============================================================================================== #
|
||||||
@@ -2393,7 +2391,7 @@ class GuiDocToolBar(QWidget):
|
|||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class GuiDocToolBar
|
|
||||||
|
|
||||||
|
|
||||||
# =============================================================================================== #
|
# =============================================================================================== #
|
||||||
@@ -2757,7 +2755,7 @@ class GuiDocEditSearch(QFrame):
|
|||||||
self.searchBox.setPalette(qPalette)
|
self.searchBox.setPalette(qPalette)
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class GuiDocEditSearch
|
|
||||||
|
|
||||||
|
|
||||||
# =============================================================================================== #
|
# =============================================================================================== #
|
||||||
@@ -2980,7 +2978,7 @@ class GuiDocEditHeader(QWidget):
|
|||||||
self.docEditor.requestProjectItemSelected.emit(self._docHandle or "", True)
|
self.docEditor.requestProjectItemSelected.emit(self._docHandle or "", True)
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class GuiDocEditHeader
|
|
||||||
|
|
||||||
|
|
||||||
# =============================================================================================== #
|
# =============================================================================================== #
|
||||||
@@ -3172,4 +3170,4 @@ class GuiDocEditFooter(QWidget):
|
|||||||
self.wordsText.setText(wText)
|
self.wordsText.setText(wText)
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class GuiDocEditFooter
|
|
||||||
|
|||||||
@@ -463,8 +463,6 @@ class GuiDocHighlighter(QSyntaxHighlighter):
|
|||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class GuiDocHighlighter
|
|
||||||
|
|
||||||
|
|
||||||
class TextBlockData(QTextBlockUserData):
|
class TextBlockData(QTextBlockUserData):
|
||||||
|
|
||||||
@@ -505,5 +503,3 @@ class TextBlockData(QTextBlockUserData):
|
|||||||
(rxMatch.capturedStart(0), rxMatch.capturedLength(0))
|
(rxMatch.capturedStart(0), rxMatch.capturedLength(0))
|
||||||
)
|
)
|
||||||
return self._spellErrors
|
return self._spellErrors
|
||||||
|
|
||||||
# END Class TextBlockData
|
|
||||||
|
|||||||
@@ -496,8 +496,6 @@ class GuiDocViewer(QTextBrowser):
|
|||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class GuiDocViewer
|
|
||||||
|
|
||||||
|
|
||||||
class GuiDocViewHistory:
|
class GuiDocViewHistory:
|
||||||
|
|
||||||
@@ -611,8 +609,6 @@ class GuiDocViewHistory:
|
|||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class GuiDocViewHistory
|
|
||||||
|
|
||||||
|
|
||||||
# =============================================================================================== #
|
# =============================================================================================== #
|
||||||
# The Embedded Document Header
|
# The Embedded Document Header
|
||||||
@@ -835,8 +831,6 @@ class GuiDocViewHeader(QWidget):
|
|||||||
self.docViewer.requestProjectItemSelected.emit(self._docHandle, True)
|
self.docViewer.requestProjectItemSelected.emit(self._docHandle, True)
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class GuiDocViewHeader
|
|
||||||
|
|
||||||
|
|
||||||
# =============================================================================================== #
|
# =============================================================================================== #
|
||||||
# The Embedded Document Footer
|
# The Embedded Document Footer
|
||||||
@@ -967,5 +961,3 @@ class GuiDocViewFooter(QWidget):
|
|||||||
CONFIG.viewSynopsis = state
|
CONFIG.viewSynopsis = state
|
||||||
self.docViewer.reloadText()
|
self.docViewer.reloadText()
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class GuiDocViewFooter
|
|
||||||
|
|||||||
@@ -221,8 +221,6 @@ class GuiDocViewerPanel(QWidget):
|
|||||||
self.kwTabs[tClass].addUpdateEntry(key, name, iItem, hItem)
|
self.kwTabs[tClass].addUpdateEntry(key, name, iItem, hItem)
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class GuiDocViewerPanel
|
|
||||||
|
|
||||||
|
|
||||||
class _ViewPanelBackRefs(QTreeWidget):
|
class _ViewPanelBackRefs(QTreeWidget):
|
||||||
|
|
||||||
@@ -360,8 +358,6 @@ class _ViewPanelBackRefs(QTreeWidget):
|
|||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class _ViewPanelBackRefs
|
|
||||||
|
|
||||||
|
|
||||||
class _ViewPanelKeyWords(QTreeWidget):
|
class _ViewPanelKeyWords(QTreeWidget):
|
||||||
|
|
||||||
@@ -528,5 +524,3 @@ class _ViewPanelKeyWords(QTreeWidget):
|
|||||||
if index.column() not in (self.C_EDIT, self.C_VIEW):
|
if index.column() not in (self.C_EDIT, self.C_VIEW):
|
||||||
self._parent.loadDocumentTagRequest.emit(tag, nwDocMode.VIEW)
|
self._parent.loadDocumentTagRequest.emit(tag, nwDocMode.VIEW)
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class _ViewPanelKeyWords
|
|
||||||
|
|||||||
@@ -28,8 +28,8 @@ import logging
|
|||||||
from collections.abc import Iterable
|
from collections.abc import Iterable
|
||||||
from time import time
|
from time import time
|
||||||
|
|
||||||
from PyQt5.QtGui import QTextBlock, QTextCursor, QTextDocument
|
|
||||||
from PyQt5.QtCore import QObject, pyqtSlot
|
from PyQt5.QtCore import QObject, pyqtSlot
|
||||||
|
from PyQt5.QtGui import QTextBlock, QTextCursor, QTextDocument
|
||||||
from PyQt5.QtWidgets import QApplication, QPlainTextDocumentLayout
|
from PyQt5.QtWidgets import QApplication, QPlainTextDocumentLayout
|
||||||
|
|
||||||
from novelwriter import SHARED
|
from novelwriter import SHARED
|
||||||
@@ -133,5 +133,3 @@ class GuiTextDocument(QTextDocument):
|
|||||||
"""Set the spell check state of the syntax highlighter."""
|
"""Set the spell check state of the syntax highlighter."""
|
||||||
self._syntax.setSpellCheck(state)
|
self._syntax.setSpellCheck(state)
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class GuiTextDocument
|
|
||||||
|
|||||||
@@ -295,5 +295,3 @@ class GuiItemDetails(QWidget):
|
|||||||
self.wCountData.setText(f"{wC:n}")
|
self.wCountData.setText(f"{wC:n}")
|
||||||
self.pCountData.setText(f"{pC:n}")
|
self.pCountData.setText(f"{pC:n}")
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class GuiItemDetails
|
|
||||||
|
|||||||
@@ -991,5 +991,3 @@ class GuiMainMenu(QMenuBar):
|
|||||||
self.aWebsite.triggered.connect(lambda: self._openWebsite(nwConst.URL_WEB))
|
self.aWebsite.triggered.connect(lambda: self._openWebsite(nwConst.URL_WEB))
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class GuiMainMenu
|
|
||||||
|
|||||||
@@ -185,8 +185,6 @@ class GuiNovelView(QWidget):
|
|||||||
self.novelTree.refreshHandle(tHandle)
|
self.novelTree.refreshHandle(tHandle)
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class GuiNovelView
|
|
||||||
|
|
||||||
|
|
||||||
class GuiNovelToolBar(QWidget):
|
class GuiNovelToolBar(QWidget):
|
||||||
|
|
||||||
@@ -349,8 +347,6 @@ class GuiNovelToolBar(QWidget):
|
|||||||
self.aLastCol[colType] = aLast
|
self.aLastCol[colType] = aLast
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class GuiNovelToolBar
|
|
||||||
|
|
||||||
|
|
||||||
class GuiNovelTree(QTreeWidget):
|
class GuiNovelTree(QTreeWidget):
|
||||||
|
|
||||||
@@ -778,5 +774,3 @@ class GuiNovelTree(QTreeWidget):
|
|||||||
if tags:
|
if tags:
|
||||||
lines.append(f"<b>{trConst(nwLabels.KEY_NAME[key])}</b>: {tags}")
|
lines.append(f"<b>{trConst(nwLabels.KEY_NAME[key])}</b>: {tags}")
|
||||||
return lines
|
return lines
|
||||||
|
|
||||||
# END Class GuiNovelTree
|
|
||||||
|
|||||||
@@ -30,10 +30,10 @@ from __future__ import annotations
|
|||||||
import csv
|
import csv
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from time import time
|
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
|
from time import time
|
||||||
|
|
||||||
from PyQt5.QtCore import Qt, pyqtSignal, pyqtSlot, QT_TRANSLATE_NOOP
|
from PyQt5.QtCore import QT_TRANSLATE_NOOP, Qt, pyqtSignal, pyqtSlot
|
||||||
from PyQt5.QtWidgets import (
|
from PyQt5.QtWidgets import (
|
||||||
QAbstractItemView, QAction, QFileDialog, QFrame, QGridLayout, QGroupBox,
|
QAbstractItemView, QAction, QFileDialog, QFrame, QGridLayout, QGroupBox,
|
||||||
QHBoxLayout, QLabel, QMenu, QScrollArea, QSplitter, QToolBar, QToolButton,
|
QHBoxLayout, QLabel, QMenu, QScrollArea, QSplitter, QToolBar, QToolButton,
|
||||||
@@ -41,10 +41,10 @@ from PyQt5.QtWidgets import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
from novelwriter import CONFIG, SHARED
|
from novelwriter import CONFIG, SHARED
|
||||||
|
from novelwriter.common import checkInt, formatFileFilter, makeFileNameSafe
|
||||||
|
from novelwriter.constants import nwHeaders, nwKeyWords, nwLabels, trConst
|
||||||
from novelwriter.enum import nwDocMode, nwItemClass, nwItemLayout, nwItemType, nwOutline
|
from novelwriter.enum import nwDocMode, nwItemClass, nwItemLayout, nwItemType, nwOutline
|
||||||
from novelwriter.error import logException
|
from novelwriter.error import logException
|
||||||
from novelwriter.common import checkInt, formatFileFilter, makeFileNameSafe
|
|
||||||
from novelwriter.constants import nwHeaders, trConst, nwKeyWords, nwLabels
|
|
||||||
from novelwriter.extensions.configlayout import NColourLabel
|
from novelwriter.extensions.configlayout import NColourLabel
|
||||||
from novelwriter.extensions.novelselector import NovelSelector
|
from novelwriter.extensions.novelselector import NovelSelector
|
||||||
from novelwriter.types import (
|
from novelwriter.types import (
|
||||||
@@ -52,7 +52,6 @@ from novelwriter.types import (
|
|||||||
QtSizeExpanding, QtUserRole
|
QtSizeExpanding, QtUserRole
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@@ -195,8 +194,6 @@ class GuiOutlineView(QWidget):
|
|||||||
self.outlineTree.refreshTree(rootHandle=(tHandle or None), overRide=True)
|
self.outlineTree.refreshTree(rootHandle=(tHandle or None), overRide=True)
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class GuiOutlineView
|
|
||||||
|
|
||||||
|
|
||||||
class GuiOutlineToolBar(QToolBar):
|
class GuiOutlineToolBar(QToolBar):
|
||||||
|
|
||||||
@@ -310,8 +307,6 @@ class GuiOutlineToolBar(QToolBar):
|
|||||||
self.outlineExportRequest.emit()
|
self.outlineExportRequest.emit()
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class GuiOutlineToolBar
|
|
||||||
|
|
||||||
|
|
||||||
class GuiOutlineTree(QTreeWidget):
|
class GuiOutlineTree(QTreeWidget):
|
||||||
|
|
||||||
@@ -727,8 +722,6 @@ class GuiOutlineTree(QTreeWidget):
|
|||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class GuiOutlineTree
|
|
||||||
|
|
||||||
|
|
||||||
class GuiOutlineHeaderMenu(QMenu):
|
class GuiOutlineHeaderMenu(QMenu):
|
||||||
|
|
||||||
@@ -771,8 +764,6 @@ class GuiOutlineHeaderMenu(QMenu):
|
|||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class GuiOutlineHeaderMenu
|
|
||||||
|
|
||||||
|
|
||||||
class GuiOutlineDetails(QScrollArea):
|
class GuiOutlineDetails(QScrollArea):
|
||||||
|
|
||||||
@@ -1103,5 +1094,3 @@ class GuiOutlineDetails(QScrollArea):
|
|||||||
return ", ".join(
|
return ", ".join(
|
||||||
[f"<a href='{tag}'>{tag}</a>" for tag in refs.get(key, [])]
|
[f"<a href='{tag}'>{tag}</a>" for tag in refs.get(key, [])]
|
||||||
)
|
)
|
||||||
|
|
||||||
# END Class GuiOutlineDetails
|
|
||||||
|
|||||||
@@ -243,8 +243,6 @@ class GuiProjectView(QWidget):
|
|||||||
self.projTree.createNewNote(tag, itemClass)
|
self.projTree.createNewNote(tag, itemClass)
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class GuiProjectView
|
|
||||||
|
|
||||||
|
|
||||||
class GuiProjectToolBar(QWidget):
|
class GuiProjectToolBar(QWidget):
|
||||||
|
|
||||||
@@ -470,8 +468,6 @@ class GuiProjectToolBar(QWidget):
|
|||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class GuiProjectToolBar
|
|
||||||
|
|
||||||
|
|
||||||
class GuiProjectTree(QTreeWidget):
|
class GuiProjectTree(QTreeWidget):
|
||||||
|
|
||||||
@@ -1651,8 +1647,6 @@ class GuiProjectTree(QTreeWidget):
|
|||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class GuiProjectTree
|
|
||||||
|
|
||||||
|
|
||||||
class _UpdatableMenu(QMenu):
|
class _UpdatableMenu(QMenu):
|
||||||
|
|
||||||
@@ -1716,8 +1710,6 @@ class _UpdatableMenu(QMenu):
|
|||||||
self.menuItemTriggered.emit(str(action.data()))
|
self.menuItemTriggered.emit(str(action.data()))
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class _UpdatableMenu
|
|
||||||
|
|
||||||
|
|
||||||
class _TreeContextMenu(QMenu):
|
class _TreeContextMenu(QMenu):
|
||||||
|
|
||||||
@@ -2069,5 +2061,3 @@ class _TreeContextMenu(QMenu):
|
|||||||
else:
|
else:
|
||||||
logger.info("Folder conversion cancelled")
|
logger.info("Folder conversion cancelled")
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class _TreeContextMenu
|
|
||||||
|
|||||||
@@ -358,5 +358,3 @@ class GuiProjectSearch(QWidget):
|
|||||||
QApplication.processEvents()
|
QApplication.processEvents()
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class GuiProjectSearch
|
|
||||||
|
|||||||
@@ -150,8 +150,6 @@ class GuiSideBar(QWidget):
|
|||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class GuiSideBar
|
|
||||||
|
|
||||||
|
|
||||||
class _PopRightMenu(QMenu):
|
class _PopRightMenu(QMenu):
|
||||||
|
|
||||||
@@ -162,5 +160,3 @@ class _PopRightMenu(QMenu):
|
|||||||
offset = QPoint(parent.width(), parent.height() - self.height())
|
offset = QPoint(parent.width(), parent.height() - self.height())
|
||||||
self.move(parent.mapToGlobal(offset))
|
self.move(parent.mapToGlobal(offset))
|
||||||
return super(_PopRightMenu, self).event(event)
|
return super(_PopRightMenu, self).event(event)
|
||||||
|
|
||||||
# END Class _PopRightMenu
|
|
||||||
|
|||||||
@@ -262,5 +262,3 @@ class GuiMainStatus(QStatusBar):
|
|||||||
f" \u2013 Peak: {mem[1]:n}"
|
f" \u2013 Peak: {mem[1]:n}"
|
||||||
), 6000)
|
), 6000)
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class GuiMainStatus
|
|
||||||
|
|||||||
@@ -795,8 +795,6 @@ class GuiIcons:
|
|||||||
|
|
||||||
return self._noIcon
|
return self._noIcon
|
||||||
|
|
||||||
# END Class GuiIcons
|
|
||||||
|
|
||||||
|
|
||||||
# =============================================================================================== #
|
# =============================================================================================== #
|
||||||
# Module Functions
|
# Module Functions
|
||||||
|
|||||||
@@ -1399,5 +1399,3 @@ class GuiMain(QMainWindow):
|
|||||||
))
|
))
|
||||||
return None, None
|
return None, None
|
||||||
return tHandle, sTitle
|
return tHandle, sTitle
|
||||||
|
|
||||||
# END Class GuiMain
|
|
||||||
|
|||||||
@@ -376,8 +376,6 @@ class SharedData(QObject):
|
|||||||
widget.close()
|
widget.close()
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class SharedData
|
|
||||||
|
|
||||||
|
|
||||||
class _GuiAlert(QMessageBox):
|
class _GuiAlert(QMessageBox):
|
||||||
|
|
||||||
@@ -438,5 +436,3 @@ class _GuiAlert(QMessageBox):
|
|||||||
self.setIconPixmap(self._theme.getPixmap("alert_question", (pSz, pSz)))
|
self.setIconPixmap(self._theme.getPixmap("alert_question", (pSz, pSz)))
|
||||||
self.setWindowTitle(self.tr("Question"))
|
self.setWindowTitle(self.tr("Question"))
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class _GuiAlert
|
|
||||||
|
|||||||
@@ -264,5 +264,3 @@ class GuiDictionaries(NNonBlockingDialog):
|
|||||||
cursor.deleteChar()
|
cursor.deleteChar()
|
||||||
self.infoBox.setTextCursor(cursor)
|
self.infoBox.setTextCursor(cursor)
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class GuiDictionaries
|
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||||||
"""
|
"""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import random
|
|
||||||
import logging
|
import logging
|
||||||
|
import random
|
||||||
|
|
||||||
from PyQt5.QtCore import Qt, pyqtSlot
|
from PyQt5.QtCore import Qt, pyqtSlot
|
||||||
from PyQt5.QtWidgets import (
|
from PyQt5.QtWidgets import (
|
||||||
@@ -35,7 +35,7 @@ from PyQt5.QtWidgets import (
|
|||||||
from novelwriter import CONFIG, SHARED
|
from novelwriter import CONFIG, SHARED
|
||||||
from novelwriter.common import readTextFile
|
from novelwriter.common import readTextFile
|
||||||
from novelwriter.extensions.switch import NSwitch
|
from novelwriter.extensions.switch import NSwitch
|
||||||
from novelwriter.types import QtAlignLeft, QtAlignRight, QtRoleAction, QtDialogClose
|
from novelwriter.types import QtAlignLeft, QtAlignRight, QtDialogClose, QtRoleAction
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
@@ -150,5 +150,3 @@ class GuiLipsum(QDialog):
|
|||||||
self._lipsumText = "\n\n".join(lipsumText[0:pCount]) + "\n\n"
|
self._lipsumText = "\n\n".join(lipsumText[0:pCount]) + "\n\n"
|
||||||
self.close()
|
self.close()
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class GuiLipsum
|
|
||||||
|
|||||||
@@ -403,5 +403,3 @@ class GuiManuscriptBuild(QDialog):
|
|||||||
"""Open the build folder in the system's file explorer."""
|
"""Open the build folder in the system's file explorer."""
|
||||||
openExternalPath(Path(self.buildPath.text()))
|
openExternalPath(Path(self.buildPath.text()))
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class GuiManuscriptBuild
|
|
||||||
|
|||||||
@@ -510,8 +510,6 @@ class GuiManuscript(NToolDialog):
|
|||||||
return obj
|
return obj
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# END Class GuiManuscript
|
|
||||||
|
|
||||||
|
|
||||||
class _DetailsWidget(QWidget):
|
class _DetailsWidget(QWidget):
|
||||||
|
|
||||||
@@ -653,8 +651,6 @@ class _DetailsWidget(QWidget):
|
|||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class _DetailsWidget
|
|
||||||
|
|
||||||
|
|
||||||
class _OutlineWidget(QWidget):
|
class _OutlineWidget(QWidget):
|
||||||
|
|
||||||
@@ -734,8 +730,6 @@ class _OutlineWidget(QWidget):
|
|||||||
self.outlineEntryClicked.emit(str(item.data(0, self.D_LINE)))
|
self.outlineEntryClicked.emit(str(item.data(0, self.D_LINE)))
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class _OutlineWidget
|
|
||||||
|
|
||||||
|
|
||||||
class _PreviewWidget(QTextBrowser):
|
class _PreviewWidget(QTextBrowser):
|
||||||
|
|
||||||
@@ -961,8 +955,6 @@ class _PreviewWidget(QTextBrowser):
|
|||||||
self.buildProgress.move((vW-pS)//2, (vH-pS)//2)
|
self.buildProgress.move((vW-pS)//2, (vH-pS)//2)
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class _PreviewWidget
|
|
||||||
|
|
||||||
|
|
||||||
class _StatsWidget(QWidget):
|
class _StatsWidget(QWidget):
|
||||||
|
|
||||||
@@ -1136,5 +1128,3 @@ class _StatsWidget(QWidget):
|
|||||||
self.maxWidget.setLayout(self.maxLayout)
|
self.maxWidget.setLayout(self.maxLayout)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class _StatsWidget
|
|
||||||
|
|||||||
@@ -278,8 +278,6 @@ class GuiBuildSettings(NToolDialog):
|
|||||||
self._build.resetChangedState()
|
self._build.resetChangedState()
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class GuiBuildSettings
|
|
||||||
|
|
||||||
|
|
||||||
class _FilterTab(NFixedPage):
|
class _FilterTab(NFixedPage):
|
||||||
|
|
||||||
@@ -574,8 +572,6 @@ class _FilterTab(NFixedPage):
|
|||||||
self._scanChildren(item.child(i), items)
|
self._scanChildren(item.child(i), items)
|
||||||
return items
|
return items
|
||||||
|
|
||||||
# END Class _FilterTab
|
|
||||||
|
|
||||||
|
|
||||||
class _HeadingsTab(NScrollablePage):
|
class _HeadingsTab(NScrollablePage):
|
||||||
|
|
||||||
@@ -941,8 +937,6 @@ class _HeadingsTab(NScrollablePage):
|
|||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class _HeadingsTab
|
|
||||||
|
|
||||||
|
|
||||||
class _HeadingSyntaxHighlighter(QSyntaxHighlighter):
|
class _HeadingSyntaxHighlighter(QSyntaxHighlighter):
|
||||||
|
|
||||||
@@ -967,8 +961,6 @@ class _HeadingSyntaxHighlighter(QSyntaxHighlighter):
|
|||||||
self.setFormat(pos + ddots, 1, self._fmtSymbol)
|
self.setFormat(pos + ddots, 1, self._fmtSymbol)
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class _HeadingSyntaxHighlighter
|
|
||||||
|
|
||||||
|
|
||||||
class _ContentTab(NScrollableForm):
|
class _ContentTab(NScrollableForm):
|
||||||
|
|
||||||
@@ -1052,8 +1044,6 @@ class _ContentTab(NScrollableForm):
|
|||||||
self.ignoredKeywords.setText(", ".join(verified))
|
self.ignoredKeywords.setText(", ".join(verified))
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class _ContentTab
|
|
||||||
|
|
||||||
|
|
||||||
class _FormatTab(NScrollableForm):
|
class _FormatTab(NScrollableForm):
|
||||||
|
|
||||||
@@ -1346,8 +1336,6 @@ class _FormatTab(NScrollableForm):
|
|||||||
self.pageSize.setCurrentIndex(index)
|
self.pageSize.setCurrentIndex(index)
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class _FormatTab
|
|
||||||
|
|
||||||
|
|
||||||
class _OutputTab(NScrollableForm):
|
class _OutputTab(NScrollableForm):
|
||||||
|
|
||||||
@@ -1432,5 +1420,3 @@ class _OutputTab(NScrollableForm):
|
|||||||
self.odtPageHeader.setText(nwHeadFmt.ODT_AUTO)
|
self.odtPageHeader.setText(nwHeadFmt.ODT_AUTO)
|
||||||
self.odtPageHeader.setCursorPosition(0)
|
self.odtPageHeader.setCursorPosition(0)
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class _OutputTab
|
|
||||||
|
|||||||
@@ -186,8 +186,6 @@ class GuiNovelDetails(NNonBlockingDialog):
|
|||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class GuiNovelDetails
|
|
||||||
|
|
||||||
|
|
||||||
class _OverviewPage(NScrollablePage):
|
class _OverviewPage(NScrollablePage):
|
||||||
|
|
||||||
@@ -294,8 +292,6 @@ class _OverviewPage(NScrollablePage):
|
|||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class _OverviewPage
|
|
||||||
|
|
||||||
|
|
||||||
class _ContentsPage(NFixedPage):
|
class _ContentsPage(NFixedPage):
|
||||||
|
|
||||||
@@ -524,5 +520,3 @@ class _ContentsPage(NFixedPage):
|
|||||||
self._data = SHARED.project.index.getTableOfContents(rootHandle, 2)
|
self._data = SHARED.project.index.getTableOfContents(rootHandle, 2)
|
||||||
self._data.append(("", 0, self.tr("END"), 0))
|
self._data.append(("", 0, self.tr("END"), 0))
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class _ContentsPage
|
|
||||||
|
|||||||
@@ -32,11 +32,11 @@ from PyQt5.QtCore import (
|
|||||||
QAbstractListModel, QEvent, QModelIndex, QObject, QPoint, QSize, Qt,
|
QAbstractListModel, QEvent, QModelIndex, QObject, QPoint, QSize, Qt,
|
||||||
pyqtSignal, pyqtSlot
|
pyqtSignal, pyqtSlot
|
||||||
)
|
)
|
||||||
from PyQt5.QtGui import QCloseEvent, QColor, QFont, QPaintEvent, QPainter, QPen
|
from PyQt5.QtGui import QCloseEvent, QColor, QFont, QPainter, QPaintEvent, QPen
|
||||||
from PyQt5.QtWidgets import (
|
from PyQt5.QtWidgets import (
|
||||||
QAction, QApplication, QDialog, QFileDialog, QFormLayout, QHBoxLayout,
|
QAction, QApplication, QDialog, QFileDialog, QFormLayout, QHBoxLayout,
|
||||||
QLabel, QLineEdit, QListView, QMenu, QPushButton, QScrollArea, QShortcut,
|
QLabel, QLineEdit, QListView, QMenu, QPushButton, QScrollArea, QShortcut,
|
||||||
QStackedWidget, QStyleOptionViewItem, QStyledItemDelegate, QVBoxLayout,
|
QStackedWidget, QStyledItemDelegate, QStyleOptionViewItem, QVBoxLayout,
|
||||||
QWidget
|
QWidget
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -267,8 +267,6 @@ class GuiWelcome(QDialog):
|
|||||||
self.btnCreate.setFocus()
|
self.btnCreate.setFocus()
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class GuiWelcome
|
|
||||||
|
|
||||||
|
|
||||||
class _OpenProjectPage(QWidget):
|
class _OpenProjectPage(QWidget):
|
||||||
|
|
||||||
@@ -392,8 +390,6 @@ class _OpenProjectPage(QWidget):
|
|||||||
self._projectClicked(index)
|
self._projectClicked(index)
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class _OpenProjectPage
|
|
||||||
|
|
||||||
|
|
||||||
class _ProjectListItem(QStyledItemDelegate):
|
class _ProjectListItem(QStyledItemDelegate):
|
||||||
|
|
||||||
@@ -450,8 +446,6 @@ class _ProjectListItem(QStyledItemDelegate):
|
|||||||
"""Set the size hint to fixed height."""
|
"""Set the size hint to fixed height."""
|
||||||
return QSize(opt.rect.width(), self._hPx)
|
return QSize(opt.rect.width(), self._hPx)
|
||||||
|
|
||||||
# END Class _ProjectListItem
|
|
||||||
|
|
||||||
|
|
||||||
class _ProjectListModel(QAbstractListModel):
|
class _ProjectListModel(QAbstractListModel):
|
||||||
|
|
||||||
@@ -491,8 +485,6 @@ class _ProjectListModel(QAbstractListModel):
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# END Class _ProjectListModel
|
|
||||||
|
|
||||||
|
|
||||||
class _NewProjectPage(QWidget):
|
class _NewProjectPage(QWidget):
|
||||||
|
|
||||||
@@ -548,8 +540,6 @@ class _NewProjectPage(QWidget):
|
|||||||
self.openProjectRequest.emit(path)
|
self.openProjectRequest.emit(path)
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class _NewProjectPage
|
|
||||||
|
|
||||||
|
|
||||||
class _NewProjectForm(QWidget):
|
class _NewProjectForm(QWidget):
|
||||||
|
|
||||||
@@ -805,8 +795,6 @@ class _NewProjectForm(QWidget):
|
|||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class _NewProjectForm
|
|
||||||
|
|
||||||
|
|
||||||
class _PopLeftDirectionMenu(QMenu):
|
class _PopLeftDirectionMenu(QMenu):
|
||||||
|
|
||||||
@@ -817,5 +805,3 @@ class _PopLeftDirectionMenu(QMenu):
|
|||||||
offset = QPoint(parent.width() - self.width(), parent.height())
|
offset = QPoint(parent.width() - self.width(), parent.height())
|
||||||
self.move(parent.mapToGlobal(offset))
|
self.move(parent.mapToGlobal(offset))
|
||||||
return super(_PopLeftDirectionMenu, self).event(event)
|
return super(_PopLeftDirectionMenu, self).event(event)
|
||||||
|
|
||||||
# END Class _PopLeftDirectionMenu
|
|
||||||
|
|||||||
@@ -614,5 +614,3 @@ class GuiWritingStats(NToolDialog):
|
|||||||
self.labelFilter.setText(formatTime(round(self.timeFilter)))
|
self.labelFilter.setText(formatTime(round(self.timeFilter)))
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class GuiWritingStats
|
|
||||||
|
|||||||
@@ -1718,5 +1718,3 @@ if __name__ == "__main__":
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
xdgUninstall()
|
xdgUninstall()
|
||||||
|
|
||||||
# END Main
|
|
||||||
|
|||||||
+1
-9
@@ -23,11 +23,11 @@ from __future__ import annotations
|
|||||||
from PyQt5.QtGui import QPixmap
|
from PyQt5.QtGui import QPixmap
|
||||||
from PyQt5.QtWidgets import QWidget
|
from PyQt5.QtWidgets import QWidget
|
||||||
|
|
||||||
|
|
||||||
# =========================================================================== #
|
# =========================================================================== #
|
||||||
# Mock GUI
|
# Mock GUI
|
||||||
# =========================================================================== #
|
# =========================================================================== #
|
||||||
|
|
||||||
|
|
||||||
class MockGuiMain(QWidget):
|
class MockGuiMain(QWidget):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@@ -55,8 +55,6 @@ class MockGuiMain(QWidget):
|
|||||||
def close(self):
|
def close(self):
|
||||||
return "close"
|
return "close"
|
||||||
|
|
||||||
# END Class MockGuiMain
|
|
||||||
|
|
||||||
|
|
||||||
class MockStatusBar:
|
class MockStatusBar:
|
||||||
|
|
||||||
@@ -69,8 +67,6 @@ class MockStatusBar:
|
|||||||
def updateProjectStatus(self, status):
|
def updateProjectStatus(self, status):
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class MockStatusBar
|
|
||||||
|
|
||||||
|
|
||||||
class MockTheme:
|
class MockTheme:
|
||||||
|
|
||||||
@@ -81,8 +77,6 @@ class MockTheme:
|
|||||||
def getPixmap(self, *a):
|
def getPixmap(self, *a):
|
||||||
return QPixmap()
|
return QPixmap()
|
||||||
|
|
||||||
# END Class MockTheme
|
|
||||||
|
|
||||||
|
|
||||||
class MockApp:
|
class MockApp:
|
||||||
|
|
||||||
@@ -92,8 +86,6 @@ class MockApp:
|
|||||||
def installTranslator(self, language):
|
def installTranslator(self, language):
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class MockApp
|
|
||||||
|
|
||||||
|
|
||||||
# =========================================================================== #
|
# =========================================================================== #
|
||||||
# Error Functions
|
# Error Functions
|
||||||
|
|||||||
@@ -22,10 +22,9 @@ from __future__ import annotations
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from tools import SimpleDialog
|
|
||||||
|
|
||||||
from PyQt5.QtGui import QWheelEvent
|
|
||||||
from PyQt5.QtCore import QPoint, QPointF, Qt
|
from PyQt5.QtCore import QPoint, QPointF, Qt
|
||||||
|
from PyQt5.QtGui import QWheelEvent
|
||||||
|
from tools import SimpleDialog
|
||||||
|
|
||||||
from novelwriter.extensions.modified import NComboBox, NDoubleSpinBox, NSpinBox
|
from novelwriter.extensions.modified import NComboBox, NDoubleSpinBox, NSpinBox
|
||||||
|
|
||||||
@@ -46,8 +45,6 @@ class MockWheelEvent(QWheelEvent):
|
|||||||
self.ignored = True
|
self.ignored = True
|
||||||
return
|
return
|
||||||
|
|
||||||
# END Class MockWheelEvent
|
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.gui
|
@pytest.mark.gui
|
||||||
def testExtModified_NComboBox(qtbot, monkeypatch):
|
def testExtModified_NComboBox(qtbot, monkeypatch):
|
||||||
|
|||||||
+2
-6
@@ -22,8 +22,8 @@ from __future__ import annotations
|
|||||||
|
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
from pathlib import Path
|
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
from PyQt5.QtWidgets import QDialog, QVBoxLayout, QWidget
|
from PyQt5.QtWidgets import QDialog, QVBoxLayout, QWidget
|
||||||
|
|
||||||
@@ -57,8 +57,6 @@ class C:
|
|||||||
hChapterDoc = "000000000000e"
|
hChapterDoc = "000000000000e"
|
||||||
hSceneDoc = "000000000000f"
|
hSceneDoc = "000000000000f"
|
||||||
|
|
||||||
# END Class C
|
|
||||||
|
|
||||||
|
|
||||||
def cmpFiles(
|
def cmpFiles(
|
||||||
fileOne: str | Path, fileTwo: str | Path,
|
fileOne: str | Path, fileTwo: str | Path,
|
||||||
@@ -148,9 +146,9 @@ def buildTestProject(obj: object, projPath: Path) -> None:
|
|||||||
"""Build a standard test project in projPath using the project
|
"""Build a standard test project in projPath using the project
|
||||||
object as the parent.
|
object as the parent.
|
||||||
"""
|
"""
|
||||||
|
from novelwriter.core.project import NWProject
|
||||||
from novelwriter.enum import nwItemClass
|
from novelwriter.enum import nwItemClass
|
||||||
from novelwriter.guimain import GuiMain
|
from novelwriter.guimain import GuiMain
|
||||||
from novelwriter.core.project import NWProject
|
|
||||||
|
|
||||||
if isinstance(obj, NWProject):
|
if isinstance(obj, NWProject):
|
||||||
nwGUI = None
|
nwGUI = None
|
||||||
@@ -220,5 +218,3 @@ class SimpleDialog(QDialog):
|
|||||||
@property
|
@property
|
||||||
def widget(self) -> QWidget:
|
def widget(self) -> QWidget:
|
||||||
return self._widget
|
return self._widget
|
||||||
|
|
||||||
# END Class TestDialog
|
|
||||||
|
|||||||
Reference in New Issue
Block a user