From: André Ribes Date: Tue, 22 Feb 2011 09:37:54 +0000 (+0100) Subject: Ajout de daUtils pour la partie GUI X-Git-Tag: V6_4_0rc3~87 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=faa0242feae3ccb2913cb2dfdc77b8687e634121;p=modules%2Fadao.git Ajout de daUtils pour la partie GUI Nettoyage du code mort en cours et meilleure organisation du code GUI --- diff --git a/configure.ac b/configure.ac index 9c226c8..69e251d 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/src/daSalome/daGUI/Makefile.am b/src/daSalome/daGUI/Makefile.am index cc18e66..748d297 100644 --- a/src/daSalome/daGUI/Makefile.am +++ b/src/daSalome/daGUI/Makefile.am @@ -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 diff --git a/src/daSalome/daGUI/daEficasWrapper/Makefile.am b/src/daSalome/daGUI/daEficasWrapper/Makefile.am index eebc5df..f48271b 100644 --- a/src/daSalome/daGUI/daEficasWrapper/Makefile.am +++ b/src/daSalome/daGUI/daEficasWrapper/Makefile.am @@ -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 diff --git a/src/daSalome/daGUI/daEficasWrapper/adaoEficasWrapper.py b/src/daSalome/daGUI/daEficasWrapper/adaoEficasWrapper.py index 353a78e..c6b468d 100644 --- a/src/daSalome/daGUI/daEficasWrapper/adaoEficasWrapper.py +++ b/src/daSalome/daGUI/daEficasWrapper/adaoEficasWrapper.py @@ -20,14 +20,12 @@ 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 index 921a6d2..0000000 --- a/src/daSalome/daGUI/daEficasWrapper/adaoWrapperUtils.py +++ /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 index c5b792a..0000000 --- a/src/daSalome/daGUI/daEficasWrapper/eficasWrapper.py +++ /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 diff --git a/src/daSalome/daGUI/daGuiImpl/adaoGuiManager.py b/src/daSalome/daGUI/daGuiImpl/adaoGuiManager.py index de020bc..ccb63d4 100644 --- a/src/daSalome/daGUI/daGuiImpl/adaoGuiManager.py +++ b/src/daSalome/daGUI/daGuiImpl/adaoGuiManager.py @@ -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 index 0000000..db22a45 --- /dev/null +++ b/src/daSalome/daGUI/daUtils/Makefile.am @@ -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 index 0000000..e69de29 diff --git a/src/daSalome/daGUI/daUtils/adaoEficasEvent.py b/src/daSalome/daGUI/daUtils/adaoEficasEvent.py new file mode 100644 index 0000000..921a6d2 --- /dev/null +++ b/src/daSalome/daGUI/daUtils/adaoEficasEvent.py @@ -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