pycrossword  0.3
Pure-Python implementation of a crossword puzzle generator and editor
Functions | Variables
pycross.utils.globalvars Namespace Reference

Functions

def make_abspath (filename, root='')
 
def readSettings (settings_file=None, write_defaults_on_error=True)
 
def switch_lang (lang='')
 

Variables

bool DEBUGGING = False
 toggle debug messages More...
 
string APP_VERSION = '0.3'
 current app version More...
 
string APP_NAME = 'pycrossword'
 app name More...
 
string GIT_REPO = 'https://github.com/S0mbre/crossword.git'
 
string APP_AUTHOR = 'Iskander Shafikov (S0mbre)'
 
string APP_EMAIL = 's00mbre@gmail.com'
 
string ENCODING = 'utf-8'
 
def SETTINGS_FILE = make_abspath('settings.pxjson')
 
def DEFAULT_SETTINGS_FILE = make_abspath('defsettings.pxjson')
 
def UPDATE_FILE = make_abspath('update.json')
 
def SAVEDCW_FILE = make_abspath('autosaved.xpf')
 
def DICFOLDER = make_abspath('assets/dic')
 
def ICONFOLDER = make_abspath('assets/icons')
 
def PLUGINS_FOLDER = make_abspath('plugins')
 
dictionary LANG = {'en': 'English', 'ru': 'Russian', 'fr': 'French', 'es': 'Spanish', 'de': 'German', 'it': 'Italian'}
 
list POS
 
string BRACES = "{}"
 
dictionary SQL_TABLES
 
 HTTP_PROXIES = None
 
int HTTP_TIMEOUT = 5
 
int MAX_RESULTS = 500
 
string PLUGIN_EXTENSION = 'pxplugin'
 
string PLUGIN_TEMPLATE_GENERAL
 
list APP_LANGUAGES
 
string NEWLINE = '\n'
 
 ENCODINGS = \
 
dictionary FONT_WEIGHTS = {100: 0, 200: 12, 300: 25, 400: 50, 500: 57, 600: 63, 700: 75, 800: 81, 900: 87}
 
string LINUX_APP_PATH = '~/.local/share/applications/{}.desktop'.format(APP_NAME.lower())
 
 LINUX_MIME_APP = \
 
 LINUX_MIME_TYPES = \
 
string LINUX_MIME_XML = f'~/.local/share/applications/{APP_NAME.lower()}-{APP_NAME.lower()}.xml'
 
string MW_DIC_KEY = '71ae1f74-7edb-4683-be03-8e3d7348660d'
 
string MW_DIC_HTTP = 'https://www.dictionaryapi.com/api/v3/references/collegiate/json/{}?key={}'
 
int MW_DAILY_REQ = 1000
 
string MW_WORD_URL = 'https://www.merriam-webster.com/dictionary/{}'
 
string YAN_DICT_KEY = 'dict.1.1.20191120T032741Z.d541dffb1a55247b.b090f62ccd320c7e33f8d88eefde8c8e1ea0ba5b'
 
string YAN_DICT_HTTP = 'https://dictionary.yandex.net/api/v1/dicservice.json/lookup?key={}&text={}&lang={}&ui=en'
 
int YAN_DAILY_REQ = 10000
 
string GOOGLE_KEY = 'AIzaSyAcc_B34Mv7Z4UoVuAMYCEiA9n14_SuEjU'
 
string GOOGLE_CSE = '012413034625838642915:je3epsydo2r'
 
string GOOGLE_HTTP = 'https://www.googleapis.com/customsearch/v1?key={}&cx={}&prettyPrint=true&q={}'
 
int GOOGLE_DAILY_REQ = 100
 
dictionary GOOGLE_LANG_LR
 
dictionary GOOGLE_LANG_HL
 
dictionary GOOGLE_COUNTRIES_CR
 
dictionary GOOGLE_COUNTRIES_GL
 
bool LANGAPPLIED = False
 

Function Documentation

◆ make_abspath()

def pycross.utils.globalvars.make_abspath (   filename,
  root = '' 
)

◆ readSettings()

def pycross.utils.globalvars.readSettings (   settings_file = None,
  write_defaults_on_error = True 
)
Checks if 'settings.pxjson' exists in the main directory.
If not, creates it with the default settings; otherwise, 
reads 'settings.pxjson' to the global CWSettings.settings object.

◆ switch_lang()

def pycross.utils.globalvars.switch_lang (   lang = '')

Variable Documentation

◆ APP_AUTHOR

string pycross.utils.globalvars.APP_AUTHOR = 'Iskander Shafikov (S0mbre)'

◆ APP_EMAIL

string pycross.utils.globalvars.APP_EMAIL = 's00mbre@gmail.com'

◆ APP_LANGUAGES

list pycross.utils.globalvars.APP_LANGUAGES
Initial value:
1 = [('English (US)', '', '', 'united-states-of-america.png', "The application must be restarted to apply new language settings. Restart now?"),
2  ('Russian', 'ru', 'Русский', 'russia.png', "Приложение должно быть перезапущено для применения новых настроек языка. Перезапустить сейчас?"),
3  ('German', 'de', 'Deutsch', 'germany.png', "Die Anwendung muss neu gestartet werden, um neue Spracheinstellungen zu übernehmen. Jetzt neu starten?"),
4  ('French', 'fr', 'Français', 'france.png', "L'application doit être redémarrée pour appliquer de nouveaux paramètres de langue. Redémarrer maintenant?"),
5  ('Italian', 'it', 'Italiano', 'italy.png', "È necessario riavviare l'applicazione per applicare le nuove impostazioni della lingua. Riavvia ora?"),
6  ('Spanish', 'es', 'Español', 'spain.png', "La aplicación debe reiniciarse para aplicar la nueva configuración de idioma. ¿Reiniciar ahora?")]

◆ APP_NAME

string pycross.utils.globalvars.APP_NAME = 'pycrossword'

app name

◆ APP_VERSION

string pycross.utils.globalvars.APP_VERSION = '0.3'

current app version

◆ BRACES

string pycross.utils.globalvars.BRACES = "{}"

◆ DEBUGGING

bool pycross.utils.globalvars.DEBUGGING = False

toggle debug messages

◆ DEFAULT_SETTINGS_FILE

def pycross.utils.globalvars.DEFAULT_SETTINGS_FILE = make_abspath('defsettings.pxjson')

◆ DICFOLDER

def pycross.utils.globalvars.DICFOLDER = make_abspath('assets/dic')

◆ ENCODING

string pycross.utils.globalvars.ENCODING = 'utf-8'

◆ ENCODINGS

pycross.utils.globalvars.ENCODINGS = \

◆ FONT_WEIGHTS

dictionary pycross.utils.globalvars.FONT_WEIGHTS = {100: 0, 200: 12, 300: 25, 400: 50, 500: 57, 600: 63, 700: 75, 800: 81, 900: 87}

◆ GIT_REPO

string pycross.utils.globalvars.GIT_REPO = 'https://github.com/S0mbre/crossword.git'

◆ GOOGLE_COUNTRIES_CR

dictionary pycross.utils.globalvars.GOOGLE_COUNTRIES_CR

◆ GOOGLE_COUNTRIES_GL

dictionary pycross.utils.globalvars.GOOGLE_COUNTRIES_GL

◆ GOOGLE_CSE

string pycross.utils.globalvars.GOOGLE_CSE = '012413034625838642915:je3epsydo2r'

◆ GOOGLE_DAILY_REQ

int pycross.utils.globalvars.GOOGLE_DAILY_REQ = 100

◆ GOOGLE_HTTP

string pycross.utils.globalvars.GOOGLE_HTTP = 'https://www.googleapis.com/customsearch/v1?key={}&cx={}&prettyPrint=true&q={}'

◆ GOOGLE_KEY

string pycross.utils.globalvars.GOOGLE_KEY = 'AIzaSyAcc_B34Mv7Z4UoVuAMYCEiA9n14_SuEjU'

◆ GOOGLE_LANG_HL

dictionary pycross.utils.globalvars.GOOGLE_LANG_HL
Initial value:
1 = {'af': 'Afrikaans', 'sq': 'Albanian', 'sm': 'Amharic', 'ar': 'Arabic', 'az': 'Azerbaijani', 'eu': 'Basque',
2  'be': 'Belarusian', 'bn': 'Bengali', 'bh': 'Bihari', 'bs': 'Bosnian', 'bg': 'Bulgarian',
3  'ca': 'Catalan', 'zh-CN': 'Chinese (Simplified)', 'zh-TW': 'Chinese (Traditional)',
4  'hr': 'Croatian', 'cs': 'Czech', 'da': 'Danish', 'nl': 'Dutch', 'en': 'English', 'eo': 'Esperanto',
5  'et': 'Estonian', 'fo': 'Faroese', 'fi': 'Finnish', 'fr': 'French', 'fy': 'Frisian', 'gl': 'Galician',
6  'ka': 'Georgian', 'de': 'German', 'el': 'Greek', 'gu': 'Gujarati', 'iw': 'Hebrew', 'hi': 'Hindi',
7  'hu': 'Hungarian', 'is': 'Icelandic', 'id': 'Indonesian', 'ia': 'Interlingua', 'ga': 'Irish', 'it': 'Italian',
8  'ja': 'Japanese', 'jw': 'Javanese', 'kn': 'Kannada', 'ko': 'Korean', 'la': 'Latin', 'lv': 'Latvian',
9  'lt': 'Lithuanian', 'mk': 'Macedonian', 'ms': 'Malay', 'ml': 'Malayam', 'mt': 'Maltese', 'mr': 'Marathi',
10  'ne': 'Nepali', 'no': 'Norwegian', 'nn': 'Norwegian (Nynorsk)', 'oc': 'Occitan', 'fa': 'Persian',
11  'pl': 'Polish', 'pt-BR': 'Portuguese (Brazil)', 'pt-PT': 'Portuguese (Portugal)', 'pa': 'Punjabi',
12  'ro': 'Romanian', 'ru': 'Russian', 'gd': 'Scots Gaelic', 'sr': 'Serbian', 'si': 'Sinhalese',
13  'sk': 'Slovak', 'sl': 'Slovenian', 'es': 'Spanish', 'su': 'Sudanese', 'sw': 'Swahili', 'sv': 'Swedish',
14  'tl': 'Tagalog', 'ta': 'Tamil', 'te': 'Telugu', 'th': 'Thai', 'ti': 'Tigrinya', 'tr': 'Turkish',
15  'uk': 'Ukrainian', 'ur': 'Urdu', 'uz': 'Uzbek', 'vi': 'Vietnamese', 'cy': 'Welsh', 'xh': 'Xhosa', 'zu': 'Zulu'}

◆ GOOGLE_LANG_LR

dictionary pycross.utils.globalvars.GOOGLE_LANG_LR
Initial value:
1 = {'lang_ar': 'Arabic', 'lang_bg': 'Bulgarian', 'lang_ca': 'Catalan', 'lang_cs': 'Czech',
2  'lang_da': 'Danish', 'lang_de': 'German', 'lang_el': 'Greek', 'lang_en': 'English',
3  'lang_es': 'Spanish', 'lang_et': 'Estonian', 'lang_fi': 'Finnish', 'lang_fr': 'French',
4  'lang_hr': 'Croatian', 'lang_hu': 'Hungarian', 'lang_id': 'Indonesian', 'lang_is': 'Icelandic',
5  'lang_it': 'Italian', 'lang_iw': 'Hebrew', 'lang_ja': 'Japanese', 'lang_ko': 'Korean',
6  'lang_lt': 'Lithuanian', 'lang_lv': 'Latvian', 'lang_nl': 'Dutch', 'lang_no': 'Norwegian',
7  'lang_pl': 'Polish', 'lang_pt': 'Portuguese', 'lang_ro': 'Romanian', 'lang_ru': 'Russian',
8  'lang_sk': 'Slovak', 'lang_sl': 'Slovenian', 'lang_sr': 'Serbian', 'lang_sv': 'Swedish',
9  'lang_tr': 'Turkish', 'lang_zh-CN': 'Chinese (Simplified)', 'lang_zh-TW': 'Chinese (Traditional)'}

◆ HTTP_PROXIES

pycross.utils.globalvars.HTTP_PROXIES = None

◆ HTTP_TIMEOUT

int pycross.utils.globalvars.HTTP_TIMEOUT = 5

◆ ICONFOLDER

def pycross.utils.globalvars.ICONFOLDER = make_abspath('assets/icons')

◆ LANG

dictionary pycross.utils.globalvars.LANG = {'en': 'English', 'ru': 'Russian', 'fr': 'French', 'es': 'Spanish', 'de': 'German', 'it': 'Italian'}

◆ LANGAPPLIED

bool pycross.utils.globalvars.LANGAPPLIED = False

◆ LINUX_APP_PATH

string pycross.utils.globalvars.LINUX_APP_PATH = '~/.local/share/applications/{}.desktop'.format(APP_NAME.lower())

◆ LINUX_MIME_APP

pycross.utils.globalvars.LINUX_MIME_APP = \

◆ LINUX_MIME_TYPES

pycross.utils.globalvars.LINUX_MIME_TYPES = \

◆ LINUX_MIME_XML

string pycross.utils.globalvars.LINUX_MIME_XML = f'~/.local/share/applications/{APP_NAME.lower()}-{APP_NAME.lower()}.xml'

◆ MAX_RESULTS

int pycross.utils.globalvars.MAX_RESULTS = 500

◆ MW_DAILY_REQ

int pycross.utils.globalvars.MW_DAILY_REQ = 1000

◆ MW_DIC_HTTP

string pycross.utils.globalvars.MW_DIC_HTTP = 'https://www.dictionaryapi.com/api/v3/references/collegiate/json/{}?key={}'

◆ MW_DIC_KEY

string pycross.utils.globalvars.MW_DIC_KEY = '71ae1f74-7edb-4683-be03-8e3d7348660d'

◆ MW_WORD_URL

string pycross.utils.globalvars.MW_WORD_URL = 'https://www.merriam-webster.com/dictionary/{}'

◆ NEWLINE

string pycross.utils.globalvars.NEWLINE = '\n'

◆ PLUGIN_EXTENSION

string pycross.utils.globalvars.PLUGIN_EXTENSION = 'pxplugin'

◆ PLUGIN_TEMPLATE_GENERAL

string pycross.utils.globalvars.PLUGIN_TEMPLATE_GENERAL
Initial value:
1 = """\
2 from utils.pluginbase import *
3 
4 class PxPlugin000(PxPluginGeneral):
5 
6  # >>> add code here <<<
7  pass
8 """

◆ PLUGINS_FOLDER

def pycross.utils.globalvars.PLUGINS_FOLDER = make_abspath('plugins')

◆ POS

list pycross.utils.globalvars.POS
Initial value:
1 = [('N', 'noun'), ('V', 'verb'), ('ADV', 'adverb'), ('ADJ', 'adjective'), ('P', 'participle'),
2  ('PRON', 'pronoun'), ('I', 'interjection'), ('C', 'conjuction'), ('PREP', 'preposition'),
3  ('PROP', 'proposition'), ('MISC', 'miscellaneous / other'), ('NONE', 'no POS')]

◆ SAVEDCW_FILE

def pycross.utils.globalvars.SAVEDCW_FILE = make_abspath('autosaved.xpf')

◆ SETTINGS_FILE

def pycross.utils.globalvars.SETTINGS_FILE = make_abspath('settings.pxjson')

◆ SQL_TABLES

dictionary pycross.utils.globalvars.SQL_TABLES
Initial value:
1 = {'words': {'table': 'twords', 'fwords': 'word', 'fpos': 'idpos'},
2  'pos': {'table': 'tpos', 'fid': 'id', 'fpos': 'pos'} }

◆ UPDATE_FILE

def pycross.utils.globalvars.UPDATE_FILE = make_abspath('update.json')

◆ YAN_DAILY_REQ

int pycross.utils.globalvars.YAN_DAILY_REQ = 10000

◆ YAN_DICT_HTTP

string pycross.utils.globalvars.YAN_DICT_HTTP = 'https://dictionary.yandex.net/api/v1/dicservice.json/lookup?key={}&text={}&lang={}&ui=en'

◆ YAN_DICT_KEY

string pycross.utils.globalvars.YAN_DICT_KEY = 'dict.1.1.20191120T032741Z.d541dffb1a55247b.b090f62ccd320c7e33f8d88eefde8c8e1ea0ba5b'