cute_mongo_forms.row.base

base.py : The Row class

  • Copyright: 2017-2018 Sampsa Riikonen
  • Authors : Sampsa Riikonen
  • Date : 2017
  • Version : 0.2

This file is part of the cute_mongo_forms library

License: LGPLv3+ (see the COPYING.LESSER file)

Functions

dictionaryCheck(definitions, dic) Checks that dictionary has certain values, according to definitions
main()
noCheck(obj)
objectCheck(definitions, obj) Checks that object has certain attributes, according to definitions
parameterInitCheck(definitions, parameters, obj) Checks that parameters are consistent with a definition
test1()
test2()
typeCheck(obj, typ) Check type of obj, for example: typeCheck(x,int)

Classes

Column(**kwargs) Mother class for columns.
ColumnSpec(column_class, **kwargs)
LineEditColumn(**kwargs) Derived from Column.
Row(**kwargs) Defines a common columns structure for documents in a [document database] collection.
RowWatcher(name, bases, clsdict)
class cute_mongo_forms.row.base.Row(**kwargs)[source]

Defines a common columns structure for documents in a [document database] collection. The column structure (i.e. “Row”) is defined in the child class header like this:

columns=[
  ColumnSpec(LineEditColumn, key_name="firstname", label_name="First Name"),
  ...
]

This class knows how to create a Qt form, corresponding to the column structure

delete(collection, _id)[source]

Delete a record

classmethod genKeys()[source]

This is called when you declare the class, i.e. at “Class MyNewRow(Row) …”. It updates the class variables “keys” and “keyset”

get(collection, _id)[source]

Load one entry from db to QtWidgets

getName()[source]

Return a name of this class that can be displayed (instead of just the classname)

get_column_value(col_key)[source]

Gets a value from one column of the widget

makeWidget()[source]

Creates a Qt form, using the column structure

new(collection)[source]

New entry to collection

set_(dic)[source]

Sets the widget values

set_column_value(col_key, value)[source]

Sets the value of one column in the widget

update(collection, _id)[source]

Save from QtWidgets to collection

updateWidget()[source]

Updates the widgets. This is necessary if columns relate to documents that have been changed.