]> Creatis software - bbtk.git/commitdiff
#3502 combo box empty - python javascript
authorEduardo DAVILA <davila@creatis.insa-lyon.fr>
Fri, 2 Jun 2023 08:58:49 +0000 (10:58 +0200)
committerEduardo DAVILA <davila@creatis.insa-lyon.fr>
Fri, 2 Jun 2023 08:58:49 +0000 (10:58 +0200)
packages/std/src/bbstdConcatStrings.h
packages/vtk/src/bbvtkBinaryOperations.cxx
packages/vtk/src/bbvtkPolyDataToActor.h
packages/vtk/src/bbvtkUpdateRender.h
packages/wx/src/bbwxComboBox.cxx

index 625ac86d5144c0bb463770731bbddc81ab6adc57..ad0ac839c85b554230430c192aec03efa1fa7390 100644 (file)
@@ -67,7 +67,7 @@ namespace bbstd
   BBTK_NAME("ConcatStrings");
   BBTK_AUTHOR("jean-pierre.roux@creatis.insa-lyon.fr");
   BBTK_CATEGORY("misc");
-  BBTK_DESCRIPTION("String concatenation (C++,Python)");
+  BBTK_DESCRIPTION("String concatenation (C++,Python,JavaScript)");
   BBTK_INPUT(ConcatStrings,In1, "String 1", std::string,"");
   BBTK_INPUT(ConcatStrings,In2, "String 2", std::string,"");  
   BBTK_INPUT(ConcatStrings,In3, "String 3", std::string,"");  
index e65289adea8929978a0afb1413f4b4124c909384..b308540427ea9438c6b4b90519094283a796468b 100644 (file)
@@ -47,9 +47,11 @@ void BinaryOperations::Process()
 //    * TYPE is the C++ type of the input/output
 //      (the one provided in the attribute 'type' of the tag 'input')
 
+    
        if (bbGetInputIn1() == NULL)
        {
                printf( "EED Warning!!!  (%s)  BinaryOperations::Process  Set In1 at least", bbGetFullName().c_str() );
+        bbSetOutputOut(NULL);
                return;
        }
 
@@ -73,6 +75,7 @@ void BinaryOperations::Process()
 
        } else {
         printf( "EED Warning!!!  (%s)  BinaryOperations::Process  Set In2 at least", bbGetFullName().c_str() );
+        bbSetOutputOut(NULL);
         return;
        }
        switch (bbGetInputOperation())
index a01dcdb60648a4965b856b085531d26f8db9397d..b62a3ff9960d41cf2cc18eac2188acedda95c2cb 100644 (file)
@@ -103,7 +103,7 @@ namespace bbvtk
   BBTK_BEGIN_DESCRIBE_BLACK_BOX(PolyDataToActor,bbtk::AtomicBlackBox);
   BBTK_NAME("PolyDataToActor");
   BBTK_AUTHOR("eduardo.davila at creatis.insa-lyon.fr");
-  BBTK_DESCRIPTION("takes a vtkPolyData object to insert into a 3D scene (e.g. a Viewer3D) (C++,Python)");
+  BBTK_DESCRIPTION("takes a vtkPolyData object to insert into a 3D scene (e.g. a Viewer3D) (C++,Python,JavaScript)");
   typedef std::vector<double> vectorcolour;
   BBTK_CATEGORY("3D object creator");
   BBTK_INPUT(PolyDataToActor,In,"Input image",vtkPolyData*,"");
index 9f08d8fef7cf8b723ee1a7438563f1e40999c239..79164361330e4b84e24a1137cc9074fb93d74c33 100644 (file)
@@ -57,7 +57,7 @@ class bbvtk_EXPORT UpdateRender
 BBTK_BEGIN_DESCRIBE_BLACK_BOX(UpdateRender,bbtk::AtomicBlackBox);
 BBTK_NAME("UpdateRender");
 BBTK_AUTHOR("JLGR");
-BBTK_DESCRIPTION("refresh 3d scene");
+BBTK_DESCRIPTION("refresh 3d scene (JavaScript)");
 BBTK_CATEGORY("");
 BBTK_INPUT(UpdateRender,Renderer,"Render to update",vtkRenderer*,"");
 BBTK_INPUT(UpdateRender,Active,"Enable render update (default is false).",bool,"");
index f0c3cc5d23de828a180d3a8ed0fd9fafb7ac11d2..17bad20cf35cdd7df8aff196e98cccb37db359fa 100644 (file)
@@ -31,10 +31,7 @@ namespace bbwx
        void OnComboBox(wxEvent& event);
        void FillItems( int iSelection, std::vector< std::string > lstIn);
     void VerifyDeselect(int iSelection);
-
     void OnSpinCtrlClick(wxCommandEvent& event);
-
-
   private:
     int                        mTypeForm;
     ComboBox           *mBox;
@@ -74,14 +71,13 @@ namespace bbwx
 //    wxFlexGridSizer *sizerH1 = new wxFlexGridSizer(0);
 //    wxFlexGridSizer *sizerH2 = new wxFlexGridSizer(2);
     wxFlexGridSizer *sizer     = new wxFlexGridSizer(2);
-       
     if (title!="")
     {
           sizer->Add( new wxStaticText(panel,-1,  bbtk::std2wx(title) ) ); 
           sizer->Add( new wxStaticText(panel,-1,  _T("") ) ); 
     }
+      
     //---------------------------------------------------------------------
-        
        if (mTypeForm==1)
        {
                wxListBox *wxlistbox = new wxListBox ( panel , -1 , wxDefaultPosition,wxSize(sizeX,sizeY),0, NULL, wxLB_SINGLE );       
@@ -96,7 +92,6 @@ namespace bbwx
                Connect( wxchoice->GetId(), 
                  wxEVT_COMMAND_CHOICE_SELECTED, (wxObjectEventFunction) (void (wxPanel::*)(wxEvent&))&ComboBoxWidget::OnComboBox ); 
        }
-       
        if (mBox->bbGetInputWithSpinButton()==true)
        {
                mwxspinbutton = new wxSpinButton( panel, -1 );    
@@ -108,7 +103,6 @@ namespace bbwx
                sizer->Add( mwxspinbutton,1,wxEXPAND ); 
        }
     sizer->AddGrowableCol(0);
-
     panel->SetSizer(sizer);
        FillItems( iSelection,lstIn );  
   }
@@ -137,13 +131,11 @@ namespace bbwx
        {
                mBox->bbSetInputSelection( iSelection );
                mBox->bbSetOutputOut( iSelection );
-
 // Patch to clean the spaces at the begining 
                std::string tmpStr = bbtk::wx2std( itemcontainer->GetString(iSelection) );
                if (tmpStr.length()>0) { while(tmpStr[0]==' ') tmpStr.erase(0,1); }
                mBox->bbSetOutputOutString(   tmpStr   );
 //             mBox->bbSetOutputOutString(   bbtk::wx2std( itemcontainer->GetString(iSelection) )   );
-
                mBox->bbSignalOutputModification();
                VerifyDeselect(iSelection);
                if (mTypeForm==0) 
@@ -151,8 +143,6 @@ namespace bbwx
                        wxChoice *wxchoise=(wxChoice *)itemcontainer;
                        wxchoise->SetToolTip( itemcontainer->GetString(iSelection)    );
                } // if mTypeForm
-
-
 //             mBox->bbSignalOutputModification("Out");
 //             mBox->bbSignalOutputModification("OutString");
        } // if iSelection
@@ -167,7 +157,6 @@ void ComboBoxWidget::OnComboBox(wxEvent& event)
        {
                mwxspinbutton->SetValue( iSelection );
        }
-
 }
 
 //--------------------------------------------------------------------------
@@ -183,8 +172,6 @@ void ComboBoxWidget::OnSpinCtrlClick(wxCommandEvent& event)
 void ComboBoxWidget::FillItems( int iSelection, std::vector< std::string > lstIn )
 {
        int i,size = lstIn.size();
-
-
 #if defined(_WIN32)
        // Patch to put spaces at the beginin
 #else
@@ -208,7 +195,6 @@ void ComboBoxWidget::FillItems( int iSelection, std::vector< std::string > lstIn
        } // for i
      */
 #endif // defined(_WIN32)
-       
        itemcontainer->Clear();
        for (i=0;i<size; i++)
        {
@@ -224,7 +210,6 @@ void ComboBoxWidget::FillItems( int iSelection, std::vector< std::string > lstIn
                }
 
        } // iSelection
-
        if (mTypeForm==0) 
        { 
                ((wxChoice*)itemcontainer)->SetAutoLayout( true ); 
@@ -241,10 +226,12 @@ BBTK_BLACK_BOX_IMPLEMENTATION(ComboBox,bbtk::WxBlackBox);
 void ComboBox::Process()
 {
        int iSelection = bbGetInputSelection();
-//     if (bbGetInputSelection() >= bbGetInputIn().size()) { iSelection=bbGetInputIn().size()-1; }
-       if (bbGetInputSelection() >= bbGetInputIn().size()) { iSelection=0; }
+//     if (bbGetInputSelection() >= bbGetInputIn().size()) { iSelection = bbGetInputIn().size()-1; }
+       if (bbGetInputSelection() >= bbGetInputIn().size()) { iSelection = 0; }
+    if (bbGetInputIn().size()==0) { iSelection = -1; }
        ComboBoxWidget *w = (ComboBoxWidget*)bbGetOutputWidget();
-       if (w!=NULL) {
+       if (w!=NULL)
+    {
                w->FillItems( iSelection, bbGetInputIn() );
                bbSetInputSelection( iSelection );
                bbSetOutputOut( iSelection );
@@ -275,7 +262,6 @@ void ComboBox::CreateWidget(wxWindow* parent)
           bbSetOutputOutString( bbGetInputIn()[ bbGetInputSelection() ] );
    } // if InputIn size
    bbSetOutputWidget( w );
-   
 }
 //===== 
 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
@@ -290,12 +276,14 @@ void ComboBox::bbUserSetDefaultValues()
        bbSetInputDeselect(false);
        bbSetInputWithSpinButton(false);
 }
-//===== 
+
+//=====
 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
 //===== 
 void ComboBox::bbUserInitializeProcessing()
 {
 }
+
 //===== 
 // Before editing this file, make sure it's a file of your own (i.e.: it wasn't generated from xml description; if so : your modifications will be lost)
 //=====