Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
CGoGN
CGoGN
Commits
bcd373bb
Commit
bcd373bb
authored
Mar 23, 2015
by
Sylvain Thery
Browse files
python recording...
parent
4f4e657d
Changes
11
Hide whitespace changes
Inline
Side-by-side
SCHNApps/Plugins/surface_differentialProperties/src/surface_differentialProperties.cpp
View file @
bcd373bb
...
...
@@ -216,6 +216,10 @@ void Surface_DifferentialProperties_Plugin::computeNormal(
ComputeNormalParameters
(
positionAttributeName
,
normalAttributeName
,
autoUpdate
);
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(
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
()
...
...
SCHNApps/Plugins/surface_import/src/surface_import.cpp
View file @
bcd373bb
...
...
@@ -30,6 +30,14 @@ MapHandlerGen* Surface_Import_Plugin::importFromFile(const QString& fileName)
QFileInfo
fi
(
fileName
);
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
);
if
(
mhg
)
{
...
...
SCHNApps/Plugins/surface_render/src/surface_render_dockTab.cpp
View file @
bcd373bb
...
...
@@ -77,6 +77,7 @@ void Surface_Render_DockTab::colorSelected(const QColor& col)
m_plugin
->
h_viewParameterSet
[
view
][
map
].
diffuseColor
=
rgbCol
;
view
->
updateGL
();
}
m_plugin
->
pythonRecording
(
"changeFaceColor"
,
""
,
view
->
getName
(),
map
->
getName
(),
rgbCol
[
0
],
rgbCol
[
1
],
rgbCol
[
2
]);
}
if
(
m_currentColorDial
==
2
)
...
...
@@ -94,6 +95,7 @@ void Surface_Render_DockTab::colorSelected(const QColor& col)
m_plugin
->
h_viewParameterSet
[
view
][
map
].
simpleColor
=
rgbCol
;
view
->
updateGL
();
}
m_plugin
->
pythonRecording
(
"changeEdgeColor"
,
""
,
view
->
getName
(),
map
->
getName
(),
rgbCol
[
0
],
rgbCol
[
1
],
rgbCol
[
2
]);
}
if
(
m_currentColorDial
==
3
)
...
...
@@ -111,6 +113,7 @@ void Surface_Render_DockTab::colorSelected(const QColor& col)
m_plugin
->
h_viewParameterSet
[
view
][
map
].
vertexColor
=
rgbCol
;
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)
m_plugin
->
h_viewParameterSet
[
view
][
map
].
positionVBO
=
map
->
getVBO
(
combo_positionVBO
->
currentText
());
view
->
updateGL
();
}
m_plugin
->
pythonRecording
(
"changePositionVBO"
,
""
,
view
->
getName
(),
map
->
getName
(),
combo_positionVBO
->
currentText
());
}
}
...
...
@@ -143,6 +147,7 @@ void Surface_Render_DockTab::normalVBOChanged(int index)
m_plugin
->
h_viewParameterSet
[
view
][
map
].
normalVBO
=
map
->
getVBO
(
combo_normalVBO
->
currentText
());
view
->
updateGL
();
}
m_plugin
->
pythonRecording
(
"changeNormalVBO"
,
""
,
view
->
getName
(),
map
->
getName
(),
combo_normalVBO
->
currentText
());
}
}
...
...
@@ -157,6 +162,7 @@ void Surface_Render_DockTab::renderVerticesChanged(bool b)
m_plugin
->
h_viewParameterSet
[
view
][
map
].
renderVertices
=
b
;
view
->
updateGL
();
}
m_plugin
->
pythonRecording
(
"changeRenderVertices"
,
""
,
view
->
getName
(),
map
->
getName
(),
b
);
}
}
...
...
@@ -171,6 +177,7 @@ void Surface_Render_DockTab::verticesScaleFactorChanged(int i)
m_plugin
->
h_viewParameterSet
[
view
][
map
].
verticesScaleFactor
=
i
/
50.0
;
view
->
updateGL
();
}
m_plugin
->
pythonRecording
(
"changeVerticesScaleFactor"
,
""
,
view
->
getName
(),
map
->
getName
(),
i
/
50.0
);
}
}
...
...
@@ -185,6 +192,7 @@ void Surface_Render_DockTab::renderEdgesChanged(bool b)
m_plugin
->
h_viewParameterSet
[
view
][
map
].
renderEdges
=
b
;
view
->
updateGL
();
}
m_plugin
->
pythonRecording
(
"changeRenderEdges"
,
""
,
view
->
getName
(),
map
->
getName
(),
b
);
}
}
...
...
@@ -199,6 +207,7 @@ void Surface_Render_DockTab::renderFacesChanged(bool b)
m_plugin
->
h_viewParameterSet
[
view
][
map
].
renderFaces
=
b
;
view
->
updateGL
();
}
m_plugin
->
pythonRecording
(
"changeRenderFaces"
,
""
,
view
->
getName
(),
map
->
getName
(),
b
);
}
}
...
...
@@ -216,6 +225,7 @@ void Surface_Render_DockTab::faceStyleChanged(QAbstractButton* b)
m_plugin
->
h_viewParameterSet
[
view
][
map
].
faceStyle
=
MapParameters
::
PHONG
;
view
->
updateGL
();
}
m_plugin
->
pythonRecording
(
"changeFacesStyle"
,
""
,
view
->
getName
(),
map
->
getName
(),
m_plugin
->
h_viewParameterSet
[
view
][
map
].
faceStyle
);
}
}
...
...
SCHNApps/forms/schnapps.ui
View file @
bcd373bb
...
...
@@ -21,7 +21,7 @@
<x>
0
</x>
<y>
0
</y>
<width>
1106
</width>
<height>
2
3
</height>
<height>
2
1
</height>
</rect>
</property>
<widget
class=
"QMenu"
name=
"menuFile"
>
...
...
@@ -32,6 +32,8 @@
<addaction
name=
"action_ShowHidePluginDock"
/>
<addaction
name=
"action_ShowHidePythonDock"
/>
<addaction
name=
"action_LoadPythonScript"
/>
<addaction
name=
"action_Begin_Python_Recording"
/>
<addaction
name=
"action_End_Python_Recording"
/>
<addaction
name=
"separator"
/>
<addaction
name=
"action_Quit"
/>
</widget>
...
...
@@ -80,6 +82,16 @@
<string>
Show/Hide Control Dock
</string>
</property>
</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>
<resources/>
<connections>
...
...
SCHNApps/include/plugin.h
View file @
bcd373bb
...
...
@@ -43,8 +43,128 @@ protected:
QString
m_name
;
QString
m_filePath
;
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 CGoGN
...
...
SCHNApps/include/schnapps.h
View file @
bcd373bb
...
...
@@ -10,9 +10,12 @@
#include
"PythonQt.h"
#include
"gui/PythonQtScriptingConsole.h"
#include
"slot_debug.h"
#include
<QTextStream>
class
QVBoxLayout
;
class
QSplitter
;
class
QFile
;
namespace
CGoGN
{
...
...
@@ -139,6 +142,22 @@ public slots:
private
slots
:
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:
void
cameraAdded
(
Camera
*
camera
);
void
cameraRemoved
(
Camera
*
camera
);
...
...
@@ -195,6 +214,8 @@ protected:
StaticPointers
m_sp
;
void
closeEvent
(
QCloseEvent
*
event
);
};
}
// namespace SCHNApps
...
...
SCHNApps/src/controlDock_mapTab.cpp
View file @
bcd373bb
...
...
@@ -114,6 +114,11 @@ void ControlDock_MapTab::selectedMapChanged()
QString
selectedMapName
=
items
[
0
]
->
text
();
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
(
vboAdded
(
Utils
::
VBO
*
)),
this
,
SLOT
(
selectedMapVBOAdded
(
Utils
::
VBO
*
)));
connect
(
m_selectedMap
,
SIGNAL
(
vboRemoved
(
Utils
::
VBO
*
)),
this
,
SLOT
(
selectedMapVBORemoved
(
Utils
::
VBO
*
)));
...
...
@@ -132,6 +137,11 @@ void ControlDock_MapTab::bbVertexAttributeChanged(int index)
{
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
());
}
}
...
...
SCHNApps/src/mapHandler.cpp
View file @
bcd373bb
...
...
@@ -141,6 +141,11 @@ Utils::VBO* MapHandlerGen::createVBO(const AttributeMultiVectorGen* 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
());
Utils
::
VBO
*
vbo
=
getVBO
(
name
);
if
(
!
vbo
)
...
...
SCHNApps/src/plugin.cpp
View file @
bcd373bb
#include
"plugin.h"
#include
<GL/glew.h>
#include
<QTextStream>
#include
"schnapps.h"
namespace
CGoGN
{
...
...
@@ -40,6 +42,7 @@ void Plugin::setFilePath(const QString& f)
void
Plugin
::
setSCHNApps
(
SCHNApps
*
s
)
{
m_schnapps
=
s
;
}
}
// namespace SCHNApps
}
// namespace CGoGN
SCHNApps/src/schnapps.cpp
View file @
bcd373bb
...
...
@@ -10,6 +10,8 @@
#include
<QKeyEvent>
#include
<QMouseEvent>
#include
<QWheelEvent>
#include
<QFile>
#include
"mapHandler.h"
#include
"schnapps.h"
...
...
@@ -39,6 +41,7 @@ SCHNApps::SCHNApps(const QString& appPath, PythonQtObjectPtr& pythonContext, Pyt
m_appPath
(
appPath
),
m_pythonContext
(
pythonContext
),
m_pythonConsole
(
pythonConsole
),
m_pyRecording
(
NULL
),
m_firstView
(
NULL
),
m_selectedView
(
NULL
)
{
...
...
@@ -103,6 +106,10 @@ SCHNApps::SCHNApps(const QString& appPath, PythonQtObjectPtr& pythonContext, Pyt
connect
(
action_ShowHidePythonDock
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
showHidePythonDock
()));
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)
m_centralLayout
=
new
QVBoxLayout
(
centralwidget
);
...
...
@@ -206,6 +213,10 @@ View* SCHNApps::addView(const QString& name)
DEBUG_EMIT
(
"viewAdded"
);
emit
(
viewAdded
(
view
));
// RECORDING
if
(
m_pyRecording
)
*
m_pyRecording
<<
view
->
getName
()
<<
" = schnapps.getView(
\"
"
<<
view
->
getName
()
<<
"
\"
);"
<<
endl
;
return
view
;
}
...
...
@@ -288,6 +299,10 @@ void SCHNApps::setSelectedView(View* view)
void
SCHNApps
::
splitView
(
const
QString
&
name
,
Qt
::
Orientation
orientation
)
{
// RECORDING
if
(
m_pyRecording
)
*
m_pyRecording
<<
"schnapps.splitView(
\"
"
<<
name
<<
"
\"
, "
<<
orientation
<<
");"
<<
endl
;
View
*
newView
=
addView
();
View
*
view
=
m_views
[
name
];
...
...
@@ -308,6 +323,7 @@ void SCHNApps::splitView(const QString& name, Qt::Orientation orientation)
spl
->
addWidget
(
newView
);
parent
->
insertWidget
(
idx
,
spl
);
}
}
/*********************************************************
...
...
@@ -357,6 +373,10 @@ void SCHNApps::registerPluginsDirectory(const QString& path)
Plugin
*
SCHNApps
::
enablePlugin
(
const
QString
&
pluginName
)
{
// RECORDING
if
(
m_pyRecording
)
*
m_pyRecording
<<
pluginName
<<
" = schnapps.enablePlugin(
\"
"
<<
pluginName
<<
"
\"
);"
<<
endl
;
if
(
m_plugins
.
contains
(
pluginName
))
return
m_plugins
[
pluginName
];
...
...
@@ -412,6 +432,10 @@ void SCHNApps::disablePlugin(const QString& pluginName)
{
if
(
m_plugins
.
contains
(
pluginName
))
{
// RECORDING
if
(
m_pyRecording
)
*
m_pyRecording
<<
"schnapps.disablePlugin(
\"
"
<<
pluginName
<<
"
\"
);"
<<
endl
;
Plugin
*
plugin
=
m_plugins
[
pluginName
];
// remove plugin dock tabs
...
...
@@ -799,6 +823,50 @@ void SCHNApps::loadPythonScriptFromFileDialog()
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
);
foreach
(
View
*
v
,
m_views
)
{
*
m_pyRecording
<<
v
->
getName
()
<<
" = schnapps.getView(
\"
"
<<
v
->
getName
()
<<
"
\"
);"
<<
endl
;
}
statusbar
->
showMessage
(
QString
(
" Recording python in "
)
+
fileName
);
}
else
{
m_pyRecFile
=
NULL
;
m_pyRecording
=
NULL
;
statusbar
->
showMessage
(
QString
(
" Cancel recording python"
),
2000
);
}
}
void
SCHNApps
::
endPyRecording
()
{
if
(
m_pyRecording
==
NULL
)
return
;
QTextStream
out
(
m_pyRecFile
);
out
<<
m_pyRecording
->
readAll
();
m_pyRecFile
->
close
();
delete
m_pyRecording
;
delete
m_pyRecFile
;
m_pyRecording
=
NULL
;
m_pyRecFile
=
NULL
;
statusbar
->
showMessage
(
QString
(
" Stop recording python"
),
2000
);
}
void
SCHNApps
::
closeEvent
(
QCloseEvent
*
event
)
{
DEBUG_EMIT
(
"schnappsClosing"
);
...
...
@@ -806,6 +874,7 @@ void SCHNApps::closeEvent(QCloseEvent *event)
QMainWindow
::
closeEvent
(
event
);
}
}
// namespace SCHNApps
}
// namespace CGoGN
SCHNApps/src/view.cpp
View file @
bcd373bb
...
...
@@ -111,6 +111,11 @@ void View::setCurrentCamera(Camera* c)
// DEBUG_SLOT();
if
(
c
!=
m_currentCamera
&&
c
)
{
// RECORDING
QTextStream
*
rec
=
m_schnapps
->
pythonStreamRecorder
();
if
(
rec
)
*
rec
<<
this
->
getName
()
<<
".setCurrentCamera(
\"
"
<<
c
->
getName
()
<<
"
\"
);"
<<
endl
;
Camera
*
prev
=
m_currentCamera
;
if
(
prev
)
prev
->
unlinkView
(
this
);
...
...
@@ -164,6 +169,11 @@ bool View::usesCamera(const QString& name) const
void
View
::
linkPlugin
(
PluginInteraction
*
plugin
)
{
// RECORDING
QTextStream
*
rec
=
m_schnapps
->
pythonStreamRecorder
();
if
(
rec
)
*
rec
<<
this
->
getName
()
<<
".linkPlugin(
\"
"
<<
plugin
->
getName
()
<<
"
\"
);"
<<
endl
;
DEBUG_SLOT
();
if
(
plugin
&&
!
l_plugins
.
contains
(
plugin
))
{
...
...
@@ -193,6 +203,12 @@ void View::unlinkPlugin(PluginInteraction* plugin)
DEBUG_SLOT
();
if
(
l_plugins
.
removeOne
(
plugin
))
{
// RECORDING
QTextStream
*
rec
=
m_schnapps
->
pythonStreamRecorder
();
if
(
rec
)
*
rec
<<
this
->
getName
()
<<
".unlinkPlugin(
\"
"
<<
plugin
->
getName
()
<<
"
\"
);"
<<
endl
;
plugin
->
unlinkView
(
this
);
DEBUG_EMIT
(
"pluginUnlinked"
);
...
...
@@ -221,6 +237,11 @@ bool View::isLinkedToPlugin(const QString& name) const
void
View
::
linkMap
(
MapHandlerGen
*
map
)
{
// RECORDING
QTextStream
*
rec
=
m_schnapps
->
pythonStreamRecorder
();
if
(
rec
)
*
rec
<<
this
->
getName
()
<<
".linkMap(
\"
"
<<
map
->
getName
()
<<
"
\"
);"
<<
endl
;
DEBUG_SLOT
();
if
(
map
&&
!
l_maps
.
contains
(
map
))
{
...
...
@@ -256,6 +277,11 @@ void View::unlinkMap(MapHandlerGen* map)
DEBUG_SLOT
();
if
(
l_maps
.
removeOne
(
map
))
{
QTextStream
*
rec
=
m_schnapps
->
pythonStreamRecorder
();
if
(
rec
)
*
rec
<<
this
->
getName
()
<<
".unlinkMap(
\"
"
<<
map
->
getName
()
<<
"
\"
);"
<<
endl
;
map
->
unlinkView
(
this
);
DEBUG_EMIT
(
"mapUnlinked"
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment