diff --git a/GUI/server/odrive_server.py b/GUI/server/odrive_server.py
index 3f3ceef8..98d1a917 100644
--- a/GUI/server/odrive_server.py
+++ b/GUI/server/odrive_server.py
@@ -10,8 +10,16 @@ import time
import argparse
# interface for odrive GUI to get data from odrivetool
-#better handling of websockets
-# eventlet.monkey_patch()
+
+# Flush stdout by default
+# Source:
+# https://stackoverflow.com/questions/230751/how-to-flush-output-of-python-print
+old_print = print
+def print(*args, **kwargs):
+ kwargs.pop('flush', False)
+ old_print(*args, **kwargs)
+ file = kwargs.get('file', sys.stdout)
+ file.flush() if file is not None else sys.stdout.flush()
app = flask.Flask(__name__)
app.config['SECRET_KEY'] = 'secret'
@@ -178,7 +186,7 @@ def postVal(odrives, keyList, value, argType):
if argType == "number":
RO.set_value(float(value))
elif argType == "boolean":
- RO.set_value(value == "true")
+ RO.set_value(value)
else:
pass # dont support that type yet
except fibre.protocol.ChannelBrokenException:
diff --git a/GUI/src/components/controls/CtrlBoolean.vue b/GUI/src/components/controls/CtrlBoolean.vue
index e2286b8f..455d379c 100644
--- a/GUI/src/components/controls/CtrlBoolean.vue
+++ b/GUI/src/components/controls/CtrlBoolean.vue
@@ -3,13 +3,13 @@
{{name}}:
- {{value}}
- {{fakeValue}}
+ {{value}}
@@ -29,7 +29,6 @@ export default {
},
data() {
return {
- fakeValue: undefined,
}
},
computed: {
@@ -55,7 +54,6 @@ export default {
keys.shift();
putVal(keys.join('.'), e.target.checked);
fetchParam(keys.join('.'));
- this.fakeValue = e.target.checked;
},
deleteCtrl: function() {
// commit a mutation in the store with the relevant information
@@ -67,7 +65,6 @@ export default {
let keys = this.path.split('.');
keys.shift();
fetchParam(keys.join('.'));
- this.fakeValue = getVal(keys.join('.'));
}
};
diff --git a/GUI/src/components/wizard/choices/wizardEnd.vue b/GUI/src/components/wizard/choices/wizardEnd.vue
index fcc012db..e126232c 100644
--- a/GUI/src/components/wizard/choices/wizardEnd.vue
+++ b/GUI/src/components/wizard/choices/wizardEnd.vue
@@ -2,9 +2,9 @@
{{diff.path}}:
- {{diff.oldVal}}
+ {{diffRepresentation(diff.path,diff.oldVal)}}
⮕
- {{diff.newVal}}
+ {{diffRepresentation(diff.path,diff.newVal)}}
@@ -32,9 +32,9 @@ export default {
created() {
// flatten config tree into array of full variable paths
this.pathFromTree(this.config);
- for (const path of this.flatpaths){
- console.log(path);
- }
+ //for (const path of this.flatpaths){
+ // console.log(path);
+ //}
for (const path of this.flatpaths) {
let odrvObj = this.$store.state.odrives.odrive0;
let configObj = this.config;
@@ -43,24 +43,15 @@ export default {
configObj = configObj[key];
}
if (configObj != null) {
- let keys = path.split('.');
- if (Object.keys(enumVars).includes(keys[keys.length - 1])){
- // print old enum and new enum strings
- console.log(enumVars[keys[keys.length-1]]);
- this.configDiffs.push({path: path, oldVal: enumVars[keys[keys.length-1]][odrvObj["val"]], newVal: enumVars[keys[keys.length-1]][configObj]})
+ console.log("oldVal is " + odrvObj["val"] + " path is " + path);
+ if (Number.isInteger(parseFloat(odrvObj["val"]))){
+ this.configDiffs.push({path: path, oldVal: parseFloat(odrvObj["val"]), newVal: configObj});
+ }
+ else if (typeof configObj == 'boolean'){
+ this.configDiffs.push({path: path, oldVal: odrvObj["val"] == "True", newVal: configObj});
}
else {
- // display numeric or boolean value
- console.log("oldVal is " + parseFloat(odrvObj["val"]) + " path is " + path);
- if (Number.isInteger(parseFloat(odrvObj["val"]))){
- this.configDiffs.push({path: path, oldVal: parseFloat(odrvObj["val"]), newVal: configObj});
- }
- else if (typeof configObj == 'boolean'){
- this.configDiffs.push({path: path, oldVal: odrvObj["val"] == true, newVal: configObj == true});
- }
- else {
- this.configDiffs.push({path: path, oldVal: parseFloat(odrvObj["val"]).toExponential(3), newVal: configObj.toExponential(3)});
- }
+ this.configDiffs.push({path: path, oldVal: parseFloat(odrvObj["val"]), newVal: configObj});
}
}
}
@@ -86,6 +77,22 @@ export default {
console.log("applying " + diff.newVal + " to " + diff.path);
}
},
+ diffRepresentation(path, val) {
+ // for the diff view, check if the path indicates that a value is an Enum and return enum string
+ // otherwise, just the numeric value
+ let keys = path.split('.');
+ let retval;
+ if (Object.keys(enumVars).includes(keys[keys.length - 1])) {
+ retval = enumVars[keys[keys.length-1]][val];
+ }
+ else if (!Number.isInteger(val) && typeof val != 'boolean') {
+ retval = parseFloat(val).toExponential(3);
+ }
+ else {
+ retval = val;
+ }
+ return retval;
+ }
}
}
diff --git a/GUI/src/lib/odrive_utils.js b/GUI/src/lib/odrive_utils.js
index 9d64d91d..1678a077 100644
--- a/GUI/src/lib/odrive_utils.js
+++ b/GUI/src/lib/odrive_utils.js
@@ -33,6 +33,7 @@ export function fetchParam(path) {
}
export function putVal(path, value) {
+ console.log("path: " + path + ", val: " + value + ", type: " + typeof value);
socketio.sendEvent({
type: "setProperty",
data: {path: path, val: value, type: typeof value}