spinetoolbox.widgets.tool_specification_widget

QWidget that is used to create or edit Tool specifications. In the former case it is presented empty, but in the latter it is filled with all the information from the specification being edited.

author:
  1. Marin (KTH), P. Savolainen (VTT)
date:

12.4.2018

Module Contents

class spinetoolbox.widgets.tool_specification_widget.ToolSpecificationWidget(toolbox, tool_specification=None)[source]

Bases: PySide2.QtWidgets.QWidget

A widget to query user’s preferences for a new tool specification.

Parameters:
  • toolbox (ToolboxUI) – QMainWindow instance
  • tool_specification (ToolSpecification) – If given, the form is pre-filled with this specification
connect_signals(self)[source]

Connect signals to slots.

populate_sourcefile_list(self, items)[source]

List source files in QTreeView. If items is None or empty list, model is cleared.

populate_inputfiles_list(self, items)[source]

List input files in QTreeView. If items is None or empty list, model is cleared.

populate_inputfiles_opt_list(self, items)[source]

List optional input files in QTreeView. If items is None or empty list, model is cleared.

populate_outputfiles_list(self, items)[source]

List output files in QTreeView. If items is None or empty list, model is cleared.

browse_main_program(self, checked=False)[source]

Open file browser where user can select the path of the main program file.

set_main_program_path(self, file_path)[source]

Set main program file and folder path.

new_main_program_file(self)[source]

Creates a new blank main program file. Let’s user decide the file name and path. Alternative version using only one getSaveFileName dialog.

new_source_file(self)[source]

Let user create a new source file for this tool specification.

show_add_source_files_dialog(self, checked=False)[source]

Let user select source files for this tool specification.

show_add_source_dirs_dialog(self, checked=False)[source]

Let user select a source directory for this tool specification. All files and sub-directories will be added to the source files.

add_dropped_includes(self, file_paths)[source]

Adds dropped file paths to Source files list.

add_single_include(self, path)[source]

Add file path to Source files list.

open_includes_file(self, index)[source]

Open source file in default program.

remove_source_files_with_del(self)[source]

Support for deleting items with the Delete key.

remove_source_files(self, checked=False)[source]

Remove selected source files from include list. Do not remove anything if there are no items selected.

add_inputfiles(self, checked=False)[source]

Let user select input files for this tool specification.

remove_inputfiles_with_del(self)[source]

Support for deleting items with the Delete key.

remove_inputfiles(self, checked=False)[source]

Remove selected input files from list. Do not remove anything if there are no items selected.

add_inputfiles_opt(self, checked=False)[source]

Let user select optional input files for this tool specification.

remove_inputfiles_opt_with_del(self)[source]

Support for deleting items with the Delete key.

remove_inputfiles_opt(self, checked=False)[source]

Remove selected optional input files from list. Do not remove anything if there are no items selected.

add_outputfiles(self, checked=False)[source]

Let user select output files for this tool specification.

remove_outputfiles_with_del(self)[source]

Support for deleting items with the Delete key.

remove_outputfiles(self, checked=False)[source]

Remove selected output files from list. Do not remove anything if there are no items selected.

handle_ok_clicked(self)[source]

Checks that everything is valid, creates Tool spec definition dictionary and adds Tool spec to project.

call_add_tool_specification(self)[source]

Adds or updates Tool specification according to user’s selections. If the name is the same as an existing tool specification, it is updated and auto-saved to the definition file. (User is editing an existing tool specification.) If the name is not in the tool specification model, creates a new tool specification and offer to save the definition file. (User is creating a new tool specification from scratch or spawning from an existing one).

keyPressEvent(self, e)[source]

Close Setup form when escape key is pressed.

Parameters:e (QKeyEvent) – Received key press event.
closeEvent(self, event=None)[source]

Handle close window.

Parameters:event (QEvent) – Closing event if ‘X’ is clicked.
_make_add_cmdline_tag_menu(self)[source]

Constructs a popup menu for the ‘@@’ button.

_insert_spaces_around_tag_in_args_edit(self, tag_length, restore_cursor_to_tag_end=False)[source]

Inserts spaces before/after @@ around cursor position/selection

Expects cursor to be at the end of the tag.

_add_cmdline_tag_url_inputs(self, _)[source]

Inserts @@url_inputs@@ tag to command line arguments.

_add_cmdline_tag_url_outputs(self, _)[source]

Inserts @@url_outputs@@ tag to command line arguments.

_add_cmdline_tag_data_store_url(self, _)[source]

Inserts @@url:<data-store-name>@@ tag to command line arguments and selects ‘<data-store-name>’.

_add_cmdline_tag_optional_inputs(self, _)[source]

Inserts @@optional_inputs@@ tag to command line arguments.