-// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2023 CEA/DEN, EDF R&D, OPEN CASCADE
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
QMutex myInitMutex;
/*! DEBUG mode */
-const bool DEBUG = false;
+const bool theDEBUG = false;
/*!
\var IsCallOldMethods
FuncMsg( const QString& funcName )
{
myName = funcName;
- if ( DEBUG )
+ if ( theDEBUG )
MESSAGE( qPrintable( myName ) << " [ begin ]" );
}
~FuncMsg()
{
- if ( DEBUG )
+ if ( theDEBUG )
MESSAGE( qPrintable( myName ) << " [ end ]" );
}
void message( const QString& msg )
{
- if ( DEBUG )
+ (void)msg; // unused in debug mode
+ if ( theDEBUG )
MESSAGE( qPrintable( myName ) << " : " << qPrintable( msg ) );
}
private:
SUIT_ResourceMgr* resMgr = module()->getApp()->resourceMgr();
QPixmap pixmap = resMgr->loadPixmap( module()->name(),
QApplication::translate( module()->name().toLatin1().data(),
- fileName.toLatin1().data() ) );
+ fileName.toUtf8().data() ) );
if ( !pixmap.isNull() )
icon = QIcon( pixmap );
}
*/
void PyModuleHelper::XmlHandler::createMenu( QDomNode& parentNode,
const int parentMenuId,
- QMenu* parentPopup )
+ QMenu* /*parentPopup*/ )
{
if ( !module() || parentNode.isNull() )
return;
QString& myIOR;
};
- static QString anIOR;
-
- if ( anIOR.isEmpty() ) {
- // post request
- PyInterp_Dispatcher::Get()->Exec( new EngineIORReq( myInterp,
- const_cast<PyModuleHelper*>( this ),
- anIOR ) );
- }
-
+ QString anIOR;
+ // post request
+ PyInterp_Dispatcher::Get()->Exec( new EngineIORReq( myInterp,
+ const_cast<PyModuleHelper*>( this ),
+ anIOR ) );
return anIOR;
}
}
// ... then call a method
int embedded = 1;
- PyObjWrapper aRes( PyObject_CallMethod( aMod, (char*)"salome_init", (char*)"i", embedded ) );
+ PyObjWrapper aRes( PyObject_CallMethod( aMod, (char*)"salome_init", (char*)"si", NULL, embedded ) );
if ( !aRes ) {
// Error!
PyErr_Print();
\param study parent study
*/
-void PyModuleHelper::internalDeactivate( SUIT_Study* study )
+void PyModuleHelper::internalDeactivate( SUIT_Study* /*study*/ )
{
FuncMsg fmsg( "--- PyModuleHelper::internalDeactivate()" );
}
// then call Python module's deactivate() method
if ( PyObject_HasAttrString( myPyModule , (char*)"closeStudy" ) ) {
- PyObjWrapper res( PyObject_CallMethod( myPyModule, (char*)"closeStudy", (char*)"i" ) );
+ PyObjWrapper res( PyObject_CallMethod( myPyModule, (char*)"closeStudy", (char*)"" ) );
if( !res ) {
PyErr_Print();
}
PyObjWrapper res( PyObject_CallMethod( myPyModule,
(char*)"preferenceChanged",
(char*)"ss",
- section.toLatin1().constData(),
- setting.toLatin1().constData() ) );
+ section.toUtf8().constData(),
+ setting.toUtf8().constData() ) );
if( !res ) {
PyErr_Print();
}
// call Python module's activeStudyChanged() method
if ( PyObject_HasAttrString( myPyModule, (char*)"activeStudyChanged" ) ) {
- PyObjWrapper res( PyObject_CallMethod( myPyModule, (char*)"activeStudyChanged", (char*)"i" ) );
+ PyObjWrapper res( PyObject_CallMethod( myPyModule, (char*)"activeStudyChanged", (char*)"" ) );
if( !res ) {
PyErr_Print();
}
PyObjWrapper res( PyObject_CallMethod( myPyModule,
(char*)"definePopup",
(char*)"sss",
- context.toLatin1().constData(),
- aObject.toLatin1().constData(),
- aParent.toLatin1().constData() ) );
+ context.toUtf8().constData(),
+ aObject.toUtf8().constData(),
+ aParent.toUtf8().constData() ) );
if( !res ) {
PyErr_Print();
}
(char*)"createPopupMenu",
(char*)"Os",
sipPopup.get(),
- context.toLatin1().constData() ) );
+ context.toUtf8().constData() ) );
if( !res1 ) {
PyErr_Print();
}
(char*)"customPopup",
(char*)"Osss",
sipPopup.get(),
- aContext.toLatin1().constData(),
- aObject.toLatin1().constData(),
- aParent.toLatin1().constData() ) );
+ aContext.toUtf8().constData(),
+ aObject.toUtf8().constData(),
+ aParent.toUtf8().constData() ) );
if( !res2 ) {
PyErr_Print();
}
// try with two parameters (new syntax)
PyObjWrapper res( PyObject_CallMethod( myPyModule, (char*)"saveFiles",
(char*)"ss",
- files.first().toLatin1().constData(),
- url.toLatin1().constData() ) );
+ files.first().toUtf8().constData(),
+ url.toUtf8().constData() ) );
if ( !res )
// try with single parameter (old syntax)
res = PyObject_CallMethod( myPyModule, (char*)"saveFiles",
- (char*)"s", files.first().toLatin1().constData() );
+ (char*)"s", files.first().toUtf8().constData() );
if ( !res ) {
PyErr_Print();
// try with two parameters (new syntax)
PyObjWrapper res( PyObject_CallMethod( myPyModule, (char*)"openFiles",
(char*)"Os", sipList.get(),
- url.toLatin1().constData() ) );
+ url.toUtf8().constData() ) );
if ( !res )
// try with single parameter (old syntax)
if ( PyObject_HasAttrString(myPyModule, (char*)"dumpStudy") ) {
PyObjWrapper res( PyObject_CallMethod( myPyModule, (char*)"dumpStudy",
- (char*)"s", files.first().toLatin1().constData()));
+ (char*)"s", files.first().toUtf8().constData()));
if ( !res ) {
PyErr_Print();
if ( PyObject_HasAttrString(myPyModule , (char*)"isDraggable") ) {
PyObjWrapper res( PyObject_CallMethod( myPyModule, (char*)"isDraggable",
- (char*)"s", what->entry().toLatin1().constData() ) );
+ (char*)"s", what->entry().toUtf8().constData() ) );
if( !res || !PyBool_Check( res )) {
PyErr_Print();
draggable = false;
if ( PyObject_HasAttrString(myPyModule , (char*)"isDropAccepted") ) {
PyObjWrapper res( PyObject_CallMethod( myPyModule, (char*)"isDropAccepted",
- (char*)"s", where->entry().toLatin1().constData() ) );
+ (char*)"s", where->entry().toUtf8().constData() ) );
if( !res || !PyBool_Check( res )) {
PyErr_Print();
dropAccepted = false;
if ( PyObject_HasAttrString(myPyModule, (char*)"dropObjects") ) {
PyObjWrapper res( PyObject_CallMethod( myPyModule, (char*)"dropObjects", (char*)"Osii",
sipList.get(),
- whereObject->entry().toLatin1().constData(),
+ whereObject->entry().toUtf8().constData(),
row, action ) );
if( !res ) {
return; // Error
if ( PyObject_HasAttrString( myPyModule, (char*)"onObjectBrowserClicked" ) ) {
- PyObjWrapper res( PyObject_CallMethod( myPyModule, (char*)"onObjectBrowserClicked", (char*)"si", theObj.toLatin1().constData(), theColumn ) );
+ PyObjWrapper res( PyObject_CallMethod( myPyModule, (char*)"onObjectBrowserClicked", (char*)"si", theObj.toUtf8().constData(), theColumn ) );
if( !res ) {
PyErr_Print();
}
}
private:
PyModuleHelper* myHelper;
- int myColumn;
QString myEntry;
+ int myColumn;
};
// Posting the request only if dispatcher is not busy!