controller¶
This module contains the Controller class.
The common scenario for controller is to ask connected model to make some data manipulation and then to ask suitable view to show data.
-
class
egegrouper.controller.
Controller
(model)[source]¶ Controller in MVC.
-
__init__
(self, model)[source]¶ Constructor. Set model.
Parameters: model (egegrouper.GrouperModel) – Model.
-
create_storage
(self, file_name)[source]¶ Create storage. Return True if success, None if an exception raised.
Parameters: file_name (str) – File name.
-
create_storage
(self, file_name)[source] Create storage. Return True if success, None if an exception raised.
Parameters: file_name (str) – File name.
-
delete_exam
(self, exam_id)[source]¶ Delete examination from storage. Return True if success, None if an exception raised.
Parameters: exam_id (str) – ID of examination to be deleted.
-
delete_group
(self, group_id)[source]¶ Delete group. Return True if success, None if an exception raised.
Parameters: group_id (str) – Group ID.
-
exam
(self, exam_id)[source]¶ Show information about selected examination. Return True if success, None if an exception raised.
Parameters: exam_id (str) – Examination ID.
-
export_exam_to_json_file
(self, exam_id, file_name)[source]¶ Export examination to JSON file. Return True if success, None if an exception raised.
Parameters: - exam_id (str) – Examination ID.
- file_name (str) – Name of JSON file.
-
group_exam
(self, exam_id, group_ids, placed_in)[source]¶ Add and delete examination to and from groups. Return True if success, None if an exception raised.
Parameters: - exam_id (str) – Examination identifier.
- group_ids (list of str) – Group identifiers.
- placed_in (list of bool) – True for examinations to be placed in groups. Length of group_ids must be equal to length of placed_in.
-
group_info
(self, group_id)[source]¶ Show list of examinations of group. Return True if success, None if an exception raised.
Parameters: group_id (str) – Group ID.
-
group_record
(self, group_id)[source]¶ Return group record.
Parameters: group_id (str) – Group ID. Returns: Attributes names and values. If an exception raised return None. Return type: OrderedDict
-
import_exams
(self, exams)[source]¶ Add exams to current storage. Return True if success, None if an exception raised.
Parameters: exams (list of sme.Examination) – Examinations to be added.
-
insert_group
(self, name, description)[source]¶ Add new group to current storage. Return True if success, None if an exception raised.
Parameters: - name (str) – Name of new group.
- description (str) – Description of new group.
-
merge_exams
(self, exam_id_1, exam_id_2)[source]¶ Merge two exams. Return True if success, None if an exception raised.
Create joined examination and put it to storage. Add measurements from examination 2 to examination 1.
Parameters: - exam_id_1 (str) – Examination 1 ID.
- exam_id_2 (str) – Examination 2 ID.
-
model_can_grumble
(method)[source]¶ Decorator. Try to do something and if model raises an exception return None.
Parameters: method – Method to decorate.
-
model_can_grumble
(method)[source] Decorator. Try to do something and if model raises an exception return None.
Parameters: method – Method to decorate.
-
open_or_create_storage
(self, file_name)[source]¶ Open or create storage. Return True if success, None if an exception raised.
If there are no data base it will be created.
Parameters: file_name (str) – File name.
-
open_or_create_storage
(self, file_name)[source] Open or create storage. Return True if success, None if an exception raised.
If there are no data base it will be created.
Parameters: file_name (str) – File name.
-
open_storage
(self, file_name)[source]¶ Open storage. Return True if success, None if an exception raised.
Parameters: file_name (str) – File name.
-
plot_exam
(self, exam_id)[source]¶ Plot signals of examination. Return True if success, None if an exception raised.
Parameters: exam_id (str) – Examination ID.
-
set_view_exam
(self, view)[source]¶ Set view for show information examination.
Parameters: view – View object.
-
set_view_exam_plot
(self, view)[source]¶ Set view for plot signals of examination.
Parameters: view – View object.
-
set_view_group
(self, view)[source]¶ Set view for show information about examinations in group.
Parameters: view – View object.
-
set_view_storage
(self, view)[source]¶ Set view for show information about storage: groups, number of examinations in groups and number of ungrouped examination.
Parameters: view – View object.
-
set_view_where_exam
(self, view)[source]¶ Set view for show groups in which examination is.
Parameters: view – View object.
-
show_message
(self, text)[source]¶ If controller has message view it asks view to show message.
Parameters: text (str) – Text of message.
-
show_message
(self, text)[source] If controller has message view it asks view to show message.
Parameters: text (str) – Text of message.
-
storage_info
(self)[source]¶ Show common information about storage. Return True if success, None if an exception raised.
-