Reorganise constants, and add ISO language codes in order to drop dependency pycountry

This commit is contained in:
Veronica K. B. Olsen
2019-11-05 18:14:40 +01:00
parent 993339c96c
commit 0e84452533
44 changed files with 610 additions and 126 deletions
+25
View File
@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
from nw.constants.iso import isoLanguage, isoCountry
from nw.constants.constants import (
nwConst, nwFiles, nwKeyWords, nwLabels, nwDependencies, nwQuotes, nwUnicode
)
from nw.constants.enum import (
nwAlert, nwDocAction, nwItemClass, nwItemLayout, nwItemType
)
__all__ = [
"isoLanguage",
"isoCountry",
"nwConst",
"nwFiles",
"nwKeyWords",
"nwLabels",
"nwDependencies",
"nwQuotes",
"nwUnicode",
"nwAlert",
"nwDocAction",
"nwItemClass",
"nwItemLayout",
"nwItemType",
]
@@ -10,7 +10,7 @@
"""
from nw.enum import nwItemClass, nwItemLayout
from nw.constants.enum import nwItemClass, nwItemLayout
class nwConst():
@@ -128,10 +128,6 @@ class nwDependencies():
"site" : "",
"docs" : "",
},
"pycountry" : {
"site" : "",
"docs" : "",
},
"latexcodec" : {
"site" : "https://pypi.org/project/latexcodec/",
"docs" : "https://latexcodec.readthedocs.io/en/latest/",
View File
+477
View File
@@ -0,0 +1,477 @@
# -*- coding: utf-8 -*-
"""novelWriter Language Codes
novelWriter Language Codes
==============================
Handles translating language codes to language names
File History:
Created: 2019-11-05 [0.4.0]
"""
import logging
logger = logging.getLogger(__name__)
class isoLanguage():
ISO_639_1 = {
"aa" : "Afar",
"ab" : "Abkhazian",
"ae" : "Avestan",
"af" : "Afrikaans",
"ak" : "Akan",
"am" : "Amharic",
"an" : "Aragonese",
"ar" : "Arabic",
"as" : "Assamese",
"av" : "Avaric",
"ay" : "Aymara",
"az" : "Azerbaijani",
"ba" : "Bashkir",
"be" : "Belarusian",
"bg" : "Bulgarian",
"bh" : "Bihari languages",
"bi" : "Bislama",
"bm" : "Bambara",
"bn" : "Bengali",
"bo" : "Tibetan",
"bo" : "Tibetan",
"br" : "Breton",
"bs" : "Bosnian",
"ca" : "Catalan",
"ce" : "Chechen",
"ch" : "Chamorro",
"co" : "Corsican",
"cr" : "Cree",
"cs" : "Czech",
"cs" : "Czech",
"cu" : "Church Slavic",
"cv" : "Chuvash",
"cy" : "Welsh",
"cy" : "Welsh",
"da" : "Danish",
"de" : "German",
"de" : "German",
"dv" : "Divehi",
"dz" : "Dzongkha",
"ee" : "Ewe",
"el" : "Modern Greek",
"en" : "English",
"eo" : "Esperanto",
"es" : "Spanish",
"et" : "Estonian",
"eu" : "Basque",
"eu" : "Basque",
"fa" : "Persian",
"fa" : "Persian",
"ff" : "Fulah",
"fi" : "Finnish",
"fj" : "Fijian",
"fo" : "Faroese",
"fr" : "French",
"fr" : "French",
"fy" : "Western Frisian",
"ga" : "Irish",
"gd" : "Gaelic",
"gl" : "Galician",
"gn" : "Guarani",
"gu" : "Gujarati",
"gv" : "Manx",
"ha" : "Hausa",
"he" : "Hebrew",
"hi" : "Hindi",
"ho" : "Hiri Motu",
"hr" : "Croatian",
"ht" : "Haitian",
"hu" : "Hungarian",
"hy" : "Armenian",
"hy" : "Armenian",
"hz" : "Herero",
"ia" : "Interlingua",
"id" : "Indonesian",
"ie" : "Interlingue",
"ig" : "Igbo",
"ii" : "Sichuan Yi",
"ik" : "Inupiaq",
"io" : "Ido",
"is" : "Icelandic",
"is" : "Icelandic",
"it" : "Italian",
"iu" : "Inuktitut",
"ja" : "Japanese",
"jv" : "Javanese",
"ka" : "Georgian",
"ka" : "Georgian",
"kg" : "Kongo",
"ki" : "Kikuyu",
"kj" : "Kuanyama",
"kk" : "Kazakh",
"kl" : "Kalaallisut",
"km" : "Central Khmer",
"kn" : "Kannada",
"ko" : "Korean",
"kr" : "Kanuri",
"ks" : "Kashmiri",
"ku" : "Kurdish",
"kv" : "Komi",
"kw" : "Cornish",
"ky" : "Kirghiz",
"la" : "Latin",
"lb" : "Luxembourgish",
"lg" : "Ganda",
"li" : "Limburgan",
"ln" : "Lingala",
"lo" : "Lao",
"lt" : "Lithuanian",
"lu" : "Luba-Katanga",
"lv" : "Latvian",
"mg" : "Malagasy",
"mh" : "Marshallese",
"mi" : "Maori",
"mi" : "Maori",
"mk" : "Macedonian",
"mk" : "Macedonian",
"ml" : "Malayalam",
"mn" : "Mongolian",
"mr" : "Marathi",
"ms" : "Malay",
"mt" : "Maltese",
"my" : "Burmese",
"na" : "Nauru",
"nb" : "Norwegian Bokmål",
"nd" : "North Ndebele",
"ne" : "Nepali",
"ng" : "Ndonga",
"nl" : "Dutch",
"nn" : "Norwegian Nynorsk",
"no" : "Norwegian",
"nr" : "South Ndebele",
"nv" : "Navajo",
"ny" : "Chichewa",
"oc" : "Occitan",
"oj" : "Ojibwa",
"om" : "Oromo",
"or" : "Oriya",
"os" : "Ossetian",
"pa" : "Panjabi",
"pi" : "Pali",
"pl" : "Polish",
"ps" : "Pushto",
"pt" : "Portuguese",
"qu" : "Quechua",
"rm" : "Romansh",
"rn" : "Rundi",
"ro" : "Romanian",
"ru" : "Russian",
"rw" : "Kinyarwanda",
"sa" : "Sanskrit",
"sc" : "Sardinian",
"sd" : "Sindhi",
"se" : "Northern Sami",
"sg" : "Sango",
"si" : "Sinhala",
"sk" : "Slovak",
"sk" : "Slovak",
"sl" : "Slovenian",
"sm" : "Samoan",
"sn" : "Shona",
"so" : "Somali",
"sq" : "Albanian",
"sq" : "Albanian",
"sr" : "Serbian",
"ss" : "Swati",
"st" : "Southern Sotho",
"su" : "Sundanese",
"sv" : "Swedish",
"sw" : "Swahili",
"ta" : "Tamil",
"te" : "Telugu",
"tg" : "Tajik",
"th" : "Thai",
"ti" : "Tigrinya",
"tk" : "Turkmen",
"tl" : "Tagalog",
"tn" : "Tswana",
"to" : "Tonga",
"tr" : "Turkish",
"ts" : "Tsonga",
"tt" : "Tatar",
"tw" : "Twi",
"ty" : "Tahitian",
"ug" : "Uighur",
"uk" : "Ukrainian",
"ur" : "Urdu",
"uz" : "Uzbek",
"ve" : "Venda",
"vi" : "Vietnamese",
"vo" : "Volapük",
"wa" : "Walloon",
"wo" : "Wolof",
"xh" : "Xhosa",
"yi" : "Yiddish",
"yo" : "Yoruba",
"za" : "Zhuang",
"zh" : "Chinese",
"zh" : "Chinese",
"zu" : "Zulu",
}
# END Class isoLanguage
class isoCountry():
ISO_3166_1_alpha_2 : {
"AD" : "Andorra",
"AE" : "United Arab Emirates",
"AF" : "Afghanistan",
"AG" : "Antigua and Barbuda",
"AI" : "Anguilla",
"AL" : "Albania",
"AM" : "Armenia",
"AO" : "Angola",
"AQ" : "Antarctica",
"AR" : "Argentina",
"AS" : "American Samoa",
"AT" : "Austria",
"AU" : "Australia",
"AW" : "Aruba",
"AX" : "Åland Islands",
"AZ" : "Azerbaijan",
"BA" : "Bosnia and Herzegovina",
"BB" : "Barbados",
"BD" : "Bangladesh",
"BE" : "Belgium",
"BF" : "Burkina Faso",
"BG" : "Bulgaria",
"BH" : "Bahrain",
"BI" : "Burundi",
"BJ" : "Benin",
"BL" : "Saint Barthélemy",
"BM" : "Bermuda",
"BN" : "Brunei Darussalam",
"BO" : "Plurinational State of Bolivia",
"BQ" : "Sint Eustatius and Saba Bonaire",
"BR" : "Brazil",
"BS" : "Bahamas",
"BT" : "Bhutan",
"BV" : "Bouvet Island",
"BW" : "Botswana",
"BY" : "Belarus",
"BZ" : "Belize",
"CA" : "Canada",
"CC" : "Cocos (Keeling) Islands",
"CD" : "The Democratic Republic of the Congo",
"CF" : "Central African Republic",
"CG" : "Congo",
"CH" : "Switzerland",
"CI" : "Côte d'Ivoire",
"CK" : "Cook Islands",
"CL" : "Chile",
"CM" : "Cameroon",
"CN" : "China",
"CO" : "Colombia",
"CR" : "Costa Rica",
"CU" : "Cuba",
"CV" : "Cape Verde",
"CW" : "Curaçao",
"CX" : "Christmas Island",
"CY" : "Cyprus",
"CZ" : "Czech Republic",
"DE" : "Germany",
"DJ" : "Djibouti",
"DK" : "Denmark",
"DM" : "Dominica",
"DO" : "Dominican Republic",
"DZ" : "Algeria",
"EC" : "Ecuador",
"EE" : "Estonia",
"EG" : "Egypt",
"EH" : "Western Sahara",
"ER" : "Eritrea",
"ES" : "Spain",
"ET" : "Ethiopia",
"FI" : "Finland",
"FJ" : "Fiji",
"FK" : "Falkland Islands (Malvinas)",
"FM" : "Federated States of Micronesia",
"FO" : "Faroe Islands",
"FR" : "France",
"GA" : "Gabon",
"GB" : "United Kingdom",
"GD" : "Grenada",
"GE" : "Georgia",
"GF" : "French Guiana",
"GG" : "Guernsey",
"GH" : "Ghana",
"GI" : "Gibraltar",
"GL" : "Greenland",
"GM" : "Gambia",
"GN" : "Guinea",
"GP" : "Guadeloupe",
"GQ" : "Equatorial Guinea",
"GR" : "Greece",
"GS" : "South Georgia and the South Sandwich Islands",
"GT" : "Guatemala",
"GU" : "Guam",
"GW" : "Guinea-Bissau",
"GY" : "Guyana",
"HK" : "Hong Kong",
"HM" : "Heard Island and McDonald Islands",
"HN" : "Honduras",
"HR" : "Croatia",
"HT" : "Haiti",
"HU" : "Hungary",
"ID" : "Indonesia",
"IE" : "Ireland",
"IL" : "Israel",
"IM" : "Isle of Man",
"IN" : "India",
"IO" : "British Indian Ocean Territory",
"IQ" : "Iraq",
"IR" : "Islamic Republic of Iran",
"IS" : "Iceland",
"IT" : "Italy",
"JE" : "Jersey",
"JM" : "Jamaica",
"JO" : "Jordan",
"JP" : "Japan",
"KE" : "Kenya",
"KG" : "Kyrgyzstan",
"KH" : "Cambodia",
"KI" : "Kiribati",
"KM" : "Comoros",
"KN" : "Saint Kitts and Nevis",
"KP" : "Democratic People's Republic of Korea",
"KR" : "Republic of Korea",
"KW" : "Kuwait",
"KY" : "Cayman Islands",
"KZ" : "Kazakhstan",
"LA" : "Lao People's Democratic Republic",
"LB" : "Lebanon",
"LC" : "Saint Lucia",
"LI" : "Liechtenstein",
"LK" : "Sri Lanka",
"LR" : "Liberia",
"LS" : "Lesotho",
"LT" : "Lithuania",
"LU" : "Luxembourg",
"LV" : "Latvia",
"LY" : "Libya",
"MA" : "Morocco",
"MC" : "Monaco",
"MD" : "Republic of Moldova",
"ME" : "Montenegro",
"MF" : "Saint Martin (French part)",
"MG" : "Madagascar",
"MH" : "Marshall Islands",
"MK" : "The Former Yugoslav Republic of Macedonia",
"ML" : "Mali",
"MM" : "Myanmar",
"MN" : "Mongolia",
"MO" : "Macao",
"MP" : "Northern Mariana Islands",
"MQ" : "Martinique",
"MR" : "Mauritania",
"MS" : "Montserrat",
"MT" : "Malta",
"MU" : "Mauritius",
"MV" : "Maldives",
"MW" : "Malawi",
"MX" : "Mexico",
"MY" : "Malaysia",
"MZ" : "Mozambique",
"NA" : "Namibia",
"NC" : "New Caledonia",
"NE" : "Niger",
"NF" : "Norfolk Island",
"NG" : "Nigeria",
"NI" : "Nicaragua",
"NL" : "Netherlands",
"NO" : "Norway",
"NP" : "Nepal",
"NR" : "Nauru",
"NU" : "Niue",
"NZ" : "New Zealand",
"OM" : "Oman",
"PA" : "Panama",
"PE" : "Peru",
"PF" : "French Polynesia",
"PG" : "Papua New Guinea",
"PH" : "Philippines",
"PK" : "Pakistan",
"PL" : "Poland",
"PM" : "Saint Pierre and Miquelon",
"PN" : "Pitcairn",
"PR" : "Puerto Rico",
"PS" : "State of Palestine",
"PT" : "Portugal",
"PW" : "Palau",
"PY" : "Paraguay",
"QA" : "Qatar",
"RE" : "Réunion",
"RO" : "Romania",
"RS" : "Serbia",
"RU" : "Russian Federation",
"RW" : "Rwanda",
"SA" : "Saudi Arabia",
"SB" : "Solomon Islands",
"SC" : "Seychelles",
"SD" : "Sudan",
"SE" : "Sweden",
"SG" : "Singapore",
"SH" : "Saint Helena, Ascension and Tristan da Cunha",
"SI" : "Slovenia",
"SJ" : "Svalbard and Jan Mayen",
"SK" : "Slovakia",
"SL" : "Sierra Leone",
"SM" : "San Marino",
"SN" : "Senegal",
"SO" : "Somalia",
"SR" : "Suriname",
"SS" : "South Sudan",
"ST" : "Sao Tome and Principe",
"SV" : "El Salvador",
"SX" : "Sint Maarten",
"SY" : "Syrian Arab Republic",
"SZ" : "Swaziland",
"TC" : "Turks and Caicos Islands",
"TD" : "Chad",
"TF" : "French Southern Territories",
"TG" : "Togo",
"TH" : "Thailand",
"TJ" : "Tajikistan",
"TK" : "Tokelau",
"TL" : "Timor-Leste",
"TM" : "Turkmenistan",
"TN" : "Tunisia",
"TO" : "Tonga",
"TR" : "Turkey",
"TT" : "Trinidad and Tobago",
"TV" : "Tuvalu",
"TW" : "Taiwan, Province of China",
"TZ" : "United Republic of Tanzania",
"UA" : "Ukraine",
"UG" : "Uganda",
"UM" : "United States Minor Outlying Islands",
"US" : "United States",
"UY" : "Uruguay",
"UZ" : "Uzbekistan",
"VA" : "Holy See (Vatican City State)",
"VC" : "Saint Vincent and the Grenadines",
"VE" : "Bolivarian Republic of Venezuela",
"VG" : "British Virgin Islands",
"VI" : "U.S. Virgin Islands",
"VN" : "Viet Nam",
"VU" : "Vanuatu",
"WF" : "Wallis and Futuna",
"WS" : "Samoa",
"YE" : "Yemen",
"YT" : "Mayotte",
"ZA" : "South Africa",
"ZM" : "Zambia",
"ZW" : "Zimbabwe",
}
# END Class isoCountry
+10 -10
View File
@@ -14,14 +14,14 @@ from nw.convert.text.tomarkdown import ToMarkdown
from nw.convert.text.totext import ToText
__all__ = [
Tokenizer,
ConcatFile,
HtmlFile,
LaTeXFile,
MarkdownFile,
TextFile,
ToHtml,
ToLaTeX,
ToMarkdown,
ToText,
"Tokenizer",
"ConcatFile",
"HtmlFile",
"LaTeXFile",
"MarkdownFile",
"TextFile",
"ToHtml",
"ToLaTeX",
"ToMarkdown",
"ToText",
]
+5 -5
View File
@@ -7,9 +7,9 @@ from nw.convert.file.markdown import MarkdownFile
from nw.convert.file.text import TextFile
__all__ = [
ConcatFile,
HtmlFile,
LaTeXFile,
MarkdownFile,
TextFile,
"ConcatFile",
"HtmlFile",
"LaTeXFile",
"MarkdownFile",
"TextFile",
]
+1 -1
View File
@@ -19,7 +19,7 @@ from PyQt5.QtWidgets import QMessageBox
from nw.convert.file.text import TextFile
from nw.convert.tokenizer import Tokenizer
from nw.enum import nwAlert, nwItemLayout
from nw.constants import nwAlert, nwItemLayout
logger = logging.getLogger(__name__)
+1 -1
View File
@@ -15,7 +15,7 @@ import nw
from nw.convert.file.text import TextFile
from nw.convert.text.tohtml import ToHtml
from nw.enum import nwAlert
from nw.constants import nwAlert
logger = logging.getLogger(__name__)
+1 -1
View File
@@ -15,7 +15,7 @@ import nw
from nw.convert.file.text import TextFile
from nw.convert.text.tolatex import ToLaTeX
from nw.enum import nwAlert
from nw.constants import nwAlert
logger = logging.getLogger(__name__)
+1 -1
View File
@@ -15,7 +15,7 @@ import nw
from nw.convert.file.text import TextFile
from nw.convert.text.tomarkdown import ToMarkdown
from nw.enum import nwAlert
from nw.constants import nwAlert
logger = logging.getLogger(__name__)
+1 -1
View File
@@ -18,7 +18,7 @@ from os import path
from PyQt5.QtWidgets import QMessageBox
from nw.convert.text.totext import ToText
from nw.enum import nwAlert, nwItemType, nwItemLayout, nwItemClass
from nw.constants import nwAlert, nwItemType, nwItemLayout, nwItemClass
logger = logging.getLogger(__name__)
+4 -4
View File
@@ -6,8 +6,8 @@ from nw.convert.text.tomarkdown import ToMarkdown
from nw.convert.text.totext import ToText
__all__ = [
ToHtml,
ToLaTeX,
ToMarkdown,
ToText,
"ToHtml",
"ToLaTeX",
"ToMarkdown",
"ToText",
]
+1 -1
View File
@@ -20,7 +20,7 @@ from PyQt5.QtCore import QRegularExpression
from nw.project.document import NWDoc
from nw.tools.translate import numberToWord
from nw.enum import nwItemLayout
from nw.constants import nwItemLayout
logger = logging.getLogger(__name__)
+17 -17
View File
@@ -26,21 +26,21 @@ from nw.gui.tools.dochighlight import GuiDocHighlighter
from nw.gui.tools.wordcounter import WordCounter
__all__ = [
GuiMainMenu,
GuiMainStatus,
GuiConfigEditor,
GuiExport,
GuiItemEditor,
GuiProjectEditor,
GuiSessionLogView,
GuiTimeLineView,
GuiDocDetails,
GuiDocEditor,
GuiDocTree,
GuiDocViewer,
GuiNoticeBar,
GuiSearchBar,
GuiDocViewDetails,
GuiDocHighlighter,
WordCounter,
"GuiMainMenu",
"GuiMainStatus",
"GuiConfigEditor",
"GuiExport",
"GuiItemEditor",
"GuiProjectEditor",
"GuiSessionLogView",
"GuiTimeLineView",
"GuiDocDetails",
"GuiDocEditor",
"GuiDocTree",
"GuiDocViewer",
"GuiNoticeBar",
"GuiSearchBar",
"GuiDocViewDetails",
"GuiDocHighlighter",
"WordCounter",
]
+6 -6
View File
@@ -8,10 +8,10 @@ from nw.gui.dialogs.sessionlog import GuiSessionLogView
from nw.gui.dialogs.timelineview import GuiTimeLineView
__all__ = [
GuiConfigEditor,
GuiExport,
GuiItemEditor,
GuiProjectEditor,
GuiSessionLogView,
GuiTimeLineView,
"GuiConfigEditor",
"GuiExport",
"GuiItemEditor",
"GuiProjectEditor",
"GuiSessionLogView",
"GuiTimeLineView",
]
+1 -2
View File
@@ -25,8 +25,7 @@ from PyQt5.QtWidgets import (
QFileDialog
)
from nw.enum import nwAlert
from nw.constants import nwQuotes
from nw.constants import nwAlert, nwQuotes
logger = logging.getLogger(__name__)
+1 -2
View File
@@ -27,9 +27,8 @@ from PyQt5.QtWidgets import (
from nw.convert import TextFile, HtmlFile, MarkdownFile, LaTeXFile, ConcatFile
from nw.project import NWDoc
from nw.tools import numberToWord, OptLastState
from nw.constants import nwFiles
from nw.common import packageRefURL
from nw.enum import nwItemType, nwAlert
from nw.constants import nwFiles, nwItemType, nwAlert
logger = logging.getLogger(__name__)
+1 -2
View File
@@ -22,8 +22,7 @@ from PyQt5.QtWidgets import (
QLineEdit, QPushButton, QComboBox
)
from nw.enum import nwItemLayout, nwItemClass, nwItemType
from nw.constants import nwLabels
from nw.constants import nwLabels, nwItemLayout, nwItemClass, nwItemType
logger = logging.getLogger(__name__)
+1 -1
View File
@@ -25,7 +25,7 @@ from PyQt5.QtWidgets import (
QTreeWidgetItem, QCheckBox
)
from nw.enum import nwAlert
from nw.constants import nwAlert
logger = logging.getLogger(__name__)
+1 -2
View File
@@ -24,9 +24,8 @@ from PyQt5.QtWidgets import (
QCheckBox
)
from nw.constants import nwConst, nwFiles
from nw.constants import nwConst, nwFiles, nwAlert
from nw.tools import OptLastState
from nw.enum import nwAlert
logger = logging.getLogger(__name__)
+1 -2
View File
@@ -23,9 +23,8 @@ from PyQt5.QtWidgets import (
QGroupBox, QCheckBox
)
from nw.constants import nwFiles
from nw.constants import nwFiles, nwItemClass
from nw.tools import OptLastState
from nw.enum import nwItemClass
logger = logging.getLogger(__name__)
+7 -7
View File
@@ -9,11 +9,11 @@ from nw.gui.elements.searchbar import GuiSearchBar
from nw.gui.elements.viewdetails import GuiDocViewDetails
__all__ = [
GuiDocDetails,
GuiDocEditor,
GuiDocTree,
GuiDocViewer,
GuiNoticeBar,
GuiSearchBar,
GuiDocViewDetails,
"GuiDocDetails",
"GuiDocEditor",
"GuiDocTree",
"GuiDocViewer",
"GuiNoticeBar",
"GuiSearchBar",
"GuiDocViewDetails",
]
+1 -2
View File
@@ -27,8 +27,7 @@ from PyQt5.QtGui import (
from nw.project import NWDoc
from nw.gui.tools import GuiDocHighlighter, WordCounter
from nw.tools import NWSpellCheck
from nw.constants import nwFiles, nwUnicode
from nw.enum import nwDocAction, nwAlert
from nw.constants import nwFiles, nwUnicode, nwDocAction, nwAlert
logger = logging.getLogger(__name__)
+3 -2
View File
@@ -20,8 +20,9 @@ from PyQt5.QtWidgets import (
)
from nw.project import NWItem
from nw.constants import nwLabels
from nw.enum import nwItemType, nwItemClass, nwItemLayout, nwAlert
from nw.constants import (
nwLabels, nwItemType, nwItemClass, nwItemLayout, nwAlert
)
logger = logging.getLogger(__name__)
+1 -1
View File
@@ -18,7 +18,7 @@ from PyQt5.QtWidgets import QTextBrowser
from PyQt5.QtGui import QTextOption, QFont, QPalette, QColor
from nw.convert import Tokenizer, ToHtml
from nw.enum import nwAlert, nwItemType
from nw.constants import nwAlert, nwItemType
logger = logging.getLogger(__name__)
+1 -1
View File
@@ -19,7 +19,7 @@ from PyQt5.QtWidgets import (
QFrame, QGridLayout, QLabel, QLineEdit, QPushButton, QApplication
)
from nw.enum import nwDocAction
from nw.constants import nwDocAction
logger = logging.getLogger(__name__)
+1 -1
View File
@@ -17,7 +17,7 @@ from PyQt5.QtCore import QUrl
from PyQt5.QtGui import QIcon, QDesktopServices
from PyQt5.QtWidgets import QMenuBar, QAction, QMessageBox
from nw.enum import nwItemType, nwItemClass, nwDocAction
from nw.constants import nwItemType, nwItemClass, nwDocAction
logger = logging.getLogger(__name__)
+2 -2
View File
@@ -4,6 +4,6 @@ from nw.gui.tools.dochighlight import GuiDocHighlighter
from nw.gui.tools.wordcounter import WordCounter
__all__ = [
GuiDocHighlighter,
WordCounter,
"GuiDocHighlighter",
"WordCounter",
]
+1 -2
View File
@@ -29,11 +29,10 @@ from nw.gui import (
GuiConfigEditor, GuiProjectEditor, GuiExport, GuiItemEditor,
GuiTimeLineView, GuiSessionLogView
)
from nw.constants import nwFiles
from nw.project import NWProject, NWDoc, NWItem, NWIndex, NWBackup
from nw.tools import countWords
from nw.theme import Theme
from nw.enum import nwItemType, nwAlert
from nw.constants import nwFiles, nwItemType, nwAlert
logger = logging.getLogger(__name__)
+6 -6
View File
@@ -8,10 +8,10 @@ from nw.project.project import NWProject
from nw.project.status import NWStatus
__all__ = [
NWBackup,
NWDoc,
NWIndex,
NWItem,
NWProject,
NWStatus,
"NWBackup",
"NWDoc",
"NWIndex",
"NWItem",
"NWProject",
"NWStatus",
]
+1 -1
View File
@@ -17,7 +17,7 @@ from os import path, mkdir, listdir
from shutil import make_archive
from datetime import datetime
from nw.enum import nwAlert
from nw.constants import nwAlert
logger = logging.getLogger(__name__)
+1 -1
View File
@@ -15,7 +15,7 @@ import nw
from os import path, mkdir, rename, unlink
from nw.enum import nwAlert
from nw.constants import nwAlert
logger = logging.getLogger(__name__)
+3 -2
View File
@@ -17,8 +17,9 @@ import nw
from os import path
from nw.project.document import NWDoc
from nw.constants import nwFiles, nwKeyWords
from nw.enum import nwItemType, nwItemClass, nwItemLayout, nwAlert
from nw.constants import (
nwFiles, nwKeyWords, nwItemType, nwItemClass, nwItemLayout, nwAlert
)
logger = logging.getLogger(__name__)
+1 -1
View File
@@ -18,7 +18,7 @@ from lxml import etree
from datetime import datetime
from nw.common import checkInt
from nw.enum import nwItemType, nwItemClass, nwItemLayout
from nw.constants import nwItemType, nwItemClass, nwItemLayout
logger = logging.getLogger(__name__)
+3 -2
View File
@@ -22,9 +22,10 @@ from time import time
from nw.project.status import NWStatus
from nw.project.item import NWItem
from nw.constants import nwFiles, nwConst
from nw.common import checkString, checkBool, checkInt
from nw.enum import nwItemType, nwItemClass, nwItemLayout, nwAlert
from nw.constants import (
nwFiles, nwConst, nwItemType, nwItemClass, nwItemLayout, nwAlert
)
logger = logging.getLogger(__name__)
+1 -1
View File
@@ -16,7 +16,7 @@ import nw
from lxml import etree
from nw.common import checkInt
from nw.enum import nwItemClass
from nw.constants import nwItemClass
logger = logging.getLogger(__name__)
+1 -1
View File
@@ -19,7 +19,7 @@ from os import path, listdir
from PyQt5.QtWidgets import qApp
from PyQt5.QtGui import QPalette, QColor, QIcon
from nw.enum import nwAlert
from nw.constants import nwAlert
logger = logging.getLogger(__name__)
+6 -6
View File
@@ -8,10 +8,10 @@ from nw.tools.translate import numberToWord
from nw.tools.wordcount import countWords
__all__ = [
TextAnalysis,
OptLastState,
NWSpellCheck,
NWSpellEnchant,
numberToWord,
countWords,
"TextAnalysis",
"OptLastState",
"NWSpellCheck",
"NWSpellEnchant",
"numberToWord",
"countWords",
]
+10 -18
View File
@@ -14,13 +14,8 @@ import logging
import enchant
import nw
try:
import pycountry
hasPyCountry = True
except:
hasPyCountry = False
from nw.tools.spellcheck import NWSpellCheck
from nw.constants import isoLanguage
logger = logging.getLogger(__name__)
@@ -61,19 +56,16 @@ class NWSpellEnchant(NWSpellCheck):
def listDictionaries(self):
retList = []
for spTag, spProvider in enchant.list_dicts():
if hasPyCountry:
spList = []
try:
langObj = pycountry.languages.get(alpha_2 = spTag[:2])
spList.append(langObj.name)
except:
spList.append(spTag[:2])
if len(spTag) > 3:
spList.append("(%s)" % spTag[3:])
spList.append("[%s]" % spProvider.name)
spName = " ".join(spList)
spList = []
if spTag[:2] in isoLanguage.ISO_639_1:
langName = isoLanguage.ISO_639_1[spTag[:2]]
else:
spName = "%s [%s]" % (spTag, spProvider.name)
langName = spTag[:2]
spList.append(langName)
if len(spTag) > 3:
spList.append("(%s)" % spTag[3:])
spList.append("[%s]" % spProvider.name)
spName = " ".join(spList)
retList.append((spTag, spName))
return retList
-1
View File
@@ -2,6 +2,5 @@ pyqt5
appdirs
lxml
pyenchant
pycountry
latexcodec
pypandoc
-1
View File
@@ -41,7 +41,6 @@ setuptools.setup(
"appdirs",
"lxml",
"pyenchant",
"pycountry",
"latexcodec",
"pypandoc",
],
+1 -1
View File
@@ -2,7 +2,7 @@
"""novelWriter Test Dummy GUI Classes
"""
from nw.enum import nwAlert
from nw.constants import nwAlert
class DummyMain():
+1 -1
View File
@@ -12,7 +12,7 @@ from nw.gui.dialogs.projecteditor import GuiProjectEditor
from nw.gui.dialogs.timelineview import GuiTimeLineView
from nw.gui.dialogs.itemeditor import GuiItemEditor
from nw.enum import *
from nw.constants import *
keyDelay = 10
stepDelay = 50
+1 -1
View File
@@ -12,7 +12,7 @@ from nw.config import Config
from nw.project.project import NWProject
from nw.project.item import NWItem
from nw.project.index import NWIndex
from nw.enum import nwItemClass
from nw.constants import nwItemClass
theConf = Config()
theMain = DummyMain()