4.3.3. WorkspaceManager package

4.3.3.1. Submodules

4.3.3.2. WorkspaceManager.DirectorySpace module

class WorkspaceManager.DirectorySpace.DirectorySpace(name='', base_path='', relative_path='')[source]

Bases: Savable.Savable

A space based on a directory in the file system.

name

str

The name of the space.

base_path

str

The absolute path of the directory containing the space.

relative_path

str

The path of the directory space relatively to base_path.

subdirs

dict(str,str)

The useful subdirectories (path,name). The paths are the keys

qt_directory

QDir

The directory corresponding to that workspace

create_directory()[source]

Effectively creates the directory thanks to Qt object QDir

delete()[source]

Delete the directory space (and its contents).

Raises:AssertionError – If the directory does not exist or can not be deleted.
static deserialize(serial)[source]
full_path()[source]
classmethod load(base_path, file_name, object_class=None)[source]

Recreate a DirectorySpace object from a file.

Parameters:
  • base_path (str) – The path of the directory containing the file.
  • file_name (str) – The name of the file to load.
  • object_class (class) – The class of the object to recreate.
save(file_name)[source]

Save the object in the file system.

serialize()[source]

4.3.3.3. WorkspaceManager.Scene module

class WorkspaceManager.Scene.Scene(name, base_path, relative_path='')[source]

Bases: DirectorySpace.DirectorySpace

A scene containing all its images.

Class Attributes:
RECONSTRUCTION_OUTPUT_DIR RECONSTRUCTION_TEMP_DIR RECONSTRUCTION_PICTURE_DIR
name

str

The name of the scene. It must be unique in the workspace. For example : “Shooting ENSEEIHT”. Default is “scene_n” where n is the current number of scenes in workspace.

base_path

str

The path of the scene’s workspace.

relative_path

str

The path of the scene relatively to base_path.

subdirs

dict(str,str)

The useful subdirectories (path,name).

PICTURES_DIR = 'pictures_set'
RECONSTRUCTION_OUTPUT_DIR = 'reconstruction_output'
RECONSTRUCTION_PICTURE_DIR = 'reconstruction_pictures'
RECONSTRUCTION_TEMP_DIR = 'reconstruction_temp'
THUMBNAILS_DIR = 'thumbnails'
__str__()[source]

Change displaying of a scene.

Example

>>> print(scene)
delete()[source]

Delete the scene and remove its access from the workspace.

It must not be called by itself but by the workspace !

static deserialize(serial)[source]

Regenerate a Scene object from serialized data (JSON like).

Parameters:serial (dict()) – The serialized version of a Scene object.
get_reconstruction_out_dir()[source]
get_reconstruction_picture_dir()[source]
get_reconstruction_temp_dir()[source]
get_thumbnails_dir()[source]

4.3.3.4. WorkspaceManager.Workspace module

class WorkspaceManager.Workspace.Workspace(name='', base_path='', relative_path='')[source]

Bases: DirectorySpace.DirectorySpace

A workspace containing its own configuration and scenes.

name

str

The name of the workspace.

base_path

str

The absolute path of the directory containing the workspace.

relative_path

str

The path of the workspace relatively to base_path.

subdirs

dict(str,str)

The useful subdirectories (path,name).

scenes

dict(str,Scene)

The dictionnary of the scenes it contains. Keys are the scene paths.

current_scene

str

The path of the current scene.

qt_directory

QDir

The directory corresponding to that workspace.

pictureModel

PictureModel

A model for the view.

__str__()[source]

Change displaying of a workspace.

Example

>>> print(workspace)
delete()[source]

Delete the workspace (and its contents).

It must not be called by itself but by the workspace manager !

Raises:AssertionError – If the workspace directory does not exist or can not be deleted.
delete_scene(scene_path)[source]

Delete the scene identified by its local path.

Parameters:scene_path (str) – The path (relatively to the workspace) of the scene to delete.
static deserialize(serial)[source]

Recreate a Workspace object from its serialization.

Parameters:serial (dict()) – The serialized version of a Workspace object.
getPictureModel()[source]
get_current_scene()[source]

Get the current scene of the workspace.

Returns:

The current scene.

Return type:

Scene

Raises:
  • AssertionError – If no current scene.
  • AssertionError – If the current scene has disappeared.
new_scene(name='', path='')[source]

Add a new scene to the workspace.

Parameters:
  • name (str) – The name of the new scene
  • path (str) – The local path of the scene (inside workspace)
Raises:

AssertionError – If a scene with the same path already exists.

serialize()[source]

Serialize a Workspace object.

setPictureModel(pictureModel)[source]
set_current_scene(scene_path)[source]

Set the current scene.

Parameters:scene_path (str) – The relative path of the scene which will be the current scene.
Raises:AssertionError – If the scene does not exist in the workspace.

4.3.3.5. WorkspaceManager.WorkspaceManager module

class WorkspaceManager.WorkspaceManager.WorkspaceManager(pictureModel)[source]

Bases: object

Manages the workspace.

Will handle all interactions between user and modules and the working space. This class is responsible for managing files inside the workspace and for communicating any change through signals.

workspaces

dict(str,Workspace)

All the workspaces.

current_workspace

str

The current workspace.

workspaces_model

QStringListModel

The list model (for qml) of the workspaces.

scenes_model

QStringListModel

The list model (for qml) of the scenes in the current workspace.

pictureModel

PictureModel

The picture model

change_scene(scene_path)[source]

Change the current scene identified by its path in the current workspace.

Parameters:scene_path (str) – The relative path of the scene to select in the current workspace.
Raises:AssertionError – If the scene directory does not exist.
change_workspace(workspace_path)[source]

Change the current workspace.

Parameters:workspace_path (str) – The absolute path of the workspace to select.
close_workspace(workspace_path)[source]

Close the workspace (it is not visible anymore in the list of open workspaces. :param workspace_path: The absolute path of the workspace to close.

delete_scene(scene_path)[source]

Delete the scene identified by its path in the current workspace.

Parameters:scene_path (str) – The relative path of the scene to delete in the current workspace.
Raises:AssertionError – If the scene directory does not exist or can not be deleted.
delete_workspace(workspace_path)[source]

Delete the workspace identified by its abolute path.

Parameters:workspace_path (str) – The absolute path of the workspace to delete.
Raises:AssertionError – If the workspace directory does not exist or can not be deleted.
getPictureModel()[source]
get_current_scene()[source]
get_current_workspace()[source]

Get the current workspace.

Returns:

The current workspace.

Return type:

Workspace

Raises:
  • AssertionError – If no current workspace.
  • AssertionError – If the current workspace has disappeared.
get_picture_dir()[source]

Retrieve the folder where all pictures are stored

Returns:The absolute path to the folder
Return type:str
get_scene_output_dir()[source]

Returns the absolute path of the output directory for ply files.

Returns:The absolute path of directory.
Return type:str
get_scene_temp_output_dir()[source]

Returns the temporary output directory for scene reconstructions.

Returns:The absolute path of the temporary directory.
Return type:str
get_selected_picture_dir()[source]

Returns the absolute path of the directory containing the pictures used for reconstruction.

Returns:The absolute path of the picture directory.
Return type:str
get_thumbnails_dir()[source]
import_pictures(picturesPath)[source]

Import pictures from an external location into the workspace :param picturesPath: The list of path to import

new_scene(name='', path='')[source]

Create a new scene in the current workspace.

Parameters:
  • name (str) – The name of the scene.
  • path (str) – The relative path of the scene in the workspace.
Raises:

AssertionError – If there is no current workspace or the scene already exists.

new_workspace(name='', base_path='')[source]

Create a new workspace.

Parameters:
  • name (str) – The name of the workspace.
  • base_path (str) – The absolute path of the directory that will contain the new workspace.
open_workspace(directory_path, file_name)[source]

Open an existi ng workspace from a save file of the workspace.

Parameters:
  • directory_path (str) – The absolute path of the directory containing the file.
  • file_name (str) – The name of the file containing the save of the workspace.
prepare_reconstruction(picturesList)[source]

Copy all file describe in picturesList inside the temporary reconstruction folder

Parameters:picturesList (list<Picture>) – The list of pictures that should be copied
save_workspace(workspace_path, file_name='workspaceSettings')[source]

Save the workspace in a file.

Parameters:
  • workspace_path (str) – The absolute path of the workspace to save.
  • file_name (str) – The name of the file to save into.
setPictureModel(pictureModel)[source]
set_current_scene(scene_path)[source]

Change the current scene identified by its path in the current workspace.

Parameters:scene_path (str) – The relative path of the scene to select in the current workspace.
Raises:AssertionError – If the scene directory does not exist.
set_current_workspace(workspace_path)[source]

Set the current workspace.

Parameters:workspace_path (str) – The absolute path of the workspace which will be the current workspace.
Raises:AssertionError – If the workspace does not exist in the workspace manager.
update_scenes_model()[source]

Updates the attribute scenes_model.

update_workspaces_model()[source]

Updates the attribute workspaces_model.

4.3.3.6. Module contents