Salome HOME
Minor source update for OM compatibility
[modules/adao.git] / src / daSalome / daGUI / ADAOGUI.py
1 # -*- coding: utf-8 -*-
2 #
3 # Copyright (C) 2008-2024 EDF R&D
4 #
5 # This file is part of SALOME ADAO module
6 #
7 # This library is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU Lesser General Public
9 # License as published by the Free Software Foundation; either
10 # version 2.1 of the License.
11 #
12 # This library is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 # Lesser General Public License for more details.
16 #
17 # You should have received a copy of the GNU Lesser General Public
18 # License along with this library; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
20 #
21 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 #
23 # Author: AndrĂ© Ribes, andre.ribes@edf.fr, EDF R&D
24
25 """
26 This python file provides the implementation of the interface of the GUI part of
27 this SALOME module. This interface is required by the SALOME GUI framework.
28 We use here a proxy module named under the alias GuiImpl for at least three
29 reasons:
30 1. To Keep the required interface as clear as possible in this file;
31 2. The concrete implementation can be substituted by an alternative version;
32 3. We could mix several concrete implementations provided by different proxy
33    modules, for example for test purposes.
34 """
35
36 import adao
37 if not hasattr(adao, "adao_py_dir"):
38     if hasattr(adao, "__file__"):
39         lieu = " A potential candidate file is %s."%repr(adao.__file__)
40     else:
41         lieu = ""
42     raise ImportError("\n\nFailed to activate module ADAO. Is it perhaps because you own a personnal perturbating file \'adao.py\' somewhere in your PATH?%s Rename, remove or move it before retrying to launch SALOME/ADAO.\n"%lieu)
43 from daGuiImpl import ADAOGUI_impl as GuiImpl
44 from daUtils import adaoLogger
45
46 adaoLogger.debug("Import ADAOGUI")
47
48 # called when module is initialized
49 # perform initialization actions
50 def initialize():
51   adaoLogger.debug("initialize")
52   GuiImpl.initialize()
53
54 # called when module is initialized
55 # return map of popup windows to be used by the module
56 def windows():
57   adaoLogger.debug("windows")
58   return GuiImpl.windows()
59
60 def views():
61   adaoLogger.debug("views")
62   return GuiImpl.views()
63
64 # called when module is initialized
65 # export module's preferences
66 def createPreferences():
67   adaoLogger.debug("createPreferences")
68   GuiImpl.createPreferences()
69
70 # called when module is activated
71 # returns True if activating is successfull and False otherwise
72 def activate():
73   adaoLogger.debug("activate")
74   return GuiImpl.activate()
75
76 # called when module is deactivated
77 def deactivate():
78   adaoLogger.debug("deactivate")
79   GuiImpl.deactivate()
80
81 # called when active study is changed
82 # active study ID is passed as parameter
83 #~ def activeStudyChanged( studyID ):
84   #~ adaoLogger.debug("activeStudyChanged")
85   #~ GuiImpl.activeStudyChanged( studyID )
86
87 # called when popup menu is invoked
88 # popup menu and menu context are passed as parameters
89 def createPopupMenu( popup, context ):
90   adaoLogger.debug("createPopupMenu")
91   GuiImpl.createPopupMenu(popup, context )
92
93 # called when GUI action is activated
94 # action ID is passed as parameter
95 def OnGUIEvent(commandID) :
96   adaoLogger.debug("OnGUIEvent")
97   GuiImpl.OnGUIEvent(commandID)
98
99 # called when module's preferences are changed
100 # preference's resources section and setting name are passed as parameters
101 def preferenceChanged( section, setting ):
102   adaoLogger.debug("preferenceChanged")
103   GuiImpl.preferenceChanged( section, setting )
104
105 def activeViewChanged(myView):
106   adaoLogger.debug("activeViewChanged")
107   GuiImpl.activeViewChanged(myView)