magneticalc.Project.Project

# ``magneticalc`.`Project`.`Project``

class documentation

`class Project(Config):`

Constructor: `Project(gui)`

View In Hierarchy

Project class.

Static Method | `get_default` | Gets the default project.
Method | `__init__` | Initializes the project class.
Method | `close` | Attempts to close the project, but lets user choose to cancel closing, or save/discard changes if there are any.
Method | `on_changed` | Gets called when the project changed.
Method | `open` | Opens a project from file.
Method | `open_default` | Opens the default project.
Method | `switch` | Closes the current project and opens another project.
Method | `validate` | Validates the project.
Instance Variable | `gui` | Undocumented

Inherited from `Config`:

Method | `cleanup` | Perform clean-up.
Method | `get_bool` | Gets boolean value, convert from string.
Method | `get_float` | Gets float value, convert from string.
Method | `get_generic` | Gets some "_key"-"_value" of data type "_type".
Method | `get_int` | Gets integer value, convert from string.
Method | `get_point` | Gets a single 3D point, convert from string.
Method | `get_points` | Gets list of 3D points, convert from string.
Method | `get_str` | Reads a configuration value.
Method | `load` | Loads the default configuration.
Method | `load_file` | Loads the configuration from file.
Method | `remove_key` | Removes a key from the configuration.
Method | `save_file` | Saves the configuration to file.
Method | `set_bool` | Sets boolean value, convert to string.
Method | `set_float` | Sets float value, convert to string.
Method | `set_generic` | Sets some "_key"-"_value" of data type "_type".
Method | `set_get_bool` | If value is not None, writes and returns key-value; otherwise (if value is None), reads and returns key-value.
Method | `set_get_dict` | If "values" is None, reads and returns all key-values in "types". Note: The actual keys saved in the configuration file are prefixed with "prefix", and suffixed with "suffix".
Method | `set_get_float` | If value is not None, writes and returns key-value; otherwise (if value is None), reads and returns key-value.
Method | `set_get_int` | If value is not None, writes and returns key-value; otherwise (if value is None), reads and returns key-value.
Method | `set_get_point` | If value is not None, writes and returns key-value; otherwise (if value is None), reads and returns key-value.
Method | `set_get_points` | If value is not None, writes and returns key-value; otherwise (if value is None), reads and returns key-value.
Method | `set_get_str` | If value is not None, writes and returns key-value; otherwise (if value is None), reads and returns key-value.
Method | `set_int` | Sets integer value, convert to string.
Method | `set_point` | Sets a single 3D point, convert to string.
Method | `set_points` | Sets list of 3D points, convert to string.
Method | `set_str` | Writes a configuration value.
Class Variable | `DebugAccess` | Undocumented
Instance Variable | `filename` | Undocumented
Instance Variable | `synced` | Undocumented
Instance Variable | `_parser` | Undocumented

@staticmethod
def get_default() -> `dict`:

Gets the default project.

Returns
`dict` | Dictionary

def __init__(self, gui: `GUI`):
overrides `magneticalc.Config.Config.__init__`

Initializes the project class.

Parameters
gui: `GUI` | GUI

def close(self, invalidate: `bool` = True) -> `bool`:

Attempts to close the project, but lets user choose to cancel closing, or save/discard changes if there are any.

Parameters
invalidate: `bool` | Enable to invalidate the GUI afterwards

Returns
`bool` | False if canceled, True if saved/discarded

def on_changed(self):
overrides `magneticalc.Config.Config.on_changed`

Gets called when the project changed.

def open(self, filename: `str`, reload: `bool` = True):

Opens a project from file.

Parameters
filename: `str` | Project filename
reload: `bool` | Enable to reload GUI

def open_default(self, reload: `bool` = True):

Opens the default project.

Parameters
reload: `bool` | Enable to reload GUI

def switch(self, filename: `str`):

Closes the current project and opens another project.

Parameters
filename: `str` | Project filename

def validate(self):

Validates the project.

gui =

Undocumented