dial_core.project.project_manager module

class dial_core.project.project_manager.ProjectManager(default_project)[source]

Bases: object

The ProjectManager class provides an interface that acts as a container for Project objects, and also has the necessary tools to create and open projects from files in the system.

Variables:active – Currently active project.
property active

Returns the currently active project.

The active project can be accessed directly by using this property.

See set_active_project to learn how to change the active project.

Return type:Project
add_project(project)[source]

Adds a project to the project manager and makes it the new active project.

Return type:Project
Returns:The recently added active project.
new_project()[source]

Adds a new default project to the project manager.

A copy of a default project (The one defined on the variable self.__default_project will be added)

Return type:Project
Returns:The recently added active project
open_project(file_path)[source]

Opens a new project from a .dial file.

Then, the project manager will automatically change its active project to the new opened one.

Return type:Project
Returns:The opened project (Which is the same as project_manager.active)
Raises:FileNotFoundError – If the file_path is invalid.
projects_count()[source]

Returns the number of created projects.

Return type:int
save_project()[source]

Saves the project on its defined file path.

The project MUST have a file path. Otherwise, it will throw a ValueError exception.

For saving a project specifying a new file path, see save_project_as.

Raises:ValueError – If the project doesn’t have a file_path defined.
save_project_as(file_path)[source]

Save the project on a new file path.

Once a project has been saved with save_project_as, it can also be saved with save_project, which will use the project’s file path automatically.

Important

The new file_path will be set as the project file path, replacing any previous paths.

set_active_project(index)[source]

Selects a project from the created ones and makes it the active project.

Return type:Project
Returns:The new active project.
Raises:IndexError – If there isn’t a project with index index.