Process¶
vtool.process_manager.process.Process ([name]) |
This class has functions to work on individual processes in the Process Manager. |
-
class
Process
(name=None)¶ This class has functions to work on individual processes in the Process Manager.
-
description
= ‘process’¶
-
data_folder_name
= ‘.data’¶
-
code_folder_name
= ‘.code’¶
-
process_data_filename
= ‘manifest.data’¶
-
set_directory
(directory)¶ Parameters: directory (str) – Directory path to the process that should be created or where an existing process lives.
-
set_external_code_library
(directory)¶ Parameters: directory (str,list) – Directory or list of directories where code can be sourced from. This makes it more convenient when writing scripts in a process.
-
is_process
()¶ Returns: Check to see if the initialized process is valid. Return type: bool
-
has_sub_parts
()¶
-
get_non_process_parts
()¶
-
get_path
()¶ Returns: The full path to the process folder. If the process hasn’t been created yet, this will return the directory set in set_directory. Return type: str
-
get_name
()¶ Returns: The name of the process. Return type: str
-
get_basename
()¶ Returns: The name of the process. If no name return basename of directory. Return type: str
-
get_relative_process
(relative_path)¶ Parameters: relative_path (str) – The path to a relative process. Returns: An instance of a process at the relative path. If a name with no backslash is supplied, this will return any matching process parented directly under the current process.
A relative path like, ‘../face’ or ‘../../other_character’ can be used.
Every ‘..’ signifies a folder above the current process.
Return type: Process
-
get_sub_process_count
()¶ Returns: The number of sub processes under the current. Return type: int
-
get_sub_processes
()¶ Returns: The process names found directly under the current process. Return type: list
-
get_sub_process
(part_name)¶ Parameters: part_name (str) – The name of a child process. Returns: A sub process if there is one that matches part_name. Return type: Process
-
get_sub_process_by_index
(index)¶
-
get_parent_process
()¶
-
get_empty_process
(path=None)¶
-
is_data_folder
(name)¶ Parameters: name (str) – The name of a data folder in the process. Returns: True if the supplied name string matches the name of the a data folder in the current process. Return type: bool
-
get_data_path
()¶ Returns: The path to the data folder for this process. Return type: str
-
get_data_folder
(name)¶ Parameters: name (str) – The name of a data folder in the process. Returns: The path to the data folder with the same name if it exists. Return type: str
-
get_data_type
(name)¶ Parameters: name (str) – The name of a data folder in the process. Returns: The name of the data type of the data folder with the same name if it exists. Return type: str
-
get_data_folders
()¶ Returns: A list of data folder names found in the current process. Return type: list
-
get_data_instance
(name)¶ Parameters: name (str) – The name of a data folder in the process. Returns: An instance of the data type class for data with the specified name in the current process. This gives access to the data functions like import_data found in the data type class.
Return type: Process
-
create_data
(name, data_type)¶ Parameters: - name (str) – The name of a data folder in the process.
- data_type (str) – A string with the name of the data type of the data in the process.
Returns: The path to the new data folder.
Return type: str
-
import_data
(name)¶ Convenience function which will run the import_data function found on the data_type instance for the specified data folder.
Parameters: name (str) – The name of a data folder in the process. Returns: None
-
open_data
(name)¶
-
save_data
(name, comment=”)¶ Convenience function that tries to run the save function function found on the data_type instance for the specified data folder. Not all data type instances have a save function.
Parameters: name (str) – The name of a data folder in the process. Returns: None
-
rename_data
(old_name, new_name)¶ Renames the data folder specified with old_name to the new_name.
Parameters: - old_name (str) – The current name of the data.
- new_name (str) – The new name for the data.
Returns: The new path to the data if rename was successful.
Return type: str
-
delete_data
(name)¶ Deletes the specified data folder from the file system.
Parameters: name (str) – The name of a data folder in the process. Returns: None
-
is_code_folder
(name)¶ Parameters: name (str) – The name of a code folder in the process. Returns: If the supplied name string matches the name of a code folder in the current process. Return type: bool
-
get_code_path
()¶ Returns: The path to the code folder for this process. Return type: str
-
get_code_folder
(name)¶ Parameters: name (str) – The name of a code folder in the process. Returns: A path to the code folder with the supplied name string if it exists. Return type: str
-
get_code_folders
(code_name=None)¶ Returns: A list of code folder names found in the current process. Return type: list
-
get_top_level_code_folders
()¶
-
get_code_type
(name)¶ Parameters: name (str) – The name of a code folder in the process. Returns: The code type name of the code folder with the supplied name if the code folder exists. Otherwise return None. Right now only python code type is used by the Process Manager. Return type: str
-
get_code_files
(basename=False)¶ Parameters: basename (bool) – Wether to return the full path or just the name of the file. Returns: The path to the code files found in the code folder for the current process. If basename is True, only return the file names without the path. Return type: list
-
get_code_file
(name, basename=False)¶ Parameters: - name (str) – The name of a code folder in the process.
- basename (bool) – Wether to return the full path or just the name of the file.
Returns: The path to the code file with the specified name in the current process.
Return type: str
-
get_code_name_from_path
(code_path)¶
-
create_code
(name, data_type=’script.python’, inc_name=False, import_data=None)¶ Create a new code folder with the specified name and data_type.
Parameters: - name (str) – The name of the code to create.
- data_type (str) – Usually ‘script.python’.
- inc_name (bool) – Wether or not to increment the name.
- import_data (str) – The name of data in the process.
- will be added to the code file to import the data. (Lines) –
Returns: Filename
Return type: str
-
move_code
(old_name, new_name)¶
-
rename_code
(old_name, new_name)¶ Renames the code folder specified with old_name to the new_name.
Parameters: - old_name (str) – The current name of the code.
- new_name (str) – The new name for the code.
Returns: The new path to the code if rename was successful.
Return type: str
-
delete_code
(name)¶ Deletes the specified data folder from the file system.
Parameters: name (str) – The name of a data folder in the process. Returns: None
-
get_setting_names
()¶
-
get_setting_file
(name)¶
-
get_settings_file
()¶
-
set_setting
(name, value)¶
-
get_setting
(name)¶
-
has_options
()¶
-
add_option
(name, value, group=None)¶
-
set_option
(name, value)¶
-
get_unformatted_option
(name, group)¶
-
get_option
(name, group=None)¶
-
get_options
()¶
-
get_option_file
()¶
-
clear_options
()¶
-
get_manifest_folder
()¶ Returns: The path to the manifest folder. Return type: str
-
get_manifest_file
()¶ Returns: The path to the manifest file. Return type: str
-
get_manifest_scripts
(basename=True)¶ Parameters: basename (bool) – Wether to return the full path or just the name of the file. Returns: The code files named in the manifest. Return type: list
-
is_in_manifest
(entry)¶
-
set_manifest
(scripts, states=[], append=False)¶ This will tell the manifest what scripts to list. Scripts is a list of python files that need to correspond with code data.
Parameters:
-
get_manifest
()¶ Returns: (list, list) Two lists, scripts and states. The scripts list contains the name of scripts in the manifest. States contains the enabled/disabled state of the script. Return type: tuple
-
sync_manifest
()¶ Sync the manifest with whats on disk.
-
load
(name)¶ Loads the named process into the instance.
Parameters: name (str) – Name of a process found in the directory. Returns: None
-
add_part
(name)¶ Parameters: name (str) – Name for a new process. Returns: Instnace of the added part. Return type: Process
-
create
()¶ Create the process.
- Retrun
- (str): Path to the process.
-
delete
()¶ Delete the process.
Returns: None
-
rename
(new_name)¶ Rename the process.
Parameters: new_name (str) – New name for the process. Returns: Wether or not the process was renamed properly. Return type: bool
-
run_script
(script, hard_error=True, settings=None)¶ Run a script in the process.
Parameters: - script (str) – Name of a code in the process.
- hard_error (bool) – Wether to error hard when errors encountered, or to just pass an error string.
Returns: The status from running the script. This includes error messages.
Return type: str
-
run
()¶ Run all the scripts in the manifest, respecting their on/off state.
Returns: None
-
set_runtime_value
(name, value)¶ This stores data to run between scripts.
Parameters: - name (str) – The name of the script.
- value – Can be many different types including str, list, tuple, float, int, etc.
Returns: None
-
get_runtime_value
(name)¶ Get the value stored with set_runtime_value.
Parameters: name (str) – The name given to the runtime value in set_runtime_value. Returns: The value stored in set_runtime_value.
-
get_runtime_value_keys
()¶ Get the runtime value dictionary keys. Every time a value is set with set_runtime_value, and dictionary entry is made.
Returns: keys in runtime value dictionary. Return type: list
-
set_runtime_dict
(dict_value)¶
-