pycrossword
0.2
Pure-Python implementation of a crossword puzzle generator and editor
|
Base class for OK-Cancel type dialogs. More...
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 | 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... | |
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.
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.
geometry | 4-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. |
title | str window title (None for no title) |
icon | str window icon file name (relative to utils::globalvars::ICONFOLDER), e.g. 'main.png'. None means no icon. |
parent | QtWidgets.QWidget parent widget (default = None , i.e. no parent) |
flags | QtCore.Qt.WindowFlags Qt window flags |
sizepolicy | QtWidgets.QSizePolicy QWidget size policy. Default is fixed size in both directions (non-resizable dialog). |
Reimplemented in pycross.forms.WordSuggestDialog.
def pycross.forms.BasicDialog.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 in pycross.forms.ShareDialog, pycross.forms.PasswordDialog, pycross.forms.ReflectGridDialog, pycross.forms.DefLookupDialog, pycross.forms.CwInfoDialog, pycross.forms.PrintPreviewDialog, pycross.forms.WordSuggestDialog, pycross.forms.SettingsDialog, pycross.forms.WordSrcDialog, and pycross.forms.LoadCwDialog.
def pycross.forms.BasicDialog.initUI | ( | self, | |
geometry = None , |
|||
title = None , |
|||
icon = None |
|||
) |
Creates the core controls: OK and Cancel buttons and layouts.
geometry | 4-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. |
title | str window title (None for no title) |
icon | str window icon file name (relative to utils::globalvars::ICONFOLDER), e.g. 'main.png'. None means no icon. |
def pycross.forms.BasicDialog.on_btn_cancel_clicked | ( | self | ) |
Fires when the Cancel button is clicked: rejects input and closes window.
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.
def pycross.forms.BasicDialog.validate | ( | self | ) |
Validates user input (reimplemented in child classes).
bool
True
if user input is valid, False
otherwise Reimplemented in pycross.forms.PasswordDialog, pycross.forms.WordSuggestDialog, pycross.forms.WordSrcDialog, and pycross.forms.LoadCwDialog.
pycross.forms.BasicDialog.btn_cancel |
QtWidgets.QPushButton
Cancel button
pycross.forms.BasicDialog.btn_OK |
QtWidgets.QPushButton
OK button
pycross.forms.BasicDialog.layout_bottom |
QtWidgets.QHBoxLayout
bottom layout for OK and Cancel buttons
pycross.forms.BasicDialog.layout_controls |
QtWidgets.QFormLayout
central layout for controls
pycross.forms.BasicDialog.layout_main |
QtWidgets.QVBoxLayout
window layout