Adds a new tab to the **Script_Editor_tabWidget** Widget and sets the given editor as child widget.

        :param editor: Editor.
        :type editor: Editor
        :return: New tab index.
        :rtype: int
514693
def add_editor_tab(self, editor):
        

        index = self.Script_Editor_tabWidget.addTab(editor, editor.get_file_short_name())
        LOGGER.debug("> Assigning '{0}' editor to '{1}' tab index.".format(editor, index))
        self.Script_Editor_tabWidget.setCurrentIndex(index)
        self.__set_tab_title(index)

        # Signals / Slots.
        editor.patterns_replaced.connect(self.__editor__patterns_replaced)
        editor.title_changed.connect(self.__editor__title_changed)
        editor.file_loaded.connect(self.__editor__file_loaded)
        editor.file_saved.connect(self.__editor__file_saved)
        editor.language_changed.connect(self.__editor__language_changed)
        editor.modification_changed.connect(self.__editor__modification_changed)
        editor.cursorPositionChanged.connect(
            self.Editor_Status_editorStatus._EditorStatus__editor__cursorPositionChanged)
        return index
1309551
def set_editor(self, editor):
        
        if self._editor is not None:
            try:
                self._editor.offset_calculator.pic_infos_available.disconnect(
                    self._update)
            except (AttributeError, RuntimeError, ReferenceError):
                # see https://github.com/OpenCobolIDE/OpenCobolIDE/issues/89
                pass
        self._editor = weakref.proxy(editor) if editor else editor
        try:
            self._editor.offset_calculator.pic_infos_available.connect(
                self._update)
        except AttributeError:
            pass
1282579
def set_editor(self, editor):
        
        try:
            self._editor.cursorPositionChanged.disconnect(self.sync)
        except (AttributeError, TypeError, RuntimeError, ReferenceError):
            pass
        try:
            self._outline_mode.document_changed.disconnect(
                self._on_changed)
        except (AttributeError, TypeError, RuntimeError, ReferenceError):
            pass
        try:
            self._folding_panel.trigger_state_changed.disconnect(
                self._on_block_state_changed)
        except (AttributeError, TypeError, RuntimeError, ReferenceError):
            pass
        if editor:
            self._editor = weakref.proxy(editor)
        else:
            self._editor = None

        if editor is not None:
            editor.cursorPositionChanged.connect(self.sync)
            try:
                self._folding_panel = weakref.proxy(
                    editor.panels.get(FoldingPanel))
            except KeyError:
                pass
            else:
                self._folding_panel.trigger_state_changed.connect(
                    self._on_block_state_changed)
            try:
                analyser = editor.modes.get(OutlineMode)
            except KeyError:
                self._outline_mode = None
            else:
                self._outline_mode = weakref.proxy(analyser)
                analyser.document_changed.connect(self._on_changed)
        self._on_changed()
1024922
def add(self, widget, *args, **kwargs):
        
        ins_widget = widget(*args, **kwargs)
        self.__iadd__(ins_widget)
        return ins_widget
968557
def addTab(self, view, title):
        
        if not isinstance(view, XView):
            return False

        tab = self._tabBar.addTab(title)
        self.addWidget(view)
        tab.titleChanged.connect(view.setWindowTitle)
        
        # create connections
        try:
            view.windowTitleChanged.connect(self.refreshTitles,
                                            QtCore.Qt.UniqueConnection)
            view.sizeConstraintChanged.connect(self.adjustSizeConstraint,
                                            QtCore.Qt.UniqueConnection)
            view.poppedOut.connect(self.disconnectView,
                                   QtCore.Qt.UniqueConnection)
        except RuntimeError:
            pass
        
        self.setCurrentIndex(self.count() - 1)
        
        return True
1045954
def editorValue(self, editor):
        
        value, success = projexui.widgetValue(editor)
        if not success:
            return None
        return value
208573
def insert_tabs(self, tab, no_tabs=1):
        

        # Mark content as changed
        post_command_event(self.main_window, self.ContentChangedMsg)

        self.code_array.insert(tab, no_tabs, axis=2)

        # Update TableChoiceIntCtrl
        shape = self.grid.code_array.shape
        post_command_event(self.main_window, self.ResizeGridMsg, shape=shape)
870575
def insertTab(self, index, widget, title):
        
        self.insertWidget(index, widget)
        tab = self.tabBar().insertTab(index, title)
        tab.titleChanged.connect(widget.setWindowTitle)
680272
def createEditor(self, delegate, parent, _option):
        
        return GroupCtiEditor(self, delegate, parent=parent)
795904
def addContentsWidget( self ):
        
        curr_widget = self.currentContentsWidget()
        widget = QWebView(self)
        page = widget.page()
        page.setLinkDelegationPolicy(page.DelegateAllLinks)
            
        self.uiContentsTAB.blockSignals(True)
        self.uiContentsTAB.addTab(widget, 'Documentation')
        self.uiContentsTAB.setCurrentIndex(self.uiContentsTAB.count() - 1)
        self.uiContentsTAB.blockSignals(False)
        
        self._currentContentsIndex = self.uiContentsTAB.count() - 1
        
        if curr_widget:
            widget.setUrl(curr_widget.url())
        
        widget.titleChanged.connect(self.refreshUi)
        widget.linkClicked.connect(self.__gotoUrl)
        
        return widget
604625
def child_added(self, child):
        
        super(UiKitView, self).child_added(child)

        widget = self.widget
        #: TODO: Should index be cached?
        for i, child_widget in enumerate(self.child_widgets()):
            if child_widget == child.widget:
                widget.insertSubview(child_widget, atIndex=i)
849835
def tabText(self, tab):
        
        if not isinstance(tab, int):
            tab = self.indexOf(tab)
        return super(FwTabWidget, self).tabText(tab)
1335489
def insert(self, i, tab_index):
        """"""
        _id = id(self.editor.tabs.widget(tab_index))
        self.history.insert(i, _id)
21235
def remove(self, tab_index):
        """"""
        _id = id(self.editor.tabs.widget(tab_index))
        if _id in self.history:
            self.history.remove(_id)
568202
def add_widget(self, widget):
        
        if self._buttons.get(widget):
            return
        btn = self.create_button(widget)
        cb = partial(self.focus_widget, w=widget)
        btn.clicked.connect(cb)
        self.layout().addWidget(btn)
        self._buttons[widget] = btn
1310836
def editorData( self, editor ):
        
        # set the information from a multi-tag edit
        if ( isinstance(editor, XMultiTagEdit) ):
            return editor.tags()
        
        # set the information from a combo box
        elif ( isinstance(editor, QComboBox) ):
            return nativestring(editor.currentText())
        
        # set the information from a line edit
        elif ( isinstance(editor, QLineEdit) ):
            return nativestring(editor.text())
        
        return None
635299
def add(self, extension):
        
        logger.debug('adding extension {}'.format(extension.name))
        self._extensions[extension.name] = extension
        extension.on_install(self.editor)
        return extension