ui_main
¶
Contains ToolboxUI class.
author: |
|
---|---|
date: | 14.12.2017 |
Module Contents¶
-
class
ui_main.
ToolboxUI
[source]¶ Bases:
PySide2.QtWidgets.QMainWindow
Class for application main GUI functions.
-
init_project
(self)[source]¶ Initializes project at application start-up. Loads the last project that was open when app was closed or starts without a project if app is started for the first time.
-
create_project
(self, name, description)[source]¶ Create new project and set it active.
Parameters: - name (str) – Project name
- description (str) – Project description
-
open_project
(self, load_path=None)[source]¶ Load project from a save file (.proj) file.
Parameters: - load_path (str) – Path to project save file. If default value is used,
- file explorer dialog is opened where the user can select the (a) –
- file to load. (project) –
Returns: True when opening the project succeeded, False otherwise
Return type: bool
-
save_project_as
(self)[source]¶ Ask user for a new project name and save. Creates a duplicate of the open project.
-
init_models
(self, tool_template_paths)[source]¶ Initialize application internal data models.
Parameters: tool_template_paths (list) – List of tool definition file paths used in this project
-
init_project_item_model
(self)[source]¶ Initializes project item model. Create root and category items and add them to the model.
-
init_tool_template_model
(self, tool_template_paths)[source]¶ Initializes Tool template model.
Parameters: tool_template_paths (list) – List of tool definition file paths used in this project
-
init_connection_model
(self)[source]¶ Initializes a model representing connections between project items.
Initialize widgets that are shared among all ProjectItems of the same type.
-
item_selection_changed
(self, selected, deselected)[source]¶ Synchronize selection with scene. Check if only one item is selected and make it the active item: disconnect signals of previous active item, connect signals of current active item and show correct properties tab for the latter.
-
activate_item_tab
(self, item)[source]¶ Shows project item properties tab according to item type. Note: Does not work if a category item is given as argument.
Parameters: item (ProjectItem) – Instance of a project item
-
open_tool_template
(self)[source]¶ Open a file dialog so the user can select an existing tool template .json file. Continue loading the tool template into the Project if successful.
-
add_tool_template
(self, tool_template)[source]¶ Add a ToolTemplate instance to project, which then can be added to a Tool item. Add tool template definition file path into project file (.proj)
tool_template (ToolTemplate): Tool template that is added to project
-
update_tool_template
(self, row, tool_template)[source]¶ Update a Tool template and refresh Tools that use it.
Parameters: - row (int) – Row of tool template in ToolTemplateModel
- tool_template (ToolTemplate) – An updated Tool template
-
remove_tool_template
(self, index)[source]¶ Remove tool template from ToolTemplateModel and tool definition file path from project file. Removes also Tool templates from all Tool items that use this template.
-
remove_item
(self, ind, delete_item=False, check_dialog=False)[source]¶ Removes item from project when it’s index in the project model is known. To remove all items in project, loop all indices through this method. This method is used in both opening and creating a new project as well as when item(s) are deleted from project. Use delete_item=False when closing the project or creating a new one. Setting delete_item=True deletes the item irrevocably. This means that data directories will be deleted from the hard drive. Handles also removing the node from the dag graph that contains it.
Parameters: - ind (QModelIndex) – Index of removed item in project model
- delete_item (bool) – If set to True, deletes the directories and data associated with the item
- check_dialog (bool) – If True, shows ‘Are you sure?’ message box
-
open_anchor
(self, qurl)[source]¶ Open file explorer in the directory given in qurl.
Parameters: qurl (QUrl) – Directory path or a file to open
-
edit_tool_template
(self, index)[source]¶ Open the tool template widget for editing an existing tool template.
Parameters: index (QModelIndex) – Index of the item (from double-click or contex menu signal)
-
open_tool_template_file
(self, index)[source]¶ Open the Tool template definition file in the default (.json) text-editor.
Parameters: index (QModelIndex) – Index of the item
-
open_tool_main_program_file
(self, index)[source]¶ Open the tool template’s main program file in the default editor.
Parameters: index (QModelIndex) – Index of the item
-
connection_data_changed
(self, index)[source]¶ [OBSOLETE?] Called when checkbox delegate wants to edit connection data. Add or remove Link instance accordingly.
-
_handle_zoom_widget_minus_pressed
(self)[source]¶ Slot for handling case when ‘-‘ button in menu is pressed.
-
_handle_zoom_widget_plus_pressed
(self)[source]¶ Slot for handling case when ‘+’ button in menu is pressed.
-
_handle_zoom_widget_reset_pressed
(self)[source]¶ Slot for handling case when ‘reset zoom’ button in menu is pressed.
-
restore_dock_widgets
(self)[source]¶ Dock all floating and or hidden QDockWidgets back to the main window.
-
hide_tabs
(self)[source]¶ Hides project item info tab bar and connections tab in project item QTreeView. Makes (hidden) actions on how to show them if needed for debugging purposes.
-
toggle_tabbar_visibility
(self)[source]¶ Shows or hides the tab bar in project item info tab widget. For debugging purposes.
-
toggle_connections_tab_visibility
(self)[source]¶ Shows or hides connections tab in the project item QTreeView. For debugging purposes.
-
update_datetime
(self)[source]¶ Returns a boolean, which determines whether date and time is prepended to every Event Log message.
-
add_message
(self, msg)[source]¶ Append regular message to Event Log.
Parameters: msg (str) – String written to QTextBrowser
-
add_success_message
(self, msg)[source]¶ Append message with green text color to Event Log.
Parameters: msg (str) – String written to QTextBrowser
-
add_error_message
(self, msg)[source]¶ Append message with red color to Event Log.
Parameters: msg (str) – String written to QTextBrowser
-
add_warning_message
(self, msg)[source]¶ Append message with yellow (golden) color to Event Log.
Parameters: msg (str) – String written to QTextBrowser
-
add_process_message
(self, msg)[source]¶ Writes message from stdout to process output QTextBrowser.
Parameters: msg (str) – String written to QTextBrowser
-
add_process_error_message
(self, msg)[source]¶ Writes message from stderr to process output QTextBrowser.
Parameters: msg (str) – String written to QTextBrowser
Context menu for project items listed in the project QTreeView.
Parameters: pos (QPoint) – Mouse position
Context menu for project item images on the QGraphicsView.
Parameters: - pos (QPoint) – Mouse position
- name (str) – The name of the concerned item
Create and show project item context menu.
Parameters: - pos (QPoint) – Mouse position
- ind (QModelIndex) – Index of concerned item
Context menu for connection links.
Parameters: - pos (QPoint) – Mouse position
- link (Link(QGraphicsPathItem)) – The concerned link
Context menu for tool templates.
Parameters: pos (QPoint) – Mouse position
Create and show a context-menu in data connection properties references view.
Parameters: pos (QPoint) – Mouse position
Create and show a context-menu in data connection properties data view.
Parameters: pos (QPoint) – Mouse position
Create and show a context-menu in Tool properties if selected Tool has a Tool template.
Parameters: pos (QPoint) – Mouse position
Create and show a context-menu in View properties.
Parameters: pos (QPoint) – Mouse position
Create and show a context-menu in Data Interface properties source files view.
Parameters: pos (QPoint) – Mouse position
-
remove_refs_with_del_key
(self)[source]¶ Slot that removes selected references from the currently selected Data Connection. Used when removing DC references by pressing the Delete key on keyboard (Qt.Key_Delete).
-
remove_data_with_del_key
(self)[source]¶ Slot that removes selected data files from the currently selected Data Connection. Used when removing DC data files by pressing the Delete key on keyboard (Qt.Key_Delete).
-
close_view_forms
(self)[source]¶ Closes all GraphViewForm, TreeViewForm, and TabularViewForm instances opened in Data Stores and Views. Ensures that close() method is called on all corresponding DiffDatabaseMapping instances, which cleans up the databases. Also closes all SpineDatapackageWidget instances opened in Data Connections.
-