]> SALOME platform Git repositories - modules/paravis.git/commitdiff
Salome HOME
Now using 'salome_iapp.IN_SALOME_GUI' to detect where we are invoked from.
authorabn <adrien.bruneton@cea.fr>
Wed, 1 Oct 2014 15:20:08 +0000 (17:20 +0200)
committerabn <adrien.bruneton@cea.fr>
Wed, 1 Oct 2014 15:20:08 +0000 (17:20 +0200)
src/PVGUI/PVGUI_Module.cxx
src/PVGUI/PVGUI_Module_actions.cxx
src/PVGUI/PVGUI_Module_widgets.cxx
src/PV_SWIG/no_wrap/pvsimple.py

index 36fdf5e53a7ce2c0dae3ec14c0933795103abbb4..c7c8c7a76544a388cf9d982fc38bf03bb7d43f46 100644 (file)
@@ -1083,14 +1083,6 @@ void PVGUI_Module::onRestartTrace()
   startTrace();
 }
 
-/*!
-  \brief Show ParaView view.
-*/
-void PVGUI_Module::onNewParaViewWindow()
-{
-  showView(true);
-}
-
 /*!
   \brief Save state under the module root object.
 */
index 0d3555a08e337e8ff1181bb610f2e2f78f6d181b..42adaf84bbb4f88402d466c1e36d51e53a7eddaf 100644 (file)
@@ -623,11 +623,11 @@ void PVGUI_Module::createActions()
 {
   QAction* anAction;
 
-  // New ParaView window
-  anAction = new QtxAction(tr("MEN_NEW_PV_VIEW"), tr("MEN_NEW_PV_VIEW"), 0, 
-                          this, false, "ParaViS:Create new ParaView view");
-  connect(anAction, SIGNAL(triggered()), this, SLOT(onNewParaViewWindow()));
-  registerAction(ParaViewNewWindowId, anAction);
+//  // New ParaView window
+//  anAction = new QtxAction(tr("MEN_NEW_PV_VIEW"), tr("MEN_NEW_PV_VIEW"), 0,
+//        this, false, "ParaViS:Create new ParaView view");
+//  connect(anAction, SIGNAL(triggered()), this, SLOT(onNewParaViewWindow()));
+//  registerAction(ParaViewNewWindowId, anAction);
 
   // Save state under the module root object
   anAction = new QAction(tr("MEN_SAVE_MULTI_STATE"), this);
index b158fe35b5e563910cdea51e93dc883a5269b345..8a5c767335ce4216f9d46d1c44f998632c6c999f 100644 (file)
@@ -118,11 +118,10 @@ void PVGUI_Module::setupDockWidgets()
   // Properties dock (previously called OBJECT_INSPECTOR)
   QDockWidget* propertiesDock = new QDockWidget( tr( "TTL_OBJECT_INSPECTOR" ), desk );
   propertiesDock->setObjectName("propertiesDock");
-  propertiesDock->setAllowedAreas( Qt::LeftDockWidgetArea|Qt::NoDockWidgetArea|Qt::RightDockWidgetArea );
+  propertiesDock->setAllowedAreas( Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea );
   desk->addDockWidget( Qt::LeftDockWidgetArea, propertiesDock );
 
   pqPropertiesPanel* propertiesPanel = guiElements->getPropertiesPanel();
-  propertiesDock->setObjectName("propertiesPanel");
   propertiesDock->setWidget(propertiesPanel);
   connect( propertiesPanel, SIGNAL( helpRequested(const QString&, const QString&) ),  this, SLOT( showHelpForProxy(const QString&, const QString&) ) );
   //            hook delete to pqDeleteReaction.
@@ -159,7 +158,8 @@ void PVGUI_Module::setupDockWidgets()
 
   desk->setTabPosition(Qt::LeftDockWidgetArea, QTabWidget::North);
   desk->tabifyDockWidget(informationDock, propertiesDock);
-  propertiesDock->raise();
+  desk->tabifyDockWidget(propertiesDock, pipelineBrowserDock);
+  //propertiesDock->raise();
 
   // Statistic View
   QDockWidget* statisticsViewDock  = new QDockWidget( tr( "TTL_STATISTICS_VIEW" ), desk );
index b6c62bc68cf8f617fa93f24a229716784ae56d9f..87e0dabac8d2bb4892fe8c693f67b3a25316f343 100644 (file)
@@ -23,21 +23,19 @@ On top of that it also establishes a connection to a valid PVServer whose addres
 is provided by the PARAVIS engine.
 """
 
+__DEBUG = 1
+
 def __my_log(msg):
-    print "[PARAVIS] %s" % msg
+    if __DEBUG:
+      print "[PARAVIS] %s" % msg
 
 def __getFromGUI():
-    """ Identify if we are running inside SALOME's embedded console.
+    """ Identify if we are running inside SALOME's embedded interpreter.
     """
-    fromGUI = False
-    try:
-      import salome
-      fromGUI = salome.fromEmbeddedConsole
-    except AttributeError:
-      pass
-    return fromGUI
+    import salome_iapp
+    return salome_iapp.IN_SALOME_GUI
 
-def InitParaViewForGUI():
+def ShowParaviewView():
     """
     If the import is made from SALOME embedded console, the ParaView application needs to 
     be instanciated to avoid a future crash. 
@@ -46,24 +44,22 @@ def InitParaViewForGUI():
       __my_log("Initializing ParaView main elements, please be patient ...")
       import SalomePyQt
       sgPyQt = SalomePyQt.SalomePyQt()
-      sgPyQt.createView("ParaView")
+      viewIds = sgPyQt.findViews("ParaView")
+      if len(viewIds):
+        sgPyQt.setViewVisible(viewIds[0], True)
+        sgPyQt.activateView(viewIds[0])
+      else:  
+        sgPyQt.createView("ParaView")
       # Now let the GUI main loop process the initialization event posted above
       sgPyQt.processEvents()  
       __my_log("ParaView initialized.")
 
 ## The below has to called BEFORE importing paraview!!! This is crazy, but it has to be.
-InitParaViewForGUI()  
-del InitParaViewForGUI
+ShowParaviewView()  
 
 import paraview
 import paravis
-
-# Forward namespace of simple into current pvsimple:
 from paraview import simple
-for name in dir(simple):
-  if not name.startswith("__"):
-    globals()[name] = getattr(simple, name)
-del simple
 
 def SalomeConnectToPVServer():
     """
@@ -81,7 +77,7 @@ def SalomeConnectToPVServer():
         a = server_url.split(':')
         b = a[1].split('//')
         host, port = b[-1], int(a[-1])
-        Connect(host, port)
+        simple.Connect(host, port)
         __my_log("Connected to %s!" % server_url)
         if __getFromGUI():
             paravis.myParavisEngine.SetGUIConnected(True)
@@ -93,3 +89,11 @@ def SalomeConnectToPVServer():
     pass
     
 SalomeConnectToPVServer()
+del SalomeConnectToPVServer
+
+# Forward namespace of simple into current pvsimple:
+for name in dir(simple):
+  if not name.startswith("__"):
+    globals()[name] = getattr(simple, name)
+del simple
+