AC_CHECK_FILE("$PYUIC",pyqt_ok=yes,pyqt_ok=no)
-#if test "x$pyqt_ok" = xyes ; then
-# AC_CHECK_FILES("$PYQTLIB/qt.py",pyqt_ok=yes,pyqt_ok=no)
-#fi
+dnl if test "x$pyqt_ok" = xyes ; then
+dnl AC_CHECK_FILES("$PYQTLIB/qt.py",pyqt_ok=yes,pyqt_ok=no)
+dnl fi
-#if test "x$pyqt_ok" = xno ; then
-# AC_CHECK_FILES("$PYQTLIB/qt/qt.py",pyqt_ok=yes,pyqt_ok=no)
-#fi
+dnl if test "x$pyqt_ok" = xno ; then
+dnl AC_CHECK_FILES("$PYQTLIB/qt/qt.py",pyqt_ok=yes,pyqt_ok=no)
+dnl fi
-#if test "x$pyqt_ok" = xyes ; then
-# AC_CHECK_FILE("$PYQTLIB/libqtcmodule.so",pyqt_ok=yes,pyqt_ok=no)
-#fi
+dnl if test "x$pyqt_ok" = xyes ; then
+dnl AC_CHECK_FILE("$PYQTLIB/libqtcmodule.so",pyqt_ok=yes,pyqt_ok=no)
+dnl fi
if test "x$pyqt_ok" = xyes ; then
AC_CHECK_FILES("$PYQT_SIPS/qtmod.sip",pyqt_ok=yes,pyqt_ok=no)
if test "x$pyqt_ok" = xyes ; then
PYQT_ROOT=$PYQTDIR
PYQT_INCLUDES="-I$PYQT_SIPS"
- PYQT_LIBS="-L$PYQTLIB -lqtcmodule"
+ PYQT_LIBS="-L$PYQTLIB "
AC_SUBST(PYQT_ROOT)
AC_SUBST(PYQT_INCLUDES)
AC_SUBST(PYQT_LIBS)
fi
fi
+version=`moc -v > mocversion 2>&1;cut -c40-44 mocversion;rm -rf mocversion`
+case "$version" in
+ 3.3.3)
+ QT_VERS=v3_3_3
+ AC_MSG_RESULT(QT3.3.3 install detected)
+ qt_ok=yes;;
+ 3.0.5)
+ AC_MSG_RESULT(QT3.0.5 install detected)
+ QT_VERS=v3_0_5
+ qt_ok=yes;;
+ *)
+ AC_MSG_RESULT(qt version $version not supported)
+ qt_ok=no
+ QT_VERS=no ;;
+esac
+
+AC_SUBST(QT_VERS)
+AC_MSG_RESULT(qt version $QT_VERS )
+
AC_SUBST(QTDIR)
QT_ROOT=$QTDIR
AC_SUBST(QT_INCLUDES)
AC_SUBST(QT_LIBS)
AC_SUBST(QT_MT_LIBS)
+AC_SUBST(QT_VERS)
AC_LANG_RESTORE
SIP_VERS=new ;;
3.10*)
SIP_VERS=new2 ;;
- 4.1*)
- SIP_VERS=new3 ;;
+ 4.1*)
+ SIP_VERS=v4_1 ;;
*)
AC_MSG_RESULT(sip version $version not supported)
SIP_VERS=no ;;
SIP_LIBS="-L${PYTHON_PREFIX}/lib/python${PYTHON_VERSION}/site-packages -lsip"
fi
- if test "x$SIP_VERS" = "xnew3"
+ if test "x$SIP_VERS" = "xv4_1"
then
- dnl new3 install : includes and libs are in python install
- AC_MSG_RESULT(new3 install detected)
+ dnl 4.1 install : includes and libs are in python install
+ AC_MSG_RESULT(4.1 install detected)
sip_ok=yes
AC_CHECK_FILE($PYTHON_PREFIX/include/python$PYTHON_VERSION/sip.h,sip_ok=$sip_ok,sip_ok=no)
SIP_INCLUDES="${PYTHON_INCLUDES}"
AC_CHECK_FILE($PYTHON_PREFIX/lib/python$PYTHON_VERSION/site-packages/sip.so,sip_ok=$sip_ok,sip_ok=no)
- SIP_LIBS="-L${PYTHON_PREFIX}/lib/python${PYTHON_VERSION}/site-packages -lsip"
+ SIP_LIBS="${PYTHON_PREFIX}/lib/python${PYTHON_VERSION}/site-packages/sip.so"
fi
fi
MOC = @MOC@
UIC = @UIC@
+QT_VERS = @QT_VERS@
#QWT
EXPORT_HEADERS = \
qsplitterP.h \
- qactionP.h
-
-# qfiledialogP.h \
-# qworkspaceP.h \
+ qworkspaceP.h \
+ qactionP.h \
+ qfiledialogP.h
# Libraries targets
+ifeq ($(QT_VERS),v3_3_3)
+ LIB_SRC = qsplitterP.cxx qsplitterP_moc.cxx
+else
+ LIB_SRC = qsplitterP.cxx qsplitterP_moc.cxx qworkspaceP.cxx qworkspaceP_moc.cxx qactionP.cxx qactionP_moc.cxx qfiledialogP.cxx qfiledialogP_moc.cxx
+endif
LIB = libqsplitterP.la
-#LIB_SRC = qsplitterP.cxx qsplitterP_moc.cxx qworkspaceP.cxx qworkspaceP_moc.cxx qactionP.cxx qactionP_moc.cxx qfiledialogP.cxx qfiledialogP_moc.cxx
-LIB_SRC = qsplitterP.cxx qsplitterP_moc.cxx qactionP.cxx qactionP_moc.cxx
qsplitterP_moc.cxx: $(inc_builddir)/qsplitterP.h
$(MOC) $(inc_builddir)/qsplitterP.h -o qsplitterP_moc.cxx
-#qworkspaceP_moc.cxx: $(inc_builddir)/qworkspaceP.h
-# $(MOC) $(inc_builddir)/qworkspaceP.h -o qworkspaceP_moc.cxx
+qworkspaceP_moc.cxx: $(inc_builddir)/qworkspaceP.h
+ $(MOC) $(inc_builddir)/qworkspaceP.h -o qworkspaceP_moc.cxx
qactionP_moc.cxx: $(inc_builddir)/qactionP.h
$(MOC) $(inc_builddir)/qactionP.h -o qactionP_moc.cxx
-#qfiledialogP_moc.cxx: $(inc_builddir)/qfiledialogP.h
-# $(MOC) $(inc_builddir)/qfiledialogP.h -o qfiledialogP_moc.cxx
+qfiledialogP_moc.cxx: $(inc_builddir)/qfiledialogP.h
+ $(MOC) $(inc_builddir)/qfiledialogP.h -o qfiledialogP_moc.cxx
-CPPFLAGS+=$(QT_INCLUDES) -I${QTDIR}/src/kernel -I$(QTDIR)/mkspecs/linux-g++
+CPPFLAGS+=$(QT_INCLUDES) -I${QTDIR}/src/kernel -I$(QTDIR)/mkspecs/linux-g++ -I/usr/share/qt3/mkspecs/linux-g++
CXXFLAGS+=
LDFLAGS+=$(QT_MT_LIBS)
#ifndef QT_NO_ACTION
+#if QT_VERSION > 0x030005
+#include <qaction.h>
+#define QActionP QAction
+#define QActionPGroup QActionGroup
+#else
+
class QActionPPrivate;
class QActionPGroupPrivate;
class QStatusBar;
#endif
+#endif // QT_VERSION
+
#endif
#include "qlineedit.h"
#endif // QT_H
+#if QT_VERSION > 0x030005
+#include <qfiledialog.h>
+#define QFileDialogP QFileDialog
+#else
+
#ifndef QT_NO_FILEDIALOG
class Q_EXPORT QFileIconProviderP : public QObject
#endif
+#endif // QT_VERSION
+
#endif // QFILEDIALOG_H
#include <qlabel.h>
#endif // QT_H
+#if QT_VERSION > 0x030005
+#include <qworkspace.h>
+#define QWorkspaceP QWorkspace
+#else
+
class QWorkspacePChild;
class QShowEvent;
class QWorkspacePPrivate;
QTitleBarPPrivate *d;
};
-
+#endif // QT_VERSION
#endif // QWORKSPACEP_H
void PyInterp_PyQt::initState()
{
SCRUTE(PyInterp_base::_gtstate);
+ //PyLockWrapper aLock(_tstate);
_tstate=PyInterp_base::_gtstate;
PyThreadState_Swap(_tstate);
SCRUTE(_tstate);
void PyInterp_PyQt::initContext()
{
+ //PyLockWrapper aLock(_tstate);
_g = PyDict_New(); // create interpreter dictionnary context
PyObject *bimod = PyImport_ImportModule("__builtin__");
PyDict_SetItemString(_g, "__builtins__", bimod);
void PyInterp_PyQt::run(const char *command)
{
MESSAGE("compile");
- //PyLockWrapper aLock(_tstate);
- PyEval_AcquireLock();
- PyThreadState_Swap(_tstate);
+ PyLockWrapper aLock(_tstate);
PyObject *code = Py_CompileString((char *)command,"PyGUI",Py_file_input);
if(!code){
// Une erreur s est produite en general SyntaxError
PyErr_Print();
- PyEval_ReleaseLock();
return;
}
PyObject *r = PyEval_EvalCode(code,_g,_g);
if(!r){
// Une erreur s est produite a l execution
PyErr_Print();
- PyEval_ReleaseLock();
return;
}
Py_DECREF(r);
- PyEval_ReleaseLock();
}
static QMutex myMutex(true);
-PyLockWrapper::PyLockWrapper(PyThreadState* theThreadState):
+PyLockWrapper::PyLockWrapper(PyThreadState* theThreadState):
myThreadState(theThreadState),
mySaveThreadState(PyInterp_base::_gtstate)
{
PyEval_AcquireLock();
- mySaveThreadState = PyThreadState_Swap(theThreadState);
+ mySaveThreadState = PyThreadState_Swap(myThreadState); // store previous current in save,
+ // set local in current
}
PyLockWrapper::~PyLockWrapper(){
- PyThreadState_Swap(mySaveThreadState);
- PyEval_ReleaseLock();
+ PyThreadState_Swap(mySaveThreadState); // restore previous current (no need to get local,
+ PyEval_ReleaseLock(); // local thread state* already in _tstate
}
PyInterp_base::~PyInterp_base()
{
if(MYPYDEBUG) MESSAGE("PyInterp_base::~PyInterp_base() - this = "<<this);
- //PyLockWrapper aLock(_tstate);
- PyEval_AcquireLock();
- PyThreadState_Swap(_tstate);
+ PyLockWrapper aLock(_tstate);
//Py_EndInterpreter(_tstate);
- PyEval_ReleaseLock();
}
if(MYPYDEBUG) MESSAGE("PyInterp_base::initialize() - this = "<<this<<"; _gtstate = "<<_gtstate);
// The lock will be acquired in initState. Make provision to release it on exit
- //PyReleaseLock aReleaseLock;
+ PyReleaseLock aReleaseLock;
initState();
initContext();
// All the initRun outputs are redirected to the standard output (console)
initRun();
- PyEval_ReleaseLock();
}
// We come from C++ to enter Python world
// We need to acquire the Python global lock
- //PyLockWrapper aLock(_tstate);
- PyEval_AcquireLock();
- PyThreadState_Swap(_tstate);
+ PyLockWrapper aLock(_tstate);
// Reset redirected outputs before treatment
PySys_SetObject("stderr",_verr);
// Outputs are redirected on standards outputs (console)
PySys_SetObject("stdout",PySys_GetObject("__stdout__"));
PySys_SetObject("stderr",PySys_GetObject("__stderr__"));
- PyEval_ReleaseLock();
return ier;
}
string PyInterp_base::getverr(){
- //PyLockWrapper aLock(_tstate);
- PyEval_AcquireLock();
- PyThreadState_Swap(_tstate);
+ PyLockWrapper aLock(_tstate);
PyObjWrapper v(PycStringIO->cgetvalue(_verr));
string aRet(PyString_AsString(v));
- PyEval_ReleaseLock();
return aRet;
}
string PyInterp_base::getvout(){
- //PyLockWrapper aLock(_tstate);
- PyEval_AcquireLock();
- PyThreadState_Swap(_tstate);
+ PyLockWrapper aLock(_tstate);
PyObjWrapper v(PycStringIO->cgetvalue(_vout));
string aRet(PyString_AsString(v));
- PyEval_ReleaseLock();
return aRet;
}
#include <qcombobox.h>
#include <qstatusbar.h>
#include <qpopupmenu.h>
-#if QT_VERSION == 0x030005
#include "qworkspaceP.h"
-#else
-#include <qworkspace.h>
-#define QWorkspaceP QWorkspace
-#endif
#include <qmainwindow.h>
#include <qfiledialog.h>
#include <qtoolbutton.h>
#include <qcombobox.h>
#include <qpushbutton.h>
-// VSR (18/01/2005): use patched QFileDialog only for the official 3.0.5 version of Qt
-#if QT_VERSION == 0x030005
#include <qfiledialogP.h>
-#else
-#include <qfiledialog.h>
-#define QFileDialogP QFileDialog
-#endif
#include "QAD.h"
#include "QAD_FileValidator.h"
void QAD_PyInterp::initState()
{
+ //PyLockWrapper aLock(_tstate);
_tstate = Py_NewInterpreter(); // create an interpreter and save current state
PySys_SetArgv(PyInterp_base::_argc,PyInterp_base::_argv); // initialize sys.argv
if(MYDEBUG) MESSAGE("QAD_PyInterp::initState - this = "<<this<<"; _tstate = "<<_tstate);
void QAD_PyInterp::initContext()
{
+ //PyLockWrapper aLock(_tstate);
PyObject *m = PyImport_AddModule("__main__"); // interpreter main module (module context)
if(!m){
if(MYDEBUG) MESSAGE("problem...");
# SIP C++ Python
# SIP defined in make_commence.in
#SIP_FLAGS = -t WS_X11 -t Qt_3_0_5 -s ".cc" -c $(CURDIR) -I $(PYQT_SIPS)
-SIP_FLAGS = -t WS_X11 -t Qt_3_3_0 -s ".cc" -c $(CURDIR) -I $(PYQT_SIPS)
# SIP input file(s)
-SIP_FILES = SalomePyQt.sip
+#SIP_FILES = SalomePyQt.sip
# SIP-generated C++ source files (corresponding line should be added for each wrapped class
# contained by SalomePyQt module)
+#SIP_SRC=$(CURDIR)/SalomePyQtcmodule.cc \
+# $(CURDIR)/sipSalomePyQtSalomePyQt.cc \
+# $(CURDIR)/sipSalomePyQtSALOME_Selection.cc
+ifeq ($(SIP_VERS),v4_1)
+SIP_FLAGS = -t WS_X11 -t Qt_3_3_0 -s ".cc" -c $(CURDIR) -I $(PYQT_SIPS)
SIP_SRC=$(CURDIR)/sipSalomePyQtcmodule.cc \
$(CURDIR)/sipSalomePyQtSalomePyQt.cc \
$(CURDIR)/sipSalomePyQtSALOME_Selection.cc
-
-ifeq ($(SIP_VERS),new3)
MOC_SRC = sipSalomePyQtcmodule_moc.cxx
MOC_H = sipSalomePyQtcmodule.h
+SIP_FILES = SalomePyQt_v4.sip
+#LDFLAGS+= -lSalomeGUI
+LDFLAGS+= -lSalomeGUI -module
+
+# Libraries targets
+LIB = SalomePyQt.la
+else
+ifeq ($(SIP_VERS),new2)
+SIP_FLAGS = -t WS_X11 -t Qt_3_0_5 -s ".cc" -c $(CURDIR) -I $(PYQT_SIPS)
+SIP_SRC=$(CURDIR)/SalomePyQtcmodule.cc \
+ $(CURDIR)/sipSalomePyQtSalomePyQt.cc \
+ $(CURDIR)/sipSalomePyQtSALOME_Selection.cc
+MOC_SRC = SalomePyQtcmodule_moc.cxx
+MOC_H = SalomePyQtcmodule.h
+SIP_FILES = SalomePyQt.sip
+LDFLAGS+= -lSalomeGUI -lqtcmodule
+
+# Libraries targets
+LIB = libSalomePyQtcmodule.la
+
+EXPORT_SHAREDPYSCRIPTS = SalomePyQt.py
else
+SIP_FLAGS = -t WS_X11 -t Qt_3_0_5 -s ".cc" -c $(CURDIR) -I $(PYQT_SIPS)
+SIP_SRC=$(CURDIR)/SalomePyQtcmodule.cc \
+ $(CURDIR)/sipSalomePyQtSalomePyQt.cc \
+ $(CURDIR)/sipSalomePyQtSALOME_Selection.cc
MOC_SRC = sipSalomePyQtProxySalomePyQt_moc.cxx
MOC_H = sipSalomePyQtProxySalomePyQt.h
-endif
+SIP_FILES = SalomePyQt.sip
+LDFLAGS+= -lSalomeGUI -lqtcmodule
# Libraries targets
-
LIB = libSalomePyQtcmodule.la
+EXPORT_SHAREDPYSCRIPTS = SalomePyQt.py
+endif
+endif
+
LIB_SRC += SalomePyQt.cxx SALOME_PYQT_GUI.cxx $(SIP_SRC) $(MOC_SRC)
LIB_MOC = SALOME_PYQT_GUI.h
LIB_CLIENT_IDL = SALOME_Exception.idl SALOME_ContainerManager.idl
CPPFLAGS+=$(QT_INCLUDES) $(PYTHON_INCLUDES) $(SIP_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES)
-LIBS+= $(PYTHON_LIBS) $(VTK_LIBS) $(OGL_LIBS)
-# $(SIP_LIBS) $(PYQT_LIBS)
-LDFLAGS+= -lSalomeGUI
-# -lqtcmodule
+LIBS+= $(PYTHON_LIBS) $(SIP_LIBS) $(PYQT_LIBS) $(VTK_LIBS) $(OGL_LIBS)
+#LDFLAGS+= -lSalomeGUI -lqtcmodule
+#LDFLAGS+= -lSalomeGUI
# Custom build step: generate C++ wrapping according to $(SIP_FILES)
// $Header$
//=============================================================================
-#include "SALOME_PYQT_GUI.h" // this include must be first (see PyInterp_base.h)!
+#include "SALOME_PYQT_GUI.h"
#include "QAD_Desktop.h"
#include "SALOMEGUI_QtCatchCorbaException.hxx"
#include "utilities.h"
-//#include <sipSalomePyQtDeclSalomePyQt.h>
+
+#if QT_VERSION > 0x030005
#include <sipAPISalomePyQt.h>
+#else
+#include <sipSalomePyQtDeclSalomePyQt.h>
+#endif
+
#include <sipqtQWorkspace.h>
#include <sipqtQPopupMenu.h>
%Import qtmod.sip
+
class SALOME_Selection : QObject
{
-%TypeHeaderCode
+
+%HeaderCode
#include <SALOME_Selection.h>
%End
+
public:
SALOME_Selection(const QString &);
void Clear();
class SalomePyQt
{
-%TypeHeaderCode
+
+%HeaderCode
#include <SalomePyQt.hxx>
%End
--- /dev/null
+%Module SalomePyQt
+
+%Import qtmod.sip
+
+class SALOME_Selection : QObject
+{
+%TypeHeaderCode
+#include <SALOME_Selection.h>
+%End
+
+public:
+ SALOME_Selection(const QString &);
+ void Clear();
+ void ClearIObjects();
+
+signals:
+ void currentSelectionChanged();
+};
+
+enum MenuName {
+ File = 1,
+ View = 2,
+ Edit = 3,
+ Preferences = 4,
+ Tools = 5,
+ Window = 6,
+ Help = 7
+};
+
+class SalomePyQt
+{
+%TypeHeaderCode
+#include <SalomePyQt.hxx>
+%End
+
+public:
+ static QWidget* getDesktop();
+ static QWorkspace* getMainFrame();
+ static QMenuBar* getMainMenuBar();
+ static QPopupMenu* getPopupMenu( const MenuName );
+ static SALOME_Selection* getSelection();
+ static int getStudyId();
+ static void putInfo( const QString& );
+ static void putInfo( const QString&, int );
+
+ static const QString& getActiveComponent();
+
+ static void updateObjBrowser( int, bool );
+
+
+ static bool removeSettings(QString);
+ static QString getSetting(QString);
+ static void addStringSetting(QString, QString, bool);
+ static void addIntSetting(QString, int, bool);
+ static void addDoubleSetting(QString, double, bool);
+
+ static QString getFileName(QWidget*, const QString&, const QStringList&, const QString&, bool);
+ static QStringList getOpenFileNames(QWidget*, const QString&, const QStringList&, const QString&);
+ static QString getExistingDirectory(QWidget*, const QString&, const QString&);
+ static void helpContext(const QString&, const QString&);
+ static bool dumpView(const QString&);
+};