21 #include "SALOME_ResourcesManager.hxx"
22 #include "SALOME_LifeCycleCORBA.hxx"
33 #include "ServiceUnreachable.hxx"
35 #include "SALOME_ModuleCatalog.hxx"
36 #include "SALOME_ModuleCatalog.hh"
37 #include "SALOMEDS_Tool.hxx"
60 #include <QFileDialog>
64 #include <QMessageBox>
72 #define WEXITSTATUS(w) ((int) ((w) & 0x40000000))
92 _mapViewContext.clear();
96 QtGuiContext::_counters =
new counters(100);
97 srand((
unsigned)time(0));
99 GuiObserver::setEventMap();
101 string iconPath = getenv(
"YACS_ROOT_DIR");
102 iconPath +=
"/share/salome/resources/yacs";
104 QDir::addSearchPath(
"icons", iconPath.c_str());
110 _loader->registerProcCataLoader();
120 CORBA::Object_ptr obj = namingService.
Resolve(
"/Kernel/ModulCatalog");
121 SALOME_ModuleCatalog::ModuleCatalog_var aModuleCatalog =
122 SALOME_ModuleCatalog::ModuleCatalog::_narrow(obj);
123 if (! CORBA::is_nil(aModuleCatalog))
125 DEBTRACE(
"SALOME_ModuleCatalog::ModuleCatalog found");
126 std::string anIOR =
orb->object_to_string( aModuleCatalog );
127 _sessionCatalog = runTime->
loadCatalog(
"session", anIOR );
130 std::map< std::string, YACS::ENGINE::ComponentDefinition * >::iterator it;
131 for (it = _sessionCatalog->_componentMap.begin();
132 it != _sessionCatalog->_componentMap.end(); ++it)
133 DEBTRACE(
"Component: " <<(*it).first);
136 std::map< std::string, YACS::ENGINE::TypeCode*>::iterator it;
137 for (it = _sessionCatalog->_typeMap.begin();
138 it != _sessionCatalog->_typeMap.end(); ++it)
140 <<
" " << (*it).second->getKindRepr()
141 <<
" " << (*it).second->name()
142 <<
" " << (*it).second->shortName()
143 <<
" " << (*it).second->id() );
145 DEBTRACE(
"_sessionCatalog " << _sessionCatalog);
149 catch(ServiceUnreachable& e)
154 _dwTree =
new QDockWidget(_parent);
155 _dwTree->setVisible(
false);
156 _dwTree->setWindowTitle(
"Tree View: edition mode");
157 _dwTree->setObjectName(
"yacsTreeViewDock");
158 _parent->addDockWidget(Qt::LeftDockWidgetArea, _dwTree);
159 _dwStacked =
new QDockWidget(_parent);
160 _dwStacked->setVisible(
false);
161 _dwStacked->setWindowTitle(
"Input Panel");
162 _dwStacked->setObjectName(
"yacsInputPanelDock");
163 _dwStacked->setMinimumWidth(270);
164 _parent->addDockWidget(Qt::RightDockWidgetArea, _dwStacked);
165 _dwCatalogs =
new QDockWidget(_parent);
166 _dwCatalogs->setVisible(
false);
167 _dwCatalogs->setWindowTitle(
"Catalogs");
168 _dwCatalogs->setObjectName(
"yacsCatalogsDock");
169 _parent->addDockWidget(Qt::RightDockWidgetArea, _dwCatalogs);
173 _dwCatalogs->setWidget(_catalogsWidget);
175 _parent->tabifyDockWidget(_dwStacked, _dwCatalogs);
176 if (_wrapper->objectBrowser())
177 _parent->tabifyDockWidget(_dwTree, _wrapper->objectBrowser());
178 _parent->setTabPosition(Qt::AllDockWidgetAreas, Resource::tabPanelsUp? QTabWidget::North: QTabWidget::South);
180 std::string usercata=Resource::userCatalog.toStdString();
181 _catalogsWidget->addCatalogFromFile(usercata);
184 GenericGui::~GenericGui()
186 if(_BJLdialog)
delete _BJLdialog;
189 void GenericGui::createActions()
202 _newSchemaAct = _wrapper->createAction(getMenuId(), tr(
"Create a new YACS Schema"), QIcon(
"icons:schema.png"),
203 tr(
"New Schema"), tr(
"Create a new YACS Schema"),
204 0, _parent,
false,
this, SLOT(onNewSchema()));
205 _newSchemaAct->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_N);
207 _importSchemaAct = _wrapper->createAction(getMenuId(), tr(
"Import a YACS Schema for edition"), QIcon(
"icons:import_dataflow.png"),
208 tr(
"Import Schema"), tr(
"Import a YACS Schema for edition"),
209 0, _parent,
false,
this, SLOT(onImportSchema()));
210 _importSchemaAct->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_O);
212 _importSupervSchemaAct = _wrapper->createAction(getMenuId(), tr(
"Import a SUPERV Schema for edition"), QIcon(
"icons:import_superv_dataflow.png"),
213 tr(
"Import SUPERV Schema"), tr(
"Import a SUPERV Schema for edition"),
214 0, _parent,
false,
this, SLOT(onImportSupervSchema()));
216 _exportSchemaAct = _wrapper->createAction(getMenuId(), tr(
"Save the current YACS Schema"), QIcon(
"icons:save_dataflow.png"),
217 tr(
"Save Schema"), tr(
"Save the current YACS Schema"),
218 0, _parent,
false,
this, SLOT(onExportSchema()));
219 _exportSchemaAct->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_S);
221 _exportSchemaAsAct = _wrapper->createAction(getMenuId(), tr(
"Save the current YACS Schema As..."), QIcon(
"icons:export_dataflow.png"),
222 tr(
"Save Schema As"), tr(
"Save the current YACS Schema As..."),
223 0, _parent,
false,
this, SLOT(onExportSchemaAs()));
226 _importCatalogAct = _wrapper->createAction(getMenuId(), tr(
"Import a Schema as a Catalog"), QIcon(
"icons:insert_file.png"),
227 tr(
"Import Catalog"), tr(
"Import a Schema as a Catalog"),
228 0, _parent,
false,
this, SLOT(onImportCatalog()));
231 _runLoadedSchemaAct = _wrapper->createAction(getMenuId(), tr(
"Prepare the current edited schema for run"), QIcon(
"icons:run_active.png"),
232 tr(
"Run Current Schema"), tr(
"Prepare the current edited schema for run"),
233 0, _parent,
false,
this, SLOT(onRunLoadedSchema()));
235 _loadRunStateSchemaAct = _wrapper->createAction(getMenuId(), tr(
"Load a previous run state for this schema, prepare to run"), QIcon(
"icons:load_execution_state.png"),
236 tr(
"Load Run State"), tr(
"Load a previous run state for this schema, prepare to run"),
237 0, _parent,
false,
this, SLOT(onLoadRunStateSchema()));
239 _loadAndRunSchemaAct = _wrapper->createAction(getMenuId(), tr(
"Load a schema for run"), QIcon(
"icons:run.png"),
240 tr(
"Load Schema to run"), tr(
"Load a schema for run"),
241 0, _parent,
false,
this, SLOT(onLoadAndRunSchema()));
243 _chooseBatchJobAct = _wrapper->createAction(getMenuId(), tr(
"Choose Batch Job to watch"), QIcon(
"icons:batch.png"),
244 tr(
"Choose Batch Job to watch"), tr(
"Choose Batch Job to watch"),
245 0, _parent,
false,
this, SLOT(onChooseBatchJob()));
247 _startResumeAct = _wrapper->createAction(getMenuId(), tr(
"Start or Resume Schema execution"), QIcon(
"icons:suspend_resume.png"),
248 tr(
"Start/Resume execution"), tr(
"Start or Resume Schema execution"),
249 0, _parent,
false,
this, SLOT(onStartResume()));
251 _abortAct = _wrapper->createAction(getMenuId(), tr(
"Abort the current execution"), QIcon(
"icons:kill.png"),
252 tr(
"Abort execution"), tr(
"Abort the current execution"),
253 0, _parent,
false,
this, SLOT(onAbort()));
255 _pauseAct = _wrapper->createAction(getMenuId(), tr(
"Suspend the current execution"), QIcon(
"icons:pause.png"),
256 tr(
"Suspend execution"), tr(
"Suspend the current execution"),
257 0, _parent,
false,
this, SLOT(onPause()));
259 _resetAct = _wrapper->createAction(getMenuId(), tr(
"Reset error nodes and restart the current execution"), QIcon(
"icons:reset.png"),
260 tr(
"Restart execution"), tr(
"Restart the current execution with reset of error nodes"),
261 0, _parent,
false,
this, SLOT(onReset()));
264 _saveRunStateAct = _wrapper->createAction(getMenuId(), tr(
"Save the current run state"), QIcon(
"icons:save_dataflow_state.png"),
265 tr(
"Save State"), tr(
"Save the current run state"),
266 0, _parent,
false,
this, SLOT(onSaveRunState()));
268 _newEditionAct = _wrapper->createAction(getMenuId(), tr(
"Edit again the current schema in a new context"), QIcon(
"icons:new_edition.png"),
269 tr(
"Edit Again"), tr(
"Edit again the current schema in a new context"),
270 0, _parent,
false,
this, SLOT(onNewEdition()));
273 _getYacsContainerLogAct = _wrapper->createAction(getMenuId(), tr(
"get YACS container log"), QIcon(
"icons:change_informations.png"),
274 tr(
"YACS Container Log"), tr(
"get YACS container log"),
275 0, _parent,
false,
this, SLOT(onGetYacsContainerLog()));
277 _getErrorReportAct = _wrapper->createAction(getMenuId(), tr(
"get Node Error Report"), QIcon(
"icons:filter_notification.png"),
278 tr(
"Node Error Report"), tr(
"get Node Error Report"),
279 0, _parent,
false,
this, SLOT(onGetErrorReport()));
281 _getErrorDetailsAct = _wrapper->createAction(getMenuId(), tr(
"get Node Error Details"), QIcon(
"icons:icon_text.png"),
282 tr(
"Node Error Details"), tr(
"get Node Error Details"),
283 0, _parent,
false,
this, SLOT(onGetErrorDetails()));
285 _getContainerLogAct = _wrapper->createAction(getMenuId(), tr(
"get Node Container Log"), QIcon(
"icons:change_informations.png"),
286 tr(
"Node Container Log"), tr(
"get Node Container Log"),
287 0, _parent,
false,
this, SLOT(onGetContainerLog()));
289 _shutdownProcAct = _wrapper->createAction(getMenuId(), tr(
"Shutdown Proc"), QIcon(
"icons:kill.png"),
290 tr(
"Shutdown Proc"), tr(
"Shutdown Proc"),
291 0, _parent,
false,
this, SLOT(onShutdownProc()));
294 _editDataTypesAct = _wrapper->createAction(getMenuId(), tr(
"Edit Data Types"), QIcon(
"icons:kill.png"),
295 tr(
"Edit Data Types"), tr(
"Edit Data Types"),
296 0, _parent,
false,
this, SLOT(onEditDataTypes()));
298 _createDataTypeAct = _wrapper->createAction(getMenuId(), tr(
"Create Data Types"), QIcon(
"icons:kill.png"),
299 tr(
"Create Data Types"), tr(
"Create Data Types"),
300 0, _parent,
false,
this, SLOT(onCreateDataType()));
302 _importDataTypeAct = _wrapper->createAction(getMenuId(), tr(
"Import Data Types, use drag and drop from catalog"), QIcon(
"icons:folder_cyan.png"),
303 tr(
"Import Data Types"), tr(
"Import Data Types, use drag and drop from catalog"),
304 0, _parent,
false,
this, SLOT(onImportDataType()));
306 _newContainerAct = _wrapper->createAction(getMenuId(), tr(
"Create a New Container"), QIcon(
"icons:container.png"),
307 tr(
"Create Container"), tr(
"Create a New Container"),
308 0, _parent,
false,
this, SLOT(onNewContainer()));
310 _newHPContainerAct = _wrapper->createAction(getMenuId(), tr(
"Create a New HP Container"), QIcon(
"icons:container.png"),
311 tr(
"Create HP Container"), tr(
"Create a New Homogeneous Pool Container."),
312 0, _parent,
false,
this, SLOT(onNewHPContainer()));
314 _selectComponentInstanceAct = _wrapper->createAction(getMenuId(), tr(
"Select a Component Instance"), QIcon(
"icons:icon_select.png"),
315 tr(
"Select a Component Instance"), tr(
"Select a Component Instance"),
316 0, _parent,
false,
this, SLOT(onSelectComponentInstance()));
318 _newSalomeComponentAct = _wrapper->createAction(getMenuId(), tr(
"Create a New SALOME Component Instance"), QIcon(
"icons:new_salome_component.png"),
319 tr(
"Create Component Instance"), tr(
"Create a New SALOME Component Instance"),
320 0, _parent,
false,
this, SLOT(onNewSalomeComponent()));
322 _newSalomePythonComponentAct = _wrapper->createAction(getMenuId(), tr(
"Create a New SALOME Python Component"), QIcon(
"icons:new_salomepy_component.png"),
323 tr(
"SALOME Python Component"), tr(
"Create a New SALOME Python Component"),
324 0, _parent,
false,
this, SLOT(onNewSalomePythonComponent()));
326 _newCorbaComponentAct = _wrapper->createAction(getMenuId(), tr(
"Create a New CORBA Component"), QIcon(
"icons:new_corba_component.png"),
327 tr(
"CORBA Component"), tr(
"Create a New CORBA Component"),
328 0, _parent,
false,
this, SLOT(onNewCorbaComponent()));
330 _salomeServiceNodeAct = _wrapper->createAction(getMenuId(), tr(
"Create a New SALOME Service Node"), QIcon(
"icons:new_salome_service_node.png"),
331 tr(
"SALOME Service Node"), tr(
"Create a New SALOME Service Node"),
332 0, _parent,
false,
this, SLOT(onSalomeServiceNode()));
334 _serviceInlineNodeAct = _wrapper->createAction(getMenuId(), tr(
"Create a New Inline Service Node"), QIcon(
"icons:new_service_inline_node.png"),
335 tr(
"Inline Service Node"), tr(
"Create a New Inline Service Node"),
336 0, _parent,
false,
this, SLOT(onServiceInlineNode()));
338 _CORBAServiceNodeAct = _wrapper->createAction(getMenuId(), tr(
"Create a New CORBA Service Node"), QIcon(
"icons:new_corba_service_node.png"),
339 tr(
"CORBA Node"), tr(
"Create a New CORBA Service Node"),
340 0, _parent,
false,
this, SLOT(onCORBAServiceNode()));
342 _nodeNodeServiceNodeAct = _wrapper->createAction(getMenuId(), tr(
"Create a New Node referencing a Node"), QIcon(
"icons:new_nodenode_service_node.png"),
343 tr(
"Ref on Node"), tr(
"Create a New Node referencing a Node"),
344 0, _parent,
false,
this, SLOT(onNodeNodeServiceNode()));
346 _cppNodeAct = _wrapper->createAction(getMenuId(), tr(
"Create a New C++ Node"), QIcon(
"icons:new_cpp_node.png"),
347 tr(
"Cpp Node"), tr(
"Create a New C++ Node"),
348 0, _parent,
false,
this, SLOT(onCppNode()));
350 _inDataNodeAct = _wrapper->createAction(getMenuId(), tr(
"Create a New Input data Node"), QIcon(
"icons:node.png"),
351 tr(
"Input Data Node"), tr(
"Create a New Input data Node"),
352 0, _parent,
false,
this, SLOT(onInDataNode()));
354 _outDataNodeAct = _wrapper->createAction(getMenuId(), tr(
"Create a New Output data Node"), QIcon(
"icons:node.png"),
355 tr(
"Output Data Node"), tr(
"Create a New Output data Node"),
356 0, _parent,
false,
this, SLOT(onOutDataNode()));
358 _inStudyNodeAct = _wrapper->createAction(getMenuId(), tr(
"Create a New Input Study Node"), QIcon(
"icons:node.png"),
359 tr(
"Input Study Node"), tr(
"Create a New Input Study Node"),
360 0, _parent,
false,
this, SLOT(onInStudyNode()));
362 _outStudyNodeAct = _wrapper->createAction(getMenuId(), tr(
"Create a New Output Study Node"), QIcon(
"icons:node.png"),
363 tr(
"Output Study Node"), tr(
"Create a New Output Study Node"),
364 0, _parent,
false,
this, SLOT(onOutStudyNode()));
366 _inlineScriptNodeAct = _wrapper->createAction(getMenuId(), tr(
"Create a New Inline Python Script Node"), QIcon(
"icons:new_inline_script_node.png"),
367 tr(
"Inline Script Node"), tr(
"Create a New Inline Python Script Node"),
368 0, _parent,
false,
this, SLOT(onInlineScriptNode()));
370 _inlineFunctionNodeAct = _wrapper->createAction(getMenuId(), tr(
"Create a New Inline Python Function Node"), QIcon(
"icons:new_inline_function_node.png"),
371 tr(
"Inline Function Node"), tr(
"Create a New Inline Python Function Node"),
372 0, _parent,
false,
this, SLOT(onInlineFunctionNode()));
374 _blockNodeAct = _wrapper->createAction(getMenuId(), tr(
"Create a New Bloc Node"), QIcon(
"icons:new_block_node.png"),
375 tr(
"bloc Node"), tr(
"Create a New Bloc Node"),
376 0, _parent,
false,
this, SLOT(onBlockNode()));
378 _FORNodeAct = _wrapper->createAction(getMenuId(), tr(
"Create a New For Loop Node"), QIcon(
"icons:new_for_loop_node.png"),
379 tr(
"For Loop Node"), tr(
"Create a New For Loop Node"),
380 0, _parent,
false,
this, SLOT(onFORNode()));
382 _FOREACHNodeAct = _wrapper->createAction(getMenuId(), tr(
"Create a New For Each Loop Node"), QIcon(
"icons:new_foreach_loop_node.png"),
383 tr(
"For Each Loop Node"), tr(
"Create a New For Each Loop Node"),
384 0, _parent,
false,
this, SLOT(onFOREACHNode()));
386 _WHILENodeAct = _wrapper->createAction(getMenuId(), tr(
"Create a New While Loop Node"), QIcon(
"icons:new_while_loop_node.png"),
387 tr(
"While Loop Node"), tr(
"Create a New While Loop Node"),
388 0, _parent,
false,
this, SLOT(onWHILENode()));
390 _SWITCHNodeAct = _wrapper->createAction(getMenuId(), tr(
"Create a New Switch Node"), QIcon(
"icons:new_switch_loop_node.png"),
391 tr(
"Switch Node"), tr(
"Create a New Switch Node"),
392 0, _parent,
false,
this, SLOT(onSWITCHNode()));
394 _OptimizerLoopAct = _wrapper->createAction(getMenuId(), tr(
"Create a New Optimizer Loop Node"), QIcon(
"icons:new_for_loop_node.png"),
395 tr(
"Optimizer Loop"), tr(
"Create a New Optimizer Loop"),
396 0, _parent,
false,
this, SLOT(onOptimizerLoop()));
398 _nodeFromCatalogAct = _wrapper->createAction(getMenuId(), tr(
"Create a New Node from Catalog, use drag and drop from catalog"), QIcon(
"icons:new_from_library_node.png"),
399 tr(
"Node from Catalog"), tr(
"Create a New Node from Catalog, use drag and drop from catalog"),
400 0, _parent,
false,
this, SLOT(onNodeFromCatalog()));
402 _deleteItemAct = _wrapper->createAction(getMenuId(), tr(
"Delete a Schema Item"), QIcon(
"icons:delete.png"),
403 tr(
"Delete Item"), tr(
"Delete a Schema Item"),
404 0, _parent,
false,
this, SLOT(onDeleteItem()));
405 _deleteItemAct->setShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_D);
407 _cutItemAct = _wrapper->createAction(getMenuId(), tr(
"Cut a Schema Item"), QIcon(
"icons:cut.png"),
408 tr(
"Cut Item"), tr(
"Cut a Schema Item"),
409 0, _parent,
false,
this, SLOT(onCutItem()));
410 _cutItemAct->setShortcut(QKeySequence::Cut);
412 _copyItemAct = _wrapper->createAction(getMenuId(), tr(
"Copy a Schema Item"), QIcon(
"icons:copy.png"),
413 tr(
"Copy Item"), tr(
"Copy a Schema Item"),
414 0, _parent,
false,
this, SLOT(onCopyItem()));
415 _copyItemAct->setShortcut(QKeySequence::Copy);
417 _pasteItemAct = _wrapper->createAction(getMenuId(), tr(
"Paste a Schema Item"), QIcon(
"icons:paste.png"),
418 tr(
"Paste Item"), tr(
"Paste a Schema Item"),
419 0, _parent,
false,
this, SLOT(onPasteItem()));
420 _pasteItemAct->setShortcut(QKeySequence::Paste);
422 _putInBlocAct = _wrapper->createAction(getMenuId(), tr(
"Put node in block"), QIcon(
"icons:paste.png"),
423 tr(
"Put node in block"), tr(
"Put node in block"),
424 0, _parent,
false,
this, SLOT(onPutInBloc()));
426 _putGraphInBlocAct = _wrapper->createAction(getMenuId(), tr(
"Bloc"), QIcon(
"icons:new_block_node.png"),
427 tr(
"Bloc"), tr(
"Bloc"),
428 0, _parent,
false,
this, SLOT(onPutGraphInBloc()));
430 _putGraphInForLoopAct = _wrapper->createAction(getMenuId(), tr(
"For Loop"), QIcon(
"icons:new_for_loop_node.png"),
431 tr(
"For Loop"), tr(
"For Loop"),
432 0, _parent,
false,
this, SLOT(onPutGraphInForLoop()));
434 _putGraphInWhileLoopAct = _wrapper->createAction(getMenuId(), tr(
"While Loop"), QIcon(
"icons:new_while_loop_node.png"),
435 tr(
"While Loop"), tr(
"While Loop"),
436 0, _parent,
false,
this, SLOT(onPutGraphInWhileLoop()));
438 _putGraphInOptimizerLoopAct = _wrapper->createAction(getMenuId(), tr(
"Optimizer Loop"), QIcon(
"icons:new_for_loop_node.png"),
439 tr(
"Optimizer Loop"), tr(
"Optimizer Loop"),
440 0, _parent,
false,
this, SLOT(onPutGraphInOptimizerLoop()));
442 _arrangeLocalNodesAct = _wrapper->createAction(getMenuId(), tr(
"arrange nodes on that bloc level, without recursion"), QIcon(
"icons:arrange_nodes.png"),
443 tr(
"arrange local nodes"), tr(
"arrange nodes on that bloc level, without recursion"),
444 0, _parent,
false,
this, SLOT(onArrangeLocalNodes()));
446 _arrangeRecurseNodesAct = _wrapper->createAction(getMenuId(), tr(
"arrange nodes on that bloc level, with recursion"), QIcon(
"icons:sample.png"),
447 tr(
"arrange nodes recursion"), tr(
"arrange nodes on that bloc level, with recursion"),
448 0, _parent,
false,
this, SLOT(onArrangeRecurseNodes()));
450 _computeLinkAct = _wrapper->createAction(getMenuId(), tr(
"compute orthogonal links"), QIcon(
"icons:rebuild_links.png"),
451 tr(
"compute links"), tr(
"compute orthogonal links"),
452 0, _parent,
false,
this, SLOT(onRebuildLinks()));
454 _zoomToBlocAct = _wrapper->createAction(getMenuId(), tr(
"zoom 2D view to selected bloc"), QIcon(
"icons:zoomToBloc.png"),
455 tr(
"zoom to bloc"), tr(
"zoom 2D view to the selected composed node"),
456 0, _parent,
false,
this, SLOT(onZoomToBloc()));
458 _centerOnNodeAct = _wrapper->createAction(getMenuId(), tr(
"center 2D view on selected node"), QIcon(
"icons:centerOnNode.png"),
459 tr(
"center on node"), tr(
"center 2D view on selected node"),
460 0, _parent,
false,
this, SLOT(onCenterOnNode()));
461 _centerOnNodeAct->setShortcut(QKeySequence::Find);
463 _shrinkExpand = _wrapper->createAction(getMenuId(), tr(
"shrink or expand the selected node"), QIcon(
"icons:shrinkExpand.png"),
464 tr(
"shrink/expand"), tr(
"shrink or expand the selected node"),
465 0, _parent,
false,
this, SLOT(onShrinkExpand()));
467 _shrinkExpandChildren = _wrapper->createAction(getMenuId(), tr(
"shrink or expand direct children of the selected node"), QIcon(
"icons:shrinkExpand.png"),
468 tr(
"shrink/expand children"), tr(
"shrink or expand direct children of the selected node"),
469 0, _parent,
false,
this, SLOT(onShrinkExpandChildren()));
471 _shrinkExpandElementaryRecursively = _wrapper->createAction(getMenuId(), tr(
"shrink or expand elementary nodes of the selected node recursively"), QIcon(
"icons:shrinkExpand.png"),
472 tr(
"shrink/expand elementary"), tr(
"shrink or expand elementary nodes of the selected node recursively"),
473 0, _parent,
false,
this, SLOT(onShrinkExpandElementaryRecursively()));
475 _toggleStraightLinksAct = _wrapper->createAction(getMenuId(), tr(
"draw straight or orthogonal links"), QIcon(
"icons:straightLink.png"),
476 tr(
"straight/orthogonal"), tr(
"draw straight or orthogonal links"),
477 0, _parent,
true,
this, SLOT(onToggleStraightLinks(
bool)));
479 _toggleStraightLinksAct->setChecked(Resource::straightLinks);
480 onToggleStraightLinks(Resource::straightLinks);
482 _toggleAutomaticComputeLinkAct = _wrapper->createAction(getMenuId(), tr(
"compute othogonal links automatically when nodes move"), QIcon(
"icons:autoComputeLink.png"),
483 tr(
"automatic link"), tr(
"compute othogonal links automatically when nodes move"),
484 0, _parent,
true,
this, SLOT(onToggleAutomaticComputeLinks(
bool)));
486 _toggleAutomaticComputeLinkAct->setChecked(Resource::autoComputeLinks);
487 onToggleAutomaticComputeLinks(Resource::autoComputeLinks);
489 _toggleSimplifyLinkAct = _wrapper->createAction(getMenuId(), tr(
"simplify links by removing unnecessary direction changes"), QIcon(
"icons:simplifyLink.png"),
490 tr(
"simplify links"), tr(
"simplify links by removing unnecessary direction changes"),
491 0, _parent,
true,
this, SLOT(onToggleSimplifyLinks(
bool)));
492 _toggleSimplifyLinkAct->setChecked(Resource::simplifyLink);
493 onToggleSimplifyLinks(Resource::simplifyLink);
495 _toggleForce2NodesLinkAct = _wrapper->createAction(getMenuId(), tr(
"force orthogonal links by adding an edge on simples links"), QIcon(
"icons:force2nodeLink.png"),
496 tr(
"force ortho links"), tr(
"force orthogonal links by adding an edge on simples links"),
497 0, _parent,
true,
this, SLOT(onToggleForce2NodesLinks(
bool)));
498 _toggleForce2NodesLinkAct->setChecked(
true);
500 _toggleAddRowColsAct = _wrapper->createAction(getMenuId(), tr(
"allow more path for the links, for a better separation"), QIcon(
"icons:addRowCols.png"),
501 tr(
"separate links"), tr(
"allow more path for the links, for a better separation"),
502 0, _parent,
true,
this, SLOT(onToggleAddRowCols(
bool)));
503 _toggleAddRowColsAct->setChecked(Resource::addRowCols);
504 onToggleAddRowCols(Resource::addRowCols);
506 _selectReferenceAct = _wrapper->createAction(getMenuId(), tr(
"select reference"), QIcon(
"icons:ob_service_node.png"),
507 tr(
"select reference"), tr(
"select reference"),
508 0, _parent,
false,
this, SLOT(onSelectReference()));
510 _whatsThisAct = _wrapper->createAction(getMenuId(), tr(
"active whatsThis Mode to get help on widgets"), QIcon(
"icons:whatsThis.png"),
511 tr(
"whatsThis Mode"), tr(
"active whatsThis Mode to get help on widgets"),
512 0, _parent,
false,
this, SLOT(onWhatsThis()));
513 _whatsThisAct->setShortcut(QKeySequence::WhatsThis);
515 _withoutStopModeAct = _wrapper->createAction(getMenuId(), tr(
"set execution mode without stop"), QIcon(
"icons:run_active.png"),
516 tr(
"mode without stop"), tr(
"set execution mode without stop"),
517 0, _parent,
true,
this, SLOT(onWithoutStopMode(
bool)));
519 _breakpointsModeAct = _wrapper->createAction(getMenuId(), tr(
"set execution mode with stop on breakpoints"), QIcon(
"icons:breakpoints_active.png"),
520 tr(
"mode breakpoints"), tr(
"set execution mode with stop on breakpoints"),
521 0, _parent,
true,
this, SLOT(onBreakpointsMode(
bool)));
523 _stepByStepModeAct = _wrapper->createAction(getMenuId(), tr(
"set execution mode step by step"), QIcon(
"icons:step_by_step_active.png"),
524 tr(
"mode step by step"), tr(
"set execution mode step by step"),
525 0, _parent,
true,
this, SLOT(onStepByStepMode(
bool)));
527 _toggleStopOnErrorAct = _wrapper->createAction(getMenuId(), tr(
"Force stop on first error during execution"), QIcon(
"icons:toggle_stop_on_error.png"),
528 tr(
"stop on error"), tr(
"Force stop on first error during execution"),
529 0, _parent,
true,
this, SLOT(onToggleStopOnError(
bool)));
531 _toggleSceneItemVisibleAct = _wrapper->createAction(getMenuId(), tr(
"toggle 2D scene item visibility"), QIcon(
"icons:toggleVisibility.png"),
532 tr(
"visible/hidden"), tr(
"toggle 2D scene item visibility"),
533 0, _parent,
true,
this, SLOT(onToggleSceneItemVisible(
bool)));
537 _showAllLinksAct = _wrapper->createAction(getMenuId(), tr(
"Show all the links"), QIcon(
"icons:showLink.png"),
538 tr(
"show all links"), tr(
"Show all the links"),
539 0, _parent,
false,
this, SLOT(onShowAllLinks()));
541 _hideAllLinksAct = _wrapper->createAction(getMenuId(), tr(
"Hide all the links"), QIcon(
"icons:hideLink.png"),
542 tr(
"hide all links"), tr(
"Hide all the links"),
543 0, _parent,
false,
this, SLOT(onHideAllLinks()));
546 _showOnlyPortLinksAct = _wrapper->createAction(getMenuId(), tr(
"Show only links from/to this port"), QIcon(
"icons:showLink.png"),
547 tr(
"show only links"), tr(
"Show only links from/to this port"),
548 0, _parent,
false,
this, SLOT(onShowOnlyPortLinks()));
550 _showPortLinksAct = _wrapper->createAction(getMenuId(), tr(
"Show links from/to this port"), QIcon(
"icons:showLink.png"),
551 tr(
"show links"), tr(
"Show links from/to this port"),
552 0, _parent,
false,
this, SLOT(onShowPortLinks()));
554 _hidePortLinksAct = _wrapper->createAction(getMenuId(), tr(
"Hide links from/to this port"), QIcon(
"icons:hideLink.png"),
555 tr(
"hide links"), tr(
"Hide links from/to this port"),
556 0, _parent,
false,
this, SLOT(onHidePortLinks()));
559 _showOnlyCtrlLinksAct = _wrapper->createAction(getMenuId(), tr(
"Show only control links from/to this node"), QIcon(
"icons:showLink.png"),
560 tr(
"show only Control links"), tr(
"Show only control links from/to this node"),
561 0, _parent,
false,
this, SLOT(onShowOnlyCtrlLinks()));
563 _showCtrlLinksAct = _wrapper->createAction(getMenuId(), tr(
"Show control links from/to this node"), QIcon(
"icons:showLink.png"),
564 tr(
"show control links"), tr(
"Show control links from/to this node"),
565 0, _parent,
false,
this, SLOT(onShowCtrlLinks()));
567 _hideCtrlLinksAct = _wrapper->createAction(getMenuId(), tr(
"Hide control links from/to this node"), QIcon(
"icons:hideLink.png"),
568 tr(
"hide control links"), tr(
"Hide control links from/to this node"),
569 0, _parent,
false,
this, SLOT(onHideCtrlLinks()));
572 _showOnlyLinkAct = _wrapper->createAction(getMenuId(), tr(
"Show only this link"), QIcon(
"icons:showLink.png"),
573 tr(
"show only"), tr(
"Show only this link"),
574 0, _parent,
false,
this, SLOT(onShowOnlyLink()));
576 _showLinkAct = _wrapper->createAction(getMenuId(), tr(
"Show this link"), QIcon(
"icons:showLink.png"),
577 tr(
"show"), tr(
"Show this link"),
578 0, _parent,
false,
this, SLOT(onShowLink()));
580 _hideLinkAct = _wrapper->createAction(getMenuId(), tr(
"Hide this link"), QIcon(
"icons:hideLink.png"),
581 tr(
"hide"), tr(
"Hide this link"),
582 0, _parent,
false,
this, SLOT(onHideLink()));
585 _emphasisPortLinksAct = _wrapper->createAction(getMenuId(), tr(
"emphasis on links from/to this port"), QIcon(
"icons:emphasisLink.png"),
586 tr(
"emphasize links"), tr(
"emphasis on links from/to this port"),
587 0, _parent,
false,
this, SLOT(onEmphasisPortLinks()));
589 _emphasisCtrlLinksAct = _wrapper->createAction(getMenuId(), tr(
"emphasis on control links from/to this node"), QIcon(
"icons:emphasisLink.png"),
590 tr(
"emphasize control links"), tr(
"emphasis on control links from/to this node"),
591 0, _parent,
false,
this, SLOT(onEmphasisCtrlLinks()));
593 _emphasisLinkAct = _wrapper->createAction(getMenuId(), tr(
"emphasis on this link"), QIcon(
"icons:emphasisLink.png"),
594 tr(
"emphasize"), tr(
"emphasis on this link"),
595 0, _parent,
false,
this, SLOT(onEmphasisLink()));
597 _deEmphasizeAllAct = _wrapper->createAction(getMenuId(), tr(
"remove all emphasis"), QIcon(
"icons:deEmphasisLink.png"),
598 tr(
"remove all emphasis"), tr(
"remove all emphasis"),
599 0, _parent,
false,
this, SLOT(onDeEmphasizeAll()));
602 _undoAct = _wrapper->createAction(getMenuId(), tr(
"undo last action"), QIcon(
"icons:undo.png"),
603 tr(
"undo"), tr(
"undo last action"),
604 0, _parent,
false,
this, SLOT(onUndo()));
605 _undoAct->setShortcut(QKeySequence::Undo);
607 _redoAct = _wrapper->createAction(getMenuId(), tr(
"redo last action"), QIcon(
"icons:redo.png"),
608 tr(
"redo"), tr(
"redo last action"),
609 0, _parent,
false,
this, SLOT(onRedo()));
610 _redoAct->setShortcut(QKeySequence::Redo);
612 _showUndoAct = _wrapper->createAction(getMenuId(), tr(
"show undo commands"), QIcon(
"icons:undo.png"),
613 tr(
"show undo"), tr(
"show undo commands"),
614 0, _parent,
false,
this, SLOT(onShowUndo()));
616 _showRedoAct = _wrapper->createAction(getMenuId(), tr(
"show redo commands"), QIcon(
"icons:redo.png"),
617 tr(
"show redo"), tr(
"show redo commands"),
618 0, _parent,
false,
this, SLOT(onShowRedo()));
621 _execModeGroup =
new QActionGroup(
this);
622 _execModeGroup->addAction(_withoutStopModeAct);
623 _execModeGroup->addAction(_breakpointsModeAct);
624 _execModeGroup->addAction(_stepByStepModeAct);
625 _withoutStopModeAct->setChecked(
true);
628 void GenericGui::createMenus()
631 aMenuId = _wrapper->createMenu( tr(
"File" ), -1, -1 );
632 _wrapper->createMenu( _wrapper->separator(), aMenuId, -1, 10 );
633 aMenuId = _wrapper->createMenu(
"YACS", aMenuId, -1, 10 );
634 _wrapper->createMenu( _newSchemaAct, aMenuId );
635 _wrapper->createMenu( _importSchemaAct, aMenuId );
637 aMenuId = _wrapper->createMenu(
"YACS", -1, -1, 30 );
638 _wrapper->createMenu( _newSchemaAct, aMenuId );
639 _wrapper->createMenu( _importSchemaAct, aMenuId );
640 _wrapper->createMenu( _importSupervSchemaAct, aMenuId );
641 _wrapper->createMenu( _wrapper->separator(), aMenuId);
642 _wrapper->createMenu( _exportSchemaAct, aMenuId );
643 _wrapper->createMenu( _exportSchemaAsAct, aMenuId );
644 _wrapper->createMenu( _wrapper->separator(), aMenuId);
645 _wrapper->createMenu( _runLoadedSchemaAct, aMenuId );
646 _wrapper->createMenu( _loadRunStateSchemaAct, aMenuId );
647 _wrapper->createMenu( _loadAndRunSchemaAct, aMenuId );
648 _wrapper->createMenu( _chooseBatchJobAct, aMenuId );
649 _wrapper->createMenu( _wrapper->separator(), aMenuId);
650 _wrapper->createMenu( _undoAct, aMenuId );
651 _wrapper->createMenu( _redoAct, aMenuId );
652 _wrapper->createMenu( _showUndoAct, aMenuId );
653 _wrapper->createMenu( _showRedoAct, aMenuId );
654 _wrapper->createMenu( _wrapper->separator(), aMenuId);
655 _wrapper->createMenu( _startResumeAct, aMenuId );
656 _wrapper->createMenu( _abortAct, aMenuId );
657 _wrapper->createMenu( _pauseAct, aMenuId );
658 _wrapper->createMenu( _resetAct, aMenuId );
659 _wrapper->createMenu( _wrapper->separator(), aMenuId);
660 _wrapper->createMenu( _saveRunStateAct, aMenuId );
662 _wrapper->createMenu( _wrapper->separator(), aMenuId);
663 _wrapper->createMenu( _withoutStopModeAct, aMenuId );
664 _wrapper->createMenu( _breakpointsModeAct, aMenuId );
665 _wrapper->createMenu( _stepByStepModeAct, aMenuId );
666 _wrapper->createMenu( _wrapper->separator(), aMenuId);
667 _wrapper->createMenu( _toggleStopOnErrorAct, aMenuId );
668 _wrapper->createMenu( _wrapper->separator(), aMenuId);
669 _wrapper->createMenu( _importCatalogAct, aMenuId );
670 _wrapper->createMenu( _wrapper->separator(), aMenuId);
671 _wrapper->createMenu( _toggleStraightLinksAct, aMenuId );
672 _wrapper->createMenu( _toggleAutomaticComputeLinkAct, aMenuId );
673 _wrapper->createMenu( _toggleSimplifyLinkAct, aMenuId );
674 _wrapper->createMenu( _toggleForce2NodesLinkAct, aMenuId );
675 _wrapper->createMenu( _toggleAddRowColsAct, aMenuId );
676 _wrapper->createMenu( _wrapper->separator(), aMenuId);
677 _wrapper->createMenu( _showAllLinksAct, aMenuId );
678 _wrapper->createMenu( _hideAllLinksAct, aMenuId );
679 _wrapper->createMenu( _wrapper->separator(), aMenuId);
680 _wrapper->createMenu( _whatsThisAct, aMenuId );
683 void GenericGui::createTools()
685 int aToolId = _wrapper->createTool ( tr(
"YACS Toolbar" ), QString(
"YACSToolbar" ) );
686 _wrapper->createTool( _newSchemaAct, aToolId );
687 _wrapper->createTool( _importSchemaAct, aToolId );
688 _wrapper->createTool( _wrapper->separator(), aToolId );
689 _wrapper->createTool( _exportSchemaAct, aToolId );
690 _wrapper->createTool( _exportSchemaAsAct, aToolId );
691 _wrapper->createTool( _wrapper->separator(), aToolId);
692 _wrapper->createTool( _runLoadedSchemaAct, aToolId );
693 _wrapper->createTool( _loadRunStateSchemaAct, aToolId );
694 _wrapper->createTool( _loadAndRunSchemaAct, aToolId );
695 _wrapper->createTool( _chooseBatchJobAct, aToolId );
696 _wrapper->createTool( _wrapper->separator(), aToolId );
697 _wrapper->createTool( _undoAct, aToolId );
698 _wrapper->createTool( _redoAct, aToolId );
699 _wrapper->createTool( _wrapper->separator(), aToolId );
700 _wrapper->createTool( _startResumeAct, aToolId );
701 _wrapper->createTool( _abortAct, aToolId );
702 _wrapper->createTool( _pauseAct, aToolId );
703 _wrapper->createTool( _resetAct, aToolId );
704 _wrapper->createTool( _wrapper->separator(), aToolId );
705 _wrapper->createTool( _saveRunStateAct, aToolId );
707 _wrapper->createTool( _withoutStopModeAct, aToolId );
708 _wrapper->createTool( _breakpointsModeAct, aToolId );
709 _wrapper->createTool( _stepByStepModeAct, aToolId );
710 _wrapper->createTool( _wrapper->separator(), aToolId );
711 _wrapper->createTool( _toggleStopOnErrorAct, aToolId );
712 _wrapper->createTool( _wrapper->separator(), aToolId );
713 _wrapper->createTool( _importCatalogAct, aToolId );
714 _wrapper->createTool( _wrapper->separator(), aToolId );
715 _wrapper->createTool( _toggleStraightLinksAct, aToolId );
716 _wrapper->createTool( _toggleAutomaticComputeLinkAct, aToolId );
717 _wrapper->createTool( _toggleSimplifyLinkAct, aToolId );
719 _wrapper->createTool( _toggleAddRowColsAct, aToolId );
720 _wrapper->createTool( _wrapper->separator(), aToolId );
721 _wrapper->createTool( _showAllLinksAct, aToolId );
722 _wrapper->createTool( _hideAllLinksAct, aToolId );
723 _wrapper->createTool( _wrapper->separator(), aToolId );
724 _wrapper->createTool( _whatsThisAct, aToolId );
727 void GenericGui::initialMenus()
729 showEditionMenus(
false);
730 showExecMenus(
false);
731 showCommonMenus(
false);
735 void GenericGui::hideAllMenus()
737 showBaseMenus (
false);
738 showCommonMenus (
false);
739 showEditionMenus(
false);
740 showExecMenus (
false);
743 void GenericGui::showBaseMenus(
bool show)
745 DEBTRACE(
"GenericGui::showBaseMenus " << show);
746 _wrapper->setMenuShown(_newSchemaAct, show);
747 _wrapper->setToolShown(_newSchemaAct, show);
748 _wrapper->setMenuShown(_importSchemaAct, show);
749 _wrapper->setToolShown(_importSchemaAct, show);
750 _wrapper->setMenuShown(_importSupervSchemaAct, show);
751 _wrapper->setMenuShown(_loadAndRunSchemaAct, show);
752 _wrapper->setToolShown(_loadAndRunSchemaAct, show);
753 _wrapper->setMenuShown(_chooseBatchJobAct, show);
754 _wrapper->setToolShown(_chooseBatchJobAct, show);
755 _wrapper->setMenuShown(_whatsThisAct, show);
756 _wrapper->setToolShown(_whatsThisAct, show);
759 void GenericGui::showEditionMenus(
bool show)
761 DEBTRACE(
"GenericGui::showEditionMenus " << show);
762 _wrapper->setMenuShown(_exportSchemaAct, show);
763 _wrapper->setToolShown(_exportSchemaAct, show);
764 _wrapper->setMenuShown(_exportSchemaAsAct, show);
765 _wrapper->setToolShown(_exportSchemaAsAct, show);
766 _wrapper->setMenuShown(_runLoadedSchemaAct, show);
767 _wrapper->setToolShown(_loadRunStateSchemaAct, show);
768 _wrapper->setMenuShown(_loadRunStateSchemaAct, show);
769 _wrapper->setToolShown(_runLoadedSchemaAct, show);
770 _wrapper->setMenuShown(_undoAct, show);
771 _wrapper->setToolShown(_undoAct, show);
772 _wrapper->setMenuShown(_redoAct, show);
773 _wrapper->setToolShown(_redoAct, show);
774 _wrapper->setMenuShown(_showUndoAct, show);
775 _wrapper->setMenuShown(_showRedoAct, show);
776 _wrapper->setMenuShown(_importCatalogAct, show);
777 _wrapper->setToolShown(_importCatalogAct, show);
780 void GenericGui::showExecMenus(
bool show)
782 DEBTRACE(
"GenericGui::showExecMenus " << show);
783 _wrapper->setMenuShown(_startResumeAct, show);
784 _wrapper->setToolShown(_startResumeAct, show);
785 _wrapper->setMenuShown(_abortAct, show);
786 _wrapper->setToolShown(_abortAct, show);
787 _wrapper->setMenuShown(_pauseAct, show);
788 _wrapper->setToolShown(_pauseAct, show);
789 _wrapper->setMenuShown(_resetAct, show);
790 _wrapper->setToolShown(_resetAct, show);
791 _wrapper->setMenuShown(_saveRunStateAct, show);
792 _wrapper->setToolShown(_saveRunStateAct, show);
795 _wrapper->setMenuShown(_withoutStopModeAct, show);
796 _wrapper->setToolShown(_withoutStopModeAct, show);
797 _wrapper->setMenuShown(_breakpointsModeAct, show);
798 _wrapper->setToolShown(_breakpointsModeAct, show);
799 _wrapper->setMenuShown(_stepByStepModeAct, show);
800 _wrapper->setToolShown(_stepByStepModeAct, show);
801 _wrapper->setMenuShown(_toggleStopOnErrorAct, show);
802 _wrapper->setToolShown(_toggleStopOnErrorAct, show);
805 void GenericGui::showCommonMenus(
bool show)
807 DEBTRACE(
"GenericGui::showCommonMenus " << show);
808 _wrapper->setMenuShown(_toggleStraightLinksAct, show);
809 _wrapper->setToolShown(_toggleStraightLinksAct, show);
810 _wrapper->setMenuShown(_toggleAutomaticComputeLinkAct, show);
811 _wrapper->setToolShown(_toggleAutomaticComputeLinkAct, show);
812 _wrapper->setMenuShown(_toggleSimplifyLinkAct, show);
813 _wrapper->setToolShown(_toggleSimplifyLinkAct, show);
814 _wrapper->setMenuShown(_toggleForce2NodesLinkAct, show);
816 _wrapper->setMenuShown(_toggleAddRowColsAct, show);
817 _wrapper->setToolShown(_toggleAddRowColsAct, show);
818 _wrapper->setMenuShown(_showAllLinksAct, show);
819 _wrapper->setToolShown(_showAllLinksAct, show);
820 _wrapper->setMenuShown(_hideAllLinksAct, show);
821 _wrapper->setToolShown(_hideAllLinksAct, show);
824 void GenericGui::switchContext(
QWidget *view,
bool onExit)
826 DEBTRACE(
"GenericGui::switchContext " << view);
827 if (! _mapViewContext.count(view))
829 onExit ? hideAllMenus() : initialMenus();
830 _dwTree->setWidget(0);
831 _dwStacked->setWidget(0);
837 _dwTree->widget()->show();
841 QtGuiContext::setQtCurrent(newContext);
845 showExecMenus(
false);
847 showEditionMenus(
true);
848 showCommonMenus(
true);
849 if (_dwTree) _dwTree->setWindowTitle(
"Tree View: edition mode");
853 showEditionMenus(
false);
856 showCommonMenus(
true);
857 _withoutStopModeAct->setChecked(
true);
858 if (_dwTree) _dwTree->setWindowTitle(
"Tree View: execution mode");
860 _dwStacked->setMinimumWidth(10);
863 bool GenericGui::closeContext(
QWidget *view,
bool onExit)
865 DEBTRACE(
"GenericGui::closeContext " << onExit);
866 if (! _mapViewContext.count(view))
871 bool tryToSave =
false;
873 if (QtGuiContext::getQtCurrent()->isEdition())
875 if (!QtGuiContext::getQtCurrent()->_setOfModifiedSubjects.empty())
878 msgBox.setText(
"Some elements are modified and not taken into account.");
879 string info =
"do you want to apply your changes ?\n";
880 info +=
" - Save : do not take into account edition in progress,\n";
881 info +=
" but if there are other modifications, select a file name for save\n";
882 info +=
" - Discard : discard all modifications and close the schema";
884 info +=
"\n - Cancel : do not close the schema, return to edition";
885 msgBox.setInformativeText(info.c_str());
888 msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
889 msgBox.setDefaultButton(QMessageBox::Cancel);
893 msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard);
894 msgBox.setDefaultButton(QMessageBox::Save);
896 int ret = msgBox.exec();
899 case QMessageBox::Save:
902 case QMessageBox::Discard:
905 case QMessageBox::Cancel:
913 if (QtGuiContext::getQtCurrent()->isNotSaved())
916 msgBox.setWindowTitle(
"Close the active schema");
917 msgBox.setText(
"The schema has been modified");
918 string info =
"do you want to save the schema ?\n";
919 info +=
" - Save : select a file name for save\n";
920 info +=
" - Discard : discard all modifications and close the schema";
922 info +=
"\n - Cancel : do not close the schema, return to edition";
923 msgBox.setInformativeText(info.c_str());
926 msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel);
927 msgBox.setDefaultButton(QMessageBox::Cancel);
931 msgBox.setStandardButtons(QMessageBox::Save | QMessageBox::Discard);
932 msgBox.setDefaultButton(QMessageBox::Save);
934 int ret = msgBox.exec();
937 case QMessageBox::Save:
940 case QMessageBox::Discard:
943 case QMessageBox::Cancel:
954 if ((!onExit) && (!_isSaved))
959 map<QWidget*, YACS::HMI::QtGuiContext*>::iterator it = _mapViewContext.begin();
962 for (; it != _mapViewContext.end(); ++it)
964 if ((*it).second != context)
966 newView = (*it).first;
967 newContext = (*it).second;
971 _wrapper->deleteSchema(view);
975 exec->closeContext();
978 _mapViewContext.
erase(view);
979 switchContext(newView, onExit);
983 void GenericGui::showDockWidgets(
bool isVisible)
985 DEBTRACE(
"GenericGui::showDockWidgets " << isVisible);
986 if (_dwTree) _dwTree->setVisible(isVisible);
987 if (_dwTree) _dwTree->toggleViewAction()->setVisible(isVisible);
988 if (_dwStacked) _dwStacked->setVisible(isVisible);
989 if (_dwStacked) _dwStacked->toggleViewAction()->setVisible(isVisible);
990 if (_dwCatalogs) _dwCatalogs->setVisible(isVisible);
991 if (_dwCatalogs) _dwCatalogs->toggleViewAction()->setVisible(isVisible);
994 void GenericGui::raiseStacked()
996 if (_dwStacked) _dwStacked->raise();
999 std::list<std::string> GenericGui::getMachineList()
1001 if (!_machineList.empty())
return _machineList;
1005 if (!
orb)
return _machineList;
1008 SALOME_LifeCycleCORBA lcc(&namingService);
1010 CORBA::Object_var obj =
1011 namingService.
Resolve(SALOME_ResourcesManager::_ResourcesManagerNameInNS);
1012 if (CORBA::is_nil(obj))
return _machineList;
1014 Engines::ResourcesManager_var resManager = Engines::ResourcesManager::_narrow(obj);
1015 if(!resManager)
return _machineList;
1017 Engines::ResourceParameters params;
1020 Engines::ResourceList* resourceList =
1021 resManager->GetFittingResources(params);
1023 for (
int i = 0;
i < resourceList->length();
i++)
1025 const char* aResource = (*resourceList)[
i];
1026 _machineList.push_back(aResource);
1029 return _machineList;
1044 const QString& schemaName,
1045 const QString& runName,
1048 DEBTRACE(
"GenericGui::createContext");
1054 QWidget* central = _parent->centralWidget();
1056 central->setFocus();
1064 fileName = schemaName;
1069 if (QtGuiContext::getQtCurrent())
1070 refWindow = QtGuiContext::getQtCurrent()->getWindow();
1074 QtGuiContext::setQtCurrent(context);
1086 QWidget *viewWindow = _wrapper->getNewWindow(scene);
1087 _mapViewContext[viewWindow] = context;
1089 gView->setScene(scene);
1090 gView->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
1091 _wrapper->AssociateViewToWindow(gView, viewWindow);
1107 editTree->setMinimumHeight(400);
1108 _dwTree->setWidget(editTree);
1111 editTree->tv_schema->setModel(schemaModel);
1115 QObject::connect(editTree->tv_schema->selectionModel(),
1116 SIGNAL(selectionChanged(
const QItemSelection &,
const QItemSelection &)),
1118 SLOT(updateSelection(
const QItemSelection &,
const QItemSelection &)));
1122 QStackedWidget *stacked =
new QStackedWidget(_dwStacked);
1123 _dwStacked->setWidget(stacked);
1130 QObject::connect(schemaModel,
1131 SIGNAL(signalSelection(
const QModelIndex &)),
1132 editTree->tv_schema,
1133 SLOT(viewSelection(
const QModelIndex &)));
1141 double passe = (end_t -start_t);
1142 passe = passe/CLOCKS_PER_SEC;
1143 DEBTRACE(
"create context -1- : " << passe);
1150 setLoadedPresentation(proc);
1154 double passe = (end_t -start_t);
1155 passe = passe/CLOCKS_PER_SEC;
1156 DEBTRACE(
"create context - load proc- : " << passe);
1162 if (forEdition && _wrapper)
1164 _wrapper->createNewSchema(fileName, viewWindow);
1170 _wrapper->createNewRun(schemaName, fileName, refWindow, viewWindow);
1174 QtGuiContext::getQtCurrent()->getSubjectProc()->update(
UPDATE,
1175 ProcInvoc::getTypeOfNode(proc),
1183 _catalogsWidget->setMinimumWidth(10);
1184 editTree->setMinimumHeight(40);
1185 _dwStacked->setMinimumWidth(10);
1190 showExecMenus(
false);
1191 showEditionMenus(
true);
1192 showCommonMenus(
true);
1193 if (_dwTree) _dwTree->setWindowTitle(
"Tree View: edition mode");
1197 showEditionMenus(
false);
1198 showExecMenus(
true);
1199 showCommonMenus(
true);
1200 _withoutStopModeAct->setChecked(
true);
1201 if (_dwTree) _dwTree->setWindowTitle(
"Tree View: execution mode");
1204 QtGuiContext::getQtCurrent()->setNotSaved(
false);
1207 double passe = (end_t -start_t);
1208 passe = passe/CLOCKS_PER_SEC;
1209 DEBTRACE(
"create context - end - : " << passe);
1218 DEBTRACE(
"GenericGui::setLoadedPresentation");
1219 QtGuiContext::getQtCurrent()->setLoadingPresentation(
true);
1220 map<SceneNodeItem*, QPointF> nodesToMove;
1221 map<YACS::ENGINE::Node*, PrsData> presNodes = _loader->getPrsData(proc);
1222 if (!presNodes.empty())
1224 map<YACS::ENGINE::Node*, PrsData>::iterator it = presNodes.begin();
1225 for (; it!= presNodes.end(); ++it)
1229 SubjectNode *snode = QtGuiContext::getQtCurrent()->_mapOfSubjectNode[node];
1230 SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[snode];
1234 inode->setPos(QPointF(pres.
_x, pres.
_y));
1238 QPointF anExpandedPos = QPointF(pres.
_expx, pres.
_expy);
1239 if (anExpandedPos.isNull())
1240 anExpandedPos = inode->pos();
1247 qreal anX = inode->x();
1248 qreal anY = inode->y();
1253 if (anY < inode->getParent()->getHeaderBottom())
1258 QtGuiContext::getQtCurrent()->setLoadingPresentation(
false);
1263 map<SceneNodeItem*, QPointF>::iterator it = nodesToMove.begin();
1264 for (; it!= nodesToMove.end(); ++it)
1266 (*it).first->setTopLeft((*it).second);
1270 if (Scene::_autoComputeLinks)
1271 _guiEditor->rebuildLinks();
1275 SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[subproc];
1283 void GenericGui::onNewSchema()
1285 DEBTRACE(
"GenericGui::onNewSchema");
1287 std::stringstream name;
1288 name <<
"newSchema_" << ++_schemaCnt;
1295 QString fileName = name.str().c_str();
1296 createContext(proc, fileName,
"",
true);
1299 void GenericGui::loadSchema(
const std::string& filename,
bool edit,
bool arrangeLocalNodes)
1309 QString fn=QString::fromUtf8(filename.c_str());
1311 createContext(proc, fn,
"",
true);
1313 createContext(proc, fn, fn,
false);
1314 if (arrangeLocalNodes)
1316 _guiEditor->arrangeProc();
1320 void GenericGui::onImportSchema()
1325 DEBTRACE(
"GenericGui::onImportSchema");
1326 QFileDialog dialog(_parent,
1327 "Choose a filename to load" ,
1329 tr(
"XML-Files (*.xml);;All Files (*)" ));
1331 dialog.setHistory(_wrapper->getQuickDirList());
1334 QStringList fileNames;
1337 fileNames = dialog.selectedFiles();
1338 if (!fileNames.isEmpty())
1339 fn = fileNames.first();
1342 if ( !fn.isEmpty() )
1346 if (!fi.exists() && fi.suffix() !=
"xml")
1349 DEBTRACE(
"file loaded : " <<fn.toUtf8().constData());
1353 proc = _loader->load(fn.toUtf8().constData());
1360 double passe = (end_t -start_t);
1361 passe = passe/CLOCKS_PER_SEC;
1362 DEBTRACE(
"load xml file : " << passe);
1368 QMessageBox msgBox(QMessageBox::Critical,
1369 "Import YACS Schema, native YACS XML format",
1370 "The file has not the native YACS XML format or is not readable.");
1379 createContext(proc, fn,
"",
true);
1383 void GenericGui::onImportSupervSchema()
1385 DEBTRACE(
"GenericGui::onImportSupervSchema");
1386 QFileDialog dialog(_parent,
1387 "Choose a SUPERV filename to load" ,
1389 tr(
"XML-Files (*.xml);;All Files (*)" ));
1391 dialog.setHistory(_wrapper->getQuickDirList());
1394 QStringList fileNames;
1397 fileNames = dialog.selectedFiles();
1398 if (!fileNames.isEmpty())
1399 fn = fileNames.first();
1402 if (fn.isEmpty())
return;
1406 if (!fi.exists() && fi.suffix() !=
"xml")
1409 DEBTRACE(
"file loaded : " <<fn.toStdString());
1410 QString tmpFileName;
1414 QString tmpDir = getenv(
"TEMP");
1415 QString fileExt =
"bat";
1417 QString tmpDir =
"/tmp";
1418 QString fileExt =
"sh";
1420 QDir aTmpDir(tmpDir);
1421 aTmpDir.mkdir(QString(
"YACS_") + getenv(
"USER"));
1422 YASSERT(aTmpDir.cd(QString(
"YACS_") + getenv(
"USER")));
1423 QDateTime curTime = QDateTime::currentDateTime();
1424 tmpFileName =
"SUPERV_import_" + curTime.toString(
"yyyyMMdd_hhmmss") +
".xml";
1425 QString tmpOutput =
"salomeloader_output";
1426 tmpFileName = aTmpDir.absoluteFilePath(tmpFileName);
1427 DEBTRACE(tmpFileName.toStdString());
1429 QString aCall =
"salomeloader."+ fileExt+
" "+ fn +
" " + tmpFileName +
" > " + tmpOutput;
1432 int ret = system(aCall.toLatin1());
1436 fstream
f(tmpOutput.toLatin1());
1442 int status=WEXITSTATUS(ret);
1445 QString mes =
"Problems in conversion: some errors but an incomplete proc has nevertheless been created.\n\n";
1446 mes += QString(hfile.str().c_str());
1447 QMessageBox msgBox(QMessageBox::Warning,
1448 "Import YACS Schema, SUPERV XML format",
1452 else if(status == 2)
1454 QString mes =
"Problems in conversion: a fatal error has been encountered. The proc can't be created.\n\n";
1455 mes += QString(hfile.str().c_str());
1456 QMessageBox msgBox(QMessageBox::Critical,
1457 "Import YACS Schema, SUPERV XML format",
1464 DEBTRACE(
"Unknown problem: " << ret );
1465 QMessageBox msgBox(QMessageBox::Critical,
1466 "Import YACS Schema, SUPERV XML format",
1467 "Unexpected exception in salomeloader.");
1475 QMessageBox msgBox(QMessageBox::Critical,
1476 "Import YACS Schema, SUPERV XML format",
1477 "Unexpected exception in convertSupervFile");
1483 if (fn.isEmpty())
return;
1485 DEBTRACE(
"file loaded : " <<fn.toStdString());
1489 QMessageBox msgBox(QMessageBox::Critical,
1490 "Import YACS Schema, SUPERV file converted in native YACS XML format",
1491 "The file has not the native YACS XML format or is not readable.");
1500 createContext(proc, fn,
"",
true);
1504 QString GenericGui::getSaveFileName(
const QString& fileName)
1506 QFileDialog dialog(_parent,
"Save schema", fileName);
1507 QStringList filters;
1508 filters <<
"XML files (*.xml)"
1510 dialog.setFileMode(QFileDialog::AnyFile);
1511 dialog.setNameFilters(filters);
1512 dialog.selectNameFilter(
"(*.xml)");
1513 dialog.setDefaultSuffix(
"xml");
1514 dialog.setConfirmOverwrite(
true);
1516 dialog.setAcceptMode(QFileDialog::AcceptSave);
1517 QString selectedFile;
1518 QStringList fileNames;
1520 if (
bool ret = dialog.exec())
1522 DEBTRACE(ret <<
" " << dialog.confirmOverwrite());
1523 fileNames = dialog.selectedFiles();
1524 if (!fileNames.isEmpty())
1525 selectedFile = fileNames.first();
1527 QString filteredName = _guiEditor->asciiFilter(selectedFile);
1528 DEBTRACE(filteredName.toStdString());
1529 return filteredName;
1532 void GenericGui::onExportSchema()
1534 DEBTRACE(
"GenericGui::onExportSchema");
1535 if (!QtGuiContext::getQtCurrent())
return;
1537 QString fo = QtGuiContext::getQtCurrent()->getFileName();
1540 if (fo.startsWith(
"newSchema_"))
1543 fn = getSaveFileName(fo);
1545 if (fn.isEmpty())
return;
1547 DEBTRACE(
"GenericGui::onExportSchema: " << fn.toUtf8().constData());
1549 _parent->setFocus();
1550 QtGuiContext::getQtCurrent()->setFileName(fn);
1555 QtGuiContext::getQtCurrent()->setNotSaved(
false);
1557 if (fn.compare(foo) && _wrapper)
1558 _wrapper->renameSchema(foo, fn, QtGuiContext::getQtCurrent()->getWindow());
1561 void GenericGui::onExportSchemaAs()
1563 DEBTRACE(
"GenericGui::onExportSchemaAs");
1565 if (!QtGuiContext::getQtCurrent())
return;
1567 QString fo = QtGuiContext::getQtCurrent()->getFileName();
1569 if (fo.startsWith(
"newSchema_")) fo.clear();
1570 QString fn = getSaveFileName(fo);
1571 if (fn.isEmpty())
return;
1573 DEBTRACE(
"GenericGui::onExportSchemaAs: " << fn.toUtf8().constData());
1574 QtGuiContext::getQtCurrent()->setFileName(fn);
1580 QtGuiContext::getQtCurrent()->setNotSaved(
false);
1582 if (fn.compare(foo) && _wrapper)
1583 _wrapper->renameSchema(foo, fn, QtGuiContext::getQtCurrent()->getWindow());
1586 void GenericGui::onImportCatalog()
1588 DEBTRACE(
"GenericGui::onImportCatalog");
1589 QFileDialog dialog(_parent,
1590 "Choose a YACS Schema to load as a Catalog" ,
1592 tr(
"XML-Files (*.xml);;All Files (*)" ));
1594 dialog.setHistory(_wrapper->getQuickDirList());
1597 QStringList fileNames;
1600 fileNames = dialog.selectedFiles();
1601 if (!fileNames.isEmpty())
1602 fn = fileNames.first();
1605 if ( !fn.isEmpty() )
1606 _catalogsWidget->addCatalogFromFile(fn.toStdString());
1609 void GenericGui::onRunLoadedSchema(
bool withState)
1611 DEBTRACE(
"GenericGui::onRunLoadedSchema");
1612 if (!QtGuiContext::getQtCurrent())
return;
1620 if (!QtGuiContext::getQtCurrent()->_setOfModifiedSubjects.empty())
1622 set<Subject*>::iterator it = QtGuiContext::getQtCurrent()->_setOfModifiedSubjects.begin();
1623 (*it)->select(
true);
1630 QtGuiContext::getQtCurrent()->getSubjectProc()->select(
true);
1642 QtGuiContext::getQtCurrent()->getSubjectProc()->select(
true);
1649 double passe = (end_t -start_t);
1650 passe = passe/CLOCKS_PER_SEC;
1651 cerr <<
"run schema -1- : " << passe << endl;
1656 QFileInfo fo = QtGuiContext::getQtCurrent()->getFileName();
1657 QString procName = fo.baseName();
1660 QString tmpDir = getenv(
"TEMP");
1662 QString tmpDir =
"/tmp";
1664 QDir aTmpDir(tmpDir);
1665 aTmpDir.mkdir(QString(
"YACS_") + getenv(
"USER"));
1666 YASSERT(aTmpDir.cd(QString(
"YACS_") + getenv(
"USER")));
1667 QDateTime curTime = QDateTime::currentDateTime();
1668 QString aRunName = procName +
"_" + curTime.toString(
"yyyyMMdd_hhmmss") +
".xml";
1669 aRunName = aTmpDir.absoluteFilePath(aRunName);
1682 double passe = (end_t -start_t);
1683 passe = passe/CLOCKS_PER_SEC;
1684 cerr <<
"run schema -2- : " << passe << endl;
1687 createContext(procrun, QtGuiContext::getQtCurrent()->getFileName(), aRunName,
false);
1691 GuiExecutor *executor = QtGuiContext::getQtCurrent()->getGuiExecutor();
1692 if (!executor)
return;
1695 QString fn = QFileDialog::getOpenFileName( _parent,
1696 "Choose a previous run state to load" ,
1698 tr(
"XML-Files (*.xml);;All Files (*)" ));
1701 DEBTRACE(
"run state to load: " <<fn.toStdString());
1706 if(_toggleStopOnErrorAct->isChecked())
1710 void GenericGui::onLoadRunStateSchema()
1712 DEBTRACE(
"GenericGui::onLoadRunStateSchema");
1713 onRunLoadedSchema(
true);
1716 void GenericGui::onLoadAndRunSchema()
1718 DEBTRACE(
"GenericGui::onLoadAndRunSchema");
1719 QString fn = QFileDialog::getOpenFileName( _parent,
1720 "Choose a filename to load" ,
1722 tr(
"XML-Files (*.xml);;All Files (*)" ));
1723 if ( !fn.isEmpty() )
1727 if (!fi.exists() && fi.suffix() !=
"xml")
1730 DEBTRACE(
"file loaded : " <<fn.toStdString());
1734 proc = _loader->load(fn.toLatin1());
1741 QMessageBox msgBox(QMessageBox::Critical,
1742 "Import YACS Schema, native YACS XML format",
1743 "The file has not the native YACS XML format or is not readable.");
1752 createContext(proc, fn,
"",
true);
1753 onRunLoadedSchema();
1757 void GenericGui::onChooseBatchJob() {
1758 DEBTRACE(
"GenericGui::onChooseBatchJob");
1761 if(_BJLdialog)
delete _BJLdialog;
1764 _BJLdialog->move(300,200);
1765 _BJLdialog->resize(450,200);
1769 void GenericGui::onStartResume()
1771 DEBTRACE(
"GenericGui::onStartResume");
1772 if (!QtGuiContext::getQtCurrent())
return;
1773 if (!QtGuiContext::getQtCurrent()->getGuiExecutor())
return;
1774 QtGuiContext::getQtCurrent()->getGuiExecutor()->startResumeDataflow();
1777 void GenericGui::onAbort()
1780 if (!QtGuiContext::getQtCurrent())
return;
1781 if (!QtGuiContext::getQtCurrent()->getGuiExecutor())
return;
1782 QtGuiContext::getQtCurrent()->getGuiExecutor()->killDataflow();
1785 void GenericGui::onPause()
1788 if (!QtGuiContext::getQtCurrent())
return;
1789 if (!QtGuiContext::getQtCurrent()->getGuiExecutor())
return;
1790 QtGuiContext::getQtCurrent()->getGuiExecutor()->suspendDataflow();
1793 void GenericGui::onReset()
1796 if (!QtGuiContext::getQtCurrent())
return;
1797 if (!QtGuiContext::getQtCurrent()->getGuiExecutor())
return;
1798 QtGuiContext::getQtCurrent()->getGuiExecutor()->resetDataflow();
1801 void GenericGui::onSaveRunState()
1803 DEBTRACE(
"GenericGui::onSaveRunState");
1804 if (!QtGuiContext::getQtCurrent())
return;
1805 if (!QtGuiContext::getQtCurrent()->getGuiExecutor())
return;
1806 QDateTime curTime = QDateTime::currentDateTime();
1807 QFileInfo procName = QtGuiContext::getQtCurrent()->getFileName();
1808 QString stateName = procName.baseName();
1810 stateName +=
"_state_" + curTime.toString(
"yyyyMMdd_hhmmss") +
".xml";
1812 stateName = getSaveFileName(stateName);
1814 if (!stateName.isEmpty())
1815 QtGuiContext::getQtCurrent()->getGuiExecutor()->saveState(stateName.toStdString());
1818 void GenericGui::onNewEdition()
1820 DEBTRACE(
"GenericGui::onNewEdition");
1826 void GenericGui::onGetYacsContainerLog()
1828 DEBTRACE(
"GenericGui::onGetYacsContainerLog");
1829 if (!QtGuiContext::getQtCurrent())
return;
1830 if (!QtGuiContext::getQtCurrent()->getGuiExecutor())
return;
1831 string log = QtGuiContext::getQtCurrent()->getGuiExecutor()->getContainerLog();
1837 void GenericGui::onGetErrorReport()
1839 DEBTRACE(
"GenericGui::onGetErrorReport");
1840 if (!QtGuiContext::getQtCurrent())
return;
1841 Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
1845 if (QtGuiContext::getQtCurrent()->getGuiExecutor())
1847 log = QtGuiContext::getQtCurrent()->getGuiExecutor()->getErrorReport(snode->
getNode());
1859 void GenericGui::onGetErrorDetails()
1861 DEBTRACE(
"GenericGui::onGetErrorDetails");
1862 if (!QtGuiContext::getQtCurrent())
return;
1863 Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
1867 if (QtGuiContext::getQtCurrent()->getGuiExecutor())
1869 log = QtGuiContext::getQtCurrent()->getGuiExecutor()->getErrorDetails(snode->
getNode());
1881 void GenericGui::onGetContainerLog()
1883 DEBTRACE(
"GenericGui::onGetContainerLog");
1884 if (!QtGuiContext::getQtCurrent())
return;
1885 if (!QtGuiContext::getQtCurrent()->getGuiExecutor())
return;
1886 Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
1889 string log = QtGuiContext::getQtCurrent()->getGuiExecutor()->getContainerLog(snode->
getNode());
1897 info +=
"The container log of this node\n";
1898 info +=
"is not stored in a file and \n";
1899 info +=
"can't be displayed here, \n";
1900 info +=
"but you can have a look at \n";
1901 info +=
"the SALOME standard output,\n";
1902 info +=
"on your terminal...";
1906 info +=
"See YACS Container log \n";
1907 info +=
"(on main proc menu) \n";
1908 info +=
"for all inline nodes";
1917 void GenericGui::onShutdownProc()
1919 DEBTRACE(
"GenericGui::onShutdownProc");
1920 if (!QtGuiContext::getQtCurrent())
return;
1921 if (!QtGuiContext::getQtCurrent()->getGuiExecutor())
return;
1922 QtGuiContext::getQtCurrent()->getGuiExecutor()->shutdownProc();
1925 void GenericGui::onEditDataTypes()
1927 DEBTRACE(
"GenericGui::onEditDataTypes");
1930 void GenericGui::onCreateDataType()
1932 DEBTRACE(
"GenericGui::onCreateDataType");
1935 void GenericGui::onImportDataType()
1937 DEBTRACE(
"GenericGui::onImportDataType");
1938 if (_dwCatalogs) _dwCatalogs->raise();
1941 void GenericGui::onSelectComponentInstance()
1943 DEBTRACE(
"GenericGui::onSelectComponentInstance");
1944 Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
1949 QtGuiContext::getQtCurrent()->_mapOfLastComponentInstance[compo->
getCompoName()]=compo;
1952 void GenericGui::onNewContainer()
1954 DEBTRACE(
"GenericGui::onNewContainer");
1955 _guiEditor->CreateContainer();
1958 void GenericGui::onNewHPContainer()
1960 DEBTRACE(
"GenericGui::onNewHPContainer");
1961 _guiEditor->CreateHPContainer();
1964 void GenericGui::onNewSalomeComponent()
1966 DEBTRACE(
"GenericGui::onNewSalomeComponent");
1967 _guiEditor->CreateComponentInstance();
1970 void GenericGui::onNewSalomePythonComponent()
1972 DEBTRACE(
"GenericGui::onNewSalomePythonComponent");
1975 void GenericGui::onNewCorbaComponent()
1977 DEBTRACE(
"GenericGui::onNewCorbaComponent");
1981 void GenericGui::onSalomeServiceNode()
1983 DEBTRACE(
"GenericGui::onSalomeServiceNode");
1984 _guiEditor->CreateNode(
"SalomeNode");
1987 void GenericGui::onServiceInlineNode()
1989 DEBTRACE(
"GenericGui::onServiceInlineNode");
1990 _guiEditor->CreateNode(
"SalomePythonNode");
1993 void GenericGui::onCORBAServiceNode()
1995 DEBTRACE(
"GenericGui::onCORBAServiceNode");
1996 _guiEditor->CreateNode(
"CORBANode");
1999 void GenericGui::onNodeNodeServiceNode()
2001 DEBTRACE(
"GenericGui::onNodeNodeServiceNode");
2004 void GenericGui::onCppNode()
2007 _guiEditor->CreateNode(
"CppNode");
2010 void GenericGui::onXMLNode()
2013 _guiEditor->CreateNode(
"XmlNode");
2016 void GenericGui::onInDataNode()
2018 DEBTRACE(
"GenericGui::onInDataNode");
2019 _guiEditor->CreateNode(
"PresetNode");
2022 void GenericGui::onOutDataNode()
2024 DEBTRACE(
"GenericGui::onOutDataNode");
2025 _guiEditor->CreateNode(
"OutNode");
2028 void GenericGui::onInStudyNode()
2030 DEBTRACE(
"GenericGui::onInStudyNode");
2031 _guiEditor->CreateNode(
"StudyInNode");
2034 void GenericGui::onOutStudyNode()
2036 DEBTRACE(
"GenericGui::onOutStudyNode");
2037 _guiEditor->CreateNode(
"StudyOutNode");
2040 void GenericGui::onInlineScriptNode()
2042 DEBTRACE(
"GenericGui::onInlineScriptNode");
2043 _guiEditor->CreateNode(
"PyScript");
2046 void GenericGui::onInlineFunctionNode()
2048 DEBTRACE(
"GenericGui::onInlineFunctionNode");
2049 _guiEditor->CreateNode(
"PyFunction");
2052 void GenericGui::onBlockNode()
2054 DEBTRACE(
"GenericGui::onBlockNode");
2055 _guiEditor->CreateBloc();
2058 void GenericGui::onFORNode()
2061 _guiEditor->CreateForLoop();
2064 void GenericGui::onFOREACHNode()
2066 DEBTRACE(
"GenericGui::onFOREACHNode");
2067 createForEachLoop(
"double");
2070 void GenericGui::createForEachLoop(std::string type)
2072 DEBTRACE(
"GenericGui::createForEachLoop");
2073 _guiEditor->CreateForEachLoop(type);
2076 void GenericGui::onWHILENode()
2078 DEBTRACE(
"GenericGui::onWHILENode");
2079 _guiEditor->CreateWhileLoop();
2082 void GenericGui::onSWITCHNode()
2084 DEBTRACE(
"GenericGui::onSWITCHNode");
2085 _guiEditor->CreateSwitch();
2088 void GenericGui::onOptimizerLoop()
2090 DEBTRACE(
"GenericGui::onOptimizerLoop");
2091 _guiEditor->CreateOptimizerLoop();
2094 void GenericGui::onNodeFromCatalog()
2096 DEBTRACE(
"GenericGui::onNodeFromCatalog");
2097 if (_dwCatalogs) _dwCatalogs->raise();
2100 void GenericGui::onDeleteItem()
2102 DEBTRACE(
"GenericGui::onDeleteItem");
2103 _guiEditor->DeleteSubject();
2106 void GenericGui::onCutItem()
2109 _guiEditor->CutSubject();
2112 void GenericGui::onCopyItem()
2114 DEBTRACE(
"GenericGui::onCopyItem");
2115 _guiEditor->CopySubject();
2118 void GenericGui::onPasteItem()
2120 DEBTRACE(
"GenericGui::onPasteItem");
2121 _guiEditor->PasteSubject();
2124 void GenericGui::onPutInBloc()
2126 _guiEditor->PutSubjectInBloc();
2129 void GenericGui::onPutGraphInBloc()
2131 DEBTRACE(
"GenericGui::onPutGraphInBloc");
2132 _guiEditor->PutGraphInBloc();
2133 _guiEditor->arrangeNodes(
false);
2136 void GenericGui::onPutGraphInForLoop()
2138 DEBTRACE(
"GenericGui::onPutGraphInForLoop");
2139 _guiEditor->PutGraphInNode(
"ForLoop");
2142 void GenericGui::putGraphInForeachLoop(std::string type)
2144 DEBTRACE(
"GenericGui::PutGraphInForeachLoop");
2145 _guiEditor->PutGraphInNode(
"ForEachLoop_"+type);
2148 void GenericGui::onPutGraphInWhileLoop()
2150 DEBTRACE(
"GenericGui::onPutGraphInWhileLoop");
2151 _guiEditor->PutGraphInNode(
"WhileLoop");
2154 void GenericGui::onPutGraphInOptimizerLoop()
2156 DEBTRACE(
"GenericGui::onPutGraphInOptimizerLoop");
2157 _guiEditor->PutGraphInNode(
"OptimizerLoop");
2160 void GenericGui::onArrangeLocalNodes()
2162 DEBTRACE(
"GenericGui::onArrangeLocalNodes");
2163 _guiEditor->arrangeNodes(
false);
2166 void GenericGui::onArrangeRecurseNodes()
2168 DEBTRACE(
"GenericGui::onArrangeRecurseNodes");
2169 _guiEditor->arrangeNodes(
true);
2172 void GenericGui::onRebuildLinks()
2174 DEBTRACE(
"GenericGui::onRebuildLinks");
2175 _guiEditor->rebuildLinks();
2178 void GenericGui::onZoomToBloc()
2180 DEBTRACE(
"GenericGui::onZoomToBloc");
2181 QtGuiContext::getQtCurrent()->getView()->onZoomToBloc();
2184 void GenericGui::onCenterOnNode()
2186 DEBTRACE(
"GenericGui::onCenterOnNode");
2187 QtGuiContext::getQtCurrent()->getView()->onCenterOnNode();
2190 void GenericGui::onShrinkExpand() {
2191 DEBTRACE(
"GenericGui::onShrinkExpand");
2192 _guiEditor->shrinkExpand();
2195 void GenericGui::onShrinkExpandChildren() {
2196 DEBTRACE(
"GenericGui::onShrinkExpandChildren");
2197 _guiEditor->shrinkExpand(Qt::ControlModifier|Qt::ShiftModifier);
2200 void GenericGui::onShrinkExpandElementaryRecursively() {
2201 DEBTRACE(
"GenericGui::onShrinkExpandElementaryRecursively");
2202 _guiEditor->shrinkExpand(Qt::ControlModifier);
2205 void GenericGui::onToggleStraightLinks(
bool checked)
2207 Scene::_straightLinks = checked;
2208 DEBTRACE(
"Scene::_straightLinks=" << checked);
2209 if (!QtGuiContext::getQtCurrent())
2211 map<Subject*, SchemaItem*>::const_iterator it = QtGuiContext::getQtCurrent()->_mapOfSchemaItem.begin();
2212 for( ; it != QtGuiContext::getQtCurrent()->_mapOfSchemaItem.end(); ++it)
2219 void GenericGui::onToggleAutomaticComputeLinks(
bool checked)
2221 Scene::_autoComputeLinks = checked;
2222 DEBTRACE(
"Scene::_autoComputeLinks=" << checked);
2225 void GenericGui::onToggleSimplifyLinks(
bool checked)
2227 Scene::_simplifyLinks = checked;
2228 DEBTRACE(
"Scene::_simplifyLinks=" << checked);
2231 void GenericGui::onToggleForce2NodesLinks(
bool checked)
2233 Scene::_force2NodesLink = checked;
2234 DEBTRACE(
"Scene::_force2NodesLink=" << checked);
2237 void GenericGui::onToggleAddRowCols(
bool checked)
2239 Scene::_addRowCols = checked;
2240 DEBTRACE(
"Scene::_addRowCols=" << checked);
2243 void GenericGui::onSelectReference()
2245 Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
2253 void GenericGui::onWhatsThis()
2255 DEBTRACE(
"GenericGui::onWhatsThis");
2256 QWhatsThis::enterWhatsThisMode();
2259 void GenericGui::onWithoutStopMode(
bool checked)
2261 DEBTRACE(
"GenericGui::onWithoutStopMode " << checked);
2262 if (!QtGuiContext::getQtCurrent())
return;
2263 if (!QtGuiContext::getQtCurrent()->getGuiExecutor())
return;
2264 if (checked) QtGuiContext::getQtCurrent()->getGuiExecutor()->setContinueMode();
2267 void GenericGui::onBreakpointsMode(
bool checked)
2269 DEBTRACE(
"GenericGui::onWithoutStopMode " << checked);
2270 if (!QtGuiContext::getQtCurrent())
return;
2271 if (!QtGuiContext::getQtCurrent()->getGuiExecutor())
return;
2272 if (checked) QtGuiContext::getQtCurrent()->getGuiExecutor()->setBreakpointMode();
2275 void GenericGui::onStepByStepMode(
bool checked)
2277 DEBTRACE(
"GenericGui::onWithoutStopMode " << checked);
2278 if (!QtGuiContext::getQtCurrent())
return;
2279 if (!QtGuiContext::getQtCurrent()->getGuiExecutor())
return;
2280 if (checked) QtGuiContext::getQtCurrent()->getGuiExecutor()->setStepByStepMode();
2283 void GenericGui::onToggleStopOnError(
bool checked)
2285 DEBTRACE(
"GenericGui::onToggleStopOnError " << checked);
2286 if (!QtGuiContext::getQtCurrent())
return;
2287 if (!QtGuiContext::getQtCurrent()->getGuiExecutor())
return;
2289 QtGuiContext::getQtCurrent()->getGuiExecutor()->setStopOnError(
false);
2291 QtGuiContext::getQtCurrent()->getGuiExecutor()->unsetStopOnError();
2294 void GenericGui::onToggleSceneItemVisible(
bool checked)
2296 DEBTRACE(
"GenericGui::onToggleSceneItemVisible " << checked);
2297 if (!QtGuiContext::getQtCurrent())
return;
2298 Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
2302 if (!QtGuiContext::getQtCurrent()->_mapOfSceneItem.count(sub))
return;
2304 SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[sub];
2305 item->setVisible(checked);
2308 void GenericGui::displayLinks(
bool isShown)
2310 if (!QtGuiContext::getQtCurrent())
return;
2312 for (it = QtGuiContext::getQtCurrent()->_mapOfSubjectLink.begin();
2313 it != QtGuiContext::getQtCurrent()->_mapOfSubjectLink.end();
2318 SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[sub];
2319 item->setVisible(isShown);
2323 void GenericGui::displayControlLinks(
bool isShown)
2325 if (!QtGuiContext::getQtCurrent())
return;
2327 for (it = QtGuiContext::getQtCurrent()->_mapOfSubjectControlLink.begin();
2328 it != QtGuiContext::getQtCurrent()->_mapOfSubjectControlLink.end();
2333 SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[sub];
2334 item->setVisible(isShown);
2338 void GenericGui::displayPortLinks(
bool isShown)
2340 Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
2347 list<SubjectLink*>::const_iterator it = linkList.begin();
2348 for( ; it != linkList.end(); ++it)
2352 SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[sub];
2353 item->setVisible(isShown);
2362 list<SubjectControlLink*>::const_iterator it = linkList.begin();
2363 for( ; it != linkList.end(); ++it)
2367 SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[sub];
2368 item->setVisible(isShown);
2374 void GenericGui::displayALink(
bool isShown)
2376 Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
2377 if (! QtGuiContext::getQtCurrent()->_mapOfSceneItem.count(sub))
return;
2378 SceneItem *item = QtGuiContext::getQtCurrent()->_mapOfSceneItem[sub];
2379 item->setVisible(isShown);
2382 void GenericGui::onShowAllLinks()
2384 DEBTRACE(
"GenericGui::onShowAllLinks");
2386 displayControlLinks(
true);
2389 void GenericGui::onHideAllLinks()
2391 DEBTRACE(
"GenericGui::onHideAllLinks");
2392 displayLinks(
false);
2393 displayControlLinks(
false);
2396 void GenericGui::onShowOnlyPortLinks()
2398 DEBTRACE(
"GenericGui::onShowOnlyPortLinks");
2400 displayPortLinks(
true);
2403 void GenericGui::onShowPortLinks()
2405 DEBTRACE(
"GenericGui::onShowPortLinks");
2406 displayPortLinks(
true);
2409 void GenericGui::onHidePortLinks()
2411 DEBTRACE(
"GenericGui::onHidePortLinks");
2412 displayPortLinks(
false);
2415 void GenericGui::onEmphasisPortLinks()
2417 DEBTRACE(
"GenericGui::onEmphasisPortLinks");
2418 if (!QtGuiContext::getQtCurrent())
return;
2419 Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
2427 emphasizePortLink(sport,
true);
2439 list<SubjectInputPort*>::const_iterator it = linkList.begin();
2440 for( ; it != linkList.end(); ++it)
2444 emphasizePortLink(sub,
true);
2449 list<SubjectOutputPort*>::const_iterator it = linkList.begin();
2450 for( ; it != linkList.end(); ++it)
2454 emphasizePortLink(sub,
true);
2461 void GenericGui::onShowOnlyCtrlLinks()
2463 DEBTRACE(
"GenericGui::onShowOnlyCtrlLinks");
2465 displayPortLinks(
true);
2468 void GenericGui::onShowCtrlLinks()
2470 DEBTRACE(
"GenericGui::onShowCtrlLinks");
2471 displayPortLinks(
true);
2474 void GenericGui::onHideCtrlLinks()
2476 DEBTRACE(
"GenericGui::onHideCtrlLinks");
2477 displayPortLinks(
false);
2480 void GenericGui::onEmphasisCtrlLinks()
2482 DEBTRACE(
"GenericGui::onEmphasisCtrlLinks");
2483 Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
2492 list<SubjectControlLink*>::const_iterator it = linkList.begin();
2493 for( ; it != linkList.end(); ++it)
2507 void GenericGui::onShowOnlyLink()
2509 DEBTRACE(
"GenericGui::onShowOnlyLink");
2514 void GenericGui::onShowLink()
2516 DEBTRACE(
"GenericGui::onShowLink");
2520 void GenericGui::onHideLink()
2522 DEBTRACE(
"GenericGui::onHideLink");
2523 displayALink(
false);
2526 void GenericGui::onEmphasisLink()
2528 DEBTRACE(
"GenericGui::onEmphasisLink");
2529 Subject *sub = QtGuiContext::getQtCurrent()->getSelectedSubject();
2535 void GenericGui::onDeEmphasizeAll()
2537 DEBTRACE(
"GenericGui::onDeEmphasizeAll");
2538 map<Subject*, SchemaItem*>::const_iterator it = QtGuiContext::getQtCurrent()->_mapOfSchemaItem.begin();
2539 for( ; it != QtGuiContext::getQtCurrent()->_mapOfSchemaItem.end(); ++it)
2546 void GenericGui::onUndo()
2549 if (QtGuiContext::getQtCurrent()->_setOfModifiedSubjects.empty())
2551 QtGuiContext::getQtCurrent()->getInvoc()->undo();
2553 QtGuiContext::getQtCurrent()->setSubjectToCopy(NULL);
2555 else Message(
"undo not possible when there are local modifications not confirmed");
2558 void GenericGui::onRedo()
2561 if (QtGuiContext::getQtCurrent()->_setOfModifiedSubjects.empty())
2563 QtGuiContext::getQtCurrent()->getInvoc()->redo();
2565 QtGuiContext::getQtCurrent()->setSubjectToCopy(NULL);
2567 else Message(
"redo not possible when there are local modifications not confirmed");
2570 void GenericGui::onShowUndo()
2572 _guiEditor->showUndo(_parent);
2575 void GenericGui::onShowRedo()
2577 _guiEditor->showRedo(_parent);
2580 void GenericGui::onCleanOnExit()
2582 DEBTRACE(
"GenericGui::onCleanOnExit");
2583 map<QWidget*, YACS::HMI::QtGuiContext*> mapViewContextCopy = _mapViewContext;
2584 map<QWidget*, YACS::HMI::QtGuiContext*>::iterator it = mapViewContextCopy.begin();
2585 for (; it != mapViewContextCopy.end(); ++it)
2587 closeContext((*it).first,
true);
2595 list<SubjectLink*>::const_iterator it = linkList.begin();
2596 for( ; it != linkList.end(); ++it)
2599 if (!subli)
continue;
2608 void GenericGui::onHelpContextModule(
const QString& theComponentName,
const QString& theFileName,
const QString& theContext)
2610 _wrapper->onHelpContextModule(theComponentName,theFileName,theContext);
#define YASSERT(val)
YASSERT macro is always defined, used like assert, but throw a YACS::Exception instead of abort.
virtual void readFile(std::string fileName)
void setText(std::string text)
virtual void readFile(std::string fileName)
CORBA::Object_ptr Resolve(const char *Path) override
Base class for all component instances.
const std::string & getCompoName() const
void checkConsistency(LinkInfo &info) const
Class that deal with list of semantics links for high level analysis.
static const unsigned char ALL_STOP_ASAP
bool areWarningsOrErrors() const
Class for logging error messages.
virtual std::string getStr()
Base class for all nodes.
virtual std::string getErrorReport()
returns a string that contains an error report if the node is in error
virtual std::string getErrorDetails() const
virtual int isValid()
indicates if the node is valid (returns 1) or not (returns 0)
Base class for all schema objects.
virtual void setEdition(bool edition)
virtual Logger * getLogger(const std::string &name)
virtual Proc * getProc()
Return the proc (this)
static void setRuntime(long flags=UsePython+UseCorba+UseXml+UseCpp+UseSalome, int argc=0, char *argv[]=NULL)
virtual Proc * createProc(const std::string &name)
CORBA::ORB_ptr getOrb() const
Catalog * getBuiltinCatalog()
Get the catalog of base nodes (elementary and composed)
virtual void addCatalog(Catalog *catalog)
Add a catalog of types and nodes to the runtime.
virtual Catalog * loadCatalog(const std::string &sourceKind, const std::string &path)
Load a catalog of calculation to use as factory.
Class for calculation node associated with a component service.
void openFileSchema(std::string xmlDump)
void setSessionCatalog(YACS::ENGINE::Catalog *cata)
void setCurrentCatalog(YACS::ENGINE::Catalog *cata)
void setLoading(bool isLoading)
void startResumeDataflow(bool initialize=false)
void setLoadStateFile(std::string xmlFile)
void setStopOnError(bool aMode)
void setEditionRoot(YACS::HMI::ItemEditionRoot *re)
void setSelectionModel(QItemSelectionModel *selmod)
void setView(YACS::HMI::GraphicsView *view)
void setEditTree(FormEditTree *editTree)
void setStackedWidget(QStackedWidget *sw)
void setWindow(QWidget *window)
void setGuiExecutor(YACS::HMI::GuiExecutor *guiEx)
void setFileName(const QString &fileName)
void setScene(QGraphicsScene *scene)
FormEditTree * getEditTree()
QStackedWidget * getStackedWidget()
void setEdition(bool isEdition)
void setSchemaModel(YACS::HMI::SchemaModel *model)
virtual void setProc(YACS::ENGINE::Proc *proc)
YACS::HMI::GuiExecutor * getGuiExecutor()
virtual qreal getHeaderBottom()
virtual void setHeight(qreal height)
AbstractSceneItem cannot be resized (only ComposedNodeItem can)
virtual void updateLinks()
virtual SceneComposedNodeItem * getParent()
shownState getShownState()
virtual void setShownState(shownState ss)
void setExpandedPos(QPointF epos)
virtual void setWidth(qreal width)
AbstractSceneItem cannot be resized (only ComposedNodeItem can)
void setEdition(bool isEdition=true)
SubjectNode * getSubjectOutNode()
SubjectNode * getSubjectInNode()
std::list< SubjectLink * > getListOfSubjectLink()
virtual std::string getName()
SubjectDataPort * getSubjectInPort()
SubjectDataPort * getSubjectOutPort()
virtual std::string getName()
std::list< SubjectInputPort * > getSubjectInputPorts() const
std::list< SubjectOutputPort * > getSubjectOutputPorts() const
std::list< SubjectControlLink * > getSubjectControlLinks() const
virtual YACS::ENGINE::Node * getNode()
virtual void update(GuiEvent event, int type, Subject *son)
static void erase(Subject *sub, Command *command=0, bool post=false)
virtual std::string getName()
virtual void select(bool isSelected)
viewer QGraphicsScene: deriver SUIT_ViewModel comme QxGraph_Viewer
YACSRUNTIMESALOME_EXPORT RuntimeSALOME * getSALOMERuntime()
def ref(target, callback=None)