pycrossword  0.4
Pure-Python implementation of a crossword puzzle generator and editor
Public Member Functions | Public Attributes | List of all members
pycross.forms.WordSuggestDialog Class Reference

Small dialog window to look for words matching a given pattern among the word sources. More...

Inheritance diagram for pycross.forms.WordSuggestDialog:
pycross.forms.BasicDialog

Public Member Functions

def __init__ (self, mainwindow, word='', word_editable=False, getresults=None, parent=None, flags=QtCore.Qt.WindowFlags())
 Constructor. More...
 
def addMainLayout (self)
 Creates the main (central) layout for controls. More...
 
def showEvent (self, event)
 Fires when the dialog shows up. More...
 
def closeEvent (self, event)
 Fires when the dialog closes. More...
 
def init (self, word='', word_editable=False)
 Creates and initializes members. More...
 
def validate (self)
 Checks that a suggestion is selected before quitting. More...
 
def fill_words (self)
 Retrieves suggestions and fills them into the list box. More...
 
def update_actions (self)
 Enables / disables actions depending on the number of returned suggestions. More...
 
def sort_words (self, order='')
 Sorts the suggestions in the list box. More...
 
def on_ch_truncate (self, checked)
 When the 'Truncate' checkbox is (un)checked. More...
 
def on_word_edited (self, text)
 When the word pattern is edited: store the new pattern. More...
 
def on_word_dblclick (self, item)
 When a suggestion is double-clicked: select it and quit. More...
 
def on_act_refresh (self, checked)
 Refresh action handler: update suggestions. More...
 
def on_act_sort (self, checked)
 Sort action handler: sort suggestions. More...
 
def on_act_shuffle (self, checked)
 Shuffle action handler: shuffle suggestions randomly. More...
 
def on_act_source_config (self, checked)
 Word source settings action: show word source management page in settings dialog. More...
 
- Public Member Functions inherited from pycross.forms.BasicDialog
def initUI (self, geometry=None, title=None, icon=None)
 Creates the core controls: OK and Cancel buttons and layouts. 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

 mainwindow
 QtWidgets.QMainWindow pointer to gui::MainWindow instance More...
 
 sortdir
 str suggestions sort order: 'A' = ascending, 'D' = descending More...
 
 word
 str word pattern to find suggestions for More...
 
 word_editable
 bool whether the word string can be edited directly in the dialog More...
 
 getresults
 callable pointer to function that retrieves word suggestions More...
 
 results
 list list of retrieved suggestions (word strings) More...
 
 selected
 str the selected word (from the suggested list) More...
 
 layout_controls
 
 layout_top
 
 l_word
 
 le_word
 
 layout_center
 
 lw_words
 
 tb_actions
 
 act_refresh
 
 act_sort
 
 act_shuffle
 
 act_source_config
 
 l_count
 
 ch_truncate
 
 layout_lower
 
 old_truncate
 
- Public Attributes inherited from pycross.forms.BasicDialog
 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...
 

Detailed Description

Small dialog window to look for words matching a given pattern among the word sources.

Constructor & Destructor Documentation

◆ __init__()

def pycross.forms.WordSuggestDialog.__init__ (   self,
  mainwindow,
  word = '',
  word_editable = False,
  getresults = None,
  parent = None,
  flags = QtCore.Qt.WindowFlags() 
)

Constructor.

Parameters
mainwindowQtWidgets.QMainWindow pointer to gui::MainWindow instance
wordstr the word pattern to look up in suggestions, e.g. 'f_th__'
word_editablebool whether the word string can be edited directly in the dialog (default = False)
getresultscallable pointer to function that retrieves word suggestions. This function takes one argument (the word pattern string) and returns suggestions as a list of strings.
parentQtWidgets.QWidget parent widget (default = None, i.e. no parent)
flagsQtCore.Qt.WindowFlags Qt window flags

Reimplemented from pycross.forms.BasicDialog.

Member Function Documentation

◆ addMainLayout()

def pycross.forms.WordSuggestDialog.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.

◆ closeEvent()

def pycross.forms.WordSuggestDialog.closeEvent (   self,
  event 
)

Fires when the dialog closes.

◆ fill_words()

def pycross.forms.WordSuggestDialog.fill_words (   self)

Retrieves suggestions and fills them into the list box.

◆ init()

def pycross.forms.WordSuggestDialog.init (   self,
  word = '',
  word_editable = False 
)

Creates and initializes members.

◆ on_act_refresh()

def pycross.forms.WordSuggestDialog.on_act_refresh (   self,
  checked 
)

Refresh action handler: update suggestions.

◆ on_act_shuffle()

def pycross.forms.WordSuggestDialog.on_act_shuffle (   self,
  checked 
)

Shuffle action handler: shuffle suggestions randomly.

◆ on_act_sort()

def pycross.forms.WordSuggestDialog.on_act_sort (   self,
  checked 
)

Sort action handler: sort suggestions.

◆ on_act_source_config()

def pycross.forms.WordSuggestDialog.on_act_source_config (   self,
  checked 
)

Word source settings action: show word source management page in settings dialog.

◆ on_ch_truncate()

def pycross.forms.WordSuggestDialog.on_ch_truncate (   self,
  checked 
)

When the 'Truncate' checkbox is (un)checked.

◆ on_word_dblclick()

def pycross.forms.WordSuggestDialog.on_word_dblclick (   self,
  item 
)

When a suggestion is double-clicked: select it and quit.

◆ on_word_edited()

def pycross.forms.WordSuggestDialog.on_word_edited (   self,
  text 
)

When the word pattern is edited: store the new pattern.

◆ showEvent()

def pycross.forms.WordSuggestDialog.showEvent (   self,
  event 
)

Fires when the dialog shows up.

◆ sort_words()

def pycross.forms.WordSuggestDialog.sort_words (   self,
  order = '' 
)

Sorts the suggestions in the list box.

Parameters
orderstr sort order: 'A' = ascending, 'D' = descending, 'toggle' = toggle order, empty = use WordSuggestDialog::sortdir

◆ update_actions()

def pycross.forms.WordSuggestDialog.update_actions (   self)

Enables / disables actions depending on the number of returned suggestions.

◆ validate()

def pycross.forms.WordSuggestDialog.validate (   self)

Checks that a suggestion is selected before quitting.

Reimplemented from pycross.forms.BasicDialog.

Member Data Documentation

◆ act_refresh

pycross.forms.WordSuggestDialog.act_refresh

◆ act_shuffle

pycross.forms.WordSuggestDialog.act_shuffle

◆ act_sort

pycross.forms.WordSuggestDialog.act_sort

◆ act_source_config

pycross.forms.WordSuggestDialog.act_source_config

◆ ch_truncate

pycross.forms.WordSuggestDialog.ch_truncate

◆ getresults

pycross.forms.WordSuggestDialog.getresults

callable pointer to function that retrieves word suggestions

◆ l_count

pycross.forms.WordSuggestDialog.l_count

◆ l_word

pycross.forms.WordSuggestDialog.l_word

◆ layout_center

pycross.forms.WordSuggestDialog.layout_center

◆ layout_controls

pycross.forms.WordSuggestDialog.layout_controls

◆ layout_lower

pycross.forms.WordSuggestDialog.layout_lower

◆ layout_top

pycross.forms.WordSuggestDialog.layout_top

◆ le_word

pycross.forms.WordSuggestDialog.le_word

◆ lw_words

pycross.forms.WordSuggestDialog.lw_words

◆ mainwindow

pycross.forms.WordSuggestDialog.mainwindow

QtWidgets.QMainWindow pointer to gui::MainWindow instance

◆ old_truncate

pycross.forms.WordSuggestDialog.old_truncate

◆ results

pycross.forms.WordSuggestDialog.results

list list of retrieved suggestions (word strings)

◆ selected

pycross.forms.WordSuggestDialog.selected

str the selected word (from the suggested list)

◆ sortdir

pycross.forms.WordSuggestDialog.sortdir

str suggestions sort order: 'A' = ascending, 'D' = descending

◆ tb_actions

pycross.forms.WordSuggestDialog.tb_actions

◆ word

pycross.forms.WordSuggestDialog.word

str word pattern to find suggestions for

◆ word_editable

pycross.forms.WordSuggestDialog.word_editable

bool whether the word string can be edited directly in the dialog


The documentation for this class was generated from the following file: