widgets.tool_template_widget

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

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

12.4.2018

Module Contents

class widgets.tool_template_widget.ToolTemplateWidget(toolbox, tool_template=None)[source]

Bases: PySide2.QtWidgets.QWidget

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

toolbox

QMainWindow instance

Type:ToolboxUI
tool_template

If given, the form is pre-filled with this template

Type:ToolTemplate
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]

Create a new blank main program file. Let user decide the file name and location.

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 template.

show_add_source_files_dialog(self, checked=False)[source]

Let user select source files for this tool template.

show_add_source_dirs_dialog(self, checked=False)[source]

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

add_dropped_includes(self, file_paths)[source]
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 template.

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 template.

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 template.

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.

ok_clicked(self)[source]

Check that everything is valid, create definition dictionary and add template to project.

call_add_tool_template(self)[source]

Add or update Tool Template according to user’s selections. If the name is the same as an existing tool template, it is updated and auto-saved to the definition file. (User is editing an existing tool template.) If the name is not in the tool template model, create a new tool template and offer to save the definition file. (User is creating a new tool template 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.