]> SALOME platform Git repositories - tools/solverlab.git/blob - CoreFlows/gui/src/CFDesktop.py
Salome HOME
initial project version
[tools/solverlab.git] / CoreFlows / gui / src / CFDesktop.py
1 # -*- coding: utf-8 -*-
2 #  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
3 #
4 #  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
5 #  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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 : A. Bruneton
24 #
25
26 from PyQt4.QtCore import Qt 
27 from PyQt4.QtGui import QMainWindow,QMenu, QDockWidget
28 from MainCFWidget import MainCFWidget
29
30 class CFDesktop(QMainWindow):
31     """ 
32     """
33     VIEW_TYPE = "COREFLOWS"
34         
35     def __init__(self, sgPyQt):
36         QMainWindow.__init__(self)
37         self._sgPyQt = sgPyQt
38         self._mainView = None
39         self._viewID = -1
40         
41     def initialize(self):
42         """ Initialize is called later than __init__() so that the Desktop and the SgPyQt
43         objects can be properly initialized.
44         """
45         self._currID = 1235
46         
47         self._sgDesktop = self._sgPyQt.getDesktop()
48         self.createIDs()
49         self.createActions()
50         
51         self.createToolbars()
52         self.createMenus()
53
54     def generateID(self):
55         self._currID += 1
56         return self._currID
57     
58     def createIDs(self):
59         pass
60         # Actions
61 #        self.itemDelActionID = self.generateID()
62 #        self.cpsActionID = self.generateID()
63 #        self.addPSActionID = self.generateID()
64 #        
65 #        # Menus
66 #        self.etudeMenuID = self.generateID()
67
68     def createActions(self):
69       pass
70 #        ca = self._sgPyQt.createAction
71 #        self.itemDelAction = ca(self.itemDelActionID, "Delete selected", "Delete selected", "", "")
72 #        self.cpsAction = ca(self.cpsActionID, "Clear plot set", "Clear plot set", "", "")
73 #        self.addPSAction = ca(self.addPSActionID, "Add plot set", "Add plot set", "", "")
74
75     def createToolbars(self):
76         pass
77 #         self.Toolbar = self._sgPyQt.createTool(self.tr("Toolbar"))
78 #         self._sgPyQt.createTool(self.fileNewAction, self.Toolbar)
79 #         self._sgPyQt.createTool(self.filePrintAction, self.Toolbar)
80 #         sep = self._sgPyQt.createSeparator()
81 #         self._sgPyQt.createTool(sep, self.Toolbar)
82 #         self._sgPyQt.createTool(self.editUndoAction, self.Toolbar)
83 #         self._sgPyQt.createTool(self.editRedoAction, self.Toolbar)
84
85     def createMenus(self):
86       pass
87 #      curveMenu = self._sgPyQt.createMenu( "Plot management", -1, self.etudeMenuID, self._sgPyQt.defaultMenuGroup() )
88 #      self._sgPyQt.createMenu(self.itemDelAction, curveMenu)
89
90     def createView(self):
91       if self._mainView is None:
92         self._mainView = MainCFWidget()
93       vid = self._sgPyQt.createView(self.VIEW_TYPE, self._mainView)
94       return vid
95           
96     def showCentralWidget(self):
97       if self._viewID == -1:
98         self._viewID = self.createView()
99       else:
100         self._sgPyQt.activateView(self._viewID)
101         
102     def hideCentralWidget(self):
103       if self._viewID != -1:
104         self._sgPyQt.setViewVisible(self._viewID, False)