Commit 170fedde authored by Pierre Kraemer's avatar Pierre Kraemer

premiers essais.

parent 8db5ec3f
......@@ -23,16 +23,13 @@ find_package(QGLViewer REQUIRED)
#======SCHNApps=======#
SET(SCHNApps_ROOT_DIR ${CGoGN_ROOT_DIR}/SCHNApps)
SET(EXECUTABLE_OUTPUT_PATH ${SCHNApps_ROOT_DIR}/bin)
SET(LIBRARY_OUTPUT_PATH ${SCHNApps_ROOT_DIR}/Plugins)
SET(LIBRARY_OUTPUT_PATH ${SCHNApps_ROOT_DIR}/lib)
ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/Release Release)
IF (NOT WIN32)
ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/Debug Debug)
ENDIF (NOT WIN32)
configure_file(${CMAKE_SOURCE_DIR}/settings/state_save.xml ${EXECUTABLE_OUTPUT_PATH}/state_save.xml @ONLY)
#======Documentation=======#
find_package(Doxygen)
......
......@@ -21,7 +21,6 @@ file(
GLOB
SCHNApps_SRC_FILES
${SCHNApps_ROOT_DIR}/src/camera.cpp
${SCHNApps_ROOT_DIR}/src/main.cpp
${SCHNApps_ROOT_DIR}/src/mapHandler.cpp
${SCHNApps_ROOT_DIR}/src/plugin.cpp
${SCHNApps_ROOT_DIR}/src/view.cpp
......@@ -69,7 +68,7 @@ QT4_ADD_RESOURCES( RCC_FILES
${SCHNApps_ROOT_DIR}/resources/resources.qrc
)
ADD_EXECUTABLE( SCHNAppsD
ADD_LIBRARY( SCHNAppsD SHARED
${SCHNApps_SRC_FILES}
${UI_H_FILES}
${MOC_FILES}
......
......@@ -43,6 +43,7 @@ IF( ${CMAKE_BUILD_TYPE} STREQUAL Debug )
)
TARGET_LINK_LIBRARIES( DifferentialPropertiesPluginD
${LIBRARY_OUTPUT_PATH}/libSCHNApps.so
${CGoGN_LIBS_D}
${COMMON_LIBS}
${QGLVIEWER_LIBRARIES}
......@@ -70,6 +71,7 @@ ELSE ( ${CMAKE_BUILD_TYPE} STREQUAL Debug )
)
TARGET_LINK_LIBRARIES( DifferentialPropertiesPlugin
${LIBRARY_OUTPUT_PATH}/libSCHNApps.so
${CGoGN_LIBS_R}
${COMMON_LIBS}
${QGLVIEWER_LIBRARIES}
......
......@@ -34,6 +34,7 @@ IF( ${CMAKE_BUILD_TYPE} STREQUAL Debug )
)
TARGET_LINK_LIBRARIES( ImportSurfacePluginD
${LIBRARY_OUTPUT_PATH}/libSCHNApps.so
${CGoGN_LIBS_D}
${COMMON_LIBS}
${QGLVIEWER_LIBRARIES}
......@@ -61,6 +62,7 @@ ELSE ( ${CMAKE_BUILD_TYPE} STREQUAL Debug )
)
TARGET_LINK_LIBRARIES( ImportSurfacePlugin
${LIBRARY_OUTPUT_PATH}/libSCHNApps.so
${CGoGN_LIBS_R}
${COMMON_LIBS}
${QGLVIEWER_LIBRARIES}
......
......@@ -38,6 +38,7 @@ IF( ${CMAKE_BUILD_TYPE} STREQUAL Debug )
)
TARGET_LINK_LIBRARIES( RenderPluginD
${LIBRARY_OUTPUT_PATH}/libSCHNApps.so
${CGoGN_LIBS_D}
${COMMON_LIBS}
${QGLVIEWER_LIBRARIES}
......@@ -65,6 +66,7 @@ ELSE ( ${CMAKE_BUILD_TYPE} STREQUAL Debug )
)
TARGET_LINK_LIBRARIES( RenderPlugin
${LIBRARY_OUTPUT_PATH}/libSCHNApps.so
${CGoGN_LIBS_R}
${COMMON_LIBS}
${QGLVIEWER_LIBRARIES}
......
......@@ -56,16 +56,16 @@
</property>
</widget>
</item>
<item row="2" column="2" alignment="Qt::AlignRight">
<item row="2" column="2">
<widget class="QPushButton" name="button_refreshVBOs">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
<enum>Qt::RightToLeft</enum>
</property>
<property name="text">
<string>Refresh</string>
......@@ -75,11 +75,7 @@
</layout>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
<widget class="Line" name="line"/>
</item>
<item>
<widget class="QCheckBox" name="check_renderVertices">
......
......@@ -38,6 +38,7 @@ IF( ${CMAKE_BUILD_TYPE} STREQUAL Debug )
)
TARGET_LINK_LIBRARIES( RenderVectorPluginD
${LIBRARY_OUTPUT_PATH}/libSCHNApps.so
${CGoGN_LIBS_D}
${COMMON_LIBS}
${QGLVIEWER_LIBRARIES}
......@@ -65,6 +66,7 @@ ELSE ( ${CMAKE_BUILD_TYPE} STREQUAL Debug )
)
TARGET_LINK_LIBRARIES( RenderVectorPlugin
${LIBRARY_OUTPUT_PATH}/libSCHNApps.so
${CGoGN_LIBS_R}
${COMMON_LIBS}
${QGLVIEWER_LIBRARIES}
......
......@@ -38,6 +38,7 @@ IF( ${CMAKE_BUILD_TYPE} STREQUAL Debug )
)
TARGET_LINK_LIBRARIES( SubdivideSurfacePluginD
${LIBRARY_OUTPUT_PATH}/libSCHNApps.so
${CGoGN_LIBS_D}
${COMMON_LIBS}
${QGLVIEWER_LIBRARIES}
......@@ -65,6 +66,7 @@ ELSE ( ${CMAKE_BUILD_TYPE} STREQUAL Debug )
)
TARGET_LINK_LIBRARIES( SubdivideSurfacePlugin
${LIBRARY_OUTPUT_PATH}/libSCHNApps.so
${CGoGN_LIBS_R}
${COMMON_LIBS}
${QGLVIEWER_LIBRARIES}
......
......@@ -21,7 +21,6 @@ file(
GLOB
SCHNApps_SRC_FILES
${SCHNApps_ROOT_DIR}/src/camera.cpp
${SCHNApps_ROOT_DIR}/src/main.cpp
${SCHNApps_ROOT_DIR}/src/mapHandler.cpp
${SCHNApps_ROOT_DIR}/src/plugin.cpp
${SCHNApps_ROOT_DIR}/src/view.cpp
......@@ -69,7 +68,7 @@ QT4_ADD_RESOURCES( RCC_FILES
${SCHNApps_ROOT_DIR}/resources/resources.qrc
)
ADD_EXECUTABLE( SCHNApps
ADD_LIBRARY( SCHNApps SHARED
${SCHNApps_SRC_FILES}
${UI_H_FILES}
${MOC_FILES}
......
from distutils.core import setup, Extension
ext = Extension(
'PySCHNApps',
library_dirs=['/usr/lib', 'usr/local/lib', '../../lib'],
libraries=['python2.7','boost_python-py27', 'SCHNApps'],
include_dirs=['../../include', '../../build/Release', '../../../include', '/usr/include/qt4', '/usr/include/libxml2'],
sources = ['window_py.cpp']
)
setup(
name = 'PySCHNApps',
version = '1.0',
description = 'SCHNApps from Python',
ext_modules = [ext]
)
#include <boost/python.hpp>
#include <boost/python/module.hpp>
#include <boost/python/def.hpp>
#include "plugin.h"
#include "window.h"
using namespace boost::python;
BOOST_PYTHON_MODULE(PySCHNApps)
{
class_<CGoGN::SCHNApps::Window>("Window")
.def(init<>())
.def("launch", &CGoGN::SCHNApps::Window::launch)
.def("loadPlugin", &CGoGN::SCHNApps::Window::loadPlugin_py)
;
}
#ifndef _PLUGIN_H_
#define _PLUGIN_H_
#include <QtPlugin>
#include <QAction>
#include <QtCore/QtPlugin>
#include <QtGui/QAction>
#include "types.h"
......
#ifndef _TYPES_H_
#define _TYPES_H_
#include <QHash>
#include <QMap>
#include <QString>
#include <QtCore/QHash>
#include <QtCore/QMap>
#include <QtCore/QString>
#include "Topology/generic/parameters.h"
#include "Topology/map/embeddedMap2.h"
......
......@@ -26,19 +26,24 @@ class Window : public QMainWindow, Ui::Window
public:
/**
* \fn Window(QWidget* parent = NULL)
* \brief Default (and unique) constructor
*
* \param parent the parent of the window
* \fn Window()
* \brief Constructor
*/
Window(const QString& appPath, QWidget* parent = NULL);
Window();
Window(const Window& w);
/**
* \fn ~Window()
* \brief the class destructor
* \brief Destructor
*/
~Window();
void launch()
{
this->QMainWindow::show();
}
const QString& getAppPath() { return m_appPath; }
/*********************************************************
......@@ -202,6 +207,7 @@ public:
* \see Plugin::enable()
*/
Plugin* loadPlugin(const QString& pluginFilePath);
void loadPlugin_py(std::string path);
/**
* \fn void unloadPlugin(QString pluginName)
......
import sys
from PyQt4 import QtGui
import PySCHNApps
if __name__ == '__main__':
app = QtGui.QApplication(sys.argv)
window = PySCHNApps.Window()
window.launch()
# window.loadPlugin("/home/kraemer/Dev/CGoGN/SCHNApps/lib/libRenderPlugin.so")
sys.exit(app.exec_())
<!-- DO NOT EDIT MANUALLY -->
<PLUGIN_INFO>
<PLUGIN_PATH>
<DIR>@PLUGIN_COMPILE_DIR@</DIR>
<DIR>@PLUGIN_COMPILE_DIR@D</DIR>
</PLUGIN_PATH>
<ACTIVE_PLUGIN/>
<GLVIEWS/>
</PLUGIN_INFO>
<SETTINGS>
<PLUGINS>
<DIR path="@PLUGIN_COMPILE_DIR@"/>
<DIR path="@PLUGIN_COMPILE_DIR@D"/>
</PLUGINS>
<CAMERAS/>
<SCENES/>
<DISPLAY/>
</SETTINGS>
......@@ -36,14 +36,14 @@ PluginsDialog::PluginsDialog(Window* window) :
connect(removeButton, SIGNAL(pressed()), this, SLOT(cb_removePlugins()));
connect(directoryButton, SIGNAL(pressed()), this, SLOT(cb_addPluginsDirectory()));
connect(treeWidget, SIGNAL(itemChanged(QTreeWidgetItem *, int)), this, SLOT(cb_togglePlugin(QTreeWidgetItem *, int)));
connect(treeWidget, SIGNAL(itemChanged(QTreeWidgetItem*, int)), this, SLOT(cb_togglePlugin(QTreeWidgetItem*, int)));
// connect(treeWidget, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(customContextMenu(const QPoint &)));
// connect(this, SIGNAL(accepted()), this, SLOT(cb_acceptDialog()));
// restoreState();
addPluginsDirectory(m_window->getAppPath() + QString("/../Plugins/"));
addPluginsDirectory(m_window->getAppPath() + QString("/lib/"));
init = false;
}
......@@ -231,7 +231,7 @@ void PluginsDialog::cb_addPluginsDirectory()
QString dir = QFileDialog::getExistingDirectory(
this,
tr("Select a directory"),
m_window->getAppPath() + QString("/../Plugins/"),
m_window->getAppPath() + QString("/lib/"),
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks
);
......@@ -312,7 +312,7 @@ void PluginsDialog::cb_removePlugins()
}
}
void PluginsDialog::cb_togglePlugin(QTreeWidgetItem *item, int column)
void PluginsDialog::cb_togglePlugin(QTreeWidgetItem* item, int column)
{
if (!init && column == 0)
{
......
......@@ -5,15 +5,15 @@ int main(int argc, char* argv[])
{
QApplication app(argc, argv);
QSplashScreen* splash = new QSplashScreen(QPixmap(":splash/cgogn/splash.png"));
splash->show();
splash->showMessage("Welcome to SCHNApps", Qt::AlignBottom | Qt::AlignCenter);
// QSplashScreen* splash = new QSplashScreen(QPixmap(":splash/cgogn/splash.png"));
// splash->show();
// splash->showMessage("Welcome to SCHNApps", Qt::AlignBottom | Qt::AlignCenter);
CGoGN::SCHNApps::Window window(app.applicationDirPath());
window.show();
splash->finish(&window);
delete splash;
// splash->finish(&window);
// delete splash;
return app.exec();
}
......@@ -26,9 +26,9 @@ namespace CGoGN
namespace SCHNApps
{
Window::Window(const QString& appPath, QWidget *parent) :
QMainWindow(parent),
m_appPath(appPath),
Window::Window() :
QMainWindow(),
m_appPath("/home/kraemer/Dev/CGoGN/SCHNApps"),
m_firstView(NULL),
m_currentView(NULL)
{
......@@ -82,6 +82,11 @@ Window::Window(const QString& appPath, QWidget *parent) :
m_initialization = false;
}
Window::Window(const Window& w)
{
std::cout << "hiohoihoih" << std::endl;
}
Window::~Window()
{
// System::StateHandler::saveState(this, h_plugins);
......@@ -448,13 +453,23 @@ Plugin* Window::loadPlugin(const QString& pluginFilePath)
}
else
{
std::cout << "plugin enable failed" << std::endl;
delete plugin;
return NULL;
}
}
// if loading fails
else
{
std::cout << "loader.instance failed" << std::endl << loader.errorString().toUtf8().constData() << std::endl;
return NULL;
}
}
void Window::loadPlugin_py(std::string path)
{
QString p(QString::fromStdString(path));
loadPlugin(p);
}
void Window::unloadPlugin(const QString& pluginName)
......
......@@ -275,7 +275,7 @@ public:
{
unmarkAll() ;
// assert(isAllUnmarked);
CGoGN_ASSERT(this->isAllUnmarked())
// CGoGN_ASSERT(this->isAllUnmarked())
}
protected:
......@@ -323,7 +323,7 @@ public:
{
unmarkAll() ;
// assert(isAllUnmarked);
CGoGN_ASSERT(this->isAllUnmarked())
// CGoGN_ASSERT(this->isAllUnmarked())
}
protected:
......@@ -371,7 +371,7 @@ public:
virtual ~CellMarkerNoUnmark()
{
// assert(isAllUnmarked()) ;
CGoGN_ASSERT(this->isAllUnmarked())
// CGoGN_ASSERT(this->isAllUnmarked())
}
protected:
......
......@@ -270,7 +270,7 @@ public:
{
unmarkAll() ;
// assert(isAllUnmarked) ;
CGoGN_ASSERT(isAllUnmarked())
// CGoGN_ASSERT(isAllUnmarked())
}
protected:
......@@ -339,7 +339,7 @@ public:
~DartMarkerNoUnmark()
{
// assert(isAllUnmarked) ;
CGoGN_ASSERT(isAllUnmarked())
// CGoGN_ASSERT(isAllUnmarked())
}
protected:
......
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