def add_tab(self, path, text, api, newline): """ Adds a tab with the referenced path and text to the editor. """ new_tab = EditorPane(path, text, newline) new_tab.connect_margin(self.breakpoint_toggle) new_tab_index = self.tabs.addTab(new_tab, new_tab.label) new_tab.set_api(api) @new_tab.modificationChanged.connect def on_modified(): modified_tab_index = self.tabs.currentIndex() self.tabs.setTabText(modified_tab_index, new_tab.label) self.update_title(new_tab.label) @new_tab.open_file.connect def on_open_file(file): # Bubble the signal up self.open_file.emit(file) self.tabs.setCurrentIndex(new_tab_index) self.connect_zoom(new_tab) self.set_theme(self.theme) new_tab.setFocus() if self.read_only_tabs: new_tab.setReadOnly(self.read_only_tabs) return new_tab
def add_tab(self, path, text, api, newline): """ Adds a tab with the referenced path and text to the editor. """ new_tab = EditorPane(path, text, newline) new_tab.connect_margin(self.breakpoint_toggle) new_tab_index = self.tabs.addTab(new_tab, new_tab.label) new_tab.set_api(api) @new_tab.modificationChanged.connect def on_modified(): modified_tab_index = self.tabs.currentIndex() self.tabs.setTabText(modified_tab_index, new_tab.label) self.update_title(new_tab.label) @new_tab.open_file.connect def on_open_file(file): # Bubble the signal up self.open_file.emit(file) self.tabs.setCurrentIndex(new_tab_index) self.connect_zoom(new_tab) self.set_theme(self.theme) new_tab.setFocus() if self.read_only_tabs: new_tab.setReadOnly(self.read_only_tabs) return new_tab