From 8452269ec6c892bbabb99f5b31cf39ae6808d1af Mon Sep 17 00:00:00 2001 From: "eduardo.davila@creatis.insa-lyon.fr" Date: Thu, 16 Nov 2023 17:18:22 +0100 Subject: [PATCH] Clean code for Python --- .../bbtkwxGUIEditorGraphicBBS.cxx | 8 ++- .../wxVtkSceneManager.cxx | 61 ++++++++++--------- 2 files changed, 38 insertions(+), 31 deletions(-) diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx index f019a5c..02c8c3f 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/bbtkwxGUIEditorGraphicBBS.cxx @@ -963,10 +963,14 @@ void wxGUIEditorGraphicBBS::OnSaveActualDiagram(wxCommandEvent& event) { SaveActualDiagram(pathfilename); SaveActualComplexBox(pathfilenamebbs); } //if isActualDiagramComplexBox - std::string cmdPy("source ~/.bashrc; bbs2 "+pathfilenamebbs+" py" ); + std::string pathfilenamepy = pathfilenamebbs; + pathfilenamepy.replace( pathfilenamepy.length()-3, 3 , "py"); + std::string cmdPy("source ~/.bashrc; bbs2 "+pathfilenamebbs+" "+pathfilenamepy); printf("EED wxGUIEditorGraphicBBS::OnSaveActualDiagram cmd:%s\n", cmdPy.c_str() ); system( cmdPy.c_str() ); - std::string cmdjs("source ~/.bashrc; bbs2 "+pathfilenamebbs+" js" ); + std::string pathfilenamejs = pathfilenamebbs; + pathfilenamejs.replace( pathfilenamejs.length()-3, 3 , "js"); + std::string cmdjs("source ~/.bashrc; bbs2 "+pathfilenamebbs+" "+pathfilenamejs); printf("EED wxGUIEditorGraphicBBS::OnSaveActualDiagram cmd:%s\n", cmdjs.c_str() ); system( cmdjs.c_str() ); } diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx index 6684df1..efb1439 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxVtkSceneManager.cxx @@ -1601,7 +1601,6 @@ std::string wxVtkSceneManager::getDiagramBBS(bool wln) { //========================================================================= std::string wxVtkSceneManager::saveComplexBoxBBS() { - std::cout<<"wxVtkSceneManager::saveComplexBoxBBS"< packages; std::vector boxes; std::vector connections; @@ -1883,41 +1882,45 @@ void wxVtkSceneManager::saveDiagram(std::string &content) content += GetCbPackageName(); content += "\n"; - /* CHANGE TO THE VERSION 1.4 RaC2012 2nd HackFest - * External inputs are possible for applications and complex boxes - //Print info complex input ports - std::vector inputs = getComplexInputPorts(); - int insize = inputs.size(); - content += "COMPLEXINPUTS:"; - sprintf(buffer, "%d", insize); - content += buffer; - content += "\n"; + /* CHANGE TO THE VERSION 1.4 RaC2012 2nd HackFest + * External inputs are possible for applications and complex boxes + //Print info complex input ports + std::vector inputs = getComplexInputPorts(); + int insize = inputs.size(); + content += "COMPLEXINPUTS:"; + sprintf(buffer, "%d", insize); + content += buffer; + content += "\n"; + + for (int i = 0; i < insize; i++) { + int id = inputs[i]; + GObjectController *cont = _controllers[id]; + cont->getModel()->save(content); + } + */ + + //Print info complex output ports + std::vector outputs = getComplexOutputPorts(); + int outsize = outputs.size(); + content += "COMPLEXOUTPUTS:"; + sprintf(buffer, "%d", outsize); + content += buffer; + content += "\n"; + + for (int i = 0; i < outsize; i++) { + int id = outputs[i]; + GObjectController *cont = _controllers[id]; + cont->getModel()->save(content); + } + - for (int i = 0; i < insize; i++) { - int id = inputs[i]; - GObjectController *cont = _controllers[id]; - cont->getModel()->save(content); - } - */ - - //Print info complex output ports - std::vector outputs = getComplexOutputPorts(); - int outsize = outputs.size(); - content += "COMPLEXOUTPUTS:"; - sprintf(buffer, "%d", outsize); - content += buffer; - content += "\n"; - for (int i = 0; i < outsize; i++) { - int id = outputs[i]; - GObjectController *cont = _controllers[id]; - cont->getModel()->save(content); - } } // _isComplexBox else { content += "FALSE\n"; } + // CHANGE TO THE VERSION 1.4 RaC2012 2nd HackFest // External inputs are possible for applications and complex boxes std::vector inputs = getComplexInputPorts(); -- 2.47.1