diff -r 8e20a87f9809 -r 5a9bdcb8c934 UI/UserInterface.py --- a/UI/UserInterface.py Thu Oct 11 19:09:10 2012 +0200 +++ b/UI/UserInterface.py Sat Oct 13 17:49:13 2012 +0200 @@ -195,6 +195,10 @@ maxSbFilePathLen = 150 maxMenuFilePathLen = 75 + LeftSide = 1 + BottomSide = 2 + RightSide = 3 + def __init__(self, app, locale, splash, plugin, noOpenAtStartup, restartArguments): """ Constructor @@ -867,6 +871,46 @@ else: self.setCorner(Qt.BottomRightCorner, Qt.BottomDockWidgetArea) + def addSideWidget(self, side, widget, icon, label): + """ + Public method to add a widget to the sides. + + @param side side to add the widget to (UserInterface.LeftSide, + UserInterface.BottomSide) + @param widget reference to the widget to add (QWidget) + @param icon icon to be used (QIcon) + @param label label text to be shown (string) + """ + assert side in [UserInterface.LeftSide, UserInterface.BottomSide] + + if self.layout == "Toolboxes": + if side == UserInterface.LeftSide: + self.vToolbox.addItem(widget, icon, label) + elif side == UserInterface.BottomSide: + self.hToolbox.addItem(widget, icon, label) + elif self.layout == "Sidebars": + if side == UserInterface.LeftSide: + self.leftSidebar.addTab(widget, icon, label) + elif side == UserInterface.BottomSide: + self.bottomSidebar.addTab(widget, icon, label) + + def removeSideWidget(self, widget): + """ + Public method to remove a widget added using addSideWidget(). + + @param widget reference to the widget to remove (QWidget) + """ + if self.layout == "Toolboxes": + for container in [self.vToolbox, self.hToolbox]: + index = container.indexOf(widget) + if index != -1: + container.removeItem(index) + elif self.layout == "Sidebars": + for container in [self.leftSidebar, self.bottomSidebar]: + index = container.indexOf(widget) + if index != -1: + container.removeTab(index) + def showLogTab(self, tabname): """ Public method to show a particular Log-Viewer tab.