pycrossword
0.4
Pure-Python implementation of a crossword puzzle generator and editor
|
Word definition lookup dialog to look up a word in a dictionary and/or Google. More...
Public Member Functions | |
def | __init__ (self, word='', word_editable=True, lang='', parent=None, flags=QtCore.Qt.WindowFlags()) |
Constructor. More... | |
def | closeEvent (self, event) |
Before the dialog quits, need to stop all running background threads. More... | |
def | showEvent (self, event) |
Retrieve results when the dialog shows. More... | |
def | kill_threads (self, dics=True, google=True) |
Stops any or both worker threads. More... | |
def | addMainLayout (self) |
Creates the main (central) layout for controls. More... | |
def | setlang (self, lang='') |
Sets the language to search in the online services. More... | |
def | init (self) |
Initializes controls. More... | |
def | update_language (self) |
Sets the selected language. More... | |
def | update_dict_engine (self) |
Sets the online dictionary engine depending on the selected language. More... | |
def | update_google_engine (self) |
Configures the Google search engine depending on the selected language. More... | |
def | add_pages (self) |
Adds the Dictionary and Google pages to the tab widget. More... | |
def | on_thread_error (self, thread, err) |
Worker thread error handler. More... | |
def | on_dics_load_start (self) |
Fires before the dictionary results are retrieved. More... | |
def | on_dics_load_run (self) |
Dictionary thread run event handler: retrieve dictionary results. More... | |
def | on_dics_load_finish (self) |
Fires after the dictionary results are retrieved. More... | |
def | on_google_load_start (self) |
Fires before the Google results are retrieved. More... | |
def | on_google_load_run (self) |
Google thread run event handler: retrieve Google search results. More... | |
def | on_google_load_finish (self) |
Fires after the Google results are retrieved. More... | |
def | update_content (self, dictionary=True, google=True) |
Fills the search results into the corresponding list and combo boxes. More... | |
def | rb_source_toggled (self, toggled) |
Shows the specified page when a radio button is toggled. More... | |
def | on_le_word_changed (self, text) |
Sets a new search word and restarts the search. More... | |
def | on_combo_lang (self, index) |
When a language combo item is selected. More... | |
def | on_combo_dict_homs (self, index) |
When a word homonym is selected in the combo (Dictionary page). More... | |
def | on_combo_google (self, index) |
When a Google result is selected in the combo (Google page). More... | |
![]() | |
def | __init__ (self, geometry=None, title=None, icon=None, parent=None, flags=QtCore.Qt.WindowFlags(), sizepolicy=QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)) |
Constructor. More... | |
def | event (self, QtCore.QEvent event) |
def | initUI (self, geometry=None, title=None, icon=None) |
Creates the core controls: OK and Cancel buttons and layouts. More... | |
def | validate (self) |
Validates user input (reimplemented in child classes). More... | |
def | on_btn_OK_clicked (self) |
Fires when the OK button is clicked. More... | |
def | on_btn_cancel_clicked (self) |
Fires when the Cancel button is clicked: rejects input and closes window. More... | |
Public Attributes | |
word | |
word_editable | |
word_def | |
google_res | |
dict_engine | |
google_engine | |
load_threads | |
worker threads to retrieve word definitions from the internet More... | |
layout_controls | |
gb_word | |
layout_gb_word | |
le_word | |
combo_lang | |
gb_sources | |
layout_gb_sources | |
rb_dict | |
rb_google | |
stacked | |
lang | |
page_dict | |
layout_dict | |
combo_dict_homs | |
layout_dict_top | |
te_dict_defs | |
l_link_dict | |
page_google | |
layout_google | |
combo_google | |
layout_google_top | |
te_google_res | |
l_link_google | |
![]() | |
layout_controls | |
QtWidgets.QFormLayout central layout for controls More... | |
btn_OK | |
QtWidgets.QPushButton OK button More... | |
btn_cancel | |
QtWidgets.QPushButton Cancel button More... | |
layout_bottom | |
QtWidgets.QHBoxLayout bottom layout for OK and Cancel buttons More... | |
layout_main | |
QtWidgets.QVBoxLayout window layout More... | |
Word definition lookup dialog to look up a word in a dictionary and/or Google.
def pycross.forms.DefLookupDialog.__init__ | ( | self, | |
word = '' , |
|||
word_editable = True , |
|||
lang = '' , |
|||
parent = None , |
|||
flags = QtCore.Qt.WindowFlags() |
|||
) |
Constructor.
word | str the word string to look up |
word_editable | bool whether the word string can be edited in the dialog (default = False ) |
lang | str short name of the langugage used to look up the word. Can be one of: 'en' (English), 'ru' (Russian), 'fr' (French), 'es' (Spanish), 'de' (German), 'it' (Italian) (see globalvars::LANG). If the value is an empty string (default), the setting from guisettings::CWSettings::settings['lookup']['default_lang'] is taken. |
parent | QtWidgets.QWidget parent widget (default = None , i.e. no parent) |
flags | QtCore.Qt.WindowFlags Qt window flags |
def pycross.forms.DefLookupDialog.add_pages | ( | self | ) |
Adds the Dictionary and Google pages to the tab widget.
def pycross.forms.DefLookupDialog.addMainLayout | ( | self | ) |
Creates the main (central) layout for controls.
Must be overridden by child classes to change the layout type (default = QtWidgets.QFormLayout
) and add controls.
Reimplemented from pycross.forms.BasicDialog.
def pycross.forms.DefLookupDialog.closeEvent | ( | self, | |
event | |||
) |
Before the dialog quits, need to stop all running background threads.
def pycross.forms.DefLookupDialog.init | ( | self | ) |
Initializes controls.
def pycross.forms.DefLookupDialog.kill_threads | ( | self, | |
dics = True , |
|||
google = True |
|||
) |
Stops any or both worker threads.
dics | bool stop the dictionary thread (default = True ) |
bool stop the google thread (default = True ) |
def pycross.forms.DefLookupDialog.on_combo_dict_homs | ( | self, | |
index | |||
) |
When a word homonym is selected in the combo (Dictionary page).
def pycross.forms.DefLookupDialog.on_combo_google | ( | self, | |
index | |||
) |
When a Google result is selected in the combo (Google page).
def pycross.forms.DefLookupDialog.on_combo_lang | ( | self, | |
index | |||
) |
When a language combo item is selected.
def pycross.forms.DefLookupDialog.on_dics_load_finish | ( | self | ) |
Fires after the dictionary results are retrieved.
def pycross.forms.DefLookupDialog.on_dics_load_run | ( | self | ) |
Dictionary thread run event handler: retrieve dictionary results.
def pycross.forms.DefLookupDialog.on_dics_load_start | ( | self | ) |
Fires before the dictionary results are retrieved.
def pycross.forms.DefLookupDialog.on_google_load_finish | ( | self | ) |
Fires after the Google results are retrieved.
def pycross.forms.DefLookupDialog.on_google_load_run | ( | self | ) |
Google thread run event handler: retrieve Google search results.
def pycross.forms.DefLookupDialog.on_google_load_start | ( | self | ) |
Fires before the Google results are retrieved.
def pycross.forms.DefLookupDialog.on_le_word_changed | ( | self, | |
text | |||
) |
Sets a new search word and restarts the search.
def pycross.forms.DefLookupDialog.on_thread_error | ( | self, | |
thread, | |||
err | |||
) |
Worker thread error handler.
thread | utils::QThreadStump worker thread instance |
err | str error message |
def pycross.forms.DefLookupDialog.rb_source_toggled | ( | self, | |
toggled | |||
) |
Shows the specified page when a radio button is toggled.
def pycross.forms.DefLookupDialog.setlang | ( | self, | |
lang = '' |
|||
) |
Sets the language to search in the online services.
lang | str search result language (see constructor for details of options) |
def pycross.forms.DefLookupDialog.showEvent | ( | self, | |
event | |||
) |
Retrieve results when the dialog shows.
def pycross.forms.DefLookupDialog.update_content | ( | self, | |
dictionary = True , |
|||
google = True |
|||
) |
Fills the search results into the corresponding list and combo boxes.
dictionary | bool whether to update the dictionary results |
bool whether to update the Google results |
def pycross.forms.DefLookupDialog.update_dict_engine | ( | self | ) |
Sets the online dictionary engine depending on the selected language.
If the language is English ('en'), the Merriam-Webster dictionary will be used; otherwise, the Yandex dictionary will be used.
def pycross.forms.DefLookupDialog.update_google_engine | ( | self | ) |
Configures the Google search engine depending on the selected language.
def pycross.forms.DefLookupDialog.update_language | ( | self | ) |
Sets the selected language.
pycross.forms.DefLookupDialog.combo_dict_homs |
pycross.forms.DefLookupDialog.combo_google |
pycross.forms.DefLookupDialog.combo_lang |
pycross.forms.DefLookupDialog.dict_engine |
pycross.forms.DefLookupDialog.gb_sources |
pycross.forms.DefLookupDialog.gb_word |
pycross.forms.DefLookupDialog.google_engine |
pycross.forms.DefLookupDialog.google_res |
pycross.forms.DefLookupDialog.l_link_dict |
pycross.forms.DefLookupDialog.l_link_google |
pycross.forms.DefLookupDialog.lang |
pycross.forms.DefLookupDialog.layout_controls |
pycross.forms.DefLookupDialog.layout_dict |
pycross.forms.DefLookupDialog.layout_dict_top |
pycross.forms.DefLookupDialog.layout_gb_sources |
pycross.forms.DefLookupDialog.layout_gb_word |
pycross.forms.DefLookupDialog.layout_google |
pycross.forms.DefLookupDialog.layout_google_top |
pycross.forms.DefLookupDialog.le_word |
pycross.forms.DefLookupDialog.load_threads |
worker threads to retrieve word definitions from the internet
pycross.forms.DefLookupDialog.page_dict |
pycross.forms.DefLookupDialog.page_google |
pycross.forms.DefLookupDialog.rb_dict |
pycross.forms.DefLookupDialog.rb_google |
pycross.forms.DefLookupDialog.stacked |
pycross.forms.DefLookupDialog.te_dict_defs |
pycross.forms.DefLookupDialog.te_google_res |
pycross.forms.DefLookupDialog.word |
pycross.forms.DefLookupDialog.word_def |
pycross.forms.DefLookupDialog.word_editable |