10.7. Module gui¶
The cerebro.gui module provides access to simple graphic interfaces, such as input dialogs, file selection, progress indicator, etc.
Functions
critical_box()
get_existing_directory()
get_open_file_name()
get_open_file_names()
get_save_file_name()
information_box()
message_editor()
question_box()
warning_box()
Classes
-
cerebro.gui.
get_existing_directory
(title)[source]¶ Parameters: title (string) – selection dialog title. Returns: path to the selected directory. Return type: string Displays a directory selection dialog and returns the selected one. If the user cancels selection, None returns.
dir = cerebro.gui.get_existing_directory('Select directory') if dir != None: print('Selected directory', dir)
-
cerebro.gui.
get_open_file_name
(title, filter='')[source]¶ Parameters: Returns: path to the selected file.
Return type: Displays a file selection dialog and returns the selected file. If the user cancels selection, None returns.
file = cerebro.gui.get_open_file_name('Select file', '*.txt') if file != None: print('Selected file:', file)
See also
-
cerebro.gui.
get_open_file_names
(title, filter='')[source]¶ Parameters: Returns: a list of paths to the selected files.
Return type: Displays a file selection dialog - with an option to select more than one file - and returns the selected file(s). If the user cancels selection, None returns.
files = cerebro.gui.get_open_file_names('Select files', '*.txt') if files != None: print('Selected files:', files)
See also
-
cerebro.gui.
get_save_file_name
(title, suffix, filename='')[source]¶ Parameters: Returns: path to the file.
Return type: Displays a dialog to select a file for saving and returns the selected file. If the user cancels selection, None returns.
file = cerebro.gui.get_save_file_name('Save file', 'txt') if file != None: print('File to be saved:', file)
-
cerebro.gui.
message_editor
(type, task_id, parent_message_id=None, html_text=None, attachments=None, attachment_as_links=None, work_time=None, status_id=None, client_visible=None)[source]¶ Parameters: - type (int) –
message type
. - task_id (int) – the ID of the task the message will added to.
- parent_message_id (int) – the ID of the parent message, i.e. the message to which this message is a response.
- html_text (string) – the text of the message in html format. The text can also be unformatted.
- attachments (list(string,)) – a list of files that will be attached to the message.
- attachment_as_links (list(string,)) – a list of files that will be attached to the message as links.
- work_time (float) – time in minutes.
- status_id (int) – the task status ID to which the task will be switched once the message has been sent.
- client_visible (bool) – If equal to True, the message is visible to clients.
Opens the standard unblocking message-editor window the next time a new message is sent to the task.
All arguments other than message type and task ID are optional. If it is not necessary to use certain message parameters, use the hex None instead.
Files or links to files in the lists ‘attachments’ and ‘attachment_as_links’ must have a full path.
To give a a task the ‘No Status’ status, set the argument ‘status_id’ to 0.
The ‘work_time’ argument should only be set for reports or reviews. If the message type is
"Отчет"
or"Отчет за ресурс"
, it indicates the time signed off (declared by the current message author). If the message type is"Рецензия"
, it indicates the time signed off and approved for the previous Report.current_task = cerebro.core.current_task() cerebro.gui.message_editor(cerebro.aclasses.AbstractMessage.TYPE_NOTE, current_task.id(), None, 'Test')
- type (int) –
-
cerebro.gui.
question_box
(title, text)[source]¶ Parameters: Returns: True, if the user pressed “Yes” button.
Return type: Displays a dialog with the question.