Salome HOME
Ajout de daUtils pour la partie GUI
authorAndré Ribes <andre.ribes@edf.fr>
Tue, 22 Feb 2011 09:37:54 +0000 (10:37 +0100)
committerAndré Ribes <andre.ribes@edf.fr>
Tue, 22 Feb 2011 09:37:54 +0000 (10:37 +0100)
Nettoyage du code mort en cours et meilleure
organisation du code GUI

configure.ac
src/daSalome/daGUI/Makefile.am
src/daSalome/daGUI/daEficasWrapper/Makefile.am
src/daSalome/daGUI/daEficasWrapper/adaoEficasWrapper.py
src/daSalome/daGUI/daEficasWrapper/adaoWrapperUtils.py [deleted file]
src/daSalome/daGUI/daEficasWrapper/eficasWrapper.py [deleted file]
src/daSalome/daGUI/daGuiImpl/adaoGuiManager.py
src/daSalome/daGUI/daUtils/Makefile.am [new file with mode: 0644]
src/daSalome/daGUI/daUtils/__init__.py [new file with mode: 0644]
src/daSalome/daGUI/daUtils/adaoEficasEvent.py [new file with mode: 0644]

index 9c226c8ed26ecbe4bfce09e0980ac02fdb7e3b98..69e251d68be823e22cfb22b4011675602841b45e 100644 (file)
@@ -115,6 +115,7 @@ AC_CONFIG_FILES([
         src/daEficas/prefs_ADAO.py
         src/daSalome/Makefile
         src/daSalome/daGUI/Makefile
+        src/daSalome/daGUI/daUtils/Makefile
         src/daSalome/daGUI/daGuiImpl/Makefile
         src/daSalome/daGUI/daEficasWrapper/Makefile
         src/daSalome/daGUI/daGuiComponent/Makefile
index cc18e66b0ee7c11eba5b290bf958bab478163f58..748d2970a86796cbde3c10a38768d12914c02ecc 100644 (file)
@@ -17,7 +17,7 @@
 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 
-SUBDIRS = daGuiImpl daEficasWrapper daGuiComponent
+SUBDIRS = daUtils daGuiImpl daEficasWrapper daGuiComponent
 
 include $(top_srcdir)/adm_local/make_common_starter.am
 
index eebc5df2aefffc101def91f1bcf988a7ad0249bb..f48271b1624313a5a575900f8a882d3ab0fa5c8c 100644 (file)
@@ -22,8 +22,5 @@ include $(top_srcdir)/adm_local/make_common_starter.am
 mypkgpythondir =$(salomepythondir)/daEficasWrapper
 
 mypkgpython_PYTHON = \
-                    eficasWrapper.py \
                     __init__.py \
-                    adaoEficasWrapper.py \
-                    adaoWrapperUtils.py
-
+                    adaoEficasWrapper.py
index 353a78e1b56edd7e4e66315da8bbfae27526ad6e..c6b468d9a16d9d75cea2becc9341c92c554b03e7 100644 (file)
 
 import sys
 import os
-from PyQt4 import QtGui,QtCore
 
-# Import from EFICAS_SRC
-import eficasSalome
-# Import from Eficas
-from InterfaceQT4 import qtEficas
+import eficasSalome               # Import from EFICAS_SRC
+from InterfaceQT4 import qtEficas # Import from Eficas
+from PyQt4 import QtGui,QtCore    # Import from PyQT
 
-from adaoWrapperUtils import *
+from daUtils.adaoEficasEvent import *
 
 #
 # ============================================
diff --git a/src/daSalome/daGUI/daEficasWrapper/adaoWrapperUtils.py b/src/daSalome/daGUI/daEficasWrapper/adaoWrapperUtils.py
deleted file mode 100644 (file)
index 921a6d2..0000000
+++ /dev/null
@@ -1,82 +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
-#
-
-__author__="André Ribes - EDF R&D"
-
-class DevelException(Exception):
-    def __init__(self, message):
-        """Canonical constructor"""
-        Exception.__init__(self,message)
-
-#
-# ==============================================================================
-# Interface of an eficas observer (for implementing the subject/observer pattern)
-# ==============================================================================
-#
-from daGuiImpl.enumerate import Enumerate
-
-class EficasObserver:
-    """
-    This class specifies the interface of an eficas observer. See example at the
-    bottom of this file.
-    """
-    def processEficasEvent(self, eficasWrapper, eficasEvent):
-        """
-        This function should be implemented in the concrete Observer.
-        @param eficasWrapper the instance of the source EficasWrapper
-        @param eficasEvent the emitted event (instance of EficasEvent)
-        """
-        raise DevelException("processEficasEvent not implemented yet")
-
-class EficasEvent:
-    EVENT_TYPES=Enumerate([
-        'CLOSE',
-        'SAVE',
-        'DESTROY',
-        'OPEN',
-        'REOPEN',
-        'NEW'
-    ])
-
-    def __init__(self,eventType,callbackId=None):
-        """
-        Creates an eficas event to be used by an EficasWrapper to notify an
-        EficasObserver.
-
-        The eventType depends of the context of creation. It specify the nature
-        of the event inside EficasWrapper that triggers the creation of this instance.
-
-        The callbackId is an object used by the EficasObserver to map the
-        notification (this received event) with the initial event (callback)
-        This object can be anything and has to be defined through a convention
-        that both the EficasWrapper and the EficasObserver can understand.
-        Typically, the eficas observer set the callback id to the eficas wrapper
-        before running the asynchronous show. Then, when an event is raised by
-        the eficas wrapper toward its observer, it embeds the callback id so that
-        the observer can match the received event to the initial trigger context.
-
-        @param the eventType to be choosen in the EVENT_TYPES
-        @param callbackId an arbitrary data object
-        """
-        if not self.EVENT_TYPES.isValid(eventType):
-            raise DevelException("The event type "+str(eventType)+" is not defined")
-
-        self.eventType = eventType
-        self.callbackId = callbackId
diff --git a/src/daSalome/daGUI/daEficasWrapper/eficasWrapper.py b/src/daSalome/daGUI/daEficasWrapper/eficasWrapper.py
deleted file mode 100644 (file)
index c5b792a..0000000
+++ /dev/null
@@ -1,83 +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
-#
-
-__author__="aribes/gboulant"
-
-from daGuiImpl import adaoLogger
-
-class DevelException(Exception):
-    def __init__(self, message):
-        """Canonical constructor"""
-        Exception.__init__(self,message)
-
-#
-# ==============================================================================
-# Interface of an eficas observer (for implementing the subject/observer pattern)
-# ==============================================================================
-#
-from daGuiImpl.enumerate import Enumerate
-class EficasObserver:
-    """
-    This class specifies the interface of an eficas observer. See example at the
-    bottom of this file.
-    """
-    def processEficasEvent(self, eficasWrapper, eficasEvent):
-        """
-        This function should be implemented in the concrete Observer.
-        @param eficasWrapper the instance of the source EficasWrapper
-        @param eficasEvent the emitted event (instance of EficasEvent)
-        """
-        raise DevelException("processEficasEvent not implemented yet")
-
-class EficasEvent:
-    EVENT_TYPES=Enumerate([
-        'CLOSE',
-        'SAVE',
-        'DESTROY',
-        'OPEN',
-        'REOPEN',
-        'NEW'
-    ])
-
-    def __init__(self,eventType,callbackId=None):
-        """
-        Creates an eficas event to be used by an EficasWrapper to notify an
-        EficasObserver.
-
-        The eventType depends of the context of creation. It specify the nature
-        of the event inside EficasWrapper that triggers the creation of this instance.
-
-        The callbackId is an object used by the EficasObserver to map the
-        notification (this received event) with the initial event (callback)
-        This object can be anything and has to be defined through a convention
-        that both the EficasWrapper and the EficasObserver can understand.
-        Typically, the eficas observer set the callback id to the eficas wrapper
-        before running the asynchronous show. Then, when an event is raised by
-        the eficas wrapper toward its observer, it embeds the callback id so that
-        the observer can match the received event to the initial trigger context.
-
-        @param the eventType to be choosen in the EVENT_TYPES
-        @param callbackId an arbitrary data object
-        """
-        if not self.EVENT_TYPES.isValid(eventType):
-            raise DevelException("The event type "+str(eventType)+" is not defined")
-
-        self.eventType = eventType
-        self.callbackId = callbackId
index de020bc0922ed9412ab147a8ef375f832ab7ebb9..ccb63d4af3cbb7de831c2e4f1a5dd90946eb3cbd 100644 (file)
@@ -34,8 +34,8 @@ sgPyQt = SalomePyQt.SalomePyQt()
 from daGuiImpl.enumerate import Enumerate
 from daGuiImpl.adaoCase import AdaoCase
 from daEficasWrapper.adaoEficasWrapper import AdaoEficasWrapper
-from daEficasWrapper.eficasWrapper import EficasObserver
-from daEficasWrapper.eficasWrapper import EficasEvent
+
+from daUtils.adaoEficasEvent import *
 import adaoGuiHelper
 import adaoStudyEditor
 import adaoLogger
diff --git a/src/daSalome/daGUI/daUtils/Makefile.am b/src/daSalome/daGUI/daUtils/Makefile.am
new file mode 100644 (file)
index 0000000..db22a45
--- /dev/null
@@ -0,0 +1,27 @@
+#  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
+#
+
+include $(top_srcdir)/adm_local/make_common_starter.am
+
+mypkgpythondir =$(salomepythondir)/daUtils
+
+mypkgpython_PYTHON = \
+                    __init__.py \
+                    adaoEficasEvent.py
+
diff --git a/src/daSalome/daGUI/daUtils/__init__.py b/src/daSalome/daGUI/daUtils/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/src/daSalome/daGUI/daUtils/adaoEficasEvent.py b/src/daSalome/daGUI/daUtils/adaoEficasEvent.py
new file mode 100644 (file)
index 0000000..921a6d2
--- /dev/null
@@ -0,0 +1,82 @@
+# -*- 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
+#
+
+__author__="André Ribes - EDF R&D"
+
+class DevelException(Exception):
+    def __init__(self, message):
+        """Canonical constructor"""
+        Exception.__init__(self,message)
+
+#
+# ==============================================================================
+# Interface of an eficas observer (for implementing the subject/observer pattern)
+# ==============================================================================
+#
+from daGuiImpl.enumerate import Enumerate
+
+class EficasObserver:
+    """
+    This class specifies the interface of an eficas observer. See example at the
+    bottom of this file.
+    """
+    def processEficasEvent(self, eficasWrapper, eficasEvent):
+        """
+        This function should be implemented in the concrete Observer.
+        @param eficasWrapper the instance of the source EficasWrapper
+        @param eficasEvent the emitted event (instance of EficasEvent)
+        """
+        raise DevelException("processEficasEvent not implemented yet")
+
+class EficasEvent:
+    EVENT_TYPES=Enumerate([
+        'CLOSE',
+        'SAVE',
+        'DESTROY',
+        'OPEN',
+        'REOPEN',
+        'NEW'
+    ])
+
+    def __init__(self,eventType,callbackId=None):
+        """
+        Creates an eficas event to be used by an EficasWrapper to notify an
+        EficasObserver.
+
+        The eventType depends of the context of creation. It specify the nature
+        of the event inside EficasWrapper that triggers the creation of this instance.
+
+        The callbackId is an object used by the EficasObserver to map the
+        notification (this received event) with the initial event (callback)
+        This object can be anything and has to be defined through a convention
+        that both the EficasWrapper and the EficasObserver can understand.
+        Typically, the eficas observer set the callback id to the eficas wrapper
+        before running the asynchronous show. Then, when an event is raised by
+        the eficas wrapper toward its observer, it embeds the callback id so that
+        the observer can match the received event to the initial trigger context.
+
+        @param the eventType to be choosen in the EVENT_TYPES
+        @param callbackId an arbitrary data object
+        """
+        if not self.EVENT_TYPES.isValid(eventType):
+            raise DevelException("The event type "+str(eventType)+" is not defined")
+
+        self.eventType = eventType
+        self.callbackId = callbackId