'Setting Tabs close function
None -> tabs are not closable'

def set_close_function(self, func):

    state = (func is not None)
    if state:
        self.sig_close_tab.connect(func)
    try:
        QTabWidget.setTabsClosable(self, state)
        self.tabCloseRequested.connect(func)
    except AttributeError:
        close_button = create_toolbutton(self, triggered=func, icon=ima.icon('fileclose'), tip=_('Close    current    tab'))
        self.setCornerWidget((close_button if state else None))
