src/Makefile
src/daComposant/Makefile
src/daSalome/Makefile
+ src/daSalome/daGUI/Makefile
+ src/daSalome/daGUI/daGuiImpl/Makefile
bin/Makefile
])
AC_OUTPUT
include $(top_srcdir)/adm_local/make_common_starter.am
-DATA_INST = DATASSIMCatalog.xml DATASSIMSchemaCatalog.xml
+DATA_INST = DATASSIMCatalog.xml DATASSIMSchemaCatalog.xml SalomeApp.xml
salomeres_DATA = ${DATA_INST}
EXTRA_DIST = ${DATA_INST}
--- /dev/null
+<document>
+ <section name="DATASSIM">
+ <!-- Major module parameters -->
+ <parameter name="name" value="DATASSIM"/>
+ <parameter name="library" value="SalomePyQtGUI"/>
+ </section>
+ <section name="resources">
+ <!-- Module resources -->
+ <parameter name="DATASSIM" value="${DATASSIM_ROOT_DIR}/share/salome/resources/datassim"/>
+ </section>
+</document>
include $(top_srcdir)/adm_local/make_common_starter.am
+SUBDIRS= daGUI
+
EXTRA_DIST = daYacsSchemaCreator daYacsIntegration
DIR = $(top_srcdir)/src/daSalome/
--- /dev/null
+# -*- 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 )
--- /dev/null
+# 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
+#
+
+SUBDIRS = daGuiImpl
+
+include $(top_srcdir)/adm_local/make_common_starter.am
+
+salomepython_PYTHON= DATASSIMGUI.py
--- /dev/null
+# -*- 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 PyQt4.QtGui import *
+from PyQt4.QtCore import *
+
+import SalomePyQt
+sgPyQt = SalomePyQt.SalomePyQt()
+
+################################################
+# GUI context class
+# Used to store actions, menus, toolbars, etc...
+################################################
+# A gui context instance is created for each study. The dictionnary __study2context__
+# keeps the mapping in memory. This context contains graphical objects that have
+# to be created for each study. It contains at least the ui component builder that
+# creates the menu and toolbar items (must be created for every study)
+
+from daGuiImpl.datassimGuiManager import DatassimGuiUiComponentBuilder
+class GUIcontext:
+ uiComponentBuilder = None
+ def __init__(self):
+ self.uiComponentBuilder = DatassimGuiUiComponentBuilder()
+
+
+__study2context__ = {}
+__current_context__ = None
+def _setContext( studyID ):
+ global __study2context__, __current_context__
+ if not __study2context__.has_key(studyID):
+ __study2context__[studyID] = GUIcontext()
+ pass
+ __current_context__ = __study2context__[studyID]
+ return __current_context__
+
+#from oma.salome.omaGuiManager import OmaGuiActionImpl
+#actionImpl = OmaGuiActionImpl()
+# This object does not need to be embedded in a GUI context object. A single
+# instance for all studies is a priori sufficient.
+
+################################################
+# Implementation of SALOME GUI interface
+################################################
+
+# called when module is initialized
+# perform initialization actions
+def initialize():
+ pass
+
+# called when module is initialized
+# return map of popup windows to be used by the module
+def windows():
+ wm = {}
+ wm[SalomePyQt.WT_ObjectBrowser] = Qt.LeftDockWidgetArea
+ wm[SalomePyQt.WT_PyConsole] = Qt.BottomDockWidgetArea
+ return wm
+
+# called when module is initialized
+# return list of 2d/3d views to be used ny the module
+def views():
+ return []
+
+def createPreferences():
+ """
+ Called when module is initialized. Export module's preferences.
+ """
+ pass
+
+# called when module is activated
+# returns True if activating is successfull and False otherwise
+def activate():
+ ctx = _setContext( sgPyQt.getStudyId() )
+ return True
+
+# called when module is deactivated
+def deactivate():
+ pass
+
+# called when active study is changed
+# active study ID is passed as parameter
+def activeStudyChanged( studyID ):
+ ctx = _setContext( sgPyQt.getStudyId() )
+ pass
+
+
+# called when popup menu is invoked
+# popup menu and menu context are passed as parameters
+def createPopupMenu( popup, context ):
+ pass
+# activeStudyId = sgPyQt.getStudyId()
+# if omaModuleHelper.verbose() : print "OMAGUI.createPopupMenu(): context = %s" % context
+# ctx = _setContext( sgPyQt.getStudyId() )
+# selcount, selected = omaGuiHelper.getAllSelected(activeStudyId)
+# if selcount == 1:
+# selectedItem = omaGuiHelper.getSelectedItem(activeStudyId)
+# popup = ctx.uiComponentBuilder.createPopupMenuOnItem(popup, activeStudyId, selectedItem)
+
+def OnGUIEvent(actionId) :
+ """
+ Called when an event is raised from a graphic item (click on menu item or
+ toolbar button). The actionId value is the ID associated to the item.
+ """
+ pass
+# actionImpl.processAction(actionId)
+
+
+# called when module's preferences are changed
+# preference's resources section and setting name are passed as parameters
+def preferenceChanged( section, setting ):
+ pass
+
+# called when active view is changed
+# view ID is passed as parameter
+def activeViewChanged( viewID ):
+ pass
+
+# called when active view is cloned
+# cloned view ID is passed as parameter
+def viewCloned( viewID ):
+ pass
+
+# called when active view is viewClosed
+# view ID is passed as parameter
+def viewClosed( viewID ):
+ pass
+
--- /dev/null
+# 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)/daGuiImpl
+
+mypkgpython_PYTHON = \
+ __init__.py \
+ DATASSIMGUI_impl.py \
+ datassimGuiManager.py \
+ enumerate.py
+
+
--- /dev/null
+# -*- 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 file centralizes the definitions and implementations of ui components used
+in the GUI part of the module.
+"""
+
+__author__ = "aribes/gboulant"
+
+import traceback
+from PyQt4.QtCore import QObject
+import SalomePyQt
+sgPyQt = SalomePyQt.SalomePyQt()
+
+from daGuiImpl.enumerate import Enumerate
+#
+# ==============================================================================
+# Classes to manage the building of UI components
+# ==============================================================================
+#
+UI_ELT_IDS = Enumerate([
+ 'DATASSIM_MENU_ID',
+ ],offset=950)
+
+ACTIONS_MAP={
+}
+
+class DatassimGuiUiComponentBuilder:
+ """
+ The initialisation of this class creates the graphic components involved
+ in the GUI (menu, menu item, toolbar). A ui component builder should be
+ created for each opened study and associated to its context (see usage in OMAGUI.py).
+ """
+ def __init__(self):
+ self.initUiComponents()
+
+ def initUiComponents(self):
+
+ objectTR = QObject()
+
+ # create top-level menu
+ mid = sgPyQt.createMenu( "DATASSIM", -1, UI_ELT_IDS.DATASSIM_MENU_ID, sgPyQt.defaultMenuGroup() )
+ # create toolbar
+ tid = sgPyQt.createTool( "DATASSIM" )
+
--- /dev/null
+# -*- coding: iso-8859-1 -*-
+# Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+#
+# Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+#
+# 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__ = "gboulant"
+__date__ = "$1 avr. 2010 09:08:02$"
+
+class Enumerate(object):
+ """
+ This class emulates a C-like enum for python.
+ """
+ def __init__(self, keys, offset=0):
+ """
+ Canonical constructor
+ @keys a list of keys string to be used as the enum symbols
+ """
+ self._dict_keynumbers = {}
+ for number, key in enumerate(keys):
+ value = offset+number
+ setattr(self, key, value)
+ self._dict_keynumbers[key] = value
+
+
+ def contains(self, key):
+ """
+ Return true if this enumerate contains the specified key
+ @key a key to test
+ """
+ return (key in self._dict_keynumbers.keys())
+
+ def isValid(self, value):
+ return (value in self._dict_keynumbers.values())
+
+ def listkeys(self):
+ list = self._dict_keynumbers.keys()
+ list.sort()
+ return list
+
+ def listvalues(self):
+ list = self._dict_keynumbers.values()
+ list.sort()
+ return list
+
+#
+# ==============================================================================
+# Basic use cases and unit test functions
+# ==============================================================================
+#
+
+def TEST_simple():
+ TYPES_LIST=Enumerate([
+ 'SEP',
+ 'OTHER'
+ ])
+ print TYPES_LIST.listvalues()
+ return True
+
+def TEST_createFromList():
+ codes = Enumerate([
+ 'KERNEL', # This should take the value 0
+ 'GUI', # This should take the value 1
+ 'GEOM', # ...
+ 'MED',
+ 'SMESH'])
+
+ print codes.KERNEL
+ print codes.GEOM
+ if (codes.KERNEL == 0 and codes.GEOM == 2):
+ return True
+ else:
+ return False
+
+def TEST_createFromString():
+ aList = "KERNEL GUI GEOM MED"
+
+ codes = Enumerate(aList.split())
+
+ print codes.KERNEL
+ print codes.GEOM
+ if (codes.KERNEL == 0 and codes.GEOM == 2):
+ return True
+ else:
+ return False
+
+def TEST_contains():
+ codes = Enumerate([
+ 'KERNEL', # This should take the value 0
+ 'GUI', # This should take the value 1
+ 'GEOM', # ...
+ 'MED',
+ 'SMESH'])
+
+ print "VISU in enumerate?", codes.contains("VISU")
+ if ( not codes.contains("VISU") ):
+ return True
+ else:
+ return False
+
+def TEST_isValid():
+ codes = Enumerate([
+ 'KERNEL', # This should take the value 0
+ 'GUI', # This should take the value 1
+ 'GEOM', # ...
+ 'MED',
+ 'SMESH'])
+
+ if ( not codes.isValid(23) ):
+ return True
+ else:
+ return False
+
+def TEST_offset():
+ codes = Enumerate([
+ 'KERNEL', # This should take the value 0
+ 'GUI', # This should take the value 1
+ 'GEOM', # ...
+ 'MED',
+ 'SMESH'], offset=20)
+
+ print codes.KERNEL
+ print codes.GEOM
+ if (codes.KERNEL == 20 and codes.GEOM == 22):
+ return True
+ else:
+ return False
+
+def TEST_listvalues():
+ codes = Enumerate([
+ 'KERNEL', # This should take the value 0
+ 'GUI', # This should take the value 1
+ 'GEOM', # ...
+ 'MED',
+ 'SMESH'], offset=20)
+
+ print codes.listvalues()
+ if codes.listvalues() != [20,21,22,23,24]:
+ return False
+ return True
+
+
+if __name__ == "__main__":
+ import unittester
+ unittester.run("enumerate","TEST_simple")
+ unittester.run("enumerate","TEST_createFromList")
+ unittester.run("enumerate","TEST_createFromString")
+ unittester.run("enumerate","TEST_contains")
+ unittester.run("enumerate","TEST_isValid")
+ unittester.run("enumerate","TEST_offset")
+ unittester.run("enumerate","TEST_listvalues")