pycrossword
0.4
Pure-Python implementation of a crossword puzzle generator and editor
|
A single download task to download one Hunspell dictionary from the remote repo and store it as a DIC file. More...
Public Member Functions | |
def | __init__ (self, settings, dicfolder, url, lang, overwrite=True, on_stopcheck=None, id=0) |
def | get_filesize_url (self, url) |
Gets the file size (in bytes) of a given web resource by URL. More... | |
def | run (self) |
Overridden worker method called when the task is started: does the download job. More... | |
Public Attributes | |
signals | |
HunspellDownloadSignals signals emitted by the download task More... | |
dicfolder | |
str path to the target folder where to store the downloaded DIC file More... | |
url | |
str URL of the DIC file to download (generally, https://raw.githubusercontent.com/wooorm/dictionaries/main/dictionaries/<LANG>/index.dic) More... | |
lang | |
str short name of the language, e.g. More... | |
overwrite | |
bool whether to overwrite the existing file (if any) More... | |
id | |
int unique ID of this task (in the thread pool) More... | |
on_stopcheck | |
callback callback function called periodically to check for interrupt condition More... | |
timeout_ | |
int timeout for HTTP(S) requests (in milliseconds) More... | |
proxies_ | |
dict HTTP(S) proxy server settings More... | |
Private Member Functions | |
def | _delete_file (self, filepath) |
Deletes a locally stored file (without raising errors on failure). More... | |
A single download task to download one Hunspell dictionary from the remote repo and store it as a DIC file.
Derived from QtCore.QRunnable so the task can be run in a thread pool concurrently with other downloads.
def pycross.dbapi.HunspellDownloadTask.__init__ | ( | self, | |
settings, | |||
dicfolder, | |||
url, | |||
lang, | |||
overwrite = True , |
|||
on_stopcheck = None , |
|||
id = 0 |
|||
) |
settings | dict pointer to the app global settings (utils::guisettings::CWSettings::settings ) |
dicfolder | str path to the target folder where to store the downloaded DIC file |
url | str URL of the DIC file to download (generally, https://raw.githubusercontent.com/wooorm/dictionaries/main/dictionaries/<LANG>/index.dic) |
lang | str short name of the language, e.g. 'en' |
overwrite | bool whether to overwrite the existing file (if any) |
on_stopcheck | callback callback function called periodically to check for interrupt condition; takes 4 parameters:
|
id | int unique ID of this task (in the thread pool) |
|
private |
Deletes a locally stored file (without raising errors on failure).
filepath | str full path of the file to delete |
def pycross.dbapi.HunspellDownloadTask.get_filesize_url | ( | self, | |
url | |||
) |
Gets the file size (in bytes) of a given web resource by URL.
url | str URL of the web resource (file) |
int
file size in bytes (-1 on error) def pycross.dbapi.HunspellDownloadTask.run | ( | self | ) |
Overridden worker method called when the task is started: does the download job.
pycross.dbapi.HunspellDownloadTask.dicfolder |
str
path to the target folder where to store the downloaded DIC file
pycross.dbapi.HunspellDownloadTask.id |
int
unique ID of this task (in the thread pool)
pycross.dbapi.HunspellDownloadTask.lang |
str
short name of the language, e.g.
'en'
pycross.dbapi.HunspellDownloadTask.on_stopcheck |
callback
callback function called periodically to check for interrupt condition
pycross.dbapi.HunspellDownloadTask.overwrite |
bool
whether to overwrite the existing file (if any)
pycross.dbapi.HunspellDownloadTask.proxies_ |
dict
HTTP(S) proxy server settings
pycross.dbapi.HunspellDownloadTask.signals |
HunspellDownloadSignals
signals emitted by the download task
pycross.dbapi.HunspellDownloadTask.timeout_ |
int
timeout for HTTP(S) requests (in milliseconds)
pycross.dbapi.HunspellDownloadTask.url |
str
URL of the DIC file to download (generally, https://raw.githubusercontent.com/wooorm/dictionaries/main/dictionaries/<LANG>/index.dic)