From 4b3795671d94871f8600b1fbfe83dbcbead45049 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Sun, 28 Mar 2021 16:37:23 +0200 Subject: [PATCH 1/3] Update lanaguage files --- i18n/nw_en_US.ts | 58 ++++++++++++++++++++--------------------- i18n/nw_fr.ts | 58 ++++++++++++++++++++--------------------- i18n/nw_nb_NO.ts | 67 ++++++++++++++++++++++++------------------------ i18n/nw_pt.ts | 58 ++++++++++++++++++++--------------------- 4 files changed, 121 insertions(+), 120 deletions(-) diff --git a/i18n/nw_en_US.ts b/i18n/nw_en_US.ts index ffc2d6a5..781732b3 100644 --- a/i18n/nw_en_US.ts +++ b/i18n/nw_en_US.ts @@ -798,22 +798,22 @@ GuiDocEditFooter - + Status - + Line: {0} ({1}) - + Words: {0} ({1}) - + Document size is {0} bytes @@ -821,22 +821,22 @@ GuiDocEditHeader - + Edit document meta - + Search document - + Toggle Focus Mode - + Close the document @@ -1379,7 +1379,7 @@ - + Changes are saved automatically. @@ -1419,102 +1419,102 @@ - + Text files ({0}) - + Markdown files ({0}) - + novelWriter files ({0}) - + All files ({0}) - + Import File - + Could not read file. The file must be an existing text file. - + Please open a document to import the text file into. - + Import Document - + Importing the file will overwrite the current content of the document. Do you want to proceed? - + Indexing: '{0}' - + Unknown item - + Indexing completed in {0} ms - + The project index has been successfully rebuilt. - + Information - + Warning - + Error - + This is a bug! - + Internal Error - + Exit - + Do you want to exit novelWriter? diff --git a/i18n/nw_fr.ts b/i18n/nw_fr.ts index ade25b13..2a173460 100644 --- a/i18n/nw_fr.ts +++ b/i18n/nw_fr.ts @@ -798,22 +798,22 @@ GuiDocEditFooter - + Status État - + Line: {0} ({1}) Ligne: {0} ({1}) - + Words: {0} ({1}) Mots: {0} ({1}) - + Document size is {0} bytes La taille du document est de {0} octets @@ -821,22 +821,22 @@ GuiDocEditHeader - + Edit document meta Modifier les métadonnées du document - + Search document Chercher dans le document - + Toggle Focus Mode Basculer le mode focus - + Close the document Fermer le document @@ -1379,7 +1379,7 @@ Fermer le projet en cours ? - + Changes are saved automatically. Les changements sont enregistrés automatiquement. @@ -1419,102 +1419,102 @@ L'index du projet est périmé ou endommagé. Reconstruction de l'index en cours. - + Text files ({0}) Fichiers de texte ({0}) - + Markdown files ({0}) Fichiers Markdown ({0}) - + novelWriter files ({0}) fichiers novelWriter ({0}) - + All files ({0}) Tous les filchiers ({0}) - + Import File Importer un fichier - + Could not read file. The file must be an existing text file. Lecture du fichier impossible. Il faut un fichier texte existant. - + Please open a document to import the text file into. Veuillez ouvrir un document dans lequel sera importé le texte. - + Import Document Importer un document - + Importing the file will overwrite the current content of the document. Do you want to proceed? Le contenu du fichier importé va remplacer le contenu actuel du document. Faut-il continuer ? - + Indexing: '{0}' Indexation d e: '{0}' - + Unknown item Item inconnu - + Indexing completed in {0} ms Indexation effectuée en {0} ms - + The project index has been successfully rebuilt. L'index du projet a été correctement reconstruit. - + Information Information - + Warning Avertissement - + Error Erreur - + This is a bug! Ceci est un bug ! - + Internal Error Erreur interne - + Exit Sortir - + Do you want to exit novelWriter? Voulez-vous sortir de novelWriter ? diff --git a/i18n/nw_nb_NO.ts b/i18n/nw_nb_NO.ts index 390da818..edaa254c 100644 --- a/i18n/nw_nb_NO.ts +++ b/i18n/nw_nb_NO.ts @@ -1,5 +1,6 @@ - + + Common @@ -798,22 +799,22 @@ GuiDocEditFooter - + Status Status - + Line: {0} ({1}) Linje: {0} ({1}) - + Words: {0} ({1}) Ord: {0} ({1}) - + Document size is {0} bytes Dokumentet er {0} byte @@ -821,22 +822,22 @@ GuiDocEditHeader - + Edit document meta Rediger dokumentinstillinger - + Search document Søk i dokumentet - + Toggle Focus Mode Slå av/på "Fokus-modus" - + Close the document Lukk dokumentet @@ -1321,7 +1322,7 @@ Novel - Innhold + Roman @@ -1346,7 +1347,7 @@ Outline - Disposisjon + Oversikt @@ -1374,7 +1375,7 @@ Ønsker du å lukke dette prosjektet? - + Changes are saved automatically. Endringer lagres automatisk. @@ -1414,102 +1415,102 @@ Prosjektets indeks er utdatert eller skadet. Bygger indeksen på nytt. - + Text files ({0}) Tekstfiler ({0}) - + Markdown files ({0}) Markdown-filer ({0}) - + novelWriter files ({0}) novelWriter-filer ({0}) - + All files ({0}) Alle filer ({0}) - + Import File Importer fil - + Could not read file. The file must be an existing text file. Kunne ikke lese filen. Filen må eksistere fra før av. - + Please open a document to import the text file into. Vennligst åpne et dokument hvor teksten i filen kan importeres. - + Import Document Importer dokument - + Importing the file will overwrite the current content of the document. Do you want to proceed? Å importere filen vil overskrive all eksisterende tekst i dokumentet. Ønsker du å fortsette? - + Indexing: '{0}' Indekserer: '{0}' - + Unknown item Ukjent enhet - + Indexing completed in {0} ms Indekseringen tok {0} ms - + The project index has been successfully rebuilt. Prosjektets indeks har blitt bygget på nytt. - + Information Informasjon - + Warning Advarsel - + Error Feil - + This is a bug! Dette er en systemfeil! - + Internal Error Intern feil - + Exit Avslutt - + Do you want to exit novelWriter? Ønsker du å avslutte novelWriter? @@ -1934,7 +1935,7 @@ Focus Outline - Gå til disposisjon + Gå til oversikt diff --git a/i18n/nw_pt.ts b/i18n/nw_pt.ts index 268c0853..110abae7 100644 --- a/i18n/nw_pt.ts +++ b/i18n/nw_pt.ts @@ -798,22 +798,22 @@ GuiDocEditFooter - + Line: {0} ({1}) Linha: {0} ({1}) - + Words: {0} ({1}) Palavras: {0} ({1}) - + Status Estado - + Document size is {0} bytes O tamanho do documento é {0} bytes @@ -821,22 +821,22 @@ GuiDocEditHeader - + Edit document meta Editar os meta-dados do documento - + Search document Procurar no documento - + Toggle Focus Mode Alternar o "Modo Foco" - + Close the document Fechar o documento @@ -1329,32 +1329,32 @@ Nota: Se o programa ou o computador sofreu uma falha anteriormente, o bloqueio pode ser sobrescrito com segurança. Se, no entanto, outra instância do novelWriter esteja com o projeto aberto, sobrescrever o bloqueio pode corromper o projeto e não é recomendado. - + Unknown item Item desconhecido - + Information Informação - + Warning Alerta - + Error Erro - + This is a bug! Isto é um bug! - + Internal Error Erro Interno @@ -1389,7 +1389,7 @@ Fechar o projeto atual? - + Changes are saved automatically. As alterações serão salvas automaticamente. @@ -1409,47 +1409,47 @@ Projeto Bloqueado - + Import File Importar Arquivo - + Could not read file. The file must be an existing text file. Não foi possível ler o arquivo. O arquivo deve ser um arquivo de texto existente. - + Please open a document to import the text file into. Por favor, abra um documento para importar o text nele. - + Import Document Importar Documento - + Importing the file will overwrite the current content of the document. Do you want to proceed? Importar o arquivo vai sobrescrever o conteúdo atual do documento. Você deseja continuar? - + The project index has been successfully rebuilt. O índice do projeto foi reconstruído com sucesso. - + Exit Sair - + Do you want to exit novelWriter? Você deseja realmente sair do novelWriter? - + Indexing completed in {0} ms Indexação completa em {0} ms @@ -1489,27 +1489,27 @@ O projeto foi bloqueado pelo computador '{0}' ({1} {2}), ativo pela última vez em {3}. - + Indexing: '{0}' Indexando: '{0}' - + Text files ({0}) Arquivos de texto ({0}) - + Markdown files ({0}) Arquivos Markdown ({0}) - + novelWriter files ({0}) Arquivos do novelWriter ({0}) - + All files ({0}) Todos os arquivos ({0}) From f92ef05ee2a40072c451b05ef93840229c7e543a Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Sun, 28 Mar 2021 17:15:17 +0200 Subject: [PATCH 2/3] Move enum and constants to the root source folder --- nw/common.py | 5 ++--- nw/config.py | 4 ++-- nw/{constants => }/constants.py | 4 +--- nw/constants/__init__.py | 30 ------------------------------ nw/core/document.py | 3 +-- nw/core/index.py | 8 +++----- nw/core/item.py | 6 ++---- nw/core/project.py | 5 ++--- nw/core/tohtml.py | 2 +- nw/core/tokenizer.py | 5 +++-- nw/core/tomd.py | 2 +- nw/core/toodt.py | 4 ++-- nw/core/tree.py | 9 ++++----- nw/{constants => }/enum.py | 0 nw/gui/build.py | 9 ++++----- nw/gui/custom.py | 2 +- nw/gui/doceditor.py | 8 +++----- nw/gui/dochighlight.py | 2 +- nw/gui/docmerge.py | 4 ++-- nw/gui/docsplit.py | 5 ++--- nw/gui/docviewer.py | 3 ++- nw/gui/itemdetails.py | 5 ++--- nw/gui/itemeditor.py | 3 ++- nw/gui/mainmenu.py | 6 ++---- nw/gui/noveltree.py | 2 +- nw/gui/outline.py | 3 ++- nw/gui/outlinedetails.py | 2 +- nw/gui/preferences.py | 5 +++-- nw/gui/projdetails.py | 4 ++-- nw/gui/projsettings.py | 2 +- nw/gui/projtree.py | 6 ++---- nw/gui/projwizard.py | 3 ++- nw/gui/theme.py | 2 +- nw/gui/wordlist.py | 3 ++- nw/gui/writingstats.py | 3 ++- nw/guimain.py | 3 ++- 36 files changed, 66 insertions(+), 106 deletions(-) rename nw/{constants => }/constants.py (99%) delete mode 100644 nw/constants/__init__.py rename nw/{constants => }/enum.py (100%) 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__) From 820e6fcfa33632d5bc61204912cf144659a663da Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Sun, 28 Mar 2021 17:15:35 +0200 Subject: [PATCH 3/3] Update tests --- tests/test_core/test_core_document.py | 2 +- tests/test_core/test_core_index.py | 2 +- tests/test_core/test_core_item.py | 2 +- tests/test_core/test_core_project.py | 3 ++- tests/test_core/test_core_tree.py | 3 ++- tests/test_gui/test_gui_doceditor.py | 2 +- tests/test_gui/test_gui_docviewer.py | 2 +- tests/test_gui/test_gui_itemeditor.py | 2 +- tests/test_gui/test_gui_mainmenu.py | 5 ++--- tests/test_gui/test_gui_outline.py | 2 +- tests/test_gui/test_gui_projtree.py | 2 +- tests/test_gui/test_gui_projwizard.py | 2 +- 12 files changed, 15 insertions(+), 14 deletions(-) diff --git a/tests/test_core/test_core_document.py b/tests/test_core/test_core_document.py index f1084f84..1eab9824 100644 --- a/tests/test_core/test_core_document.py +++ b/tests/test_core/test_core_document.py @@ -27,7 +27,7 @@ from dummy import causeOSError from nw.core import NWProject, NWDoc from nw.core.item import NWItem -from nw.constants import nwItemClass, nwItemLayout +from nw.enum import nwItemClass, nwItemLayout @pytest.mark.core def testCoreDocument_LoadSave(monkeypatch, dummyGUI, nwMinimal): diff --git a/tests/test_core/test_core_index.py b/tests/test_core/test_core_index.py index 927a506c..95b83a81 100644 --- a/tests/test_core/test_core_index.py +++ b/tests/test_core/test_core_index.py @@ -31,7 +31,7 @@ from tools import cmpFiles from nw.core.project import NWProject from nw.core.index import NWIndex, countWords -from nw.constants import nwItemClass, nwItemLayout +from nw.enum import nwItemClass, nwItemLayout @pytest.mark.core def testCoreIndex_LoadSave(monkeypatch, nwLipsum, dummyGUI, outDir, refDir): diff --git a/tests/test_core/test_core_item.py b/tests/test_core/test_core_item.py index 6b615dcd..e4ed227e 100644 --- a/tests/test_core/test_core_item.py +++ b/tests/test_core/test_core_item.py @@ -26,7 +26,7 @@ from lxml import etree from nw.core import NWProject from nw.core.item import NWItem -from nw.constants import nwItemClass, nwItemType, nwItemLayout +from nw.enum import nwItemClass, nwItemType, nwItemLayout @pytest.mark.core def testCoreItem_Setters(dummyGUI): diff --git a/tests/test_core/test_core_project.py b/tests/test_core/test_core_project.py index 3265cea9..8eb918ec 100644 --- a/tests/test_core/test_core_project.py +++ b/tests/test_core/test_core_project.py @@ -31,8 +31,9 @@ from tools import cmpFiles, writeFile, readFile from dummy import causeOSError from nw.core.project import NWProject -from nw.constants import nwItemClass, nwItemType, nwItemLayout, nwFiles +from nw.enum import nwItemClass, nwItemType, nwItemLayout from nw.common import formatTimeStamp +from nw.constants import nwFiles @pytest.mark.core def testCoreProject_NewMinimal(fncDir, outDir, refDir, tmpDir, dummyGUI): diff --git a/tests/test_core/test_core_tree.py b/tests/test_core/test_core_tree.py index b80bb784..803e88c4 100644 --- a/tests/test_core/test_core_tree.py +++ b/tests/test_core/test_core_tree.py @@ -26,7 +26,8 @@ import pytest from lxml import etree from nw.core.project import NWProject, NWItem, NWTree -from nw.constants import nwItemClass, nwItemType, nwItemLayout, nwFiles +from nw.enum import nwItemClass, nwItemType, nwItemLayout +from nw.constants import nwFiles @pytest.fixture(scope="function") def dummyItems(dummyGUI): diff --git a/tests/test_gui/test_gui_doceditor.py b/tests/test_gui/test_gui_doceditor.py index b53da662..a4d0c43b 100644 --- a/tests/test_gui/test_gui_doceditor.py +++ b/tests/test_gui/test_gui_doceditor.py @@ -33,7 +33,7 @@ from PyQt5.QtWidgets import QAction, QMessageBox, QDialog from nw.gui.itemeditor import GuiItemEditor from nw.gui.doceditor import GuiDocEditor from nw.gui.projtree import GuiProjectTree -from nw.constants import nwItemType, nwDocAction, nwWidget +from nw.enum import nwItemType, nwDocAction, nwWidget keyDelay = 2 typeDelay = 1 diff --git a/tests/test_gui/test_gui_docviewer.py b/tests/test_gui/test_gui_docviewer.py index 3585c8c8..ed77dcc4 100644 --- a/tests/test_gui/test_gui_docviewer.py +++ b/tests/test_gui/test_gui_docviewer.py @@ -26,7 +26,7 @@ from PyQt5.QtCore import Qt, QUrl from PyQt5.QtGui import QTextCursor from PyQt5.QtWidgets import qApp, QAction, QMessageBox -from nw.constants import nwDocAction +from nw.enum import nwDocAction keyDelay = 2 typeDelay = 1 diff --git a/tests/test_gui/test_gui_itemeditor.py b/tests/test_gui/test_gui_itemeditor.py index aacdd4b7..d4c8b7db 100644 --- a/tests/test_gui/test_gui_itemeditor.py +++ b/tests/test_gui/test_gui_itemeditor.py @@ -29,7 +29,7 @@ from tools import cmpFiles, getGuiItem from PyQt5.QtWidgets import QAction, QMessageBox from nw.gui import GuiItemEditor, GuiProjectTree -from nw.constants import nwItemLayout +from nw.enum import nwItemLayout keyDelay = 2 typeDelay = 1 diff --git a/tests/test_gui/test_gui_mainmenu.py b/tests/test_gui/test_gui_mainmenu.py index e2ef781a..2c718704 100644 --- a/tests/test_gui/test_gui_mainmenu.py +++ b/tests/test_gui/test_gui_mainmenu.py @@ -28,9 +28,8 @@ from PyQt5.QtGui import QTextCursor, QTextBlock from PyQt5.QtWidgets import QAction, QFileDialog, QMessageBox from nw.gui.doceditor import GuiDocEditor -from nw.constants import ( - nwUnicode, nwDocAction, nwDocInsert, nwKeyWords, nwWidget -) +from nw.enum import nwDocAction, nwDocInsert, nwWidget +from nw.constants import nwKeyWords, nwUnicode keyDelay = 2 typeDelay = 1 diff --git a/tests/test_gui/test_gui_outline.py b/tests/test_gui/test_gui_outline.py index bfeb2f96..53724636 100644 --- a/tests/test_gui/test_gui_outline.py +++ b/tests/test_gui/test_gui_outline.py @@ -25,7 +25,7 @@ import pytest from PyQt5.QtCore import Qt, QPoint from PyQt5.QtWidgets import QAction, QTreeWidgetItem, QMessageBox -from nw.constants import nwOutline +from nw.enum import nwOutline keyDelay = 2 typeDelay = 1 diff --git a/tests/test_gui/test_gui_projtree.py b/tests/test_gui/test_gui_projtree.py index 07fbc312..c595eaf1 100644 --- a/tests/test_gui/test_gui_projtree.py +++ b/tests/test_gui/test_gui_projtree.py @@ -30,7 +30,7 @@ from PyQt5.QtWidgets import QAction, QMessageBox from nw.guimain import GuiMain from nw.gui.projtree import GuiProjectTree -from nw.constants import nwItemType, nwItemClass +from nw.enum import nwItemType, nwItemClass @pytest.mark.gui def testGuiProjTree_TreeItems(qtbot, caplog, monkeypatch, nwGUI, nwMinimal): diff --git a/tests/test_gui/test_gui_projwizard.py b/tests/test_gui/test_gui_projwizard.py index 0825eea6..02f7b00a 100644 --- a/tests/test_gui/test_gui_projwizard.py +++ b/tests/test_gui/test_gui_projwizard.py @@ -30,7 +30,7 @@ from PyQt5.QtCore import Qt from PyQt5.QtWidgets import QFileDialog, QWizard, QMessageBox from nw.gui import GuiProjectWizard -from nw.constants import nwItemClass +from nw.enum import nwItemClass from nw.gui.projwizard import ( ProjWizardIntroPage, ProjWizardFolderPage, ProjWizardPopulatePage, ProjWizardCustomPage, ProjWizardFinalPage