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

Base class for OK-Cancel type dialogs. More...

Inheritance diagram for pycross.forms.BasicDialog:
pycross.forms.CustomPluginDialog pycross.forms.CwInfoDialog pycross.forms.DefLookupDialog pycross.forms.LoadCwDialog pycross.forms.ParamValueEditor pycross.forms.PasswordDialog pycross.forms.PrintPreviewDialog pycross.forms.ReflectGridDialog pycross.forms.SettingsDialog pycross.forms.ShareDialog pycross.forms.WordSrcDialog pycross.forms.WordSuggestDialog

Public Member Functions

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 addMainLayout (self)
 Creates the main (central) layout for controls. More...
 
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

 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

Base class for OK-Cancel type dialogs.

Creates the basic layout for controls (leaving the central area free to add controls), and declares the validate() method to validate correctness of user input before accepting.

Constructor & Destructor Documentation

◆ __init__()

def pycross.forms.BasicDialog.__init__ (   self,
  geometry = None,
  title = None,
  icon = None,
  parent = None,
  flags = QtCore.Qt.WindowFlags(),
  sizepolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed) 
)

Constructor.

Parameters
geometry4-tuple window geometry data: (left, top, width, height). If set to None (default), the position will be centered on the parent widget or screen and the size will be automatically adjusted to fit the internal controls.
titlestr window title (None for no title)
iconstr window icon file name (relative to utils::globalvars::ICONFOLDER), e.g. 'main.png'. None means no icon.
parentQtWidgets.QWidget parent widget (default = None, i.e. no parent)
flagsQtCore.Qt.WindowFlags Qt window flags
sizepolicyQtWidgets.QSizePolicy QWidget size policy. Default is fixed size in both directions (non-resizable dialog).

Reimplemented in pycross.forms.WordSuggestDialog.

Member Function Documentation

◆ addMainLayout()

def pycross.forms.BasicDialog.addMainLayout (   self)

◆ event()

def pycross.forms.BasicDialog.event (   self,
QtCore.QEvent  event 
)

◆ initUI()

def pycross.forms.BasicDialog.initUI (   self,
  geometry = None,
  title = None,
  icon = None 
)

Creates the core controls: OK and Cancel buttons and layouts.

Parameters
geometry4-tuple window geometry data: (left, top, width, height). If set to None (default), the position will be centered on the parent widget or screen and the size will be automatically adjusted to fit the internal controls.
titlestr window title (None for no title)
iconstr window icon file name (relative to utils::globalvars::ICONFOLDER), e.g. 'main.png'. None means no icon.

◆ on_btn_cancel_clicked()

def pycross.forms.BasicDialog.on_btn_cancel_clicked (   self)

Fires when the Cancel button is clicked: rejects input and closes window.

◆ on_btn_OK_clicked()

def pycross.forms.BasicDialog.on_btn_OK_clicked (   self)

Fires when the OK button is clicked.

Calls validate() to check correctness of input and, if correct, accepts and closes window.

◆ validate()

def pycross.forms.BasicDialog.validate (   self)

Validates user input (reimplemented in child classes).

Returns
bool True if user input is valid, False otherwise
See also
on_btn_OK_clicked()

Reimplemented in pycross.forms.PasswordDialog, pycross.forms.WordSuggestDialog, pycross.forms.ParamValueEditor, pycross.forms.CustomPluginDialog, pycross.forms.WordSrcDialog, and pycross.forms.LoadCwDialog.

Member Data Documentation

◆ btn_cancel

pycross.forms.BasicDialog.btn_cancel

QtWidgets.QPushButton Cancel button

◆ btn_OK

pycross.forms.BasicDialog.btn_OK

QtWidgets.QPushButton OK button

◆ layout_bottom

pycross.forms.BasicDialog.layout_bottom

QtWidgets.QHBoxLayout bottom layout for OK and Cancel buttons

◆ layout_controls

pycross.forms.BasicDialog.layout_controls

QtWidgets.QFormLayout central layout for controls

◆ layout_main

pycross.forms.BasicDialog.layout_main

QtWidgets.QVBoxLayout window layout


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