Skip to content

Commit

Permalink
Fix bool bug and save cancellation
Browse files Browse the repository at this point in the history
  • Loading branch information
NiceneNerd committed Apr 10, 2021
1 parent 6ad8244 commit 9cfdfa4
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion plasticity_ai/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION = "0.5.0"
VERSION = "0.5.1"

from sys import argv

Expand Down
2 changes: 1 addition & 1 deletion plasticity_ai/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def save_file(self, params):
if result:
open_path = Path(result if isinstance(result, str) else result[0])
else:
return {"success": False}
return {"success": False, "error": "cancel"}
try:
pio = self._decoder.object_hook(params["pio"])
if open_path.suffix == ".yml":
Expand Down
2 changes: 1 addition & 1 deletion plasticity_ai/assets/scripts/bundle.js

Large diffs are not rendered by default.

11 changes: 7 additions & 4 deletions plasticity_ai/assets/src/js/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,13 @@ export default class App extends Component {
pio: this.state.aiprog.clone_pio(),
path
});
if (response.error)
alert(
`The following error occured when saving this file: ${response.error}`
);
if (response.error) {
if (response.error != "cancel")
alert(
`The following error occured when saving this file: ${response.error}`
);
this.setState({ loading: false });
}
else this.setState({ modified: false, path, loading: false });
}

Expand Down
2 changes: 1 addition & 1 deletion plasticity_ai/assets/src/js/Components.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class ParamInput extends Component {
let new_val;
switch (this.type) {
case "Bool":
new_val = { bool: $(`#${this.props.param}`).prop("checked") };
new_val = { Bool: $(`#${this.props.param}`).prop("checked") };
break;
case "Int":
case "U32":
Expand Down
1 change: 1 addition & 0 deletions plasticity_ai/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ def _to_param(self, obj) -> Parameter:
"F32": lambda p: float(p["F32"]),
"String32": lambda p: oead.FixedSafeString32(str(p["String32"])),
"Bool": lambda p: bool(p["Bool"]),
"bool": lambda p: bool(p["Bool"]),
"Vec3": lambda p: self._construct_vec3(p["Vec3"]),
}
return Parameter(enc_map.get(next(iter(obj)), lambda x: x)(obj))
Expand Down

0 comments on commit 9cfdfa4

Please sign in to comment.