Class Project

class Project.Project

This class represents an InstantTerra project.

>>> from wysilab import InstantTerra
>>> it = InstantTerra()
>>> project = it.project  # Get the current project

Project.new()

Create a new project.

Warning

If the current project has not been saved, it will be lost!

>>> project.is_available()
False
>>> project.new()
>>> project.is_available()
True

Project.save(filename)

Parameters

filename (str) - Path of the project to save.

Raises
  • Exception - Raise an exception if there is no project to save.

  • Exception - Raise an exception if it is impossible to save the project.

Save the current project with the specified filename.

>>> project.save("my_project.terrain")

Project.open(filename)

Parameters

filename (str) - Path of the project to save.

Raises
  • FileNotFoundError - Raise an exception if the file was not found.

  • FileExistsError - Raise an exception if the file is not a valid InstantTerra project.

Open a project with the specified filename.

Warning

If the current project has not been saved, it will be lost!

>>> project.is_available()
False
>>> project.open("my_project.terrain")
>>> project.is_available()
True

Project.close()

Close the current project.

Warning

If the current project has not been saved, it will be lost!

>>> project.is_available()
True
>>> project.close()
>>> project.is_available()
False

Project.is_available()

Returns

True if the project exists, otherwise False.

Return type

bool

Returns the status of the current project.

>>> project.is_available()
True

Project.export_all()

Raises

IOError - Raise an exception if exports cannot be done.

Export all the nodes of the project

>>> project.export_all()

Project.graph

Type

Graph

Raises

ValueError - Impossible to override this attribute.

Access the project graph.

>>> graph = project.graph

Copyright © 2021 · All Rights Reserved · Wysilab