#include <qscilexerpython.h>
#endif
+#include <QToolButton>
#include <QSplitter>
#include <QTemporaryFile>
#include <QTextStream>
_glayout->setMargin(1);
splitter->addWidget(window);
+ //add an options section in ports layout for execution mode (local or remote)
+ QHBoxLayout* hboxLayout = new QHBoxLayout();
+ hboxLayout->setMargin(0);
+ QToolButton* tb_options = new QToolButton();
+ tb_options->setCheckable(true);
+ QIcon icon;
+ icon.addFile("icons:icon_down.png");
+ icon.addFile("icons:icon_up.png", QSize(), QIcon::Normal, QIcon::On);
+ tb_options->setIcon(icon);
+ hboxLayout->addWidget(tb_options);
+
+ QLabel* label = new QLabel("Execution Mode");
+ QFont font;
+ font.setBold(true);
+ font.setWeight(75);
+ label->setFont(font);
+ hboxLayout->addWidget(label);
+
+ _portslayout->addLayout(hboxLayout);
+
+ fr_options = new QFrame();
+ QHBoxLayout* hboxLayout1 = new QHBoxLayout(fr_options);
+ hboxLayout1->setMargin(0);
+ radiolocal= new QRadioButton("YACS");
+ radioremote= new QRadioButton("Container");
+ radiolocal->setChecked(true);
+ hboxLayout1->addWidget(radiolocal);
+ hboxLayout1->addWidget(radioremote);
+ hboxLayout->addWidget(fr_options);
+
fr_container = new QFrame();
QHBoxLayout* hboxLayout2 = new QHBoxLayout(fr_container);
hboxLayout2->setMargin(0);
}
connect(_sci, SIGNAL(textChanged()), this, SLOT(onScriptModified()));
+ connect(tb_options, SIGNAL(toggled(bool)), this, SLOT(on_tb_options_toggled(bool)));
+ connect(radioremote, SIGNAL(toggled(bool)), this, SLOT(on_remote_toggled(bool)));
connect(cb_container, SIGNAL(mousePressed()), this, SLOT(fillContainerPanel()));
connect(cb_container, SIGNAL(activated(int)), this, SLOT(changeContainer(int)));
update(UPDATE,0,0);
- changeContainer(0);
+ on_tb_options_toggled(false);
}
EditionScript::~EditionScript()
onApply();
}
+void EditionScript::on_tb_options_toggled(bool checked)
+{
+ DEBTRACE("EditionScript::on_tb_options_toggled " << checked);
+ _checked = checked;
+ if(_checked)
+ {
+ fr_options->show();
+ if(_remote) {
+ fr_container->show();
+ formcontainer->show();
+ }
+ }
+ else
+ {
+ fr_options->hide();
+ fr_container->hide();
+ formcontainer->hide();
+ }
+}
+
+void EditionScript::on_remote_toggled(bool checked)
+{
+ DEBTRACE("EditionScript::on_remote_toggled " << checked);
+ _remote=checked;
+ YACS::ENGINE::InlineNode *pyNode = dynamic_cast<YACS::ENGINE::InlineNode*>(_subInlineNode->getNode());
+ std::string mode = pyNode->getExecutionMode();
+ DEBTRACE(mode);
+
+ if(checked)
+ {
+ //remote radio button is checked
+ if(mode != "remote")
+ _subInlineNode->setExecutionMode("remote");
+ fr_container->show();
+ formcontainer->show();
+ fillContainerPanel();
+ }
+ else
+ {
+ //remote radio button is unchecked
+ if(mode != "local")
+ _subInlineNode->setExecutionMode("local");
+ fr_container->hide();
+ formcontainer->hide();
+ }
+}
+
void EditionScript::fillContainerPanel()
{
DEBTRACE("EditionScript::fillContainerPanel ");
int index = cb_container->findText(cont->getName().c_str());
cb_container->setCurrentIndex(index);
formcontainer->FillPanel(cont);
- }
+ }
+ else if (cb_container->count()) {
+ changeContainer(0);
+ }
}
void EditionScript::changeContainer(int index)
}
else if(event == UPDATE)
{
+ YACS::ENGINE::InlineNode *pyNode = dynamic_cast<YACS::ENGINE::InlineNode*>(_subInlineNode->getNode());
+ std::string mode = pyNode->getExecutionMode();
+ if(mode == "remote")
+ {
+ _remote=true;
+ radioremote->setChecked(true);
+ }
+ else if(mode == "local")
+ {
+ _remote=false;
+ radiolocal->setChecked(true);
+ }
+
fillContainerPanel();
}
}