Commit b9dd9823 authored by Sylvain Thery's avatar Sylvain Thery

execPythonCmd

parent 47bdc707
......@@ -116,7 +116,7 @@ template <typename VEC>
typename VEC::DATA_TYPE BoundingBox<VEC>::diagSize() const
{
assert(m_initialized || !"Bounding box not initialized");
return VEC::DATA_TYPE((m_pMax - m_pMin).norm());
return typename VEC::DATA_TYPE((m_pMax - m_pMin).norm());
}
template <typename VEC>
......
......@@ -147,6 +147,8 @@ public slots:
void loadPythonScriptFromFile(const QString& fileName);
void execPythonCmd(const QString& fileName);
void statusBarMessage(const QString& msg, int msec);
QString openFileDialog(const QString& title, const QString& dir = QString(), const QString& filter = QString());
......@@ -171,7 +173,7 @@ protected:
private slots:
void pyRecording();
void appendPyRecording();
//void endPyRecording();
// void endPyRecording();
public:
inline QTextStream* pythonStreamRecorder() { return m_pyRecording; }
......@@ -224,6 +226,9 @@ protected:
QMap<Plugin*, QList<QWidget*> > m_pluginTabs;
QMap<Plugin*, QList<QAction*> > m_pluginMenuActions;
QMap<int, QString > m_pythonShortCuts;
CameraSet m_cameras;
ViewSet m_views;
PluginSet m_plugins;
......
......@@ -968,6 +968,27 @@ void SCHNApps::showHidePythonDock()
m_pythonDock->setVisible(m_pythonDock->isHidden());
}
void SCHNApps::execPythonCmd(const QString& cmd)
{
#ifdef WIN32
QString line = cmd;
if (line.size() >= 2)
{
int j = 0;
while (line[j] == ' ') ++j;
QString spaces(4 - j, QChar(' ')); // need 4 spaces at begin of line
line.replace(QChar('\\'), QChar('/')); // replace \ by / in win path
m_pythonConsole.consoleMessage(spaces + line);
m_pythonConsole.executeLine(false);
}
#else
m_pythonConsole.consoleMessage(cmd);
m_pythonConsole.executeLine(false);
#endif
}
void SCHNApps::loadPythonScriptFromFile(const QString& fileName)
{
#ifdef WIN32
......
......@@ -529,11 +529,11 @@ int View::scaleIntSlideVal(float v)
void View::keyPressEvent(QKeyEvent* event)
{
switch (event->key())
{
case Qt::Key_Z:
{
// m_schnapps->execPythonCmd("schnapps.getSelectedView().setViewScaling(1.,0.5,1.0);schnapps.getSelectedView().updateGL()");
int isX = scaleIntSlideVal(m_scaleView[0][0]);
int isY = scaleIntSlideVal(m_scaleView[1][1]);
int isZ = scaleIntSlideVal(m_scaleView[2][2]);
......@@ -541,7 +541,7 @@ void View::keyPressEvent(QKeyEvent* event)
Utils::QT::inputValues(
Utils::QT::VarSlider(0, 100, isX, "Scale X",
Utils::QT::VarSlider(0, 100, isY, "Scale Y",
Utils::QT::VarSlider(0, 100, isZ, "Scale Z"))));
Utils::QT::VarSlider(0, 100, isZ, "Scale Z"))),"Scaling view");
float sx = scaleRealSlideVal(isX);
float sy = scaleRealSlideVal(isY);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment