diff --git a/nw/common.py b/nw/common.py index 1cf4e9a9..d093be2d 100644 --- a/nw/common.py +++ b/nw/common.py @@ -31,9 +31,8 @@ from datetime import datetime from PyQt5.QtWidgets import qApp from PyQt5.QtCore import QCoreApplication -from nw.constants import ( - nwConst, nwUnicode, nwItemClass, nwItemType, nwItemLayout -) +from nw.enum import nwItemClass, nwItemType, nwItemLayout +from nw.constants import nwConst, nwUnicode logger = logging.getLogger(__name__) diff --git a/nw/config.py b/nw/config.py index 64d3b678..bea508bc 100644 --- a/nw/config.py +++ b/nw/config.py @@ -39,9 +39,9 @@ from PyQt5.QtCore import ( QTranslator ) -from nw.constants import nwConst, nwFiles, nwUnicode -from nw.common import splitVersionNumber, formatTimeStamp from nw.error import logException +from nw.common import splitVersionNumber, formatTimeStamp +from nw.constants import nwConst, nwFiles, nwUnicode logger = logging.getLogger(__name__) diff --git a/nw/constants/constants.py b/nw/constants.py similarity index 99% rename from nw/constants/constants.py rename to nw/constants.py index a3ab3580..abf399c5 100644 --- a/nw/constants/constants.py +++ b/nw/constants.py @@ -26,9 +26,7 @@ along with this program. If not, see . from PyQt5.QtCore import QCoreApplication, QT_TRANSLATE_NOOP -from nw.constants.enum import ( - nwItemClass, nwItemLayout, nwItemType, nwOutline -) +from nw.enum import nwItemClass, nwItemLayout, nwItemType, nwOutline def trConst(tString): """Wrapper function for locally translating constants. diff --git a/nw/constants/__init__.py b/nw/constants/__init__.py deleted file mode 100644 index f0f12c60..00000000 --- a/nw/constants/__init__.py +++ /dev/null @@ -1,30 +0,0 @@ -# -*- coding: utf-8 -*- -from nw.constants.constants import ( - trConst, nwConst, nwLists, nwRegEx, nwFiles, nwKeyWords, nwLabels, - nwQuotes, nwUnicode, nwHtmlUnicode -) -from nw.constants.enum import ( - nwAlert, nwDocAction, nwItemClass, nwItemLayout, nwItemType, nwOutline, - nwDocInsert, nwWidget -) - -__all__ = [ - "trConst", - "nwConst", - "nwLists", - "nwRegEx", - "nwFiles", - "nwKeyWords", - "nwLabels", - "nwQuotes", - "nwUnicode", - "nwHtmlUnicode", - "nwAlert", - "nwDocAction", - "nwItemClass", - "nwItemLayout", - "nwItemType", - "nwOutline", - "nwDocInsert", - "nwWidget", -] diff --git a/nw/core/document.py b/nw/core/document.py index d0c3f664..1d7600c2 100644 --- a/nw/core/document.py +++ b/nw/core/document.py @@ -31,9 +31,8 @@ from functools import partial from PyQt5.QtCore import QCoreApplication -from nw.constants import nwAlert +from nw.enum import nwAlert, nwItemLayout, nwItemClass from nw.common import isHandle -from nw.constants import nwItemLayout, nwItemClass logger = logging.getLogger(__name__) diff --git a/nw/core/index.py b/nw/core/index.py index a6054071..986e4f93 100644 --- a/nw/core/index.py +++ b/nw/core/index.py @@ -32,12 +32,10 @@ import os from time import time -from nw.constants import ( - nwFiles, nwKeyWords, nwItemType, nwItemClass, nwItemLayout, nwAlert, - nwUnicode -) -from nw.core.document import NWDoc +from nw.enum import nwItemType, nwItemClass, nwItemLayout, nwAlert from nw.common import isHandle, isTitleTag, isItemClass, isItemLayout +from nw.constants import nwFiles, nwKeyWords, nwUnicode +from nw.core.document import NWDoc logger = logging.getLogger(__name__) diff --git a/nw/core/item.py b/nw/core/item.py index 62460e7e..18eada78 100644 --- a/nw/core/item.py +++ b/nw/core/item.py @@ -28,10 +28,8 @@ import logging from lxml import etree -from nw.constants import nwItemType, nwItemClass, nwItemLayout -from nw.common import ( - checkInt, isHandle, isItemClass, isItemLayout, isItemType -) +from nw.enum import nwItemType, nwItemClass, nwItemLayout +from nw.common import checkInt, isHandle, isItemClass, isItemLayout, isItemType logger = logging.getLogger(__name__) diff --git a/nw/core/project.py b/nw/core/project.py index 5f2862ac..99bd0d1a 100644 --- a/nw/core/project.py +++ b/nw/core/project.py @@ -45,9 +45,8 @@ from nw.common import ( checkString, checkBool, checkInt, isHandle, formatTimeStamp, makeFileNameSafe, hexToInt ) -from nw.constants import ( - trConst, nwFiles, nwItemType, nwItemClass, nwItemLayout, nwLabels, nwAlert -) +from nw.enum import nwItemType, nwItemClass, nwItemLayout, nwAlert +from nw.constants import trConst, nwFiles, nwLabels logger = logging.getLogger(__name__) diff --git a/nw/core/tohtml.py b/nw/core/tohtml.py index 9b0e7379..412efe4f 100644 --- a/nw/core/tohtml.py +++ b/nw/core/tohtml.py @@ -27,7 +27,7 @@ along with this program. If not, see . import logging from nw.core.tokenizer import Tokenizer -from nw.constants import nwLabels, nwKeyWords, nwHtmlUnicode +from nw.constants import nwKeyWords, nwLabels, nwHtmlUnicode logger = logging.getLogger(__name__) diff --git a/nw/core/tokenizer.py b/nw/core/tokenizer.py index ff88a274..921f7cef 100644 --- a/nw/core/tokenizer.py +++ b/nw/core/tokenizer.py @@ -32,9 +32,10 @@ from functools import partial from PyQt5.QtCore import QCoreApplication, QRegularExpression -from nw.core.document import NWDoc +from nw.enum import nwItemLayout, nwItemType from nw.common import numberToRoman -from nw.constants import nwConst, nwUnicode, nwItemLayout, nwItemType, nwRegEx +from nw.constants import nwConst, nwRegEx, nwUnicode +from nw.core.document import NWDoc logger = logging.getLogger(__name__) diff --git a/nw/core/tomd.py b/nw/core/tomd.py index 3167b204..53e3ab80 100644 --- a/nw/core/tomd.py +++ b/nw/core/tomd.py @@ -26,8 +26,8 @@ along with this program. If not, see . import logging -from nw.core.tokenizer import Tokenizer from nw.constants import nwLabels +from nw.core.tokenizer import Tokenizer logger = logging.getLogger(__name__) diff --git a/nw/core/toodt.py b/nw/core/toodt.py index d1519a9d..89b74148 100644 --- a/nw/core/toodt.py +++ b/nw/core/toodt.py @@ -29,11 +29,11 @@ import logging from lxml import etree from hashlib import sha256 -from datetime import datetime from zipfile import ZipFile +from datetime import datetime +from nw.constants import nwKeyWords, nwLabels from nw.core.tokenizer import Tokenizer -from nw.constants import nwLabels, nwKeyWords logger = logging.getLogger(__name__) diff --git a/nw/core/tree.py b/nw/core/tree.py index 5fdc55ba..b0c0340c 100644 --- a/nw/core/tree.py +++ b/nw/core/tree.py @@ -29,14 +29,13 @@ import logging import os from lxml import etree -from hashlib import sha256 from time import time +from hashlib import sha256 -from nw.core.item import NWItem +from nw.enum import nwItemType, nwItemClass, nwItemLayout from nw.common import checkHandle -from nw.constants import ( - nwFiles, nwItemType, nwItemClass, nwItemLayout, nwConst, nwLists -) +from nw.constants import nwConst, nwLists, nwFiles +from nw.core.item import NWItem logger = logging.getLogger(__name__) diff --git a/nw/constants/enum.py b/nw/enum.py similarity index 100% rename from nw/constants/enum.py rename to nw/enum.py diff --git a/nw/gui/build.py b/nw/gui/build.py index 2a2be0e8..58526af5 100644 --- a/nw/gui/build.py +++ b/nw/gui/build.py @@ -44,12 +44,11 @@ from PyQt5.QtWidgets import ( QSizePolicy, QDoubleSpinBox, QComboBox ) -from nw.common import fuzzyTime, makeFileNameSafe -from nw.gui.custom import QSwitch from nw.core import ToHtml, ToOdt, ToMarkdown -from nw.constants import ( - nwConst, nwAlert, nwFiles, nwItemType, nwItemLayout, nwItemClass -) +from nw.enum import nwAlert, nwItemType, nwItemLayout, nwItemClass +from nw.common import fuzzyTime, makeFileNameSafe +from nw.constants import nwConst, nwFiles +from nw.gui.custom import QSwitch logger = logging.getLogger(__name__) diff --git a/nw/gui/custom.py b/nw/gui/custom.py index 7df275f8..e41c54dd 100644 --- a/nw/gui/custom.py +++ b/nw/gui/custom.py @@ -40,7 +40,7 @@ from PyQt5.QtWidgets import ( QLineEdit ) -from nw.constants import trConst, nwUnicode, nwQuotes +from nw.constants import trConst, nwQuotes, nwUnicode logger = logging.getLogger(__name__) diff --git a/nw/gui/doceditor.py b/nw/gui/doceditor.py index e0aee4d3..91abfce9 100644 --- a/nw/gui/doceditor.py +++ b/nw/gui/doceditor.py @@ -50,12 +50,10 @@ from PyQt5.QtWidgets import ( ) from nw.core import NWDoc, NWSpellSimple, countWords -from nw.gui.dochighlight import GuiDocHighlighter +from nw.enum import nwAlert, nwDocAction, nwDocInsert, nwItemClass from nw.common import transferCase -from nw.constants import ( - trConst, nwConst, nwAlert, nwUnicode, nwDocAction, nwDocInsert, - nwItemClass, nwKeyWords, nwLabels -) +from nw.constants import nwConst, trConst, nwKeyWords, nwLabels, nwUnicode +from nw.gui.dochighlight import GuiDocHighlighter logger = logging.getLogger(__name__) diff --git a/nw/gui/dochighlight.py b/nw/gui/dochighlight.py index 620b8b74..ea9df173 100644 --- a/nw/gui/dochighlight.py +++ b/nw/gui/dochighlight.py @@ -34,7 +34,7 @@ from PyQt5.QtGui import ( QColor, QTextCharFormat, QFont, QSyntaxHighlighter, QBrush ) -from nw.constants import nwUnicode, nwRegEx +from nw.constants import nwRegEx, nwUnicode logger = logging.getLogger(__name__) diff --git a/nw/gui/docmerge.py b/nw/gui/docmerge.py index c804c794..4a6fe00f 100644 --- a/nw/gui/docmerge.py +++ b/nw/gui/docmerge.py @@ -33,9 +33,9 @@ from PyQt5.QtWidgets import ( QListWidgetItem, QDialogButtonBox ) -from nw.constants import nwAlert, nwItemType -from nw.gui.custom import QHelpLabel from nw.core import NWDoc +from nw.enum import nwAlert, nwItemType +from nw.gui.custom import QHelpLabel logger = logging.getLogger(__name__) diff --git a/nw/gui/docsplit.py b/nw/gui/docsplit.py index 2bffb28f..da5b27f0 100644 --- a/nw/gui/docsplit.py +++ b/nw/gui/docsplit.py @@ -34,10 +34,9 @@ from PyQt5.QtWidgets import ( ) from nw.core import NWDoc +from nw.enum import nwAlert, nwItemType, nwItemClass, nwItemLayout +from nw.constants import nwConst from nw.gui.custom import QHelpLabel -from nw.constants import ( - nwAlert, nwItemType, nwItemClass, nwItemLayout, nwConst -) logger = logging.getLogger(__name__) diff --git a/nw/gui/docviewer.py b/nw/gui/docviewer.py index 638622f4..0feaa101 100644 --- a/nw/gui/docviewer.py +++ b/nw/gui/docviewer.py @@ -41,7 +41,8 @@ from PyQt5.QtWidgets import ( ) from nw.core import ToHtml -from nw.constants import nwAlert, nwItemType, nwDocAction, nwUnicode +from nw.enum import nwAlert, nwItemType, nwDocAction +from nw.constants import nwUnicode logger = logging.getLogger(__name__) diff --git a/nw/gui/itemdetails.py b/nw/gui/itemdetails.py index 608aa6ba..79162382 100644 --- a/nw/gui/itemdetails.py +++ b/nw/gui/itemdetails.py @@ -31,9 +31,8 @@ from PyQt5.QtCore import Qt from PyQt5.QtGui import QFont, QPixmap from PyQt5.QtWidgets import QWidget, QGridLayout, QLabel -from nw.constants import ( - trConst, nwLabels, nwItemClass, nwItemType, nwItemLayout -) +from nw.enum import nwItemClass, nwItemType, nwItemLayout +from nw.constants import trConst, nwLabels logger = logging.getLogger(__name__) diff --git a/nw/gui/itemeditor.py b/nw/gui/itemeditor.py index 07926d33..b2c0f496 100644 --- a/nw/gui/itemeditor.py +++ b/nw/gui/itemeditor.py @@ -33,8 +33,9 @@ from PyQt5.QtWidgets import ( QDialogButtonBox ) +from nw.enum import nwItemLayout, nwItemType +from nw.constants import trConst, nwLists, nwLabels from nw.gui.custom import QSwitch -from nw.constants import trConst, nwLabels, nwItemLayout, nwItemType, nwLists logger = logging.getLogger(__name__) diff --git a/nw/gui/mainmenu.py b/nw/gui/mainmenu.py index 3f2579fd..402e40a9 100644 --- a/nw/gui/mainmenu.py +++ b/nw/gui/mainmenu.py @@ -31,10 +31,8 @@ from PyQt5.QtCore import QUrl, QProcess from PyQt5.QtGui import QDesktopServices from PyQt5.QtWidgets import QMenuBar, QAction -from nw.constants import ( - trConst, nwItemType, nwItemClass, nwDocAction, nwDocInsert, nwKeyWords, - nwLabels, nwUnicode, nwWidget -) +from nw.enum import nwItemType, nwItemClass, nwDocAction, nwDocInsert, nwWidget +from nw.constants import trConst, nwKeyWords, nwLabels, nwUnicode logger = logging.getLogger(__name__) diff --git a/nw/gui/noveltree.py b/nw/gui/noveltree.py index 7dde6aeb..c559f414 100644 --- a/nw/gui/noveltree.py +++ b/nw/gui/noveltree.py @@ -32,8 +32,8 @@ from time import time from PyQt5.QtCore import Qt, QSize from PyQt5.QtWidgets import QTreeWidget, QTreeWidgetItem, QAbstractItemView -from nw.constants import nwKeyWords from nw.common import checkInt +from nw.constants import nwKeyWords logger = logging.getLogger(__name__) diff --git a/nw/gui/outline.py b/nw/gui/outline.py index 7a54c6be..55359e52 100644 --- a/nw/gui/outline.py +++ b/nw/gui/outline.py @@ -34,7 +34,8 @@ from PyQt5.QtWidgets import ( QTreeWidget, QTreeWidgetItem, QMenu, QAction, QAbstractItemView ) -from nw.constants import trConst, nwKeyWords, nwLabels, nwOutline +from nw.enum import nwOutline +from nw.constants import trConst, nwKeyWords, nwLabels logger = logging.getLogger(__name__) diff --git a/nw/gui/outlinedetails.py b/nw/gui/outlinedetails.py index 8a1bc101..a4d032b5 100644 --- a/nw/gui/outlinedetails.py +++ b/nw/gui/outlinedetails.py @@ -32,8 +32,8 @@ from PyQt5.QtWidgets import ( QScrollArea, QWidget, QGridLayout, QHBoxLayout, QGroupBox, QLabel ) -from nw.constants import trConst, nwLabels, nwKeyWords from nw.common import checkInt +from nw.constants import trConst, nwKeyWords, nwLabels logger = logging.getLogger(__name__) diff --git a/nw/gui/preferences.py b/nw/gui/preferences.py index 529c71bc..16b1ba8d 100644 --- a/nw/gui/preferences.py +++ b/nw/gui/preferences.py @@ -35,9 +35,10 @@ from PyQt5.QtWidgets import ( QLineEdit, QFileDialog, QFontDialog, QDoubleSpinBox ) -from nw.gui.custom import QSwitch, QConfigLayout, PagedDialog, QuotesDialog from nw.core import NWSpellSimple, NWSpellEnchant -from nw.constants import nwConst, nwAlert +from nw.enum import nwAlert +from nw.constants import nwConst +from nw.gui.custom import QSwitch, QConfigLayout, PagedDialog, QuotesDialog logger = logging.getLogger(__name__) diff --git a/nw/gui/projdetails.py b/nw/gui/projdetails.py index ba393261..74e315c4 100644 --- a/nw/gui/projdetails.py +++ b/nw/gui/projdetails.py @@ -35,9 +35,9 @@ from PyQt5.QtWidgets import ( QLabel, QSpinBox, QGridLayout, QHBoxLayout, QLineEdit, QAbstractItemView ) -from nw.gui.custom import PagedDialog, QSwitch -from nw.constants import nwUnicode from nw.common import numberToRoman +from nw.constants import nwUnicode +from nw.gui.custom import PagedDialog, QSwitch logger = logging.getLogger(__name__) diff --git a/nw/gui/projsettings.py b/nw/gui/projsettings.py index 44ae65e4..55fd3d8c 100644 --- a/nw/gui/projsettings.py +++ b/nw/gui/projsettings.py @@ -35,7 +35,7 @@ from PyQt5.QtWidgets import ( QComboBox ) -from nw.constants import nwAlert +from nw.enum import nwAlert from nw.gui.custom import QSwitch, PagedDialog, QConfigLayout logger = logging.getLogger(__name__) diff --git a/nw/gui/projtree.py b/nw/gui/projtree.py index 54a4acfb..e0d5b4b3 100644 --- a/nw/gui/projtree.py +++ b/nw/gui/projtree.py @@ -37,10 +37,8 @@ from PyQt5.QtWidgets import ( ) from nw.core import NWDoc -from nw.constants import ( - trConst, nwLabels, nwItemType, nwItemClass, nwItemLayout, nwAlert, - nwConst, nwLists -) +from nw.enum import nwItemType, nwItemClass, nwItemLayout, nwAlert +from nw.constants import nwConst, trConst, nwLists, nwLabels logger = logging.getLogger(__name__) diff --git a/nw/gui/projwizard.py b/nw/gui/projwizard.py index 951b8211..81b885e8 100644 --- a/nw/gui/projwizard.py +++ b/nw/gui/projwizard.py @@ -35,8 +35,9 @@ from PyQt5.QtWidgets import ( QGroupBox, QGridLayout, QSpinBox ) +from nw.enum import nwItemClass from nw.common import makeFileNameSafe -from nw.constants import trConst, nwLabels, nwItemClass +from nw.constants import trConst, nwLabels from nw.gui.custom import QSwitch logger = logging.getLogger(__name__) diff --git a/nw/gui/theme.py b/nw/gui/theme.py index 946a6435..cec8ee4e 100644 --- a/nw/gui/theme.py +++ b/nw/gui/theme.py @@ -39,7 +39,7 @@ from PyQt5.QtGui import ( QPalette, QColor, QIcon, QFont, QFontMetrics, QFontDatabase, QPixmap ) -from nw.constants import nwAlert +from nw.enum import nwAlert logger = logging.getLogger(__name__) diff --git a/nw/gui/wordlist.py b/nw/gui/wordlist.py index 6f1cd490..7b7d810f 100644 --- a/nw/gui/wordlist.py +++ b/nw/gui/wordlist.py @@ -34,7 +34,8 @@ from PyQt5.QtWidgets import ( QAbstractItemView, QPushButton, QLineEdit, QLabel ) -from nw.constants import nwFiles, nwAlert +from nw.enum import nwAlert +from nw.constants import nwFiles logger = logging.getLogger(__name__) diff --git a/nw/gui/writingstats.py b/nw/gui/writingstats.py index d87d22df..cd50a3dd 100644 --- a/nw/gui/writingstats.py +++ b/nw/gui/writingstats.py @@ -38,8 +38,9 @@ from PyQt5.QtWidgets import ( QLabel, QGroupBox, QMenu, QAction, QFileDialog, QSpinBox, QHBoxLayout ) +from nw.enum import nwAlert from nw.common import formatTime, checkInt -from nw.constants import nwConst, nwFiles, nwAlert +from nw.constants import nwConst, nwFiles from nw.gui.custom import QSwitch logger = logging.getLogger(__name__) diff --git a/nw/guimain.py b/nw/guimain.py index d6da8940..ba8a5ebc 100644 --- a/nw/guimain.py +++ b/nw/guimain.py @@ -46,8 +46,9 @@ from nw.gui import ( GuiProjectTree, GuiProjectWizard, GuiTheme, GuiWordList, GuiWritingStats ) from nw.core import NWProject, NWDoc, NWIndex -from nw.constants import nwItemType, nwItemClass, nwAlert, nwLists, nwWidget +from nw.enum import nwItemType, nwItemClass, nwAlert, nwWidget from nw.common import getGuiItem, hexToInt +from nw.constants import nwLists logger = logging.getLogger(__name__)