Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CGoGN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Sauvage
CGoGN
Commits
31961900
Commit
31961900
authored
Mar 12, 2013
by
Pierre Kraemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add ability to load a Python script file
parent
6c8638bf
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
26 additions
and
27 deletions
+26
-27
SCHNApps/bin/init.py
SCHNApps/bin/init.py
+0
-23
SCHNApps/bin/schnappsInit.py
SCHNApps/bin/schnappsInit.py
+2
-0
SCHNApps/forms/window.ui
SCHNApps/forms/window.ui
+9
-0
SCHNApps/include/window.h
SCHNApps/include/window.h
+1
-0
SCHNApps/src/main.cpp
SCHNApps/src/main.cpp
+1
-1
SCHNApps/src/window.cpp
SCHNApps/src/window.cpp
+13
-3
No files found.
SCHNApps/bin/init.py
deleted
100644 → 0
View file @
6c8638bf
importPlugin
=
schnapps
.
loadPlugin
(
"ImportSurface"
);
renderPlugin
=
schnapps
.
loadPlugin
(
"Render"
);
renderVectorPlugin
=
schnapps
.
loadPlugin
(
"RenderVector"
);
renderScalarPlugin
=
schnapps
.
loadPlugin
(
"RenderScalar"
);
renderTopoSurfacePlugin
=
schnapps
.
loadPlugin
(
"RenderTopoSurface"
);
differentialPropertiesPlugin
=
schnapps
.
loadPlugin
(
"DifferentialProperties"
);
subdivisionPlugin
=
schnapps
.
loadPlugin
(
"SubdivideSurface"
);
surfaceDeformationPlugin
=
schnapps
.
loadPlugin
(
"SurfaceDeformation"
);
obj
=
importPlugin
.
importFromFile
(
"/home/kraemer/Media/Data/surface/midRes/cow_11k.off"
);
v
=
schnapps
.
getView
(
"view_0"
);
schnapps
.
linkViewAndPlugin
(
v
.
getName
(),
renderPlugin
.
getName
());
schnapps
.
linkViewAndPlugin
(
v
.
getName
(),
renderVectorPlugin
.
getName
());
schnapps
.
linkViewAndPlugin
(
v
.
getName
(),
renderScalarPlugin
.
getName
());
#schnapps.linkViewAndPlugin(v.getName(), renderTopoSurfacePlugin.getName());
schnapps
.
linkViewAndPlugin
(
v
.
getName
(),
surfaceDeformationPlugin
.
getName
());
schnapps
.
linkViewAndMap
(
v
.
getName
(),
obj
.
getName
());
differentialPropertiesPlugin
.
computeNormal
(
obj
.
getName
());
differentialPropertiesPlugin
.
computeCurvature
(
obj
.
getName
());
SCHNApps/bin/schnappsInit.py
0 → 100644
View file @
31961900
importPlugin
=
schnapps
.
loadPlugin
(
"ImportSurface"
);
renderPlugin
=
schnapps
.
loadPlugin
(
"Render"
);
\ No newline at end of file
SCHNApps/forms/window.ui
View file @
31961900
...
...
@@ -33,6 +33,7 @@
</property>
<addaction
name=
"actionShowHideDock"
/>
<addaction
name=
"actionShowHidePythonDock"
/>
<addaction
name=
"actionLoadPythonScript"
/>
<addaction
name=
"separator"
/>
<addaction
name=
"actionQuit"
/>
</widget>
...
...
@@ -116,6 +117,14 @@
<string>
Show/Hide Python Dock
</string>
</property>
</action>
<action
name=
"actionLoadPythonScript"
>
<property
name=
"text"
>
<string>
Load Python Script
</string>
</property>
<property
name=
"shortcut"
>
<string>
Ctrl+P
</string>
</property>
</action>
</widget>
<resources>
<include
location=
"../resources/resources.qrc"
/>
...
...
SCHNApps/include/window.h
View file @
31961900
...
...
@@ -193,6 +193,7 @@ public slots:
void
cb_showHideDock
();
void
cb_showHidePythonDock
();
void
cb_loadPythonScript
();
void
cb_showCamerasDialog
();
void
cb_showPluginsDialog
();
...
...
SCHNApps/src/main.cpp
View file @
31961900
...
...
@@ -30,7 +30,7 @@ int main(int argc, char* argv[])
schnapps
.
show
();
pythonContext
.
addObject
(
"schnapps"
,
&
schnapps
);
QFileInfo
fi
(
app
.
applicationDirPath
()
+
QString
(
"/
i
nit.py"
));
QFileInfo
fi
(
app
.
applicationDirPath
()
+
QString
(
"/
schnappsI
nit.py"
));
if
(
fi
.
exists
())
pythonContext
.
evalFile
(
fi
.
filePath
());
...
...
SCHNApps/src/window.cpp
View file @
31961900
...
...
@@ -6,6 +6,7 @@
#include <QDockWidget>
#include <QPluginLoader>
#include <QFile>
#include <QFileDialog>
#include <QFileInfo>
#include <QDir>
#include <QKeyEvent>
...
...
@@ -66,6 +67,7 @@ Window::Window(const QString& appPath, PythonQtObjectPtr& pythonContext, PythonQ
m_pythonDock
->
setWidget
(
&
m_pythonConsole
);
connect
(
actionShowHidePythonDock
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
cb_showHidePythonDock
()));
connect
(
actionLoadPythonScript
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
cb_loadPythonScript
()));
m_centralLayout
=
new
QVBoxLayout
(
centralwidget
);
...
...
@@ -453,7 +455,7 @@ void Window::registerPluginsDirectory(const QString& path)
Plugin
*
Window
::
loadPlugin
(
const
QString
&
pluginName
)
{
if
(
h_plugins
.
contains
(
pluginName
))
return
NULL
;
return
h_plugins
[
pluginName
]
;
if
(
m_availablePlugins
.
contains
(
pluginName
))
{
...
...
@@ -492,13 +494,13 @@ Plugin* Window::loadPlugin(const QString& pluginName)
// if loading fails
else
{
std
::
cout
<<
"loadPlugin: loader.instance() failed"
<<
std
::
endl
<<
loader
.
errorString
().
toStdString
()
<<
std
::
endl
;
//
std::cout << "loadPlugin: loader.instance() failed" << std::endl << loader.errorString().toStdString() << std::endl;
return
NULL
;
}
}
else
{
std
::
cout
<<
"loadPlugin: plugin not found ("
<<
pluginName
.
toStdString
()
<<
")"
<<
std
::
endl
;
//
std::cout << "loadPlugin: plugin not found (" << pluginName.toStdString() << ")" << std::endl;
return
NULL
;
}
}
...
...
@@ -750,6 +752,14 @@ void Window::cb_showHidePythonDock()
m_pythonDock
->
setVisible
(
m_pythonDock
->
isHidden
());
}
void
Window
::
cb_loadPythonScript
()
{
QString
fileName
=
QFileDialog
::
getOpenFileName
(
this
,
"Load Python script"
,
getAppPath
(),
"Python script (*.py)"
);
QFileInfo
fi
(
fileName
);
if
(
fi
.
exists
())
m_pythonContext
.
evalFile
(
fi
.
filePath
());
}
void
Window
::
cb_showCamerasDialog
()
{
m_camerasDialog
->
show
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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