Skip to content

Commit

Permalink
Merge pull request #6 from fzi-forschungszentrum-informatik/fix_creat…
Browse files Browse the repository at this point in the history
…e_subtree_from_nodes

Add generate subtree funcitonality..
  • Loading branch information
Oberacda authored Apr 4, 2024
2 parents 2fffbd3 + 14410c4 commit cee1d95
Show file tree
Hide file tree
Showing 3 changed files with 735 additions and 209 deletions.
22 changes: 22 additions & 0 deletions src/RosBtPy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ import {
} from "./types/services/SetExecutionMode";
import { SaveFileBrowser } from "./components/SaveFileBrowser";
import { LoadFileBrowser } from "./components/LoadFileBrowser";
import { GenerateSubtreeBrowser } from "./components/GenerateSubtreeFileBrowser";

interface AppState {
bt_namespace: string;
Expand Down Expand Up @@ -122,6 +123,7 @@ interface AppState {
messages_available: boolean;
node_search: string;
selected_node_name: string | null;
gen_subtree_msg: TreeMsg | null;
}

interface AppProps {}
Expand Down Expand Up @@ -218,6 +220,7 @@ export class RosBtPyApp extends Component<AppProps, AppState> {
messages_available: false,
node_search: "",
selected_node_name: null,
gen_subtree_msg: null,
};

this.nodes_fuse = null;
Expand Down Expand Up @@ -318,6 +321,7 @@ export class RosBtPyApp extends Component<AppProps, AppState> {
this.handleNodeSearchClear = this.handleNodeSearchClear.bind(this);
this.onNewRunningCommand = this.onNewRunningCommand.bind(this);
this.onRunningCommandCompleted = this.onRunningCommandCompleted.bind(this);
this.onGeneratedSubtreeChange = this.onGeneratedSubtreeChange.bind(this);
}

onTreeUpdate(msg: TreeMsg) {
Expand Down Expand Up @@ -1005,6 +1009,10 @@ export class RosBtPyApp extends Component<AppProps, AppState> {
}
}

onGeneratedSubtreeChange(tree_msg: TreeMsg | null) {
this.setState({ gen_subtree_msg: tree_msg });
}

render() {
let selectedNodeComponent = null;

Expand All @@ -1025,6 +1033,8 @@ export class RosBtPyApp extends Component<AppProps, AppState> {
onSelectionChange={this.onEditorSelectionChange}
onMultipleSelectionChange={this.onMultipleSelectionChange}
onSelectedEdgeChange={this.onSelectedEdgeChange}
onGenSubtreeChange={this.onGeneratedSubtreeChange}
onChangeFileModal={this.onChangeFileModal}
/>
);
} else if (this.state.selected_node === null) {
Expand Down Expand Up @@ -1228,6 +1238,18 @@ export class RosBtPyApp extends Component<AppProps, AppState> {
onSelectedStorageFolderChange={this.onSelectedStorageFolderChange}
/>
);
} else if (this.state.show_file_modal === "generate_subtree") {
modal_content = (
<GenerateSubtreeBrowser
ros={this.state.ros}
bt_namespace={this.state.bt_namespace}
onError={this.onError}
tree_message={this.state.gen_subtree_msg}
last_selected_folder={this.state.last_selected_storage_folder}
onChangeFileModal={this.onChangeFileModal}
onSelectedStorageFolderChange={this.onSelectedStorageFolderChange}
/>
);
}

return (
Expand Down
Loading

0 comments on commit cee1d95

Please sign in to comment.