Project management#
This section contains the classes related to Scade One projects.
from ansys.scadeone.core import ScadeOne, ProjectFile
with ScadeOne() as app:
project = app.load_project("project.sproj")
...
Project documentation#
This section gives the description of project class which is used to manage Scade One projects.
Projects are used by ScadeOne
objects, and projects have a link to
the application. To deal with the cross-links, we use the IProject
interface.
- class ansys.scadeone.core.project.Project(app: IScadeOne, project: ProjectStorage)#
Bases:
IProject
,ProjectCreator
This class is the entry point of a project.
- check_exists(parent_path: Path | str) bool #
Return true if any of the project modules or sproj already exists attention, dependencies may not be checked.
- dependencies(all=False) List[Project] #
Project dependencies as list of Projects.
If all is True, include recursively dependencies of dependencies.
A dependency occurs only once.
- save() None #
Save the project, that is all its modules.
Two cases:
new project, saving to the .sproj location
loaded project, saving and replacing old files
- swan_sources(all=False) List[SwanFile] #
Return all Swan sources from project.
If all is True, include also sources from project dependencies.
- Returns:
list
[SwanFile
]List of all SwanFile objects.
- property app: IScadeOne#
Access to current Scade One application.
- property data: _ProjectData#
Project JSON data.
- property storage: ProjectStorage#
Project storage.
Project items#
A project can manipulate different items saved using the storage module. The API handles projects and Swan sources (.swan and .swani files).
Project file#
- class ansys.scadeone.core.common.storage.ProjectFile(file: str | Path)#
Bases:
FileStorage
,ProjectStorage
Project as a file.
- dump(**kw)#
Uses self.json to update storage content and returns self.
See json.dumps() for detailed interface.
- load(**kw)#
Loads content of JSON data into json property and returns self.
See json.loads() for detailed interface.
- property json#
JSON content. Any modification is propagated to the underlying JSON object.
Swan code#
- class ansys.scadeone.core.common.storage.SwanFile(file: str | Path)#
Bases:
FileStorage
,SwanStorage
Swan code within a file.
- Parameters:
- file
Path
File containing the Swan source.
- file
- check_swan_version()#
Check Swan version information.
- Raises:
ScadeOneException
When version information is missing or invalid.
- check_swant_version()#
Check Swan test harness version information.
- Raises:
ScadeOneException
When version information is missing or invalid.
Footnotes