Version: 8.3.0
browser_session.py
Go to the documentation of this file.
1 # Copyright (C) 2006-2016 CEA/DEN, EDF R&D
2 #
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
7 #
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # Lesser General Public License for more details.
12 #
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 #
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 #
19 
20 import sys
21 from qt import *
22 import browser
23 import sessions
24 import pilot
25 
27  def init(self):
28  self.rootItem=sessions.Sessions(port=2809)
29  self.objectBrowser.additem(self.rootItem)
30  self.boxManager.setRootItem(self.rootItem)
31  self.setStretchFactor(self.hSplitter,10)
32 
34  def __init__(self,parent,appli):
35  QMainWindow.__init__(self,parent)
36  self.appli=appli
37  self.catalogTool=parent
38  self.createWidgets()
39 
40  def createWidgets(self):
41  box=QVBox(self)
42 
43  hb=QHBox(box)
44  self.browser=Browser(hb,self.appli)
45 
46  row2=QHBox(box)
47  but1=QPushButton( "Import catalog", row2 )
48  but1.setFixedSize( but1.sizeHint())
49  #but2=QPushButton( "Cancel", row2 )
50  self.connect( but1, SIGNAL("clicked()"), self.handleBut1 )
51  #box.connect( but2, SIGNAL("clicked()"), self.handleCancel )
52  self.setCentralWidget(box)
53  #self.resize(800,600)
54 
55  def handleBut1(self):
56  addr=self.browser.selected.addr+"#Kernel.dir/ModulCatalog.object"
57  cata=pilot.getRuntime().loadCatalog("session",addr)
58  self.catalogTool.register(cata,self.browser.selected.addr)
59 
60 if __name__ == "__main__":
61  app = QApplication(sys.argv)
62  t=MainBrowser(None,None)
63  app.setMainWidget(t)
64  t.show()
65  app.exec_loop()
66