1 # Copyright (C) 2014-2016 CEA/DEN, EDF R&D, OPEN CASCADE
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.
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.
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
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 from PyQt4.QtCore import *
21 from PyQt4.QtGui import *
26 SalomePyQt.WT_ObjectBrowser : "objectBrowserDock",
27 SalomePyQt.WT_PyConsole : "pythonConsoleDock",
28 SalomePyQt.WT_LogWindow : "logWindowDock",
29 SalomePyQt.WT_NoteBook : "noteBookDock",
32 def findDockWidgetByTitle( title ):
34 Find and return dock widget by its window title.
35 Returns None if dock widget does not exist or is not created yet.
37 WARNING: this function is language-dependant as the title of the
38 dock widget is normally internationalized according to the currently
43 findDockWidgetByTitle( "Object Browser" )
45 sg = SalomePyQt.SalomePyQt()
46 dwl = sg.getDesktop().findChildren( QDockWidget )
47 dw = filter(lambda a: a.windowTitle() == QString( title ), dwl)
51 def findDockWidgetByName( dwName ):
53 Find and return dock widget by its internal name
54 Returns None if dock widget does not exist or is not created yet
56 Note: this function is language-independant: internal name
57 of the dock widget does not depend on the currently used language.
61 findDockWidgetByName( "objectBrowserDock" )
63 sg = SalomePyQt.SalomePyQt()
64 return sg.getDesktop().findChild( QDockWidget, dwName )
66 def findDockWidgetById( dwId ):
68 Find and return dock widget by its id
69 Returns None if dock widget does not exist or is not created yet
71 WARNING: this function works only with dock widget ids
72 specified in SalomePyQt interface.
76 findDockWidgetById( SalomePyQt.WT_ObjectBrowser )
79 return findDockWidgetByName( _dockWidgetNames[ dwId ] )
84 def getAllDockWindows():
88 WARNING: this function searches all dock widgets starting from the
89 top-level main window; thus, resulting list contains also dock windows
90 that belong to the lower-level windows (e.g. view windows).
92 sg = SalomePyQt.SalomePyQt()
93 return sg.getDesktop().findChildren( QDockWidget )
95 def tabifyDockWidgets( dw1, dw2 ):
97 Tabify two dock widgets.
99 sg = SalomePyQt.SalomePyQt()
100 if dw1 and dw2: sg.getDesktop().tabifyDockWidget( dw1, dw2 )