Salome HOME
Merge branch 'V7_main'
[modules/adao.git] / src / daSalome / daGUI / daGuiImpl / adaoStudyEditor.py
index 9d29837bba7e9a36f6d59c947d445d3f66d319be..3e7df28097d044dab66bc579d7e8f1a50fd1c5f5 100644 (file)
@@ -1,5 +1,5 @@
-# -*- coding: iso-8859-1 -*-
-#  Copyright (C) 2010 EDF R&D
+# -*- coding: utf-8 -*-
+#  Copyright (C) 2010-2013 EDF R&D
 #
 #  This library is free software; you can redistribute it and/or
 #  modify it under the terms of the GNU Lesser General Public
 
 __author__="aribes/gboulant"
 
-from enumerate import Enumerate
-import studyedit
+from daUtils.enumerate import Enumerate
+
+from salome.kernel import studyedit
+
 import adaoModuleHelper
-from daGuiImpl.adaoCase import AdaoCase
 
 #
 # ==============================================================================
@@ -56,36 +57,45 @@ def addInStudy(salomeStudyId, adaoCase):
     studyEditor = studyedit.getStudyEditor(salomeStudyId)
 
     adaoRootEntry = studyEditor.findOrCreateComponent(
-        engineName    = adaoModuleHelper.componentName(),
-        componentName = adaoModuleHelper.componentUserName())
+        moduleName    = adaoModuleHelper.componentName(),
+        componentName = adaoModuleHelper.componentUserName(),
+        icon          = adaoModuleHelper.modulePixmap())
 
-    itemName  = adaoCase.get_name()
-    itemValue = str(adaoCase.get_filename())
+    itemName  = adaoCase.name
+    itemValue = adaoCase.filename
     itemType  = ADAO_ITEM_TYPES.ADAO_CASE
 
+    icon = adaoModuleHelper.studyItemPixmapNOk()
+    if adaoCase.isOk():
+      icon = adaoModuleHelper.studyItemPixmapOk()
+
     salomeStudyItem = studyEditor.createItem(
         adaoRootEntry, itemName,
         comment = itemValue,
-        typeId  = itemType)
-    # _MEM_ Note that we use the comment attribute to store the serialize
-    # description of the data.
+        typeId  = itemType,
+        icon    = icon)
 
     return salomeStudyItem
 
 def updateItem(salomeStudyId, salomeStudyItem, adaoCase):
 
     studyEditor = studyedit.getStudyEditor(salomeStudyId)
-    
-    if salomeStudyItem.GetName()[:-2] != adaoCase.get_name():
-      itemName  = adaoCase.get_name()
-      itemValue = adaoCase.get_filename()
+
+    if salomeStudyItem.GetName()[:-2] != adaoCase.name:
+      itemName  = adaoCase.name
+      itemValue = adaoCase.filename
     else:
       itemName  = salomeStudyItem.GetName()
-      itemValue = adaoCase.get_filename()
+      itemValue = adaoCase.filename
+
+    icon = adaoModuleHelper.studyItemPixmapNOk()
+    if adaoCase.isOk():
+      icon = adaoModuleHelper.studyItemPixmapOk()
 
     studyEditor.setItem(salomeStudyItem,
         name    = itemName,
-        comment = itemValue)
+        comment = itemValue,
+        icon    = icon)
 
 def removeItem(salomeStudyId, item):
     """