1 # -*- coding: iso-8859-1 -*-
2 # Copyright (C) 2010 EDF R&D
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License.
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 from eficasWrapper import *
22 from PyQt4 import QtGui,QtCore
25 # Configuration de l'installation
26 my_path = os.path.dirname(os.path.abspath(__file__))
27 DATASSIM_INSTALL_DIR = my_path + "/../daEficas"
28 sys.path[:0]=[DATASSIM_INSTALL_DIR]
31 # ================================================
32 # Specialization of the EficasWrapper for DATASSIM
33 # ================================================
35 class DatassimEficasWrapper(EficasWrapper):
40 def __init__(self, parent, code="DATASSIM"):
41 EficasWrapper.__init__(self, parent, code)
43 # Association de l'objet editor avec le callbackId
44 def setCallbackId(self, callbackId):
45 index = self.viewmanager.myQtab.currentIndex()
46 self.__myCallbackId[self.viewmanager.dict_editors[index]] = callbackId
48 def getCallbackId(self):
49 if self.__close_editor is None:
50 index = self.viewmanager.myQtab.currentIndex()
51 return self.__myCallbackId[self.viewmanager.dict_editors[index]]
53 return self.__myCallbackId[self.__close_editor]
59 qtEficas.Appli.fileSave(self)
60 index = self.viewmanager.myQtab.currentIndex()
62 self.notifyObserver(EficasEvent.EVENT_TYPES.SAVE)
68 qtEficas.Appli.fileSaveAs(self)
69 self.notifyObserver(EficasEvent.EVENT_TYPES.SAVE)
71 def getCaseName(self):
72 if self.__close_editor is None:
73 index = self.viewmanager.myQtab.currentIndex()
74 CaseName = self.viewmanager.myQtab.tabText(index)
77 CaseName = self.__close_editor.fichier.split('/')[-1]
84 QtGui.QMessageBox.warning( self, "Alerte", "You cannot Open a Case into Eficas window when you are using Datassim SALOME module")
90 index = self.viewmanager.myQtab.currentIndex()
91 self.__close_editor = self.viewmanager.dict_editors[index]
92 res = self.viewmanager.handleClose(self)
93 if res != 2: # l utilsateur a annule
94 if self.__close_editor.fichier is None:
95 # We have to destroy the case
96 self.notifyObserver(EficasEvent.EVENT_TYPES.DESTROY)
97 self.__myCallbackId.pop(self.__close_editor)
99 # Il faudrait en faire plus -> Voir Edit dans SALOME !
100 self.notifyObserver(EficasEvent.EVENT_TYPES.SAVE)
101 self.__myCallbackId.pop(self.__close_editor)
102 self.__close_editor = None
105 def fileCloseAll(self):
109 while len(self.viewmanager.dict_editors) > 0:
110 self.viewmanager.myQtab.setCurrentIndex(0)
111 res = self.fileClose()
112 if res==2 : return res # l utilsateur a annule