|
pycrossword
0.4
Pure-Python implementation of a crossword puzzle generator and editor
|
Functions | |
| def | make_abspath (filename, root='') |
| Returns the absolute path for a relative one, for a given root directory. More... | |
| def | readSettings (settings_file=None, write_defaults_on_error=True) |
| Loads the app settings from a settings file. More... | |
| def | switch_lang (lang='') |
| Changes the app interface language by installing the specified translation. More... | |
Variables | |
| bool | DEBUGGING = False |
| toggle debug message printing More... | |
| string | APP_VERSION = '0.4.1' |
| current app version More... | |
| string | APP_NAME = 'pycrossword' |
| app name More... | |
| string | GIT_REPO = 'https://github.com/S0mbre/crossword.git' |
| git repo hosting this app More... | |
| string | APP_AUTHOR = 'Iskander Shafikov (S0mbre)' |
| app author More... | |
| string | APP_EMAIL = 's00mbre@gmail.com' |
| author's email More... | |
| string | ENCODING = 'utf-8' |
| default encoding (for file I/O mostly) More... | |
| def | SETTINGS_FILE = make_abspath('settings.pxjson') |
| path to the current app settings More... | |
| def | DEFAULT_SETTINGS_FILE = make_abspath('defsettings.pxjson') |
| path to the default app settings More... | |
| def | UPDATE_FILE = make_abspath('update.json') |
| path to the Update file that stores info on the available update and last update date More... | |
| def | SAVEDCW_FILE = make_abspath('autosaved.xpf') |
| path to the auto-saved crossword file (in XPF format) More... | |
| def | DICFOLDER = make_abspath('assets/dic') |
| path to the 'dic' folder containing word sources More... | |
| def | ICONFOLDER = make_abspath('assets/icons') |
| path to the icons folder containing GUI icon resources More... | |
| def | PLUGINS_FOLDER = make_abspath('plugins') |
| path to the plugins folder containing user plugins More... | |
| dictionary | LANG = {'en': 'English', 'ru': 'Russian', 'fr': 'French', 'es': 'Spanish', 'de': 'German', 'it': 'Italian'} |
| app interface languages in brief and full notation More... | |
| list | POS |
| parts of speech in brief and full notation More... | |
| string | BRACES = "{}" |
| braces More... | |
| dictionary | SQL_TABLES |
| default SQLite DB table names for word sources More... | |
| int | MAX_RESULTS = 500 |
| default max results for word source searches More... | |
| string | PLUGIN_EXTENSION = 'pxplugin' |
| user plugin file extension More... | |
| string | PLUGIN_TEMPLATE_GENERAL |
| user plugin template (for the 'general' category) More... | |
| list | APP_LANGUAGES |
| app interface languages More... | |
| string | NEWLINE = '\n' |
| newline character More... | |
| ENCODINGS = \ | |
| string encodings More... | |
| dictionary | FONT_WEIGHTS = {100: 0, 200: 12, 300: 25, 400: 50, 500: 57, 600: 63, 700: 75, 800: 81, 900: 87} |
| CSS-to-Qt font weight conversion table. More... | |
| string | LINUX_APP_PATH = '~/.local/share/applications/{}.desktop'.format(APP_NAME.lower()) |
| app path in Linux OS More... | |
| LINUX_MIME_APP = \ | |
| Linux MIME info for app (used for file associations) More... | |
| LINUX_MIME_TYPES = \ | |
| Linux MIME type description (used for file associations) More... | |
| string | LINUX_MIME_XML = f'~/.local/share/applications/{APP_NAME.lower()}-{APP_NAME.lower()}.xml' |
| Linux MIME XML file path (used for file associations) More... | |
| string | MW_DIC_KEY = '71ae1f74-7edb-4683-be03-8e3d7348660d' |
| MW Collegiate Dictionary & Audio API key. More... | |
| string | MW_DIC_HTTP = 'https://www.dictionaryapi.com/api/v3/references/collegiate/json/{}?key={}' |
| MW Collegiate Dictionary API URL. More... | |
| int | MW_DAILY_REQ = 1000 |
| MW Collegiate Dictionary daily request limit, see https://www.dictionaryapi.com/. More... | |
| string | MW_WORD_URL = 'https://www.merriam-webster.com/dictionary/{}' |
| MW Collegiate Dictionary URL. More... | |
| string | YAN_DICT_KEY = 'dict.1.1.20191120T032741Z.d541dffb1a55247b.b090f62ccd320c7e33f8d88eefde8c8e1ea0ba5b' |
| Yandex dictionary API key. More... | |
| string | YAN_DICT_HTTP = 'https://dictionary.yandex.net/api/v1/dicservice.json/lookup?key={}&text={}&lang={}&ui=en' |
| Yandex dictionary API URL. More... | |
| int | YAN_DAILY_REQ = 10000 |
| Yandex dictionary daily request limit. More... | |
| string | GOOGLE_KEY = 'AIzaSyAcc_B34Mv7Z4UoVuAMYCEiA9n14_SuEjU' |
| Google Search JSON API key. More... | |
| string | GOOGLE_CSE = '012413034625838642915:je3epsydo2r' |
| Google CSE identifier. More... | |
| string | GOOGLE_HTTP = 'https://www.googleapis.com/customsearch/v1?key={}&cx={}&prettyPrint=true&q={}' |
| Google API URL. More... | |
| int | GOOGLE_DAILY_REQ = 100 |
| Google daily limit, see https://developers.google.com/custom-search/v1/overview. More... | |
| dictionary | GOOGLE_LANG_LR |
| Google document languages. More... | |
| dictionary | GOOGLE_LANG_HL |
| Google interface languages. More... | |
| dictionary | GOOGLE_COUNTRIES_CR |
| Google document countries. More... | |
| dictionary | GOOGLE_COUNTRIES_GL |
| Google user search countries. More... | |
| bool | LANGAPPLIED = False |
flag that is set to True when the inerface language has been applied More... | |
| def pycross.utils.globalvars.make_abspath | ( | filename, | |
root = '' |
|||
| ) |
Returns the absolute path for a relative one, for a given root directory.
| filename | str relative path, e.g. '../setup.py' |
| root | str root directory full path to calculate the abs path; if empty (default), the 'pycross' directory in the installation dir will be used. |
str absolute path for filename | def pycross.utils.globalvars.readSettings | ( | settings_file = None, |
|
write_defaults_on_error = True |
|||
| ) |
Loads the app settings from a settings file.
Checks if 'settings.pxjson' exists in the root directory. If not, creates it with the default settings; otherwise, reads 'settings.pxjson' to the global pycross::guisettings::CWSettings::settings object.
| settings_file | str path to the settings file ('*.pxjson'). If left None, SETTINGS_FILE is used. |
| write_defaults_on_error | bool whether to save the default settings into the settings file on load error (default = True) |
dict pointer to global app settings pycross::guisettings::CWSettings::settings | def pycross.utils.globalvars.switch_lang | ( | lang = '' | ) |
Changes the app interface language by installing the specified translation.
It installs the global _() function used by gettext to get localized strings.
| lang | str short language name – see APP_LANGUAGES |
| string pycross.utils.globalvars.APP_AUTHOR = 'Iskander Shafikov (S0mbre)' |
app author
| string pycross.utils.globalvars.APP_EMAIL = 's00mbre@gmail.com' |
author's email
| list pycross.utils.globalvars.APP_LANGUAGES |
app interface languages
| string pycross.utils.globalvars.APP_NAME = 'pycrossword' |
app name
| string pycross.utils.globalvars.APP_VERSION = '0.4.1' |
current app version
| string pycross.utils.globalvars.BRACES = "{}" |
braces
| bool pycross.utils.globalvars.DEBUGGING = False |
toggle debug message printing
| def pycross.utils.globalvars.DEFAULT_SETTINGS_FILE = make_abspath('defsettings.pxjson') |
path to the default app settings
| def pycross.utils.globalvars.DICFOLDER = make_abspath('assets/dic') |
path to the 'dic' folder containing word sources
| string pycross.utils.globalvars.ENCODING = 'utf-8' |
default encoding (for file I/O mostly)
| pycross.utils.globalvars.ENCODINGS = \ |
string encodings
| dictionary pycross.utils.globalvars.FONT_WEIGHTS = {100: 0, 200: 12, 300: 25, 400: 50, 500: 57, 600: 63, 700: 75, 800: 81, 900: 87} |
CSS-to-Qt font weight conversion table.
| string pycross.utils.globalvars.GIT_REPO = 'https://github.com/S0mbre/crossword.git' |
git repo hosting this app
| dictionary pycross.utils.globalvars.GOOGLE_COUNTRIES_CR |
Google document countries.
| dictionary pycross.utils.globalvars.GOOGLE_COUNTRIES_GL |
Google user search countries.
| string pycross.utils.globalvars.GOOGLE_CSE = '012413034625838642915:je3epsydo2r' |
Google CSE identifier.
| int pycross.utils.globalvars.GOOGLE_DAILY_REQ = 100 |
Google daily limit, see https://developers.google.com/custom-search/v1/overview.
| string pycross.utils.globalvars.GOOGLE_HTTP = 'https://www.googleapis.com/customsearch/v1?key={}&cx={}&prettyPrint=true&q={}' |
Google API URL.
| string pycross.utils.globalvars.GOOGLE_KEY = 'AIzaSyAcc_B34Mv7Z4UoVuAMYCEiA9n14_SuEjU' |
Google Search JSON API key.
| dictionary pycross.utils.globalvars.GOOGLE_LANG_HL |
Google interface languages.
| dictionary pycross.utils.globalvars.GOOGLE_LANG_LR |
Google document languages.
| def pycross.utils.globalvars.ICONFOLDER = make_abspath('assets/icons') |
path to the icons folder containing GUI icon resources
| dictionary pycross.utils.globalvars.LANG = {'en': 'English', 'ru': 'Russian', 'fr': 'French', 'es': 'Spanish', 'de': 'German', 'it': 'Italian'} |
app interface languages in brief and full notation
| bool pycross.utils.globalvars.LANGAPPLIED = False |
flag that is set to True when the inerface language has been applied
| string pycross.utils.globalvars.LINUX_APP_PATH = '~/.local/share/applications/{}.desktop'.format(APP_NAME.lower()) |
app path in Linux OS
| pycross.utils.globalvars.LINUX_MIME_APP = \ |
Linux MIME info for app (used for file associations)
| pycross.utils.globalvars.LINUX_MIME_TYPES = \ |
Linux MIME type description (used for file associations)
| string pycross.utils.globalvars.LINUX_MIME_XML = f'~/.local/share/applications/{APP_NAME.lower()}-{APP_NAME.lower()}.xml' |
Linux MIME XML file path (used for file associations)
| int pycross.utils.globalvars.MAX_RESULTS = 500 |
default max results for word source searches
| int pycross.utils.globalvars.MW_DAILY_REQ = 1000 |
MW Collegiate Dictionary daily request limit, see https://www.dictionaryapi.com/.
| string pycross.utils.globalvars.MW_DIC_HTTP = 'https://www.dictionaryapi.com/api/v3/references/collegiate/json/{}?key={}' |
MW Collegiate Dictionary API URL.
| string pycross.utils.globalvars.MW_DIC_KEY = '71ae1f74-7edb-4683-be03-8e3d7348660d' |
MW Collegiate Dictionary & Audio API key.
| string pycross.utils.globalvars.MW_WORD_URL = 'https://www.merriam-webster.com/dictionary/{}' |
MW Collegiate Dictionary URL.
| string pycross.utils.globalvars.NEWLINE = '\n' |
newline character
| string pycross.utils.globalvars.PLUGIN_EXTENSION = 'pxplugin' |
user plugin file extension
| string pycross.utils.globalvars.PLUGIN_TEMPLATE_GENERAL |
| def pycross.utils.globalvars.PLUGINS_FOLDER = make_abspath('plugins') |
path to the plugins folder containing user plugins
| list pycross.utils.globalvars.POS |
parts of speech in brief and full notation
| def pycross.utils.globalvars.SAVEDCW_FILE = make_abspath('autosaved.xpf') |
path to the auto-saved crossword file (in XPF format)
| def pycross.utils.globalvars.SETTINGS_FILE = make_abspath('settings.pxjson') |
path to the current app settings
| dictionary pycross.utils.globalvars.SQL_TABLES |
| def pycross.utils.globalvars.UPDATE_FILE = make_abspath('update.json') |
path to the Update file that stores info on the available update and last update date
| int pycross.utils.globalvars.YAN_DAILY_REQ = 10000 |
Yandex dictionary daily request limit.
| string pycross.utils.globalvars.YAN_DICT_HTTP = 'https://dictionary.yandex.net/api/v1/dicservice.json/lookup?key={}&text={}&lang={}&ui=en' |
Yandex dictionary API URL.
| string pycross.utils.globalvars.YAN_DICT_KEY = 'dict.1.1.20191120T032741Z.d541dffb1a55247b.b090f62ccd320c7e33f8d88eefde8c8e1ea0ba5b' |
Yandex dictionary API key.
1.8.17