def tabChanged(self, index):
debug("tabChanged " + str(index))
- self.notifyObserver(EficasEvent.EVENT_TYPES.TABCHANGED, callbackId=self.viewmanager.dict_editors[index])
+ # This signal is also emit when a new case is created/added
+ # On regarde que le dictionnaire contient l'index
+ if index in self.viewmanager.dict_editors.keys():
+ self.notifyObserver(EficasEvent.EVENT_TYPES.TABCHANGED, callbackId=self.viewmanager.dict_editors[index])
def addJdcInSalome( self, jdcPath ):
# On gere nous meme l'etude
def getOpenFileName(self):
return str(self.__file_open_name)
- def selectCase(self, callbackId):
+ def selectCase(self, editor):
rtn = False
- for editor, myCallbackId in self.__myCallbackId.iteritems():
- if myCallbackId[0] == callbackId[0]:
- if myCallbackId[1].GetID() == callbackId[1].GetID():
- try:
- for indexEditor in self.viewmanager.dict_editors.keys():
- if editor is self.viewmanager.dict_editors[indexEditor]:
- self.viewmanager.myQtab.setCurrentIndex(indexEditor)
- rtn = True
- except:
- pass
+ for indexEditor in self.viewmanager.dict_editors.keys():
+ if editor is self.viewmanager.dict_editors[indexEditor]:
+ self.viewmanager.myQtab.setCurrentIndex(indexEditor)
+ rtn = True
+ break
return rtn
def fileClose(self):
import traceback
from PyQt4.QtCore import QObject
+from PyQt4.QtCore import * # Import from PyQT
from PyQt4 import QtGui,QtCore
import SalomePyQt
sgPyQt = SalomePyQt.SalomePyQt()
# Value == objet AdaoCase()
self.cases = {}
-
# Création des deux managers
self.salome_manager = AdaoGuiUiComponentBuilder()
self.eficas_manager = AdaoEficasWrapper(parent=SalomePyQt.SalomePyQt().getDesktop())
# Cela simplifier grandement le code
sgPyQt.setViewClosable(self.eficas_viewId, False)
+ # On s'abonne au gestionnaire de selection
+ self.selection_manager = sgPyQt.getSelection()
+ QtCore.QObject.connect(self.selection_manager, QtCore.SIGNAL('currentSelectionChanged()'), self.currentSelectionChanged)
+
def activate(self):
- self.__dlgEficasWrapper.setEnabled(True)
+ self.eficas_manager.setEnabled(True)
def deactivate(self):
- self.__dlgEficasWrapper.setEnabled(False)
+ self.eficas_manager.setEnabled(False)
+
+ def currentSelectionChanged(self):
+ adaoLogger.debug("currentSelectionChanged")
+ salomeStudyItem = adaoGuiHelper.getSelectedItem()
+ for case_name, adao_case in self.cases.iteritems():
+ if adao_case.salome_study_item.GetID() == salomeStudyItem.GetID():
+ self.eficas_manager.selectCase(adao_case.eficas_editor)
+ break
def _processEficasTabChanged(self, eficasWrapper, eficasEvent):
"""