pycrossword
0.4
Pure-Python implementation of a crossword puzzle generator and editor
|
Manager for the inbuilt SQLite word source database. More...
Public Member Functions | |
def | __init__ (self, settings, parent=None, flags=QtCore.Qt.WindowFlags()) |
def | sizeHint (self) |
Overridden method to make the window half the screen size. More... | |
def | showEvent (self, event) |
OnShow event handler: populates the dictionaries when the window is displayed. More... | |
def | closeEvent (self, event) |
OnClose event handler: stops all running operations, writes changes to the DB. More... | |
def | resizeEvent (self, event) |
OnResize event handler: adjusts the Preview control size. More... | |
def | initUI (self) |
Creates and initializes the GUI. More... | |
def | createTabs (self) |
Creates the 2 tabs of the window. More... | |
def | create_tvDicPreview_menu (self) |
Creates the context menu for WordDBManager::tvDicPreview. More... | |
def | repopulate_dic_model (self, refresh_from_server=True, stopcheck=None) |
Repopulates the list of available dictionaries on Tab 1. More... | |
def | on_repopulate_dic_model_run_fromserver (self) |
OnRun callback for WordDBManager::dics_model_thread forcing update from server. More... | |
def | on_repopulate_dic_model_run_local (self) |
OnRun callback for WordDBManager::dics_model_thread forcing update from stored data. More... | |
def | on_repopulate_dic_model_start (self) |
OnStart callback for WordDBManager::dics_model_thread called when the thread starts. More... | |
def | on_repopulate_dic_model_finish (self) |
OnFinish callback for WordDBManager::dics_model_thread called when the thread completes. More... | |
def | on_act_refreshdics (self, checked) |
OnTriggered handler for WordDBManager::act_refreshdics: starts WordDBManager::dics_model_thread. More... | |
def | on_act_refreshdics_changed (self) |
OnChanged handler for WordDBManager::act_refreshdics: adjusts the Enabled property of some actions. More... | |
def | on_act_installdics (self, checked) |
OnTriggered handler for WordDBManager::act_installdics: installs / uninstalls checked / unchecked dictionaries. More... | |
def | on_act_stopdics (self, checked) |
OnTriggered handler for WordDBManager::act_stopdics: interrupts the current operations waiting on the spawned threads to terminate. More... | |
def | on_act_addwd (self, checked) |
OnTriggered handler for WordDBManager::act_addwd: adds a new word to the current DB. More... | |
def | on_act_delwd (self, checked) |
OnTriggered handler for WordDBManager::act_delwd: deletes the selected words from the current DB. More... | |
def | on_act_peekdic (self, checked) |
OnTriggered handler for WordDBManager::act_peekdic: shows or hides the dictionary preview table. More... | |
def | show_dic_content (self, filepath) |
Shows the raw content of the given dictionary the in the preview panel. More... | |
def | on_start_download_preview (self, id, url, lang, filepath) |
OnStart callback for dbapi::HunspellImport::download_hunspell() downloading dictionaries for preview. More... | |
def | stopcheck_download_preview (self, id, url, lang, filepath) |
OnStopCheck callback for dbapi::HunspellImport::download_hunspell() downloading dictionaries for preview. More... | |
def | on_getfilesize_download_preview (self, id, url, lang, filepath, total_bytes) |
OnGetFilesize callback for dbapi::HunspellImport::download_hunspell() downloading dictionaries for preview. More... | |
def | on_run_download_preview (self, id, url, lang, filepath, bytes_written, total_bytes) |
OnProgress callback for dbapi::HunspellImport::download_hunspell() downloading dictionaries for preview. More... | |
def | on_complete_download_preview (self, id, url, lang, filepath) |
OnComplete callback for dbapi::HunspellImport::download_hunspell() downloading dictionaries for preview. More... | |
def | on_error_download_preview (self, id, url, lang, filepath, message) |
OnError callback for dbapi::HunspellImport::download_hunspell() downloading dictionaries for preview. More... | |
def | download_dic (self, lang, overwrite=False) |
Downloads the dictionary for the given language from the Hunspell repo and stores it locally as pycross/assets/dic/<LANG>.dic. More... | |
def | show_db (self, dic_lang, stopcheck=None) |
Refreshes and shows the DB for a given dictionary in the DB view. More... | |
def | update_db_actions (self) |
Updates the Enabled property of the DB actions in the toolbar. More... | |
def | on_combo_selectdb (self, index) |
Fires when a DB is selected in WordDBManager::combo_selectdb. More... | |
def | on_act_refreshdb (self, checked) |
OnTriggered handler for WordDBManager::act_refreshdb: display / refresh the current database in the editor. More... | |
def | on_act_stopdb (self, checked) |
OnTriggered handler for WordDBManager::act_stopdb: stops the current operation (DB view refresh). More... | |
def | on_act_commit (self, checked) |
OnTriggered handler for WordDBManager::act_commit: writes the pending changes to the DB. More... | |
def | check_commit_db (self, refresh=True, ignore_errors=False) |
Displays a user confirmation dialog to write the pending changes to the current DB. More... | |
def | commit_db (self, refresh=True, ignore_errors=False) |
Commits (writes) the pending changes to the currently edited DB. More... | |
def | on_repopulate_db_model_start (self) |
OnStart callback for WordDBManager::db_model_thread called when the thread starts. More... | |
def | on_repopulate_db_model_run (self) |
OnRun callback for WordDBManager::db_model_thread: repopulates the DB model. More... | |
def | on_repopulate_db_model_finish (self) |
def | on_repopulate_db_model_error (self, thread, message) |
OnError callback for WordDBManager::db_model_thread: shows error and interrupts repopulation. More... | |
def | stop_operations (self) |
Stops all operations running in child threads. More... | |
def | reformat_dic_model_row (self, r) |
Formats the given row in the dictionaries view changing the background color according to the dictionary status. More... | |
def | locate_dic_item (self, lang) |
Returns the item in WordDBManager::dics_model corresponding to a given language. More... | |
def | on_download_dics_start (self, id, url, lang, filepath) |
OnStart callback for dbapi::HunspellImport::download_hunspell() downloading dictionaries for installation. More... | |
def | on_download_dics_getfilesize (self, id, url, lang, filepath, total_bytes) |
OnGetFilesize callback for dbapi::HunspellImport::download_hunspell() downloading dictionaries for installation. More... | |
def | on_download_dics_run (self, id, url, lang, filepath, bytes_written, total_bytes) |
OnProgress callback for dbapi::HunspellImport::download_hunspell() downloading dictionaries for installation. More... | |
def | on_download_dics_finish (self, id, url, lang, filepath) |
OnComplete callback for dbapi::HunspellImport::download_hunspell() downloading dictionaries for installation. More... | |
def | on_download_dics_error (self, id, url, lang, filepath, message) |
OnError callback for dbapi::HunspellImport::download_hunspell() downloading dictionaries for installation. More... | |
def | on_download_dics_stopcheck (self, id, url, lang, filepath) |
OnStopCheck callback for dbapi::HunspellImport::download_hunspell() downloading dictionaries for installation. More... | |
def | execute_pending_dics (self) |
Installs the checked and uninstalls the unchecked dictionaries. More... | |
def | on_install_dics_start (self, id, lang, filepath) |
OnStart callback for dbapi::HunspellImport::add_all_from_hunspell(). More... | |
def | on_install_dics_commit (self, id, lang, filepath, records) |
OnCommit callback for dbapi::HunspellImport::add_all_from_hunspell(). More... | |
def | on_install_dics_finish (self, id, lang, filepath, records) |
OnFinish callback for dbapi::HunspellImport::add_all_from_hunspell(). More... | |
def | on_install_dics_error (self, id, lang, filepath, message) |
OnError callback for dbapi::HunspellImport::add_all_from_hunspell(). More... | |
def | on_install_dics_stopcheck (self, id, lang, filepath) |
OnStopCheck callback for dbapi::HunspellImport::add_all_from_hunspell(). More... | |
def | do_install_dics (self) |
Installs the downloaded dictionaries marked for installation. More... | |
def | db_model_item_changed (self, item) |
OnItemChanged handler for WordDBManager::db_model: adds the changed item to WordDBManager::db_model_changed_indices. More... | |
def | db_model_reset (self) |
OnModelReset handler for WordDBManager::db_model: clears WordDBManager::db_model_changed_indices. More... | |
def | dics_model_item_changed (self, item) |
OnItemChanged handler for WordDBManager::dics_model: sets the item internal / displayed data according to the user changes. More... | |
def | on_tvDics_activated (self, index) |
OnItemActivated handler for WordDBManager::tvDics: brings up editor dialogs to edit specific values like Replacements or Excluded POS. More... | |
def | on_tvDics_selectionchanged (self, current, previous) |
OnSelectionChanged handler for WordDBManager::tvDics. More... | |
def | on_tvDb_selectionchanged (self, current, previous) |
OnSelectionChanged handler for WordDBManager::tvDb. More... | |
def | on_tvDicPreview_contextmenu (self, pos) |
OnCustomContextMenuRequested handler for WordDBManager::tvDicPreview. More... | |
Public Attributes | |
mainwindow | |
gui::MainWindow the app main window More... | |
dics_model | |
QtGui.QStandardItemModel underlying model for the dictionary collection populated from the Hunspell repo (in Tab 1) More... | |
dics | |
dict stored data for dictionaries retrieved from the Hunspell repo More... | |
dics_model_thread | |
utils::QThreadStump dedicated thread to populate dictionaries from the Hunspell repo More... | |
hunspellmgr | |
dbapi::HunspellImport HunspellImport object to import dictionaries from Hunspell More... | |
to_install | |
list list of dictionaries selected for installation More... | |
loadermovie | |
QtGui.QMovie animation shown during lengthy operations More... | |
db_model | |
QtGui.QStandardItemModel underlying model for the current database (in Tab 2) More... | |
db_model_thread | |
utils::QThreadStump dedicated thread to refresh the database table (in Tab 2) More... | |
db_model_changed_indices | |
set stored indices of the DB model to reflect user changes that must be committed More... | |
lo_main | |
QtWidgets.QVBoxLayout central widget layout More... | |
tabw | |
QtWidgets.QTabWidget tab container for the 2 tabs in the window More... | |
statusbar | |
QtWidgets.QStatusBar main status bar More... | |
statusbar_pbar | |
QtWidgets.QProgressBar progress bar inside status bar (hidden by default) More... | |
wcentral | |
QtWidgets.QWidget window central widget (root container for other controls) More... | |
tb_dicactions | |
QtWidgets.QWidget Tab 1 widget More... | |
act_refreshdics | |
QtWidgets.QAction action to repopulate dictionaries list More... | |
act_installdics | |
QtWidgets.QAction action to install selected (checked) and uninstall unchecked dictionaries More... | |
act_stopdics | |
QtWidgets.QAction action to stop the current operation (refresh / installation) More... | |
act_peekdic | |
QtWidgets.QAction action to see the raw content of the selected dictionary More... | |
splitter_dics | |
QtWidgets.QSplitter splitter between dictionaries list and preview More... | |
tvDics | |
QtWidgets.QTableView table control to view the dictionaries list More... | |
l_gif | |
QtWidgets.QLabel GIF control to display the wait animation (for dics list) More... | |
tvDicPreview | |
QtWidgets.QTableView table control to preview the dictionary content (read-only) More... | |
l_gif2 | |
QtWidgets.QLabel GIF control to display the wait animation (for preview) More... | |
combo_selectdb | |
QtWidgets.QWidget Tab 2 widget More... | |
tb_dbactions | |
QtWidgets.QToolBar Tab 2 toolbar More... | |
act_refreshdb | |
QtWidgets.QAction action to display / refresh the current database in the editor More... | |
act_stopdb | |
QtWidgets.QAction action to stop the current operation (DB view refresh) More... | |
act_addwd | |
QtWidgets.QAction action to add a new word to the DB More... | |
act_delwd | |
QtWidgets.QAction action to delete the selected words from the DB More... | |
act_commit | |
QtWidgets.QAction action to write the pending changes to the DB More... | |
l_gif3 | |
QtWidgets.QLabel GIF control to display the wait animation (for DB view) More... | |
tvDB | |
QtWidgets.QTableView table control to display / edit the current DB More... | |
tvDicPreview_menu | |
QtWidgets.QMenu context menu for WordDBManager::tvDicPreview More... | |
dic_preview_item | |
Static Public Attributes | |
sigEnableInstall = QtCore.pyqtSignal(bool) | |
QtCore.pyqtSignal signal to notify if dictionary installation can be started. More... | |
list | pos_list |
list list of localized part pf speech names More... | |
Private Member Functions | |
def | _get_pos_index (self, pos_short) |
Gets the index of a part of speech in utils::globalvars::POS given its short name. More... | |
def | _get_pos_short (self, pos_desc) |
Gets the short name of a part of speech given its full name. More... | |
Private Attributes | |
_default_bgcolor | |
Manager for the inbuilt SQLite word source database.
Lets the user download and import Hunspell dictionaries for any language, with flexible part-of-speech / blacklisting / replacement settings. Language dictionaries (basically, word lists) available for download are retrieved from the unofficial Hunspell repository on Github. These dictionaries can be downloaded and installed locally as SQLite databases, which in turn can be used by the application as word sources to generate crossword. Installed dictionaries are stored as *.db files in pycross/assets/dic (one *.db file for each installed language). See pycross::dbapi for details on the DB structure. The Word DB Manager provides the user with a convenient GUI to investigate the available and installed dictionaries, install / uninstall them, and manually edit the installed databases (add / remove and change entries). Most operations are performed in a multithreaded way, without blocking the GUI window, and can be interrupted by the user at any moment.
def pycross.forms.WordDBManager.__init__ | ( | self, | |
settings, | |||
parent = None , |
|||
flags = QtCore.Qt.WindowFlags() |
|||
) |
settings | dict pointer to the app global settings dictionary (utils::guisettings::CWSettings::settings ) |
parent | QtWidgets.QWidget parent widget |
flags | QtCore.Qt.WindowFlags Qt window flags |
|
private |
Gets the index of a part of speech in utils::globalvars::POS given its short name.
pos_short | str short POS name, e.g. 'n' (noun) |
int
index of the POS in utils::globalvars::POS (default = 0)
|
private |
Gets the short name of a part of speech given its full name.
pos_desc | str full POS name, e.g. 'Noun' |
str
| None
short POS name, e.g. 'n' (None
if not found in in utils::globalvars::POS) def pycross.forms.WordDBManager.check_commit_db | ( | self, | |
refresh = True , |
|||
ignore_errors = False |
|||
) |
Displays a user confirmation dialog to write the pending changes to the current DB.
refresh | bool whether to refresh the DB view after writing the changes |
ignore_errors | bool whether to ignore any errors when writing the changes |
def pycross.forms.WordDBManager.closeEvent | ( | self, | |
event | |||
) |
OnClose event handler: stops all running operations, writes changes to the DB.
def pycross.forms.WordDBManager.commit_db | ( | self, | |
refresh = True , |
|||
ignore_errors = False |
|||
) |
Commits (writes) the pending changes to the currently edited DB.
refresh | bool whether to refresh the DB view after writing the changes |
ignore_errors | bool whether to ignore any errors when writing the changes |
def pycross.forms.WordDBManager.create_tvDicPreview_menu | ( | self | ) |
Creates the context menu for WordDBManager::tvDicPreview.
def pycross.forms.WordDBManager.createTabs | ( | self | ) |
Creates the 2 tabs of the window.
def pycross.forms.WordDBManager.db_model_item_changed | ( | self, | |
item | |||
) |
OnItemChanged handler for WordDBManager::db_model: adds the changed item to WordDBManager::db_model_changed_indices.
def pycross.forms.WordDBManager.db_model_reset | ( | self | ) |
OnModelReset handler for WordDBManager::db_model: clears WordDBManager::db_model_changed_indices.
def pycross.forms.WordDBManager.dics_model_item_changed | ( | self, | |
item | |||
) |
OnItemChanged handler for WordDBManager::dics_model: sets the item internal / displayed data according to the user changes.
def pycross.forms.WordDBManager.do_install_dics | ( | self | ) |
Installs the downloaded dictionaries marked for installation.
def pycross.forms.WordDBManager.download_dic | ( | self, | |
lang, | |||
overwrite = False |
|||
) |
Downloads the dictionary for the given language from the Hunspell repo and stores it locally as pycross/assets/dic/<LANG>.dic.
lang | str short language name for the dictionary (e.g. 'en', 'de') |
overwrite | bool whether to overwrite the existing file |
def pycross.forms.WordDBManager.execute_pending_dics | ( | self | ) |
Installs the checked and uninstalls the unchecked dictionaries.
def pycross.forms.WordDBManager.initUI | ( | self | ) |
Creates and initializes the GUI.
def pycross.forms.WordDBManager.locate_dic_item | ( | self, | |
lang | |||
) |
Returns the item in WordDBManager::dics_model corresponding to a given language.
lang | str short language name for the dictionary (e.g. 'en', 'de') |
QtGui.QStandardItem
| None
found item in WordDBManager::dics_model or None
if not found def pycross.forms.WordDBManager.on_act_addwd | ( | self, | |
checked | |||
) |
OnTriggered handler for WordDBManager::act_addwd: adds a new word to the current DB.
def pycross.forms.WordDBManager.on_act_commit | ( | self, | |
checked | |||
) |
OnTriggered handler for WordDBManager::act_commit: writes the pending changes to the DB.
def pycross.forms.WordDBManager.on_act_delwd | ( | self, | |
checked | |||
) |
OnTriggered handler for WordDBManager::act_delwd: deletes the selected words from the current DB.
def pycross.forms.WordDBManager.on_act_installdics | ( | self, | |
checked | |||
) |
OnTriggered handler for WordDBManager::act_installdics: installs / uninstalls checked / unchecked dictionaries.
def pycross.forms.WordDBManager.on_act_peekdic | ( | self, | |
checked | |||
) |
OnTriggered handler for WordDBManager::act_peekdic: shows or hides the dictionary preview table.
def pycross.forms.WordDBManager.on_act_refreshdb | ( | self, | |
checked | |||
) |
OnTriggered handler for WordDBManager::act_refreshdb: display / refresh the current database in the editor.
def pycross.forms.WordDBManager.on_act_refreshdics | ( | self, | |
checked | |||
) |
OnTriggered handler for WordDBManager::act_refreshdics: starts WordDBManager::dics_model_thread.
def pycross.forms.WordDBManager.on_act_refreshdics_changed | ( | self | ) |
OnChanged handler for WordDBManager::act_refreshdics: adjusts the Enabled property of some actions.
def pycross.forms.WordDBManager.on_act_stopdb | ( | self, | |
checked | |||
) |
OnTriggered handler for WordDBManager::act_stopdb: stops the current operation (DB view refresh).
def pycross.forms.WordDBManager.on_act_stopdics | ( | self, | |
checked | |||
) |
OnTriggered handler for WordDBManager::act_stopdics: interrupts the current operations waiting on the spawned threads to terminate.
def pycross.forms.WordDBManager.on_combo_selectdb | ( | self, | |
index | |||
) |
Fires when a DB is selected in WordDBManager::combo_selectdb.
def pycross.forms.WordDBManager.on_complete_download_preview | ( | self, | |
id, | |||
url, | |||
lang, | |||
filepath | |||
) |
OnComplete callback for dbapi::HunspellImport::download_hunspell() downloading dictionaries for preview.
id | int ID of task in the thread pool |
url | str URL of the downloaded file (dictionary) |
lang | str short language name for the dictionary (e.g. 'en', 'de') |
filepath | str full path to the downloaded dictionary (saved in pycross/assets/dic by default) |
def pycross.forms.WordDBManager.on_download_dics_error | ( | self, | |
id, | |||
url, | |||
lang, | |||
filepath, | |||
message | |||
) |
OnError callback for dbapi::HunspellImport::download_hunspell() downloading dictionaries for installation.
id | int ID of task in the thread pool |
url | str URL of the downloaded file (dictionary) |
lang | str short language name for the dictionary (e.g. 'en', 'de') |
filepath | str full path to the downloaded dictionary (saved in pycross/assets/dic by default) |
message | str the error message |
def pycross.forms.WordDBManager.on_download_dics_finish | ( | self, | |
id, | |||
url, | |||
lang, | |||
filepath | |||
) |
OnComplete callback for dbapi::HunspellImport::download_hunspell() downloading dictionaries for installation.
id | int ID of task in the thread pool |
url | str URL of the downloaded file (dictionary) |
lang | str short language name for the dictionary (e.g. 'en', 'de') |
filepath | str full path to the downloaded dictionary (saved in pycross/assets/dic by default) |
def pycross.forms.WordDBManager.on_download_dics_getfilesize | ( | self, | |
id, | |||
url, | |||
lang, | |||
filepath, | |||
total_bytes | |||
) |
OnGetFilesize callback for dbapi::HunspellImport::download_hunspell() downloading dictionaries for installation.
id | int ID of task in the thread pool |
url | str URL of the downloaded file (dictionary) |
lang | str short language name for the dictionary (e.g. 'en', 'de') |
filepath | str full path to the downloaded dictionary (saved in pycross/assets/dic by default) |
total_bytes | int length of file to be downloaded (in bytes) |
def pycross.forms.WordDBManager.on_download_dics_run | ( | self, | |
id, | |||
url, | |||
lang, | |||
filepath, | |||
bytes_written, | |||
total_bytes | |||
) |
OnProgress callback for dbapi::HunspellImport::download_hunspell() downloading dictionaries for installation.
id | int ID of task in the thread pool |
url | str URL of the downloaded file (dictionary) |
lang | str short language name for the dictionary (e.g. 'en', 'de') |
filepath | str full path to the downloaded dictionary (saved in pycross/assets/dic by default) |
bytes_written | int number of bytes downloaded so far |
total_bytes | int length of file to be downloaded (in bytes) |
def pycross.forms.WordDBManager.on_download_dics_start | ( | self, | |
id, | |||
url, | |||
lang, | |||
filepath | |||
) |
OnStart callback for dbapi::HunspellImport::download_hunspell() downloading dictionaries for installation.
id | int ID of task in the thread pool |
url | str URL of the downloaded file (dictionary) |
lang | str short language name for the dictionary (e.g. 'en', 'de') |
filepath | str full path to the downloaded dictionary (saved in pycross/assets/dic by default) |
def pycross.forms.WordDBManager.on_download_dics_stopcheck | ( | self, | |
id, | |||
url, | |||
lang, | |||
filepath | |||
) |
OnStopCheck callback for dbapi::HunspellImport::download_hunspell() downloading dictionaries for installation.
id | int ID of task in the thread pool |
url | str URL of the downloaded file (dictionary) |
lang | str short language name for the dictionary (e.g. 'en', 'de') |
filepath | str full path to the downloaded dictionary (saved in pycross/assets/dic by default) |
bool
True
to stop / False
to continue download def pycross.forms.WordDBManager.on_error_download_preview | ( | self, | |
id, | |||
url, | |||
lang, | |||
filepath, | |||
message | |||
) |
OnError callback for dbapi::HunspellImport::download_hunspell() downloading dictionaries for preview.
id | int ID of task in the thread pool |
url | str URL of the downloaded file (dictionary) |
lang | str short language name for the dictionary (e.g. 'en', 'de') |
filepath | str full path to the downloaded dictionary (saved in pycross/assets/dic by default) |
message | str the error message |
def pycross.forms.WordDBManager.on_getfilesize_download_preview | ( | self, | |
id, | |||
url, | |||
lang, | |||
filepath, | |||
total_bytes | |||
) |
OnGetFilesize callback for dbapi::HunspellImport::download_hunspell() downloading dictionaries for preview.
id | int ID of task in the thread pool |
url | str URL of the downloaded file (dictionary) |
lang | str short language name for the dictionary (e.g. 'en', 'de') |
filepath | str full path to the downloaded dictionary (saved in pycross/assets/dic by default) |
total_bytes | int length of file to be downloaded (in bytes) |
def pycross.forms.WordDBManager.on_install_dics_commit | ( | self, | |
id, | |||
lang, | |||
filepath, | |||
records | |||
) |
OnCommit callback for dbapi::HunspellImport::add_all_from_hunspell().
id | int ID of task in the thread pool |
lang | str short language name for the dictionary (e.g. 'en', 'de') |
filepath | str full path to the downloaded dictionary (saved in pycross/assets/dic by default) |
records | int number of records (entries) written so far |
def pycross.forms.WordDBManager.on_install_dics_error | ( | self, | |
id, | |||
lang, | |||
filepath, | |||
message | |||
) |
OnError callback for dbapi::HunspellImport::add_all_from_hunspell().
id | int ID of task in the thread pool |
lang | str short language name for the dictionary (e.g. 'en', 'de') |
filepath | str full path to the downloaded dictionary (saved in pycross/assets/dic by default) |
message | str error message |
def pycross.forms.WordDBManager.on_install_dics_finish | ( | self, | |
id, | |||
lang, | |||
filepath, | |||
records | |||
) |
OnFinish callback for dbapi::HunspellImport::add_all_from_hunspell().
id | int ID of task in the thread pool |
lang | str short language name for the dictionary (e.g. 'en', 'de') |
filepath | str full path to the downloaded dictionary (saved in pycross/assets/dic by default) |
records | int number of records (entries) written to the DB |
def pycross.forms.WordDBManager.on_install_dics_start | ( | self, | |
id, | |||
lang, | |||
filepath | |||
) |
OnStart callback for dbapi::HunspellImport::add_all_from_hunspell().
id | int ID of task in the thread pool |
lang | str short language name for the dictionary (e.g. 'en', 'de') |
filepath | str full path to the downloaded dictionary (saved in pycross/assets/dic by default) |
def pycross.forms.WordDBManager.on_install_dics_stopcheck | ( | self, | |
id, | |||
lang, | |||
filepath | |||
) |
OnStopCheck callback for dbapi::HunspellImport::add_all_from_hunspell().
id | int ID of task in the thread pool |
lang | str short language name for the dictionary (e.g. 'en', 'de') |
filepath | str full path to the downloaded dictionary (saved in pycross/assets/dic by default) |
bool
True
to stop / False
to continue def pycross.forms.WordDBManager.on_repopulate_db_model_error | ( | self, | |
thread, | |||
message | |||
) |
OnError callback for WordDBManager::db_model_thread: shows error and interrupts repopulation.
thread | QtCore.QThread pointer to thread causing the error |
message | str the error message |
def pycross.forms.WordDBManager.on_repopulate_db_model_finish | ( | self | ) |
def pycross.forms.WordDBManager.on_repopulate_db_model_run | ( | self | ) |
OnRun callback for WordDBManager::db_model_thread: repopulates the DB model.
def pycross.forms.WordDBManager.on_repopulate_db_model_start | ( | self | ) |
OnStart callback for WordDBManager::db_model_thread called when the thread starts.
def pycross.forms.WordDBManager.on_repopulate_dic_model_finish | ( | self | ) |
OnFinish callback for WordDBManager::dics_model_thread called when the thread completes.
def pycross.forms.WordDBManager.on_repopulate_dic_model_run_fromserver | ( | self | ) |
OnRun callback for WordDBManager::dics_model_thread forcing update from server.
def pycross.forms.WordDBManager.on_repopulate_dic_model_run_local | ( | self | ) |
OnRun callback for WordDBManager::dics_model_thread forcing update from stored data.
def pycross.forms.WordDBManager.on_repopulate_dic_model_start | ( | self | ) |
OnStart callback for WordDBManager::dics_model_thread called when the thread starts.
def pycross.forms.WordDBManager.on_run_download_preview | ( | self, | |
id, | |||
url, | |||
lang, | |||
filepath, | |||
bytes_written, | |||
total_bytes | |||
) |
OnProgress callback for dbapi::HunspellImport::download_hunspell() downloading dictionaries for preview.
id | int ID of task in the thread pool |
url | str URL of the downloaded file (dictionary) |
lang | str short language name for the dictionary (e.g. 'en', 'de') |
filepath | str full path to the downloaded dictionary (saved in pycross/assets/dic by default) |
bytes_written | int number of bytes downloaded so far |
total_bytes | int length of file to be downloaded (in bytes) |
def pycross.forms.WordDBManager.on_start_download_preview | ( | self, | |
id, | |||
url, | |||
lang, | |||
filepath | |||
) |
OnStart callback for dbapi::HunspellImport::download_hunspell() downloading dictionaries for preview.
id | int ID of task in the thread pool |
url | str URL of the downloaded file (dictionary) |
lang | str short language name for the dictionary (e.g. 'en', 'de') |
filepath | str full path to the downloaded dictionary (saved in pycross/assets/dic by default) |
def pycross.forms.WordDBManager.on_tvDb_selectionchanged | ( | self, | |
current, | |||
previous | |||
) |
OnSelectionChanged handler for WordDBManager::tvDb.
def pycross.forms.WordDBManager.on_tvDicPreview_contextmenu | ( | self, | |
pos | |||
) |
OnCustomContextMenuRequested handler for WordDBManager::tvDicPreview.
def pycross.forms.WordDBManager.on_tvDics_activated | ( | self, | |
index | |||
) |
OnItemActivated handler for WordDBManager::tvDics: brings up editor dialogs to edit specific values like Replacements or Excluded POS.
index | QtCore.QModelIndex the index of the activated (e.g. double-clicked) item |
def pycross.forms.WordDBManager.on_tvDics_selectionchanged | ( | self, | |
current, | |||
previous | |||
) |
OnSelectionChanged handler for WordDBManager::tvDics.
def pycross.forms.WordDBManager.reformat_dic_model_row | ( | self, | |
r | |||
) |
Formats the given row in the dictionaries view changing the background color according to the dictionary status.
r | int number of row to apply formatting to |
def pycross.forms.WordDBManager.repopulate_dic_model | ( | self, | |
refresh_from_server = True , |
|||
stopcheck = None |
|||
) |
Repopulates the list of available dictionaries on Tab 1.
refresh_from_server | bool if True , the list will be retrieved from the Github repo; if False , the previously populated data in WordDBManager::dics will be used |
stopcheck | callable callback function that must return True to stop the current operation, or False to continue |
def pycross.forms.WordDBManager.resizeEvent | ( | self, | |
event | |||
) |
OnResize event handler: adjusts the Preview control size.
def pycross.forms.WordDBManager.show_db | ( | self, | |
dic_lang, | |||
stopcheck = None |
|||
) |
Refreshes and shows the DB for a given dictionary in the DB view.
dic_lang | dict dictionary info (see dbapi::HunspellImport::list_hunspell()) |
stopcheck | callable callback function that must return True to stop the current operation, or False to continue |
def pycross.forms.WordDBManager.show_dic_content | ( | self, | |
filepath | |||
) |
Shows the raw content of the given dictionary the in the preview panel.
filepath | str full path to dictionary file (*.dic) |
def pycross.forms.WordDBManager.showEvent | ( | self, | |
event | |||
) |
OnShow event handler: populates the dictionaries when the window is displayed.
def pycross.forms.WordDBManager.sizeHint | ( | self | ) |
Overridden method to make the window half the screen size.
def pycross.forms.WordDBManager.stop_operations | ( | self | ) |
Stops all operations running in child threads.
def pycross.forms.WordDBManager.stopcheck_download_preview | ( | self, | |
id, | |||
url, | |||
lang, | |||
filepath | |||
) |
OnStopCheck callback for dbapi::HunspellImport::download_hunspell() downloading dictionaries for preview.
id | int ID of task in the thread pool |
url | str URL of the downloaded file (dictionary) |
lang | str short language name for the dictionary (e.g. 'en', 'de') |
filepath | str full path to the downloaded dictionary (saved in pycross/assets/dic by default) |
bool
True
to stop / False
to continue download def pycross.forms.WordDBManager.update_db_actions | ( | self | ) |
Updates the Enabled property of the DB actions in the toolbar.
|
private |
pycross.forms.WordDBManager.act_addwd |
QtWidgets.QAction
action to add a new word to the DB
pycross.forms.WordDBManager.act_commit |
QtWidgets.QAction
action to write the pending changes to the DB
pycross.forms.WordDBManager.act_delwd |
QtWidgets.QAction
action to delete the selected words from the DB
pycross.forms.WordDBManager.act_installdics |
QtWidgets.QAction
action to install selected (checked) and uninstall unchecked dictionaries
pycross.forms.WordDBManager.act_peekdic |
QtWidgets.QAction
action to see the raw content of the selected dictionary
pycross.forms.WordDBManager.act_refreshdb |
QtWidgets.QAction
action to display / refresh the current database in the editor
pycross.forms.WordDBManager.act_refreshdics |
QtWidgets.QAction
action to repopulate dictionaries list
pycross.forms.WordDBManager.act_stopdb |
QtWidgets.QAction
action to stop the current operation (DB view refresh)
pycross.forms.WordDBManager.act_stopdics |
QtWidgets.QAction
action to stop the current operation (refresh / installation)
pycross.forms.WordDBManager.combo_selectdb |
QtWidgets.QWidget
Tab 2 widget
QtWidgets.QVBoxLayout
Tab 2 layout QtWidgets.QFormLayout
Tab 2 top panel layout QtWidgets.QComboBox
combo box to select the database to view / edit
pycross.forms.WordDBManager.db_model |
QtGui.QStandardItemModel
underlying model for the current database (in Tab 2)
pycross.forms.WordDBManager.db_model_changed_indices |
set
stored indices of the DB model to reflect user changes that must be committed
pycross.forms.WordDBManager.db_model_thread |
utils::QThreadStump
dedicated thread to refresh the database table (in Tab 2)
pycross.forms.WordDBManager.dic_preview_item |
pycross.forms.WordDBManager.dics |
dict
stored data for dictionaries retrieved from the Hunspell repo
pycross.forms.WordDBManager.dics_model |
QtGui.QStandardItemModel
underlying model for the dictionary collection populated from the Hunspell repo (in Tab 1)
pycross.forms.WordDBManager.dics_model_thread |
utils::QThreadStump
dedicated thread to populate dictionaries from the Hunspell repo
pycross.forms.WordDBManager.hunspellmgr |
dbapi::HunspellImport
HunspellImport object to import dictionaries from Hunspell
pycross.forms.WordDBManager.l_gif |
QtWidgets.QLabel
GIF control to display the wait animation (for dics list)
pycross.forms.WordDBManager.l_gif2 |
QtWidgets.QLabel
GIF control to display the wait animation (for preview)
pycross.forms.WordDBManager.l_gif3 |
QtWidgets.QLabel
GIF control to display the wait animation (for DB view)
pycross.forms.WordDBManager.lo_main |
QtWidgets.QVBoxLayout
central widget layout
pycross.forms.WordDBManager.loadermovie |
QtGui.QMovie
animation shown during lengthy operations
pycross.forms.WordDBManager.mainwindow |
gui::MainWindow
the app main window
|
static |
list
list of localized part pf speech names
|
static |
QtCore.pyqtSignal
signal to notify if dictionary installation can be started.
pycross.forms.WordDBManager.splitter_dics |
QtWidgets.QSplitter
splitter between dictionaries list and preview
pycross.forms.WordDBManager.statusbar |
QtWidgets.QStatusBar
main status bar
pycross.forms.WordDBManager.statusbar_pbar |
QtWidgets.QProgressBar
progress bar inside status bar (hidden by default)
pycross.forms.WordDBManager.tabw |
QtWidgets.QTabWidget
tab container for the 2 tabs in the window
pycross.forms.WordDBManager.tb_dbactions |
QtWidgets.QToolBar
Tab 2 toolbar
pycross.forms.WordDBManager.tb_dicactions |
QtWidgets.QWidget
Tab 1 widget
QtWidgets.QVBoxLayout
Tab 1 layout QtWidgets.QToolBar
Tab 1 toolbar
pycross.forms.WordDBManager.to_install |
list
list of dictionaries selected for installation
pycross.forms.WordDBManager.tvDB |
QtWidgets.QTableView
table control to display / edit the current DB
pycross.forms.WordDBManager.tvDicPreview |
QtWidgets.QTableView
table control to preview the dictionary content (read-only)
pycross.forms.WordDBManager.tvDicPreview_menu |
QtWidgets.QMenu
context menu for WordDBManager::tvDicPreview
pycross.forms.WordDBManager.tvDics |
QtWidgets.QTableView
table control to view the dictionaries list
pycross.forms.WordDBManager.wcentral |
QtWidgets.QWidget
window central widget (root container for other controls)