The Screen class is a widget that provides an easy way of handling multiple views.
More...
List of all members.
Public Member Functions |
| def | setFocusToView |
| | Sets the focus to current view.
|
| def | setupViews |
| | Initializes the list of views using a types list and an ids list.
|
| def | setEmbedded |
| | Sets whether the screen is embedded.
|
| def | embedded |
| | Returns True if the Screen acts in embedded mode.
|
| def | setToolbarVisible |
| | Allows making the toolbar visible or hidden.
|
| def | setSearchFormVisible |
| | Allows making the search form visible or hidden.
|
| def | triggerAction |
| | This function is expected to be used as a slot for an Action trigger signal.
|
|
def | setView |
| | Sets the current widget of the Screen.
|
| def | search |
| | Searches with the current parameters of the search form and loads the models that fit the criteria.
|
| def | setRecordGroup |
| | Sets the RecordGroup this Screen should show.
|
| def | currentRecord |
| | Returns a reference the current record (Record).
|
| def | setCurrentRecord |
| | Sets the current record.
|
| def | switchView |
| | Switches the current view to the previous one.
|
| def | addViewByIdAndType |
| | Adds a view given it's id and type.
|
| def | addViewById |
| | Adds a view given its id.
|
| def | addViewByType |
| | Adds a view given a view type.
|
| def | addView |
| | Adds a view given it's XML description and fields.
|
| def | loadActions |
| | Loads all actions associated with the current model including plugins.
|
| def | new |
| | Creates a new record in the current model.
|
| def | newRecordPosition |
| | Returns 0 or -1 depending on new records policy for the current view.
|
| def | addOnTop |
| | Returns whether new records will be added on top or on the bottom.
|
| def | setOnWriteFunction |
| | Sets the on_write function.
|
| def | save |
| | Stores all modified models.
|
| def | reload |
| | Reload current model and refreshes the view.
|
| def | cancel |
| | Removes all new records and marks all modified ones as not loaded.
|
| def | currentView |
| | Returns a reference to the current view.
|
| def | get |
| | Returns a dictionary with all field values for the current record.
|
| def | isModified |
| | Returns True if any record has been modified.
|
| def | remove |
| | Removes all selected ids.
|
| def | load |
| | Loads the given ids to the RecordGroup and refreshes the view.
|
| def | display |
| | Displays the record with id 'id' or refreshes the current record if no id is given.
|
| def | displayNext |
| | Moves current record to the next one in the list and displays it in the current view.
|
| def | displayPrevious |
| | Moves current record to the previous one in the list and displays it in the current view.
|
| def | selectedIds |
| | Returns all selected record ids.
|
|
def | selectedRecords |
| | Returns all selected records.
|
| def | currentId |
| | Returns the current record id.
|
| def | clear |
| | Clears the list of records and refreshes the view.
|
|
def | storeViewSettings |
| | Stores settings of all opened views.
|
Detailed Description
The Screen class is a widget that provides an easy way of handling multiple views.
This class is capable of managing various views of the same model and provides functions for moving to the next and previous record.
If neither setViewTypes() nor setViewIds() are called, form and tree views (in this order) will be used. If you use only a single 'id' and say it's a 'tree', one you try to switchView the default 'form' view will be shown. If you only want to show the 'tree' view, use setViewTypes( [] ) or setViewTypes( ['tree'] ) When you add a new view by it's ID the type of the given view is removed from the list of view types. (See: addViewById() )
A Screen can emit four different signals: activated() -> Emited each time a record is activated (such as a double click on a list). closed() -> Emited when a view asks for the screen to be closed (such as a 'close' button on a form). currentChanged() -> Emited when the current record has been modified. recordMessage(int,int,int) -> Emited each time the current record changes (such as moving to previous or next).
Definition at line 69 of file Screen.py.
Member Function Documentation
| def Koo::Screen::Screen::Screen::addOnTop |
( |
|
self |
) |
|
Returns whether new records will be added on top or on the bottom.
Note that this is a property defined by the current view. If there's no current view it will return False.
Definition at line 646 of file Screen.py.
| def Koo::Screen::Screen::Screen::addView |
( |
|
self, |
|
|
|
arch, |
|
|
|
fields, |
|
|
|
display = False, |
|
|
|
toolbar = None, |
|
|
|
id = False | |
|
) |
| | |
Adds a view given it's XML description and fields.
- Parameters:
-
| arch | XML string: typically 'arch' field returned by model fields_view_get() function. |
| fields | Fields dictionary containing each field (widget) properties. |
| display | Whether you want the added view to be shown (True) or only loaded (False) |
| toolbar | Toolbar information as returned from fields_view_get server function. |
| id | View id. This parameter is used for storing and loading settings for the view. If id=False, no settings will be stored/loaded. |
- Returns:
- The view widget
Definition at line 541 of file Screen.py.
| def Koo::Screen::Screen::Screen::addViewById |
( |
|
self, |
|
|
|
id, |
|
|
|
display = False | |
|
) |
| | |
Adds a view given its id.
- Parameters:
-
| id | View id to load or False if you want to load given view_type. |
| display | Whether you want the added view to be shown (True) or only loaded (False). |
- Returns:
- The view widget
- See also:
- AddViewByType
-
AddViewByIdAndType
Definition at line 509 of file Screen.py.
| def Koo::Screen::Screen::Screen::addViewByIdAndType |
( |
|
self, |
|
|
|
id, |
|
|
|
type, |
|
|
|
display = False | |
|
) |
| | |
Adds a view given it's id and type.
This function is needed to resemble server's fields_view_get function. This function wasn't necessary but accounting module needs it because it tries to open a view with it's ID but reimplements fields_view_get and checks the view type.
- See also:
- AddViewById
-
AddViewByType
Definition at line 492 of file Screen.py.
| def Koo::Screen::Screen::Screen::addViewByType |
( |
|
self, |
|
|
|
type, |
|
|
|
display = False | |
|
) |
| | |
Adds a view given a view type.
- Parameters:
-
| type | View type ('form', 'tree', 'calendar', 'graph'...). |
| display | Whether you want the added view to be shown (True) or only loaded (False). |
- Returns:
- The view widget
- See also:
- AddViewById
-
AddViewByIdAndType
Definition at line 523 of file Screen.py.
| def Koo::Screen::Screen::Screen::cancel |
( |
|
self |
) |
|
Removes all new records and marks all modified ones as not loaded.
Definition at line 725 of file Screen.py.
| def Koo::Screen::Screen::Screen::clear |
( |
|
self |
) |
|
Clears the list of records and refreshes the view.
Note that this won't remove the records from the database. But clears the records from the model. It means that sometimes you might want to use setRecordGroup( None ) instead of calling clear(). This is what OneToMany and ManyToMany widgets do, for example.
- See also:
- remove()
Definition at line 889 of file Screen.py.
| def Koo::Screen::Screen::Screen::currentId |
( |
|
self |
) |
|
Returns the current record id.
Definition at line 875 of file Screen.py.
| def Koo::Screen::Screen::Screen::currentRecord |
( |
|
self |
) |
|
Returns a reference the current record (Record).
Definition at line 393 of file Screen.py.
| def Koo::Screen::Screen::Screen::currentView |
( |
|
self |
) |
|
Returns a reference to the current view.
Definition at line 740 of file Screen.py.
| def Koo::Screen::Screen::Screen::display |
( |
|
self, |
|
|
|
id = None | |
|
) |
| | |
Displays the record with id 'id' or refreshes the current record if no id is given.
Definition at line 821 of file Screen.py.
| def Koo::Screen::Screen::Screen::displayNext |
( |
|
self |
) |
|
Moves current record to the next one in the list and displays it in the current view.
Definition at line 830 of file Screen.py.
| def Koo::Screen::Screen::Screen::displayPrevious |
( |
|
self |
) |
|
Moves current record to the previous one in the list and displays it in the current view.
Definition at line 844 of file Screen.py.
| def Koo::Screen::Screen::Screen::embedded |
( |
|
self |
) |
|
Returns True if the Screen acts in embedded mode.
Definition at line 196 of file Screen.py.
| def Koo::Screen::Screen::Screen::get |
( |
|
self |
) |
|
Returns a dictionary with all field values for the current record.
Definition at line 750 of file Screen.py.
| def Koo::Screen::Screen::Screen::isModified |
( |
|
self |
) |
|
Returns True if any record has been modified.
Returns False otherwise.
Definition at line 757 of file Screen.py.
| def Koo::Screen::Screen::Screen::load |
( |
|
self, |
|
|
|
ids, |
|
|
|
addOnTop = False | |
|
) |
| | |
Loads the given ids to the RecordGroup and refreshes the view.
Definition at line 810 of file Screen.py.
| def Koo::Screen::Screen::Screen::loadActions |
( |
|
self, |
|
|
|
actions | |
|
) |
| | |
Loads all actions associated with the current model including plugins.
Definition at line 592 of file Screen.py.
| def Koo::Screen::Screen::Screen::new |
( |
|
self, |
|
|
|
default = True, |
|
|
|
context = None | |
|
) |
| | |
Creates a new record in the current model.
If the current view is not editable it will automatically switch to a view that allows editing.
Definition at line 612 of file Screen.py.
| def Koo::Screen::Screen::Screen::newRecordPosition |
( |
|
self |
) |
|
Returns 0 or -1 depending on new records policy for the current view.
If the view adds on top it will return 0, otherwise it will return -1
Definition at line 636 of file Screen.py.
| def Koo::Screen::Screen::Screen::reload |
( |
|
self |
) |
|
Reload current model and refreshes the view.
If the current view only shows a single record, only the current one will be reloaded. If the view shows multiple records it will reload the whole model.
Definition at line 687 of file Screen.py.
| def Koo::Screen::Screen::Screen::remove |
( |
|
self, |
|
|
|
unlink = False | |
|
) |
| | |
Removes all selected ids.
If unlink is False (the default) records are only removed from the list. If unlink is True records will be removed from the server too.
Definition at line 771 of file Screen.py.
| def Koo::Screen::Screen::Screen::save |
( |
|
self |
) |
|
Stores all modified models.
Definition at line 658 of file Screen.py.
| def Koo::Screen::Screen::Screen::search |
( |
|
self |
) |
|
Searches with the current parameters of the search form and loads the models that fit the criteria.
Definition at line 322 of file Screen.py.
| def Koo::Screen::Screen::Screen::selectedIds |
( |
|
self |
) |
|
Returns all selected record ids.
Note that if there are new unsaved records, they might all have ID=None. You're probably looking for selectedRecords() function.
- See also:
- selectedRecords
Definition at line 865 of file Screen.py.
| def Koo::Screen::Screen::Screen::setCurrentRecord |
( |
|
self, |
|
|
|
value | |
|
) |
| | |
Sets the current record.
Note that value will be a reference to the Record.
Definition at line 417 of file Screen.py.
| def Koo::Screen::Screen::Screen::setEmbedded |
( |
|
self, |
|
|
|
value | |
|
) |
| | |
Sets whether the screen is embedded.
Embedded screens don't show the search or toolbar widgets. By default embedded is True so it doesn't load unnecessary forms.
Definition at line 190 of file Screen.py.
| def Koo::Screen::Screen::Screen::setFocusToView |
( |
|
self |
) |
|
Sets the focus to current view.
Definition at line 148 of file Screen.py.
| def Koo::Screen::Screen::Screen::setOnWriteFunction |
( |
|
self, |
|
|
|
functionName | |
|
) |
| | |
Sets the on_write function.
That is the function (in the server) that must be called after storing a record.
Definition at line 654 of file Screen.py.
| def Koo::Screen::Screen::Screen::setRecordGroup |
( |
|
self, |
|
|
|
group | |
|
) |
| | |
Sets the RecordGroup this Screen should show.
- Parameters:
-
| group | RecordGroup object. |
Definition at line 357 of file Screen.py.
| def Koo::Screen::Screen::Screen::setSearchFormVisible |
( |
|
self, |
|
|
|
value | |
|
) |
| | |
Allows making the search form visible or hidden.
Definition at line 205 of file Screen.py.
| def Koo::Screen::Screen::Screen::setToolbarVisible |
( |
|
self, |
|
|
|
value | |
|
) |
| | |
Allows making the toolbar visible or hidden.
Definition at line 200 of file Screen.py.
| def Koo::Screen::Screen::Screen::setupViews |
( |
|
self, |
|
|
|
types, |
|
|
|
ids | |
|
) |
| | |
Initializes the list of views using a types list and an ids list.
Example:
screen.setupViews( ['tree','form'], [False, False] )
Definition at line 165 of file Screen.py.
| def Koo::Screen::Screen::Screen::switchView |
( |
|
self, |
|
|
|
viewType = None | |
|
) |
| | |
Switches the current view to the previous one.
If viewType (such as 'calendar') is given it will switch to that view type.
Definition at line 447 of file Screen.py.
| def Koo::Screen::Screen::Screen::triggerAction |
( |
|
self |
) |
|
This function is expected to be used as a slot for an Action trigger signal.
(as it will check the sender). It will call the Action.execute(id,ids) function.
Definition at line 256 of file Screen.py.
The documentation for this class was generated from the following file: