X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FHOMARDGUI%2FHOMARDGUI.cxx;h=0bcbb070eefda55c262d4faa972d7e8c45fb626b;hb=refs%2Ftags%2FV9_13_0b1;hp=e04d2541af0af7e580798450e9eaea53efb2efbb;hpb=0d34303ea7a124c42783c9dc08accead8c4a6c69;p=modules%2Fhomard.git diff --git a/src/HOMARDGUI/HOMARDGUI.cxx b/src/HOMARDGUI/HOMARDGUI.cxx index e04d2541..0bcbb070 100644 --- a/src/HOMARDGUI/HOMARDGUI.cxx +++ b/src/HOMARDGUI/HOMARDGUI.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2011-2016 CEA/DEN, EDF R&D +// Copyright (C) 2011-2024 CEA, EDF // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -24,8 +24,7 @@ #include "HOMARDGUI.h" // SALOME Includes -#include "Utils_ORB_INIT.hxx" -#include "Utils_SINGLETON.hxx" +#include "OpUtil.hxx" #include "SALOME_LifeCycleCORBA.hxx" #include "SUIT_ResourceMgr.h" @@ -49,6 +48,8 @@ #include "SalomeApp_Module.h" #include "SALOMEconfig.h" #include +#include +#include #include @@ -105,7 +106,8 @@ HOMARDGUI::~HOMARDGUI() //======================================================================= HOMARD::HOMARD_Gen_var HOMARDGUI::InitHOMARDGen(SalomeApp_Application* app) { - Engines::EngineComponent_var comp = app->lcc()->FindOrLoad_Component( "FactoryServer","HOMARD" ); + Engines::EngineComponent_var comp; + comp = app->lcc()->FindOrLoad_Component( "FactoryServer","HOMARD" ); HOMARD::HOMARD_Gen_var clr = HOMARD::HOMARD_Gen::_narrow(comp); ASSERT(!CORBA::is_nil(clr)); return clr; @@ -179,7 +181,7 @@ void HOMARDGUI::createActions(){ //================================================ void HOMARDGUI::createPreferences() { - MESSAGE("createPreferences") + MESSAGE("createPreferences"); int Onglet, Bloc, Pref ; // 1. Generalites @@ -231,7 +233,7 @@ void HOMARDGUI::createPreferences() //================================================ void HOMARDGUI::createMenus() { - MESSAGE("createMenus") + MESSAGE("createMenus"); // int HOMARD_Id = createMenu( tr( "HOM_MEN_HOMARD" ), -1, 5, 10 ); createMenu( 1101, HOMARD_Id, -1 ); //Create_Case @@ -268,7 +270,7 @@ void HOMARDGUI::createMenus() //================================================ void HOMARDGUI::recupPreferences() { - MESSAGE("recupPreferences") + INFOS("recupPreferences") // // A. Declarations // @@ -281,9 +283,14 @@ void HOMARDGUI::recupPreferences() // B. Les valeurs // B.1. La langue // + SUIT_ResourceMgr* resMgr0 = getApp()->resourceMgr(); + QString lang = resMgr0->stringValue( resMgr0->langSection(), "language", "en" ); + INFOS ("Récupération de lang = " << lang.toStdString().c_str() ); defaut_s = homardGen->GetLanguageShort(); + INFOS ("Récupération de defaut_s = " << defaut_s.c_str() ); SUIT_ResourceMgr* resMgr = getApp()->resourceMgr(); _LanguageShort = resMgr->stringValue("language", "language", QString(defaut_s.c_str()) ); + INFOS ("Récupération de LanguageShort = " << _LanguageShort.toStdString().c_str() ); // // B.2. Les publications bool publish_mesh ; @@ -326,10 +333,10 @@ void HOMARDGUI::recupPreferences() // // C. Enregistrement dans l'objet general // - MESSAGE ("Enregistrement de LanguageShort = " << _LanguageShort.toStdString().c_str() ); - MESSAGE ("Enregistrement de PublisMeshIN = " << _PublisMeshIN<<", PublisMeshOUT = "<< _PublisMeshOUT); - MESSAGE ("Enregistrement de YACSMaxIter = " << _YACSMaxIter<<", YACSMaxNode = "<< _YACSMaxNode<<", YACSMaxElem = "<< _YACSMaxElem); - MESSAGE ("Enregistrement de YACSTypeTest = " << _YACSTypeTest); + INFOS ("Enregistrement de LanguageShort = " << _LanguageShort.toStdString().c_str() ); + INFOS ("Enregistrement de PublisMeshIN = " << _PublisMeshIN<<", PublisMeshOUT = "<< _PublisMeshOUT); + INFOS ("Enregistrement de YACSMaxIter = " << _YACSMaxIter<<", YACSMaxNode = "<< _YACSMaxNode<<", YACSMaxElem = "<< _YACSMaxElem); + INFOS ("Enregistrement de YACSTypeTest = " << _YACSTypeTest); // homardGen->SetLanguageShort(_LanguageShort.toStdString().c_str()); homardGen->SetPublisMesh(_PublisMeshIN, _PublisMeshOUT); @@ -342,7 +349,7 @@ void HOMARDGUI::recupPreferences() void HOMARDGUI::OnGUIEvent() //================================================ { - MESSAGE("OnGUIEvent()") + MESSAGE("OnGUIEvent()"); setOrb(); const QObject* obj = sender(); if ( !obj || !obj->inherits( "QAction" ) ) { return; } @@ -369,18 +376,12 @@ bool HOMARDGUI::OnGUIEvent (int theCommandID) } SUIT_Desktop* parent = application()->desktop(); + HOMARD::HOMARD_Gen_var homardGen = HOMARDGUI::InitHOMARDGen(app); if (!CORBA::is_nil(homardGen)) - { - // Set current study - SalomeApp_Study* aSAStudy =dynamic_cast(app->activeStudy()); - _PTR(Study) aStudy = aSAStudy->studyDS(); - SALOMEDS::Study_ptr aStudyDS; - if (aStudy) - aStudyDS = _CAST(Study,aStudy)->GetStudy(); - homardGen->SetCurrentStudy(aStudyDS); - } + homardGen->UpdateStudy(); + getApp()->updateObjectBrowser(); // B. Choix selon les commandes @@ -617,7 +618,7 @@ bool HOMARDGUI::OnGUIEvent (int theCommandID) case 1301: // Information sur un maillage { - MESSAGE("etape 1301") + MESSAGE("etape 1301"); MESSAGE("command " << theCommandID << " activated"); MonMeshInfo *aDlg = new MonMeshInfo( parent, true, HOMARD::HOMARD_Gen::_duplicate(homardGen) ) ; aDlg->show(); @@ -638,7 +639,7 @@ bool HOMARDGUI::OnGUIEvent (int theCommandID) case 1401: // Création d'un schema YACS { - MESSAGE("etape 1401") + MESSAGE("etape 1401"); MESSAGE("command " << theCommandID << " activated avec objet " << _ObjectName.toStdString().c_str() ); MonCreateYACS *aDlg = new MonCreateYACS( true, HOMARD::HOMARD_Gen::_duplicate(homardGen), _ObjectName ) ; aDlg->show(); @@ -647,7 +648,7 @@ bool HOMARDGUI::OnGUIEvent (int theCommandID) case 1402: // Ecriture d'un schéma YACS { - MESSAGE("etape 1402") + MESSAGE("etape 1402"); MESSAGE("command " << theCommandID << " activated avec objet " << _ObjectName.toStdString().c_str() ); try { homardGen->YACSWrite(_ObjectName.toStdString().c_str()); } catch( SALOME::SALOME_Exception& S_ex ) @@ -722,9 +723,7 @@ void HOMARDGUI::setOrb() { try { - ORB_INIT &init = *SINGLETON_::Instance(); - ASSERT(SINGLETON_::IsAlreadyExisting()); - _orb = init( 0 , 0 ); + _orb = KERNEL::GetRefToORB(); } catch (...) {