Add a new constants class named nwLists

This commit is contained in:
Veronica K. B. Olsen
2021-01-06 21:53:42 +01:00
parent b5eef748b4
commit 4a4ac1d6c8
3 changed files with 23 additions and 13 deletions
+10 -9
View File
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from nw.constants.iso import isoLanguage, isoCountry
from nw.constants.constants import (
nwConst, nwRegEx, nwFiles, nwKeyWords, nwLabels, nwQuotes, nwUnicode
nwConst, nwLists, nwRegEx, nwFiles, nwKeyWords, nwLabels, nwQuotes, nwUnicode
)
from nw.constants.enum import (
nwAlert, nwDocAction, nwItemClass, nwItemLayout, nwItemType, nwOutline,
@@ -11,18 +11,19 @@ from nw.constants.enum import (
__all__ = [
"isoCountry",
"isoLanguage",
"nwAlert",
"nwConst",
"nwDocAction",
"nwDocInsert",
"nwLists",
"nwRegEx",
"nwFiles",
"nwKeyWords",
"nwLabels",
"nwQuotes",
"nwUnicode",
"nwAlert",
"nwDocAction",
"nwItemClass",
"nwItemLayout",
"nwItemType",
"nwKeyWords",
"nwLabels",
"nwOutline",
"nwQuotes",
"nwRegEx",
"nwUnicode",
"nwDocInsert",
]
+11 -2
View File
@@ -45,10 +45,19 @@ class nwConst():
SP_INTERNAL = "internal"
SP_ENCHANT = "enchant"
# Check Lists
# END Class nwConst
class nwLists():
"""Lists used for grouping various other constants.
"""
# Regular user-accessible item types
REG_TYPES = {nwItemType.ROOT, nwItemType.FOLDER, nwItemType.FILE}
# END Class nwConst
# Item classes where the full list of novel layouts are allowed
CLS_NOVEL = {nwItemClass.NOVEL, nwItemClass.ARCHIVE}
# END Class nwLists
class nwRegEx():
+2 -2
View File
@@ -47,7 +47,7 @@ from nw.gui import (
GuiTheme, GuiWritingStats
)
from nw.core import NWProject, NWDoc, NWIndex
from nw.constants import nwItemType, nwItemClass, nwAlert, nwConst
from nw.constants import nwItemType, nwItemClass, nwAlert, nwLists
from nw.common import getGuiItem
logger = logging.getLogger(__name__)
@@ -725,7 +725,7 @@ class GuiMain(QMainWindow):
tItem = self.theProject.projTree[tHandle]
if tItem is None:
return
if tItem.itemType not in nwConst.REG_TYPES:
if tItem.itemType not in nwLists.REG_TYPES:
return
logger.verbose("Requesting change to item %s" % tHandle)