Commit bcd373bb authored by Sylvain Thery's avatar Sylvain Thery

python recording...

parent 4f4e657d
...@@ -216,6 +216,10 @@ void Surface_DifferentialProperties_Plugin::computeNormal( ...@@ -216,6 +216,10 @@ void Surface_DifferentialProperties_Plugin::computeNormal(
ComputeNormalParameters(positionAttributeName, normalAttributeName, autoUpdate); ComputeNormalParameters(positionAttributeName, normalAttributeName, autoUpdate);
mh->notifyAttributeModification(normal); mh->notifyAttributeModification(normal);
//this->pythonRecording("computeNormal", "", mh->getName(), QString(position.name().c_str()), QString(normal.name().c_str()), autoUpdate);
this->pythonRecording("computeNormal", "", mh->getName(), positionAttributeName, normalAttributeName, autoUpdate);
} }
...@@ -307,6 +311,9 @@ void Surface_DifferentialProperties_Plugin::computeCurvature( ...@@ -307,6 +311,9 @@ void Surface_DifferentialProperties_Plugin::computeCurvature(
mh->notifyAttributeModification(kgaussian); mh->notifyAttributeModification(kgaussian);
} }
this->pythonRecording("computeCurvature", "", mh->getName(),
positionAttributeName, normalAttributeName, KmaxAttributeName, kmaxAttributeName, KminAttributeName, kminAttributeName, KnormalAttributeName, compute_kmean, compute_kgaussian, autoUpdate);
} }
void Surface_DifferentialProperties_Plugin::schnappsClosing() void Surface_DifferentialProperties_Plugin::schnappsClosing()
......
...@@ -30,6 +30,14 @@ MapHandlerGen* Surface_Import_Plugin::importFromFile(const QString& fileName) ...@@ -30,6 +30,14 @@ MapHandlerGen* Surface_Import_Plugin::importFromFile(const QString& fileName)
QFileInfo fi(fileName); QFileInfo fi(fileName);
if(fi.exists()) if(fi.exists())
{ {
// RECORDING
//QTextStream* rec = m_schnapps->pythonStreamRecorder();
//if (rec)
// *rec << fi.baseName() << " = " << this->getName() << ".importFromFile(\"" << fileName << "\");" << endl;
pythonRecording("importFromFile", fi.baseName(), fileName);
MapHandlerGen* mhg = m_schnapps->addMap(fi.baseName(), 2); MapHandlerGen* mhg = m_schnapps->addMap(fi.baseName(), 2);
if(mhg) if(mhg)
{ {
......
...@@ -77,6 +77,7 @@ void Surface_Render_DockTab::colorSelected(const QColor& col) ...@@ -77,6 +77,7 @@ void Surface_Render_DockTab::colorSelected(const QColor& col)
m_plugin->h_viewParameterSet[view][map].diffuseColor = rgbCol; m_plugin->h_viewParameterSet[view][map].diffuseColor = rgbCol;
view->updateGL(); view->updateGL();
} }
m_plugin->pythonRecording("changeFaceColor", "", view->getName(), map->getName(), rgbCol[0], rgbCol[1], rgbCol[2]);
} }
if (m_currentColorDial == 2) if (m_currentColorDial == 2)
...@@ -94,6 +95,7 @@ void Surface_Render_DockTab::colorSelected(const QColor& col) ...@@ -94,6 +95,7 @@ void Surface_Render_DockTab::colorSelected(const QColor& col)
m_plugin->h_viewParameterSet[view][map].simpleColor = rgbCol; m_plugin->h_viewParameterSet[view][map].simpleColor = rgbCol;
view->updateGL(); view->updateGL();
} }
m_plugin->pythonRecording("changeEdgeColor", "", view->getName(), map->getName(), rgbCol[0], rgbCol[1], rgbCol[2]);
} }
if (m_currentColorDial == 3) if (m_currentColorDial == 3)
...@@ -111,6 +113,7 @@ void Surface_Render_DockTab::colorSelected(const QColor& col) ...@@ -111,6 +113,7 @@ void Surface_Render_DockTab::colorSelected(const QColor& col)
m_plugin->h_viewParameterSet[view][map].vertexColor = rgbCol; m_plugin->h_viewParameterSet[view][map].vertexColor = rgbCol;
view->updateGL(); view->updateGL();
} }
m_plugin->pythonRecording("changVertexColor", "", view->getName(), map->getName(), rgbCol[0], rgbCol[1], rgbCol[2]);
} }
} }
...@@ -129,6 +132,7 @@ void Surface_Render_DockTab::positionVBOChanged(int index) ...@@ -129,6 +132,7 @@ void Surface_Render_DockTab::positionVBOChanged(int index)
m_plugin->h_viewParameterSet[view][map].positionVBO = map->getVBO(combo_positionVBO->currentText()); m_plugin->h_viewParameterSet[view][map].positionVBO = map->getVBO(combo_positionVBO->currentText());
view->updateGL(); view->updateGL();
} }
m_plugin->pythonRecording("changePositionVBO", "", view->getName(), map->getName(), combo_positionVBO->currentText());
} }
} }
...@@ -143,6 +147,7 @@ void Surface_Render_DockTab::normalVBOChanged(int index) ...@@ -143,6 +147,7 @@ void Surface_Render_DockTab::normalVBOChanged(int index)
m_plugin->h_viewParameterSet[view][map].normalVBO = map->getVBO(combo_normalVBO->currentText()); m_plugin->h_viewParameterSet[view][map].normalVBO = map->getVBO(combo_normalVBO->currentText());
view->updateGL(); view->updateGL();
} }
m_plugin->pythonRecording("changeNormalVBO","", view->getName(), map->getName(), combo_normalVBO->currentText());
} }
} }
...@@ -157,6 +162,7 @@ void Surface_Render_DockTab::renderVerticesChanged(bool b) ...@@ -157,6 +162,7 @@ void Surface_Render_DockTab::renderVerticesChanged(bool b)
m_plugin->h_viewParameterSet[view][map].renderVertices = b; m_plugin->h_viewParameterSet[view][map].renderVertices = b;
view->updateGL(); view->updateGL();
} }
m_plugin->pythonRecording("changeRenderVertices", "", view->getName(), map->getName(), b);
} }
} }
...@@ -171,6 +177,7 @@ void Surface_Render_DockTab::verticesScaleFactorChanged(int i) ...@@ -171,6 +177,7 @@ void Surface_Render_DockTab::verticesScaleFactorChanged(int i)
m_plugin->h_viewParameterSet[view][map].verticesScaleFactor = i / 50.0; m_plugin->h_viewParameterSet[view][map].verticesScaleFactor = i / 50.0;
view->updateGL(); view->updateGL();
} }
m_plugin->pythonRecording("changeVerticesScaleFactor", "", view->getName(), map->getName(), i / 50.0);
} }
} }
...@@ -185,6 +192,7 @@ void Surface_Render_DockTab::renderEdgesChanged(bool b) ...@@ -185,6 +192,7 @@ void Surface_Render_DockTab::renderEdgesChanged(bool b)
m_plugin->h_viewParameterSet[view][map].renderEdges = b; m_plugin->h_viewParameterSet[view][map].renderEdges = b;
view->updateGL(); view->updateGL();
} }
m_plugin->pythonRecording("changeRenderEdges", "", view->getName(), map->getName(), b);
} }
} }
...@@ -199,6 +207,7 @@ void Surface_Render_DockTab::renderFacesChanged(bool b) ...@@ -199,6 +207,7 @@ void Surface_Render_DockTab::renderFacesChanged(bool b)
m_plugin->h_viewParameterSet[view][map].renderFaces = b; m_plugin->h_viewParameterSet[view][map].renderFaces = b;
view->updateGL(); view->updateGL();
} }
m_plugin->pythonRecording("changeRenderFaces", "", view->getName(), map->getName(), b);
} }
} }
...@@ -216,6 +225,7 @@ void Surface_Render_DockTab::faceStyleChanged(QAbstractButton* b) ...@@ -216,6 +225,7 @@ void Surface_Render_DockTab::faceStyleChanged(QAbstractButton* b)
m_plugin->h_viewParameterSet[view][map].faceStyle = MapParameters::PHONG; m_plugin->h_viewParameterSet[view][map].faceStyle = MapParameters::PHONG;
view->updateGL(); view->updateGL();
} }
m_plugin->pythonRecording("changeFacesStyle", "", view->getName(), map->getName(), m_plugin->h_viewParameterSet[view][map].faceStyle);
} }
} }
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1106</width> <width>1106</width>
<height>23</height> <height>21</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="menuFile"> <widget class="QMenu" name="menuFile">
...@@ -32,6 +32,8 @@ ...@@ -32,6 +32,8 @@
<addaction name="action_ShowHidePluginDock"/> <addaction name="action_ShowHidePluginDock"/>
<addaction name="action_ShowHidePythonDock"/> <addaction name="action_ShowHidePythonDock"/>
<addaction name="action_LoadPythonScript"/> <addaction name="action_LoadPythonScript"/>
<addaction name="action_Begin_Python_Recording"/>
<addaction name="action_End_Python_Recording"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="action_Quit"/> <addaction name="action_Quit"/>
</widget> </widget>
...@@ -80,6 +82,16 @@ ...@@ -80,6 +82,16 @@
<string>Show/Hide Control Dock</string> <string>Show/Hide Control Dock</string>
</property> </property>
</action> </action>
<action name="action_Begin_Python_Recording">
<property name="text">
<string>Begin Python Recording</string>
</property>
</action>
<action name="action_End_Python_Recording">
<property name="text">
<string>End Python Recording</string>
</property>
</action>
</widget> </widget>
<resources/> <resources/>
<connections> <connections>
......
...@@ -43,8 +43,128 @@ protected: ...@@ -43,8 +43,128 @@ protected:
QString m_name; QString m_name;
QString m_filePath; QString m_filePath;
SCHNApps* m_schnapps; SCHNApps* m_schnapps;
// void pythonRecording(const QString& slotName, const QString& returned = "", const QString& param1 = "", const QString& param2 = "", const QString& param3 = "", const QString& param4 = "");
//template <typename T1, typename T2, typename T3, typename T4>
//inline void pythonRecording(QString slotName, QString returned = "", T1 param1 = "", T2 param2 = "", T3 param3 = "", T4 param4 = "");
template <typename T1>
inline void pythonRecording(QString slotName, QString returned, T1 param1);
template <typename T1, typename T2>
inline void pythonRecording(QString slotName, QString returned, T1 param1, T2 param2);
template <typename T1, typename T2, typename T3>
inline void pythonRecording(QString slotName, QString returned, T1 param1, T2 param2, T3 param3);
template <typename T1, typename T2, typename T3, typename T4>
inline void pythonRecording(QString slotName, QString returned, T1 param1, T2 param2, T3 param3, T4 param4);
template <typename T1, typename T2, typename T3, typename T4, typename T5>
inline void pythonRecording(QString slotName, QString returned, T1 param1, T2 param2, T3 param3, T4 param4, T5 param5);
template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11>
void pythonRecording(QString slotName, QString returned, T1 param1, T2 param2, T3 param3, T4 param4, T5 param5, T6 param6, T7 param7, T8 param8, T9 param9, T10 param10, T11 param11);
}; };
template <typename T>
inline T pyR_stringify(T v)
{
return v;
}
template <>
inline QString pyR_stringify(QString v)
{
return "\"" + v + "\"";
}
template <typename T1>
void Plugin::pythonRecording(QString slotName, QString returned, T1 param1)
{
QTextStream* rec = m_schnapps->pythonStreamRecorder();
if (rec)
{
if (!returned.isEmpty())
*rec << returned << " = ";
*rec << this->getName() << "." << slotName << "(" << pyR_stringify(param1) << ");" << endl;
}
}
template <typename T1, typename T2>
void Plugin::pythonRecording(QString slotName, QString returned, T1 param1, T2 param2)
{
QTextStream* rec = m_schnapps->pythonStreamRecorder();
if (rec)
{
if (!returned.isEmpty())
*rec << returned << " = ";
*rec << this->getName() << "." << slotName << "(" << pyR_stringify(param1) << ", " << pyR_stringify(param2) << ");" << endl;
}
}
template <typename T1, typename T2, typename T3>
void Plugin::pythonRecording(QString slotName, QString returned, T1 param1, T2 param2, T3 param3)
{
QTextStream* rec = m_schnapps->pythonStreamRecorder();
if (rec)
{
if (!returned.isEmpty())
*rec << returned << " = ";
*rec << this->getName() << "." << slotName << "(" << pyR_stringify(param1) << ", " << pyR_stringify(param2) << ", " << pyR_stringify(param3) << ");" << endl;
}
}
template <typename T1, typename T2, typename T3, typename T4>
void Plugin::pythonRecording(QString slotName, QString returned, T1 param1, T2 param2, T3 param3, T4 param4)
{
QTextStream* rec = m_schnapps->pythonStreamRecorder();
if (rec)
{
if (!returned.isEmpty())
*rec << returned << " = ";
*rec << this->getName() << "." << slotName << "(" << pyR_stringify(param1) << ", " << pyR_stringify(param2) << ", " << pyR_stringify(param3) << ", " << pyR_stringify(param4) << ");" << endl;
}
}
template <typename T1, typename T2, typename T3, typename T4, typename T5>
void Plugin::pythonRecording(QString slotName, QString returned, T1 param1, T2 param2, T3 param3, T4 param4, T5 param5)
{
QTextStream* rec = m_schnapps->pythonStreamRecorder();
if (rec)
{
if (!returned.isEmpty())
*rec << returned << " = ";
*rec << this->getName() << "." << slotName << "(" << pyR_stringify(param1) << ", " << pyR_stringify(param2) << ", ";
*rec << pyR_stringify(param3) << ", " << pyR_stringify(param4) << ", " << pyR_stringify(param5) << ");" << endl;
}
}
template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7, typename T8, typename T9, typename T10, typename T11>
void Plugin::pythonRecording(QString slotName, QString returned, T1 param1, T2 param2, T3 param3, T4 param4, T5 param5, T6 param6, T7 param7, T8 param8, T9 param9, T10 param10, T11 param11)
{
QTextStream* rec = m_schnapps->pythonStreamRecorder();
if (rec)
{
if (!returned.isEmpty())
*rec << returned << " = ";
*rec << this->getName() << "." << slotName << "(" << pyR_stringify(param1) << ", " << pyR_stringify(param2) << ", ";
*rec << pyR_stringify(param3) << ", " << pyR_stringify(param4) << ", " << pyR_stringify(param5) << ", ";
*rec << pyR_stringify(param6) << ", " << pyR_stringify(param7) << ", " << pyR_stringify(param8) << ", ";
*rec << pyR_stringify(param9) << ", " << pyR_stringify(param10) << ", " << pyR_stringify(param11) << ");" << endl;
}
}
} // namespace SCHNApps } // namespace SCHNApps
} // namespace CGoGN } // namespace CGoGN
......
...@@ -10,9 +10,12 @@ ...@@ -10,9 +10,12 @@
#include "PythonQt.h" #include "PythonQt.h"
#include "gui/PythonQtScriptingConsole.h" #include "gui/PythonQtScriptingConsole.h"
#include "slot_debug.h" #include "slot_debug.h"
#include <QTextStream>
class QVBoxLayout; class QVBoxLayout;
class QSplitter; class QSplitter;
class QFile;
namespace CGoGN namespace CGoGN
{ {
...@@ -139,6 +142,22 @@ public slots: ...@@ -139,6 +142,22 @@ public slots:
private slots: private slots:
void loadPythonScriptFromFileDialog(); void loadPythonScriptFromFileDialog();
/*********************************************************
* MANAGE PYTHON RECORDING
*********************************************************/
protected:
QTextStream* m_pyRecording;
QFile* m_pyRecFile;
private slots:
void beginPyRecording();
void endPyRecording();
public:
inline QTextStream* pythonStreamRecorder() { return m_pyRecording; }
signals: signals:
void cameraAdded(Camera* camera); void cameraAdded(Camera* camera);
void cameraRemoved(Camera* camera); void cameraRemoved(Camera* camera);
...@@ -195,6 +214,8 @@ protected: ...@@ -195,6 +214,8 @@ protected:
StaticPointers m_sp; StaticPointers m_sp;
void closeEvent(QCloseEvent *event); void closeEvent(QCloseEvent *event);
}; };
} // namespace SCHNApps } // namespace SCHNApps
......
...@@ -114,6 +114,11 @@ void ControlDock_MapTab::selectedMapChanged() ...@@ -114,6 +114,11 @@ void ControlDock_MapTab::selectedMapChanged()
QString selectedMapName = items[0]->text(); QString selectedMapName = items[0]->text();
m_selectedMap = m_schnapps->getMap(selectedMapName); m_selectedMap = m_schnapps->getMap(selectedMapName);
// RECORDING
QTextStream* rec = m_schnapps->pythonStreamRecorder();
if (rec)
*rec << "schnapps.setSelectedMap(\"" << m_selectedMap->getName() << "\");" << endl;
connect(m_selectedMap, SIGNAL(attributeAdded(unsigned int, const QString&)), this, SLOT(selectedMapAttributeAdded(unsigned int, const QString&))); connect(m_selectedMap, SIGNAL(attributeAdded(unsigned int, const QString&)), this, SLOT(selectedMapAttributeAdded(unsigned int, const QString&)));
connect(m_selectedMap, SIGNAL(vboAdded(Utils::VBO*)), this, SLOT(selectedMapVBOAdded(Utils::VBO*))); connect(m_selectedMap, SIGNAL(vboAdded(Utils::VBO*)), this, SLOT(selectedMapVBOAdded(Utils::VBO*)));
connect(m_selectedMap, SIGNAL(vboRemoved(Utils::VBO*)), this, SLOT(selectedMapVBORemoved(Utils::VBO*))); connect(m_selectedMap, SIGNAL(vboRemoved(Utils::VBO*)), this, SLOT(selectedMapVBORemoved(Utils::VBO*)));
...@@ -132,6 +137,11 @@ void ControlDock_MapTab::bbVertexAttributeChanged(int index) ...@@ -132,6 +137,11 @@ void ControlDock_MapTab::bbVertexAttributeChanged(int index)
{ {
if (!b_updatingUI) if (!b_updatingUI)
{ {
// RECORDING
QTextStream* rec = m_schnapps->pythonStreamRecorder();
if (rec)
*rec << m_selectedMap->getName() << ".setBBVertexAttribute(\"" << combo_bbVertexAttribute->currentText() << "\");" << endl;
m_selectedMap->setBBVertexAttribute(combo_bbVertexAttribute->currentText()); m_selectedMap->setBBVertexAttribute(combo_bbVertexAttribute->currentText());
} }
} }
......
...@@ -141,6 +141,11 @@ Utils::VBO* MapHandlerGen::createVBO(const AttributeMultiVectorGen* attr) ...@@ -141,6 +141,11 @@ Utils::VBO* MapHandlerGen::createVBO(const AttributeMultiVectorGen* attr)
{ {
if(attr) if(attr)
{ {
// RECORDING
QTextStream* rec = m_schnapps->pythonStreamRecorder();
if (rec)
*rec << this->getName() << ".createVBO(\"" << QString(attr->getName().c_str()) << "\");" << endl;
QString name = QString::fromStdString(attr->getName()); QString name = QString::fromStdString(attr->getName());
Utils::VBO* vbo = getVBO(name); Utils::VBO* vbo = getVBO(name);
if(!vbo) if(!vbo)
......
#include "plugin.h" #include "plugin.h"
#include <GL/glew.h> #include <GL/glew.h>
#include <QTextStream>
#include "schnapps.h"
namespace CGoGN namespace CGoGN
{ {
...@@ -40,6 +42,7 @@ void Plugin::setFilePath(const QString& f) ...@@ -40,6 +42,7 @@ void Plugin::setFilePath(const QString& f)
void Plugin::setSCHNApps(SCHNApps* s) void Plugin::setSCHNApps(SCHNApps* s)
{ m_schnapps = s; } { m_schnapps = s; }
} // namespace SCHNApps } // namespace SCHNApps
} // namespace CGoGN } // namespace CGoGN
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
#include <QKeyEvent> #include <QKeyEvent>
#include <QMouseEvent> #include <QMouseEvent>
#include <QWheelEvent> #include <QWheelEvent>
#include <QFile>
#include "mapHandler.h" #include "mapHandler.h"
#include "schnapps.h" #include "schnapps.h"
...@@ -39,6 +41,7 @@ SCHNApps::SCHNApps(const QString& appPath, PythonQtObjectPtr& pythonContext, Pyt ...@@ -39,6 +41,7 @@ SCHNApps::SCHNApps(const QString& appPath, PythonQtObjectPtr& pythonContext, Pyt
m_appPath(appPath), m_appPath(appPath),
m_pythonContext(pythonContext), m_pythonContext(pythonContext),
m_pythonConsole(pythonConsole), m_pythonConsole(pythonConsole),
m_pyRecording(NULL),
m_firstView(NULL), m_firstView(NULL),
m_selectedView(NULL) m_selectedView(NULL)
{ {
...@@ -103,6 +106,10 @@ SCHNApps::SCHNApps(const QString& appPath, PythonQtObjectPtr& pythonContext, Pyt ...@@ -103,6 +106,10 @@ SCHNApps::SCHNApps(const QString& appPath, PythonQtObjectPtr& pythonContext, Pyt
connect(action_ShowHidePythonDock, SIGNAL(triggered()), this, SLOT(showHidePythonDock())); connect(action_ShowHidePythonDock, SIGNAL(triggered()), this, SLOT(showHidePythonDock()));
connect(action_LoadPythonScript, SIGNAL(triggered()), this, SLOT(loadPythonScriptFromFileDialog())); connect(action_LoadPythonScript, SIGNAL(triggered()), this, SLOT(loadPythonScriptFromFileDialog()));
connect(action_Begin_Python_Recording, SIGNAL(triggered()), this, SLOT(beginPyRecording()));
connect(action_End_Python_Recording, SIGNAL(triggered()), this, SLOT(endPyRecording()));
// create & setup central widget (views) // create & setup central widget (views)
m_centralLayout = new QVBoxLayout(centralwidget); m_centralLayout = new QVBoxLayout(centralwidget);
...@@ -206,6 +213,10 @@ View* SCHNApps::addView(const QString& name) ...@@ -206,6 +213,10 @@ View* SCHNApps::addView(const QString& name)
DEBUG_EMIT("viewAdded"); DEBUG_EMIT("viewAdded");
emit(viewAdded(view)); emit(viewAdded(view));
// RECORDING
if (m_pyRecording)
*m_pyRecording << view->getName() << " = schnapps.getView(\"" << view->getName() << "\");" << endl;
return view; return view;
} }
...@@ -288,6 +299,10 @@ void SCHNApps::setSelectedView(View* view) ...@@ -288,6 +299,10 @@ void SCHNApps::setSelectedView(View* view)
void SCHNApps::splitView(const QString& name, Qt::Orientation orientation) void SCHNApps::splitView(const QString& name, Qt::Orientation orientation)
{ {
// RECORDING
if (m_pyRecording)
*m_pyRecording << "schnapps.splitView(\"" << name << "\", " << orientation << ");" << endl;
View* newView = addView(); View* newView = addView();
View* view = m_views[name]; View* view = m_views[name];
...@@ -308,6 +323,7 @@ void SCHNApps::splitView(const QString& name, Qt::Orientation orientation) ...@@ -308,6 +323,7 @@ void SCHNApps::splitView(const QString& name, Qt::Orientation orientation)
spl->addWidget(newView); spl->addWidget(newView);
parent->insertWidget(idx, spl); parent->insertWidget(idx, spl);
} }
} }
/********************************************************* /*********************************************************
...@@ -357,6 +373,10 @@ void SCHNApps::registerPluginsDirectory(const QString& path) ...@@ -357,6 +373,10 @@ void SCHNApps::registerPluginsDirectory(const QString& path)
Plugin* SCHNApps::enablePlugin(const QString& pluginName) Plugin* SCHNApps::enablePlugin(const QString& pluginName)
{ {
// RECORDING
if (m_pyRecording)
*m_pyRecording << pluginName << " = schnapps.enablePlugin(\"" << pluginName << "\");" << endl;
if (m_plugins.contains(pluginName)) if (m_plugins.contains(pluginName))
return m_plugins[pluginName]; return m_plugins[pluginName];
...@@ -412,6 +432,10 @@ void SCHNApps::disablePlugin(const QString& pluginName) ...@@ -412,6 +432,10 @@ void SCHNApps::disablePlugin(const QString& pluginName)
{ {
if (m_plugins.contains(pluginName)) if (m_plugins.contains(pluginName))
{ {
// RECORDING
if (m_pyRecording)
*m_pyRecording << "schnapps.disablePlugin(\"" << pluginName << "\");" << endl;
Plugin* plugin = m_plugins[pluginName]; Plugin* plugin = m_plugins[pluginName];
// remove plugin dock tabs // remove plugin dock tabs
...@@ -799,6 +823,50 @@ void SCHNApps::loadPythonScriptFromFileDialog() ...@@ -799,6 +823,50 @@ void SCHNApps::loadPythonScriptFromFileDialog()
loadPythonScriptFromFile(fileName); loadPythonScriptFromFile(fileName);
} }
void SCHNApps::beginPyRecording()
{
QString fileName = QFileDialog::getSaveFileName(this, "Save python script", this->getAppPath(), " python script (*.py)");
if (fileName.size() != 0)
{
m_pyRecFile = new QFile(fileName);
if (!m_pyRecFile->open(QIODevice::WriteOnly | QIODevice::Text))
return;
m_pyRecording = new QTextStream(m_pyRecFile);