-// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2021 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
#include "HELLOGUI.h"
#include "HELLO_version.h"
+#include "HELLO_Component_Generator.hxx"
#include <SalomeApp_Application.h>
#include <SalomeApp_Study.h>
#include <SALOME_LifeCycleCORBA.hxx>
#include <SALOMEDS_SObject.hxx>
#include <SALOMEDS_Study.hxx>
+#include "SALOME_NamingService_Abstract.hxx"
+#include "SALOME_KernelServices.hxx"
#include <QInputDialog>
Perform general module initialization (like creation of actions,
menus, toolbars, etc).
- \note This function is invoked only once per study, when the module
+ \note This function is invoked only once, when the module
is first time activated by the user.
The study associated with the application might not exist
(created or opened) when this function is invoked, so it is not
// create toolbars
int aToolId;
- aToolId = createTool ( tr( "TOOL_TEST" ) ); // Test toolbar
+ aToolId = createTool ( tr( "TOOL_TEST" ), QString( "HelloTest" ) ); // Test toolbar
createTool( OpTestMe, aToolId ); // Test - Test me
- aToolId = createTool ( tr( "TOOL_HELLO" ) ); // Hello toolbar
+ aToolId = createTool ( tr( "TOOL_HELLO" ), QString( "HelloMain" ) ); // Hello toolbar
createTool( OpHello, aToolId ); // Hello - Hello
createTool( OpGoodbye, aToolId ); // Hello - Goodbye
// want Object browser, in the left area
theMap.insert( SalomeApp_Application::WT_ObjectBrowser,
Qt::LeftDockWidgetArea );
+#ifndef DISABLE_PYCONSOLE
// want Python console, in the bottom area
theMap.insert( SalomeApp_Application::WT_PyConsole,
Qt::BottomDockWidgetArea );
+#endif
}
/*!
*/
void HELLOGUI::hello()
{
- SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( application()->activeStudy() );
- _PTR(Study) studyDS = study->studyDS();
-
// request user name
bool ok;
QString name = QInputDialog::getText( getApp()->desktop(), tr( "QUE_HELLO_TITLE" ), tr( "QUE_ENTER_NAME" ),
if ( ok && !name.trimmed().isEmpty() ) {
// say hello to SALOME
- HELLO_ORB::status status = engine()->hello( _CAST(Study, studyDS)->GetStudy(), (const char*)name.toLatin1() );
+ HELLO_ORB::status status = engine()->hello( (const char*)name.toLatin1() );
// update Object browser
getApp()->updateObjectBrowser(true);
if ( !name.trimmed().isEmpty() ) {
// say goodby to SALOME
- HELLO_ORB::status status = engine()->goodbye( _CAST(Study, studyDS)->GetStudy(), (const char*)name.toLatin1() );
+ HELLO_ORB::status status = engine()->goodbye( (const char*)name.toLatin1() );
// update Object browser
getApp()->updateObjectBrowser(true);
void HELLOGUI::init()
{
// initialize HELLO module engine (load, if necessary)
- if ( CORBA::is_nil( myEngine ) ) {
- Engines::EngineComponent_var comp =
- SalomeApp_Application::lcc()->FindOrLoad_Component( "FactoryServer", "HELLO" );
+ if ( CORBA::is_nil( myEngine ) )
+ {
+ SALOME_NamingService_Abstract *ns = SalomeApp_Application::namingService();
+ Engines::EngineComponent_var comp;
+ if(ns->IsTrueNS())
+ {
+ comp = SalomeApp_Application::lcc()->FindOrLoad_Component( "FactoryServer", "HELLO" );
+ }
+ else
+ {
+ comp = RetrieveHELLOInstance();
+ CORBA::Object_var comp2 = CORBA::Object::_narrow(comp);
+ KERNEL::RegisterCompo("HELLO",comp2);
+ }
myEngine = HELLO_ORB::HELLO_Gen::_narrow( comp );
}
}
// Export the module
extern "C" {
// FACTORY FUNCTION: create an instance of the Hello module GUI
+ HELLO_EXPORT
CAM_Module* createModule()
{
return new HELLOGUI();
}
// VERSIONING FUNCTION: get Hello module's version identifier
+ HELLO_EXPORT
char* getModuleVersion()
{
return (char*)HELLO_VERSION_STR; // HELLO_VERSION_STR is defined in HELLO_version.h