|
@@ -88,13 +88,13 @@ def _goto_mode(new_mode, model_name=None):
|
|
|
return
|
|
|
elif mode == MODE_MODELLING and new_mode == MODE_MODIFY:
|
|
|
# Are in root view, but want to modify a model
|
|
|
- model_modify(model_name)
|
|
|
+ _model_modify(model_name)
|
|
|
elif mode == MODE_MODIFY and new_mode == MODE_MODIFY and model_name != None and current_model != model_name:
|
|
|
# Are in modify mode, but want to modify a different model
|
|
|
- model_exit()
|
|
|
- model_modify(model_name)
|
|
|
+ _model_exit()
|
|
|
+ _model_modify(model_name)
|
|
|
elif mode == MODE_MODIFY and new_mode == MODE_MODELLING:
|
|
|
- model_exit()
|
|
|
+ _model_exit()
|
|
|
elif mode == new_mode:
|
|
|
return
|
|
|
else:
|
|
@@ -194,6 +194,48 @@ def _handle_output(requested=None, split=None):
|
|
|
else:
|
|
|
raise InterfaceMismatch(value)
|
|
|
|
|
|
+def _model_modify(model_name):
|
|
|
+ """Modify an existing model."""
|
|
|
+ # raises UnknownModel
|
|
|
+ # raises PermissionDenied
|
|
|
+ # raises UnknownError
|
|
|
+ global mode
|
|
|
+ global prev_mode
|
|
|
+
|
|
|
+ if mode == MODE_MANUAL:
|
|
|
+ prev_mode = MODE_MANUAL
|
|
|
+ mode = MODE_MODIFY
|
|
|
+ return None
|
|
|
+
|
|
|
+ _goto_mode(MODE_MODELLING)
|
|
|
+ prev_mode = MODE_MODELLING
|
|
|
+
|
|
|
+ _input(["model_modify", model_name])
|
|
|
+ _handle_output("Success")
|
|
|
+ global current_model
|
|
|
+ current_model = model_name
|
|
|
+ # Mode has changed
|
|
|
+ mode = MODE_MODIFY
|
|
|
+ _output("Model loaded, ready for commands!")
|
|
|
+
|
|
|
+def _model_exit():
|
|
|
+ """Leave model modify mode."""
|
|
|
+ # return None
|
|
|
+ # raises UnknownError
|
|
|
+ global mode
|
|
|
+ global prev_mode
|
|
|
+
|
|
|
+ if prev_mode == MODE_MANUAL:
|
|
|
+ mode = MODE_MANUAL
|
|
|
+ return
|
|
|
+
|
|
|
+ if mode != MODE_MODIFY:
|
|
|
+ raise InvalidMode()
|
|
|
+
|
|
|
+ _input("exit")
|
|
|
+ _output("Success")
|
|
|
+ mode = MODE_MODELLING
|
|
|
+
|
|
|
# Main MvC operations
|
|
|
def init(address_param="http://127.0.0.1:8001", timeout=20.0):
|
|
|
"""Starts up the connection to the Modelverse."""
|
|
@@ -295,30 +337,6 @@ def model_delete(model_name):
|
|
|
_input(["model_delete", model_name])
|
|
|
_handle_output("Success")
|
|
|
|
|
|
-def model_modify(model_name):
|
|
|
- """Modify an existing model."""
|
|
|
- # raises UnknownModel
|
|
|
- # raises PermissionDenied
|
|
|
- # raises UnknownError
|
|
|
- global mode
|
|
|
- global prev_mode
|
|
|
-
|
|
|
- if mode == MODE_MANUAL:
|
|
|
- prev_mode = MODE_MANUAL
|
|
|
- mode = MODE_MODIFY
|
|
|
- return None
|
|
|
-
|
|
|
- _goto_mode(MODE_MODELLING)
|
|
|
- prev_mode = MODE_MODELLING
|
|
|
-
|
|
|
- _input(["model_modify", model_name])
|
|
|
- _handle_output("Success")
|
|
|
- global current_model
|
|
|
- current_model = model_name
|
|
|
- # Mode has changed
|
|
|
- mode = MODE_MODIFY
|
|
|
- _output("Model loaded, ready for commands!")
|
|
|
-
|
|
|
def model_list():
|
|
|
"""List all models."""
|
|
|
# return [(model1, metamodel1), (model2, metamodel2), ...]
|
|
@@ -925,23 +943,7 @@ def read_association_destination(model_name, ID):
|
|
|
_input(["read_association_destination", ID])
|
|
|
return _handle_output("Success: ", split=" ")
|
|
|
|
|
|
-def model_exit():
|
|
|
- """Leave model modify mode."""
|
|
|
- # return None
|
|
|
- # raises UnknownError
|
|
|
- global mode
|
|
|
- global prev_mode
|
|
|
-
|
|
|
- if prev_mode == MODE_MANUAL:
|
|
|
- mode = MODE_MANUAL
|
|
|
- return
|
|
|
-
|
|
|
- if mode != MODE_MODIFY:
|
|
|
- raise InvalidMode()
|
|
|
-
|
|
|
- _input("exit")
|
|
|
- _output("Success")
|
|
|
- mode = MODE_MODELLING
|
|
|
+##### To document:
|
|
|
|
|
|
def service_register(name, function):
|
|
|
"""Register a function as a service with a specific name."""
|
|
@@ -981,3 +983,19 @@ def service_get(port):
|
|
|
def service_set(port, value):
|
|
|
"""Set a value on a specified port."""
|
|
|
_input(value, port=port)
|
|
|
+
|
|
|
+def password_change(user, password):
|
|
|
+ """Change a user's password."""
|
|
|
+ raise NotImplementedError()
|
|
|
+
|
|
|
+def transformation_read_signature(transformation):
|
|
|
+ """Reads an operation's signature, specifying the names and their required types."""
|
|
|
+ raise NotImplementedError()
|
|
|
+
|
|
|
+def element_list_nice(model_name):
|
|
|
+ """Fetches a nice representation of models."""
|
|
|
+ raise NotImplementedError()
|
|
|
+
|
|
|
+def connections_between(model_name, source_element, target_element):
|
|
|
+ """Gets a list of all allowed connections between the source and target element in the model."""
|
|
|
+ raise NotImplementedError()
|