X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2Fgenericgui%2FGuiExecutor.cxx;h=4bd977c69451a22148d5ac76b68957558d519ee6;hb=f31c1aa1cf3481bf51166f0c4e3dd118bc3ab43b;hp=0b857e80ffdc33262f0d5f96720c8ffbc70398d1;hpb=66780cef0655cb3cfcc299787f0918ee47a44526;p=modules%2Fyacs.git diff --git a/src/genericgui/GuiExecutor.cxx b/src/genericgui/GuiExecutor.cxx index 0b857e80f..4bd977c69 100644 --- a/src/genericgui/GuiExecutor.cxx +++ b/src/genericgui/GuiExecutor.cxx @@ -1,9 +1,9 @@ -// Copyright (C) 2006-2013 CEA/DEN, EDF R&D +// Copyright (C) 2006-2015 CEA/DEN, EDF R&D // // 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 @@ -279,8 +279,12 @@ void GuiExecutor::saveState(const std::string& xmlFile) bool StartFinish = (getExecutorState() == YACS::NOTYETINITIALIZED || getExecutorState() == YACS::FINISHED); if ( _isRunning || - !(CORBA::is_nil(_procRef)) && StartFinish ) - _procRef->saveState(xmlFile.c_str()); + !(CORBA::is_nil(_procRef)) && StartFinish ) { + if ( !_procRef->saveState(xmlFile.c_str()) ) { + string what = "Impossible to open file for writing: " + xmlFile; + throw Exception(what); + } + } } void GuiExecutor::setLoadStateFile(std::string xmlFile) @@ -392,6 +396,7 @@ void GuiExecutor::registerStatusObservers() for ( std::list::iterator it = aNodeSet.begin(); it != aNodeSet.end(); it++ ) { _procRef->addObserver(_observerRef, _serv->getEngineId((*it)->getNumId()) , "status"); + _procRef->addObserver(_observerRef, _serv->getEngineId((*it)->getNumId()) , "progress"); } _procRef->addObserver(_observerRef, _serv->getEngineId(_proc->getNumId()) , "executor"); } @@ -519,32 +524,39 @@ bool GuiExecutor::event(QEvent *e) SubjectNode *snode = _context->_mapOfExecSubjectNode[iGui]; DEBTRACE("node " << snode->getName() << " state=" << state); - YACS::ENGINE::Node *node = snode->getNode(); - list inports = node->getLocalInputPorts(); - list::iterator iti = inports.begin(); - for ( ; iti != inports.end(); ++iti) - { - string val = _procRef->getInPortValue(numid, (*iti)->getName().c_str()); - DEBTRACE("node " << snode->getName() << " inport " << (*iti)->getName() - << " value " << val); - YASSERT(_context->_mapOfSubjectDataPort.count(*iti)); - SubjectDataPort* port = _context->_mapOfSubjectDataPort[*iti]; - port->setExecValue(val); - port->update(YACS::HMI::UPDATEPROGRESS, 0, port); - } - list outports = node->getLocalOutputPorts(); - list::iterator ito = outports.begin(); - for ( ; ito != outports.end(); ++ito) - { - string val = _procRef->getOutPortValue(numid, (*ito)->getName().c_str()); - DEBTRACE("node " << snode->getName() << " outport " << (*ito)->getName() - << " value " << val); - YASSERT(_context->_mapOfSubjectDataPort.count(*ito)); - SubjectDataPort* port = _context->_mapOfSubjectDataPort[*ito]; - port->setExecValue(val); - port->update(YACS::HMI::UPDATEPROGRESS, 0, port); - } - snode->update(YACS::HMI::UPDATEPROGRESS, state, snode); + if (event == "progress") { // --- Update progress bar + std::string progress = _procRef->getNodeProgress(numid); + snode->setProgress( progress ); + snode->update(YACS::HMI::PROGRESS, state, snode); + } + else { // --- Update node ports + YACS::ENGINE::Node *node = snode->getNode(); + list inports = node->getLocalInputPorts(); + list::iterator iti = inports.begin(); + for ( ; iti != inports.end(); ++iti) + { + string val = _procRef->getInPortValue(numid, (*iti)->getName().c_str()); + DEBTRACE("node " << snode->getName() << " inport " << (*iti)->getName() + << " value " << val); + YASSERT(_context->_mapOfSubjectDataPort.count(*iti)); + SubjectDataPort* port = _context->_mapOfSubjectDataPort[*iti]; + port->setExecValue(val); + port->update(YACS::HMI::UPDATEPROGRESS, 0, port); + } + list outports = node->getLocalOutputPorts(); + list::iterator ito = outports.begin(); + for ( ; ito != outports.end(); ++ito) + { + string val = _procRef->getOutPortValue(numid, (*ito)->getName().c_str()); + DEBTRACE("node " << snode->getName() << " outport " << (*ito)->getName() + << " value " << val); + YASSERT(_context->_mapOfSubjectDataPort.count(*ito)); + SubjectDataPort* port = _context->_mapOfSubjectDataPort[*ito]; + port->setExecValue(val); + port->update(YACS::HMI::UPDATEPROGRESS, 0, port); + } + snode->update(YACS::HMI::UPDATEPROGRESS, state, snode); + } } return true;