21 #include <kross/core/action.h>
22 #include <kross/core/manager.h>
27 _dataStructures = dataStructures;
42 qDebug() <<
"entering the Execute part";
44 if (_backend ==
"javascript") {
45 qDebug() <<
"implementing the jsDefaults";
47 }
else if (_backend ==
"python") {
48 qDebug() <<
"implementing the Python Defaults";
50 }
else if (_backend ==
"ruby") {
51 qDebug() <<
"implementing the Ruby Defaults ";
54 qDebug() <<
"Backend Not Implemented Yet.";
57 qDebug() <<
"creating the action";
58 Kross::Action *action =
new Kross::Action(0,
"myScript");
60 qDebug() <<
"setting the backend" << _backend.toAscii();
61 action->setInterpreter(_backend);
62 qDebug() <<
"interpreter set.";
68 foreach(
const QVariant & v, (*_dataStructures)) {
69 qDebug() <<
"Got inside of the foreach";
72 qDebug() <<
"Graph is NULL";
75 if (g->property(
"name") != QVariant()) {
76 qDebug() <<
"adding the Graph " << g->property(
"name").toString().toAscii();
77 action->addObject(g, g->property(
"name").toString());
94 QString codeToBeExecuted =
"";
96 codeToBeExecuted += _autoGeneratedScript;
97 codeToBeExecuted += _script;
98 qDebug() <<
"Code to be Executed: \n" << codeToBeExecuted.toAscii();
99 qDebug() <<
" \nsetting the code";
100 action->setCode(codeToBeExecuted.toAscii());
102 qDebug() <<
"triggering the code";
105 qDebug() <<
"triggering the action";
110 void KrossBackend::javaDefaults()
115 void KrossBackend::raptorDefaults()
120 void KrossBackend::pyDefaults()
122 _autoGeneratedScript.clear();
127 foreach(
const QVariant & v, (*_dataStructures)) {
129 _autoGeneratedScript +=
"# -*- coding: utf-8 -*- \n";
130 if (g->property(
"name") != QVariant()) {
131 _autoGeneratedScript +=
"import ";
132 _autoGeneratedScript += g->property(
"name").toString();
133 _autoGeneratedScript +=
'\n';
139 void KrossBackend::rbDefaults()
141 _autoGeneratedScript.clear();
146 foreach(
const QVariant & v, (*_dataStructures)) {
148 if (g->property(
"name") != QVariant()) {
149 _autoGeneratedScript +=
"require '";
150 _autoGeneratedScript += g->property(
"name").toString();
151 _autoGeneratedScript +=
"' \n";
157 void KrossBackend::jsDefaults()
162 void KrossBackend::luaDefaults()
167 void KrossBackend::csDefaults()
174 qDebug() <<
"Got in here";
178 if (!f.open(QIODevice::ReadOnly | QIODevice::Text)) {
179 qDebug() <<
"File not found";
183 while (! f.atEnd()) {
184 QByteArray line = f.readLine();
void loadFile(const QString &file)
void setScript(const QString &s)
Kross::Action * execute()
void setBackend(const QString &backend)
KrossBackend(QVariantList *dataStructures)