|
@@ -73,7 +73,12 @@ current_model = None
|
|
|
def _goto_mode(new_mode, model_name=None):
|
|
|
global mode
|
|
|
|
|
|
- if mode == MODE_MODELLING and new_mode == MODE_MODIFY:
|
|
|
+ if mode == MODE_MANUAL and new_mode == MODE_MODIFY:
|
|
|
+ if model_name != None and current_model != model_name:
|
|
|
+ raise InvalidMode("Mode error: cannot modify other models!")
|
|
|
+ else:
|
|
|
+ return
|
|
|
+ elif mode == MODE_MODELLING and new_mode == MODE_MODIFY:
|
|
|
# Are in root view, but want to modify a model
|
|
|
model_modify(model_name)
|
|
|
elif mode == MODE_MODIFY and new_mode == MODE_MODIFY and model_name != None and current_model != model_name:
|
|
@@ -86,7 +91,7 @@ def _goto_mode(new_mode, model_name=None):
|
|
|
return
|
|
|
else:
|
|
|
# Go to a mode that we have no automatic transfer to: raise exception
|
|
|
- raise InvalidMode()
|
|
|
+ raise InvalidMode("Required mode: %s, current mode: %s" % (new_mode, mode))
|
|
|
|
|
|
def _input(value):
|
|
|
# Ugly json encoding of primitives
|
|
@@ -362,9 +367,12 @@ def model_overwrite(model_name, new_model=None):
|
|
|
else:
|
|
|
compiled = ["exit"]
|
|
|
|
|
|
+ if mode == MODE_MODIFY:
|
|
|
+ _goto_mode(MODE_MODELLING)
|
|
|
+
|
|
|
if mode == MODE_MODELLING:
|
|
|
_input(["model_overwrite", model_name])
|
|
|
- elif mode == MODE_MODIFY or mode == MODE_MANUAL:
|
|
|
+ elif mode == MODE_MANUAL:
|
|
|
_input("upload")
|
|
|
else:
|
|
|
raise InvalidMode()
|
|
@@ -500,10 +508,8 @@ def transformation_execute_MANUAL(operation_name, input_models_dict, output_mode
|
|
|
_handle_output("Success: ready for MANUAL execution")
|
|
|
|
|
|
# Skip over the begin of mini_modify
|
|
|
- _output()
|
|
|
- _output()
|
|
|
- _output()
|
|
|
- _output()
|
|
|
+ _output() # Please perform manual operation X
|
|
|
+ _output() # Model loaded, ready for commands
|
|
|
|
|
|
# We are now executing, so everything we get is part of the dialog, except if it is the string for transformation termination
|
|
|
mode = MODE_MANUAL
|
|
@@ -598,10 +604,8 @@ def process_execute(process_name, prefix, callbacks):
|
|
|
if reply is not None:
|
|
|
_input(reply)
|
|
|
elif t == "ManualOperation":
|
|
|
- _output()
|
|
|
- _output()
|
|
|
- _output()
|
|
|
- _output()
|
|
|
+ _output() # Please perform manual operation X
|
|
|
+ _output() # Model loaded, ready for commands
|
|
|
mode = MODE_MANUAL
|
|
|
callback()
|
|
|
_input("exit")
|