1 # Copyright (C) 2014-2023 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 qtsalome import *
25 SalomePyQt.WT_ObjectBrowser : "objectBrowserDock",
26 SalomePyQt.WT_PyConsole : "pythonConsoleDock",
27 SalomePyQt.WT_LogWindow : "logWindowDock",
28 SalomePyQt.WT_NoteBook : "noteBookDock",
31 def findDockWidgetByTitle( title ):
33 Find and return dock widget by its window title.
34 Returns None if dock widget does not exist or is not created yet.
36 WARNING: this function is language-dependant as the title of the
37 dock widget is normally internationalized according to the currently
42 findDockWidgetByTitle( "Object Browser" )
44 sg = SalomePyQt.SalomePyQt()
45 dwl = sg.getDesktop().findChildren( QDockWidget )
46 dw = [a for a in dwl if a.windowTitle() == str( title )]
50 def findDockWidgetByName( dwName ):
52 Find and return dock widget by its internal name
53 Returns None if dock widget does not exist or is not created yet
55 Note: this function is language-independant: internal name
56 of the dock widget does not depend on the currently used language.
60 findDockWidgetByName( "objectBrowserDock" )
62 sg = SalomePyQt.SalomePyQt()
63 return sg.getDesktop().findChild( QDockWidget, dwName )
65 def findDockWidgetById( dwId ):
67 Find and return dock widget by its id
68 Returns None if dock widget does not exist or is not created yet
70 WARNING: this function works only with dock widget ids
71 specified in SalomePyQt interface.
75 findDockWidgetById( SalomePyQt.WT_ObjectBrowser )
78 return findDockWidgetByName( _dockWidgetNames[ dwId ] )
83 def getAllDockWindows():
87 WARNING: this function searches all dock widgets starting from the
88 top-level main window; thus, resulting list contains also dock windows
89 that belong to the lower-level windows (e.g. view windows).
91 sg = SalomePyQt.SalomePyQt()
92 return sg.getDesktop().findChildren( QDockWidget )
94 def tabifyDockWidgets( dw1, dw2 ):
96 Tabify two dock widgets.
98 sg = SalomePyQt.SalomePyQt()
99 if dw1 and dw2: sg.getDesktop().tabifyDockWidget( dw1, dw2 )