From: André Ribes Date: Wed, 16 Jun 2010 14:04:43 +0000 (+0200) Subject: DATASSIM -> ADAO X-Git-Tag: V6_4_0rc3~141 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=949abb22bf7e9bc3ead2df4a52f5878af8afcc52;p=modules%2Fadao.git DATASSIM -> ADAO --- diff --git a/src/daSalome/daGUI/ADAOGUI.py b/src/daSalome/daGUI/ADAOGUI.py new file mode 100644 index 0000000..39d5a7b --- /dev/null +++ b/src/daSalome/daGUI/ADAOGUI.py @@ -0,0 +1,77 @@ +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2010 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 +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +""" +This python file provides the implementation of the interface of the GUI part of +this SALOME module. This interface is required by the SALOME GUI framework. +We use here a proxy module named under the alias GuiImpl for at least three +reasons: +1. To Keep the required interface as clear as possible in this file; +2. The concrete implementation can be substituted by an alternative version; +3. We could mix several concrete implementations provided by different proxy + modules, for example for test purposes. +""" + +from daGuiImpl import ADAOGUI_impl as GuiImpl + + +# called when module is initialized +# perform initialization actions +def initialize(): + GuiImpl.initialize() + +# called when module is initialized +# return map of popup windows to be used by the module +def windows(): + return GuiImpl.windows() + +# called when module is initialized +# export module's preferences +def createPreferences(): + GuiImpl.createPreferences() + +# called when module is activated +# returns True if activating is successfull and False otherwise +def activate(): + return GuiImpl.activate() + +# called when module is deactivated +def deactivate(): + GuiImpl.deactivate() + +# called when active study is changed +# active study ID is passed as parameter +def activeStudyChanged( studyID ): + GuiImpl.activeStudyChanged( studyID ) + +# called when popup menu is invoked +# popup menu and menu context are passed as parameters +def createPopupMenu( popup, context ): + GuiImpl.createPopupMenu(popup, context ) + +# called when GUI action is activated +# action ID is passed as parameter +def OnGUIEvent(commandID) : + GuiImpl.OnGUIEvent(commandID) + +# called when module's preferences are changed +# preference's resources section and setting name are passed as parameters +def preferenceChanged( section, setting ): + GuiImpl.preferenceChanged( section, setting ) diff --git a/src/daSalome/daGUI/DATASSIMGUI.py b/src/daSalome/daGUI/DATASSIMGUI.py deleted file mode 100644 index 3bc6c12..0000000 --- a/src/daSalome/daGUI/DATASSIMGUI.py +++ /dev/null @@ -1,77 +0,0 @@ -# -*- coding: iso-8859-1 -*- -# Copyright (C) 2010 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 -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# - -""" -This python file provides the implementation of the interface of the GUI part of -this SALOME module. This interface is required by the SALOME GUI framework. -We use here a proxy module named under the alias GuiImpl for at least three -reasons: -1. To Keep the required interface as clear as possible in this file; -2. The concrete implementation can be substituted by an alternative version; -3. We could mix several concrete implementations provided by different proxy - modules, for example for test purposes. -""" - -from daGuiImpl import DATASSIMGUI_impl as GuiImpl - - -# called when module is initialized -# perform initialization actions -def initialize(): - GuiImpl.initialize() - -# called when module is initialized -# return map of popup windows to be used by the module -def windows(): - return GuiImpl.windows() - -# called when module is initialized -# export module's preferences -def createPreferences(): - GuiImpl.createPreferences() - -# called when module is activated -# returns True if activating is successfull and False otherwise -def activate(): - return GuiImpl.activate() - -# called when module is deactivated -def deactivate(): - GuiImpl.deactivate() - -# called when active study is changed -# active study ID is passed as parameter -def activeStudyChanged( studyID ): - GuiImpl.activeStudyChanged( studyID ) - -# called when popup menu is invoked -# popup menu and menu context are passed as parameters -def createPopupMenu( popup, context ): - GuiImpl.createPopupMenu(popup, context ) - -# called when GUI action is activated -# action ID is passed as parameter -def OnGUIEvent(commandID) : - GuiImpl.OnGUIEvent(commandID) - -# called when module's preferences are changed -# preference's resources section and setting name are passed as parameters -def preferenceChanged( section, setting ): - GuiImpl.preferenceChanged( section, setting ) diff --git a/src/daSalome/daGUI/Makefile.am b/src/daSalome/daGUI/Makefile.am index 738c844..1718d77 100644 --- a/src/daSalome/daGUI/Makefile.am +++ b/src/daSalome/daGUI/Makefile.am @@ -21,4 +21,4 @@ SUBDIRS = daGuiImpl daEficasWrapper include $(top_srcdir)/adm_local/make_common_starter.am -salomepython_PYTHON= DATASSIMGUI.py +salomepython_PYTHON= ADAOGUI.py diff --git a/src/daSalome/daGUI/daEficasWrapper/Makefile.am b/src/daSalome/daGUI/daEficasWrapper/Makefile.am index 7b0f6a3..e8ba8b4 100644 --- a/src/daSalome/daGUI/daEficasWrapper/Makefile.am +++ b/src/daSalome/daGUI/daEficasWrapper/Makefile.am @@ -24,7 +24,7 @@ mypkgpythondir =$(salomepythondir)/daEficasWrapper mypkgpython_PYTHON = \ eficasWrapper.py \ __init__.py \ - datassimEficasWrapper.py + adaoEficasWrapper.py EXTRA_DIST = eficasWrapper.py.in diff --git a/src/daSalome/daGUI/daEficasWrapper/adaoEficasWrapper.py b/src/daSalome/daGUI/daEficasWrapper/adaoEficasWrapper.py new file mode 100644 index 0000000..87ca6e9 --- /dev/null +++ b/src/daSalome/daGUI/daEficasWrapper/adaoEficasWrapper.py @@ -0,0 +1,168 @@ +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2010 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 +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +from eficasWrapper import * +from PyQt4 import QtGui,QtCore +import sys + +# Configuration de l'installation +my_path = os.path.dirname(os.path.abspath(__file__)) +ADAO_INSTALL_DIR = my_path + "/../daEficas" +sys.path[:0]=[ADAO_INSTALL_DIR] + +# +# ============================================ +# Specialization of the EficasWrapper for ADAO +# ============================================ +# +class AdaoEficasWrapper(EficasWrapper): + + def __init__(self, parent, code="ADAO"): + EficasWrapper.__init__(self, parent, code) + self.__myCallbackId = {} + self.__close_editor = None + self.__file_open_name = "" + + def init_gui(self): + EficasWrapper.init_gui(self) + print "self.__myCallbackId", self.__myCallbackId + save_CallbackId = self.__myCallbackId.copy() + for editor, myCallbackId in save_CallbackId.iteritems(): + self.notifyObserver(EficasEvent.EVENT_TYPES.REOPEN, callbackId=myCallbackId) + + # Association de l'objet editor avec le callbackId + def setCallbackId(self, callbackId): + index = self.viewmanager.myQtab.currentIndex() + self.__myCallbackId[self.viewmanager.dict_editors[index]] = callbackId + + def getCallbackId(self): + if self.__close_editor is None: + index = self.viewmanager.myQtab.currentIndex() + return self.__myCallbackId[self.viewmanager.dict_editors[index]] + else: + return self.__myCallbackId[self.__close_editor] + + def fileSave(self): + """ + @overload + """ + qtEficas.Appli.fileSave(self) + index = self.viewmanager.myQtab.currentIndex() + if index > -1 : + self.notifyObserver(EficasEvent.EVENT_TYPES.SAVE) + + def fileSaveAs(self): + """ + @overload + """ + qtEficas.Appli.fileSaveAs(self) + self.notifyObserver(EficasEvent.EVENT_TYPES.SAVE) + + def getCaseName(self): + if self.__close_editor is None: + index = self.viewmanager.myQtab.currentIndex() + CaseName = self.viewmanager.myQtab.tabText(index) + return CaseName + else: + CaseName = str(self.__close_editor.fichier.split('/')[-1]) + return CaseName + + def getFileCaseName(self): + if self.__close_editor is None: + index = self.viewmanager.myQtab.currentIndex() + editor = self.viewmanager.dict_editors[index] + return editor.fichier + else: + return self.__close_editor.fichier + + def Openfile(self, filename): + self.viewmanager.handleOpen(fichier=filename) + + def handleOpenRecent(self): + """ + @overload + """ + idx = self.sender() + fichier = self.ficRecents[idx] + self.__file_open_name = fichier + self.notifyObserver(EficasEvent.EVENT_TYPES.OPEN) + self.__file_open_name = "" + + def fileOpen(self): + """ + @overload + """ + fichier = QtGui.QFileDialog.getOpenFileName(self, + self.trUtf8('Ouvrir Fichier'), + self.CONFIGURATION.savedir, + self.trUtf8('JDC Files (*.comm);;''All Files (*)')) + if fichier.isNull(): return + self.__file_open_name = fichier + self.notifyObserver(EficasEvent.EVENT_TYPES.OPEN) + self.__file_open_name = "" + + def getOpenFileName(self): + return str(self.__file_open_name) + + def selectCase(self, callbackId): + 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 + return rtn + + def fileClose(self): + """ + @overload + """ + index = self.viewmanager.myQtab.currentIndex() + self.__close_editor = self.viewmanager.dict_editors[index] + res = self.viewmanager.handleClose(self) + if res != 2: # l utilsateur a annule + if self.__close_editor.fichier is None: + # We have to destroy the case + self.notifyObserver(EficasEvent.EVENT_TYPES.DESTROY) + self.__myCallbackId.pop(self.__close_editor) + else: + # Il faudrait en faire plus -> Voir Edit dans SALOME ! + self.notifyObserver(EficasEvent.EVENT_TYPES.SAVE) + self.__myCallbackId.pop(self.__close_editor) + self.__close_editor = None + return res + + def fileCloseAll(self): + """ + @overload + """ + while len(self.viewmanager.dict_editors) > 0: + self.viewmanager.myQtab.setCurrentIndex(0) + if self.viewmanager.myQtab.currentIndex() == 0: + res = self.fileClose() + if res==2 : return res # l utilsateur a annule + else: + return 0 + diff --git a/src/daSalome/daGUI/daEficasWrapper/datassimEficasWrapper.py b/src/daSalome/daGUI/daEficasWrapper/datassimEficasWrapper.py deleted file mode 100644 index 7a11ae6..0000000 --- a/src/daSalome/daGUI/daEficasWrapper/datassimEficasWrapper.py +++ /dev/null @@ -1,168 +0,0 @@ -# -*- coding: iso-8859-1 -*- -# Copyright (C) 2010 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 -# License as published by the Free Software Foundation; either -# version 2.1 of the License. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# - -from eficasWrapper import * -from PyQt4 import QtGui,QtCore -import sys - -# Configuration de l'installation -my_path = os.path.dirname(os.path.abspath(__file__)) -DATASSIM_INSTALL_DIR = my_path + "/../daEficas" -sys.path[:0]=[DATASSIM_INSTALL_DIR] - -# -# ================================================ -# Specialization of the EficasWrapper for DATASSIM -# ================================================ -# -class DatassimEficasWrapper(EficasWrapper): - - def __init__(self, parent, code="DATASSIM"): - EficasWrapper.__init__(self, parent, code) - self.__myCallbackId = {} - self.__close_editor = None - self.__file_open_name = "" - - def init_gui(self): - EficasWrapper.init_gui(self) - print "self.__myCallbackId", self.__myCallbackId - save_CallbackId = self.__myCallbackId.copy() - for editor, myCallbackId in save_CallbackId.iteritems(): - self.notifyObserver(EficasEvent.EVENT_TYPES.REOPEN, callbackId=myCallbackId) - - # Association de l'objet editor avec le callbackId - def setCallbackId(self, callbackId): - index = self.viewmanager.myQtab.currentIndex() - self.__myCallbackId[self.viewmanager.dict_editors[index]] = callbackId - - def getCallbackId(self): - if self.__close_editor is None: - index = self.viewmanager.myQtab.currentIndex() - return self.__myCallbackId[self.viewmanager.dict_editors[index]] - else: - return self.__myCallbackId[self.__close_editor] - - def fileSave(self): - """ - @overload - """ - qtEficas.Appli.fileSave(self) - index = self.viewmanager.myQtab.currentIndex() - if index > -1 : - self.notifyObserver(EficasEvent.EVENT_TYPES.SAVE) - - def fileSaveAs(self): - """ - @overload - """ - qtEficas.Appli.fileSaveAs(self) - self.notifyObserver(EficasEvent.EVENT_TYPES.SAVE) - - def getCaseName(self): - if self.__close_editor is None: - index = self.viewmanager.myQtab.currentIndex() - CaseName = self.viewmanager.myQtab.tabText(index) - return CaseName - else: - CaseName = str(self.__close_editor.fichier.split('/')[-1]) - return CaseName - - def getFileCaseName(self): - if self.__close_editor is None: - index = self.viewmanager.myQtab.currentIndex() - editor = self.viewmanager.dict_editors[index] - return editor.fichier - else: - return self.__close_editor.fichier - - def Openfile(self, filename): - self.viewmanager.handleOpen(fichier=filename) - - def handleOpenRecent(self): - """ - @overload - """ - idx = self.sender() - fichier = self.ficRecents[idx] - self.__file_open_name = fichier - self.notifyObserver(EficasEvent.EVENT_TYPES.OPEN) - self.__file_open_name = "" - - def fileOpen(self): - """ - @overload - """ - fichier = QtGui.QFileDialog.getOpenFileName(self, - self.trUtf8('Ouvrir Fichier'), - self.CONFIGURATION.savedir, - self.trUtf8('JDC Files (*.comm);;''All Files (*)')) - if fichier.isNull(): return - self.__file_open_name = fichier - self.notifyObserver(EficasEvent.EVENT_TYPES.OPEN) - self.__file_open_name = "" - - def getOpenFileName(self): - return str(self.__file_open_name) - - def selectCase(self, callbackId): - 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 - return rtn - - def fileClose(self): - """ - @overload - """ - index = self.viewmanager.myQtab.currentIndex() - self.__close_editor = self.viewmanager.dict_editors[index] - res = self.viewmanager.handleClose(self) - if res != 2: # l utilsateur a annule - if self.__close_editor.fichier is None: - # We have to destroy the case - self.notifyObserver(EficasEvent.EVENT_TYPES.DESTROY) - self.__myCallbackId.pop(self.__close_editor) - else: - # Il faudrait en faire plus -> Voir Edit dans SALOME ! - self.notifyObserver(EficasEvent.EVENT_TYPES.SAVE) - self.__myCallbackId.pop(self.__close_editor) - self.__close_editor = None - return res - - def fileCloseAll(self): - """ - @overload - """ - while len(self.viewmanager.dict_editors) > 0: - self.viewmanager.myQtab.setCurrentIndex(0) - if self.viewmanager.myQtab.currentIndex() == 0: - res = self.fileClose() - if res==2 : return res # l utilsateur a annule - else: - return 0 -