def tabChanged(self,  index):
        self.ribbon.widget(self.ribbon.currentTabNumber).on_deActivation()
        self.ribbon.currentTabNumber = index
        #change current module name, so that overlays are stored at the right place
        if self.project is not None:
            moduleName = self.project.dataMgr._currentModuleName = self.ribbon.widget(index).__class__.moduleName

            ribbonWidget = self.ribbon.widget(index)
    
            #for convenience of the module
            ribbonWidget.dataMgr = self.project.dataMgr
            ribbonWidget.activeImage = self.project.dataMgr[self.project.dataMgr._activeImageNumber]
            ribbonWidget.localMgr =  ribbonWidget.activeImage.module[moduleName]
            ribbonWidget.globalMgr = ribbonWidget.dataMgr.module[moduleName]
    
            ribbonWidget.on_activation()

        if self.labelWidget is not None:
            self.labelWidget.repaint()
update the overlayWidget of the volumeEditor and switch the _history
dataset/ETHPy150Open ilastik/ilastik-0.5/ilastik/ilastikMain.py/MainWindow.tabChanged