# Classe de base permettant de lire, afficher
# et sauvegarder les fichiers utilisateurs
-class CONFIG(configuration.configBase):
+class CONFIG(configuration.configBase): # configuration.CONFIG_BASE):
def __init__(self,appli,repIni):
# self.labels_eficas = ['lang']
self.labels_eficas = ['lang','rep_cata','catalogues','closeAutreCommande','closeFrameRechercheCommande','closeEntete','taille']
configuration.configBase.__init__(self,appli,repIni)
+ #~ configuration.CONFIG_BASE.__init__(self,appli,repIni)
self.rep_user = os.environ["HOME"]
self.appli = appli
# called when active study is changed
# active study ID is passed as parameter
-def activeStudyChanged( studyID ):
- adaoLogger.debug("activeStudyChanged")
- GuiImpl.activeStudyChanged( studyID )
+#~ def activeStudyChanged( studyID ):
+ #~ adaoLogger.debug("activeStudyChanged")
+ #~ GuiImpl.activeStudyChanged( studyID )
# called when popup menu is invoked
# popup menu and menu context are passed as parameters
def __init__(self):
self.adaoCaseManager = AdaoCaseManager()
-__study2context__ = {}
-__current_context__ = None
-def _setContext( studyID ):
- global __study2context__, __current_context__
- QApplication.processEvents()
- if studyID not in __study2context__:
- __study2context__[studyID] = GUIcontext()
- pass
- __current_context__ = __study2context__[studyID]
- return __current_context__
+#~ __study2context__ = {}
+#~ __current_context__ = None
+__current_context__ = GUIcontext()
+#~ def _setContext( studyID ):
+ #~ global __study2context__, __current_context__
+ #~ QApplication.processEvents()
+ #~ if studyID not in __study2context__:
+ #~ __study2context__[studyID] = GUIcontext()
+ #~ pass
+ #~ __current_context__ = __study2context__[studyID]
+ #~ return __current_context__
# This object does not need to be embedded in a GUI context object. A single
# instance for all studies is a priori sufficient.
# called when module is activated
# returns True if activating is successfull and False otherwise
def activate():
- ctx = _setContext( sgPyQt.getStudyId() )
+ #~ ctx = _setContext( sgPyQt.getStudyId() )
+ global __current_context__ ; ctx = __current_context__
+ QApplication.processEvents()
ctx.adaoCaseManager.activate()
return True
# called when module is deactivated
def deactivate():
- ctx = _setContext( sgPyQt.getStudyId() )
+ #~ ctx = _setContext( sgPyQt.getStudyId() )
+ global __current_context__ ; ctx = __current_context__
+ QApplication.processEvents()
ctx.adaoCaseManager.deactivate()
# called when active study is changed
# active study ID is passed as parameter
-def activeStudyChanged( studyID ):
- ctx = _setContext( sgPyQt.getStudyId() )
+def activeStudyChanged(): # studyID ):
+ #~ ctx = _setContext( sgPyQt.getStudyId() )
+ QApplication.processEvents()
# called when popup menu is invoked
# popup menu and menu context are passed as parameters
def createPopupMenu( popup, context ):
- activeStudyId = sgPyQt.getStudyId()
- ctx = _setContext(sgPyQt.getStudyId())
- selcount, selected = adaoGuiHelper.getAllSelected(activeStudyId)
+ #~ activeStudyId = sgPyQt.getStudyId()
+ #~ ctx = _setContext(sgPyQt.getStudyId())
+ global __current_context__ ; ctx = __current_context__
+ QApplication.processEvents()
+ selcount, selected = adaoGuiHelper.getAllSelected()# activeStudyId)
if selcount == 1:
- selectedItem = adaoGuiHelper.getSelectedItem(activeStudyId)
- popup = ctx.adaoCaseManager.salome_manager.createPopupMenuOnItem(popup, activeStudyId, selectedItem)
+ selectedItem = adaoGuiHelper.getSelectedItem()# activeStudyId)
+ popup = ctx.adaoCaseManager.salome_manager.createPopupMenuOnItem(popup, selectedItem) # activeStudyId, selectedItem)
def OnGUIEvent(actionId) :
"""
Called when an event is raised from a graphic item (click on menu item or
toolbar button). The actionId value is the ID associated to the item.
"""
- ctx = _setContext( sgPyQt.getStudyId() )
+ #~ ctx = _setContext( sgPyQt.getStudyId() )
+ global __current_context__ ; ctx = __current_context__
+ QApplication.processEvents()
ctx.adaoCaseManager.processGUIEvent(actionId)
# called when module's preferences are changed
"""
QMessageBox.information( parent, "Information", msg, QMessageBox.Close)
-def getActiveStudyId():
- """
- This function returns the id of the active study. The concept of active study
- makes sens only in the GUI context.
- """
- return salome.sg.getActiveStudyId()
+#~ def getActiveStudyId():
+ #~ """
+ #~ This function returns the id of the active study. The concept of active study
+ #~ makes sens only in the GUI context.
+ #~ """
+ #~ return salome.sg.getActiveStudyId()
def refreshObjectBrowser():
"""
GUI is working.
"""
if salome.sg is not None:
- salome.sg.updateObjBrowser(0)
+ # salome.sg.updateObjBrowser(0)
+ salome.sg.updateObjBrowser()
def selectItem(salomeStudyItem):
if salome.sg is not None:
salome.sg.ClearIObjects()
salome.sg.AddIObject(salomeStudyItem)
-def getSelectedItem(salomeStudyId=-100):
+def getSelectedItem():# salomeStudyId=-100):
"""
Get the current selection. If more than one item are selected, the
only first is considered. The object is return (not the id).
if salome.sg is None:
raise Exception("GuiHelper.getSelectedItem can't be used without the GUI context")
- if salomeStudyId != -100:
- studyEditor = salome.kernel.studyedit.getStudyEditor(salomeStudyId)
+ #~ if salomeStudyId != -100:
+ #~ studyEditor = salome.kernel.studyedit.getStudyEditor(salomeStudyId)
studyEditor = salome.kernel.studyedit.getStudyEditor()
item = None
listEntries=salome.sg.getAllSelected()
item = studyEditor.study.FindObjectID( entry )
return item
-def getAllSelected(salomeStudyId):
+def getAllSelected():# salomeStudyId):
"""
Returns all selected items in the specified study.
"""
if salome.sg is None:
raise OmaException("getSelectedItem can't be used without the GUI context", OmaException.TYPES.DEVEL)
- study = adaoModuleHelper.getStudyManager().GetStudyByID( salomeStudyId )
+ # study = adaoModuleHelper.getStudyManager().GetStudyByID( salomeStudyId )
selcount = salome.sg.SelectedCount()
seltypes = {}
for i in range( selcount ):
- __incObjToMap( seltypes, adaoModuleHelper.getObjectID( study, salome.sg.getSelected( i ) ) )
+ __incObjToMap( seltypes, adaoModuleHelper.getObjectID( salome.sg.getSelected( i ) ) ) # study, salome.sg.getSelected( i ) ) )
pass
return selcount, seltypes
def _processEficasNewEvent(self, eficasWrapper, eficasEvent):
adao_case = eficasEvent.callbackId
# Ajout dand l'etude
- salomeStudyId = adaoGuiHelper.getActiveStudyId()
- salomeStudyItem = adaoStudyEditor.addInStudy(salomeStudyId, adao_case)
+ #~ salomeStudyId = adaoGuiHelper.getActiveStudyId()
+ salomeStudyItem = adaoStudyEditor.addInStudy( adao_case ) # salomeStudyId, adao_case)
# Affichage correct dans l'etude
adaoGuiHelper.refreshObjectBrowser()
adaoGuiHelper.selectItem(salomeStudyItem.GetID())
# Finalisation des donnees du cas
- adao_case.salome_study_id = salomeStudyId
+ #~ adao_case.salome_study_id = salomeStudyId
adao_case.salome_study_item = salomeStudyItem
# Ajout du cas
self.cases[adao_case.eficas_editor] = adao_case
def _processEficasSaveEvent(self, eficasWrapper, eficasEvent):
adao_case = eficasEvent.callbackId
# On met a jour l'etude
- adaoStudyEditor.updateItem(adao_case.salome_study_id, adao_case.salome_study_item, adao_case)
+ adaoStudyEditor.updateItem(adao_case.salome_study_item, adao_case) # adao_case.salome_study_id, adao_case.salome_study_item, adao_case)
# Affichage correct dans l'etude
adaoGuiHelper.refreshObjectBrowser()
adaoGuiHelper.selectItem(adao_case.salome_study_item.GetID())
# Recuperation du cas
adao_case = self.cases[editor]
# Suppression de l'objet dans l'etude
- adaoStudyEditor.removeItem(adao_case.salome_study_id, adao_case.salome_study_item)
+ adaoStudyEditor.removeItem(adao_case.salome_study_item) # adao_case.salome_study_id, adao_case.salome_study_item)
# Suppression du cas
self.cases.pop(editor)
# Refresh GUI -> appelle currentSelectionChanged()
a = sgPyQt.createAction( UI_ELT_IDS.CLOSE_ADAOCASE_ID, "Close case", "Close case", "Close the selected case", "" )
a = sgPyQt.createAction( UI_ELT_IDS.YACS_EXPORT_ID, "Export to YACS", "Export to YACS", "Generate a YACS graph executing this case", "" )
- def createPopupMenuOnItem(self,popup,salomeSudyId, item):
- if adaoStudyEditor.isValidAdaoCaseItem(salomeSudyId, item):
+ def createPopupMenuOnItem(self,popup,item): # salomeSudyId, item):
+ if adaoStudyEditor.isValidAdaoCaseItem(item): # Attention : appel ancien avec un coquille (StudyId) : (salomeSudyId, item):
popup.addAction( sgPyQt.action( UI_ELT_IDS.CLOSE_ADAOCASE_ID ) )
popup.addAction( sgPyQt.action( UI_ELT_IDS.YACS_EXPORT_ID ) )
return popup
from LifeCycleCORBA import LifeCycleCORBA
import SALOMEDS
import SALOMEDS_Attributes_idl
+from salome.kernel.studyedit import getStudyEditor
#import OMA_ORB
###
# Get object's ID
###
-def getObjectID( study, entry ):
+def getObjectID( entry ): # study, entry ):
ID = unknownID()
- if study and entry:
- sobj = study.FindObjectID( entry )
+ if entry: # study and entry:
+ sobj = getStudyEditor().study.FindObjectID( entry )
if sobj is not None:
test, anAttr = sobj.FindAttribute( "AttributeLocalID" )
if test: ID = anAttr._narrow( SALOMEDS.AttributeLocalID ).Value()
# a SComponent is a reference in a study toward a SALOME component
#
-def addInStudy(salomeStudyId, adaoCase):
+def addInStudy(adaoCase): # salomeStudyId, adaoCase):
"""
This function adds in the specified SALOME study a study entry that corresponds
to the specified adao case. This study case is put in a folder under
the ADAO component and is identified by the case name.
"""
- studyEditor = studyedit.getStudyEditor(salomeStudyId)
+ studyEditor = studyedit.getStudyEditor() # salomeStudyId)
adaoRootEntry = studyEditor.findOrCreateComponent(
moduleName = adaoModuleHelper.componentName(),
return salomeStudyItem
-def updateItem(salomeStudyId, salomeStudyItem, adaoCase):
+def updateItem(salomeStudyItem, adaoCase): # salomeStudyId, salomeStudyItem, adaoCase):
- studyEditor = studyedit.getStudyEditor(salomeStudyId)
+ studyEditor = studyedit.getStudyEditor() # salomeStudyId)
if salomeStudyItem.GetName()[:-2] != adaoCase.name:
itemName = adaoCase.name
comment = itemValue,
icon = icon)
-def removeItem(salomeStudyId, item):
+def removeItem(item): # salomeStudyId, item):
"""
Remove the item from the specified study.
"""
- studyEditor = studyedit.getStudyEditor(salomeStudyId)
+ studyEditor = studyedit.getStudyEditor() # salomeStudyId)
return studyEditor.removeItem(item,True)
-def isValidAdaoCaseItem(salomeStudyId,item):
+def isValidAdaoCaseItem(item): # salomeStudyId,item):
"""
Return true if the specified item corresponds to a valid adaoCase
"""
if item is None:
return False
- studyEditor = studyedit.getStudyEditor(salomeStudyId)
+ studyEditor = studyedit.getStudyEditor() # salomeStudyId)
itemType = studyEditor.getTypeId(item)
if itemType != ADAO_ITEM_TYPES.ADAO_CASE:
return False