INSTRUCTION stringlengths 1 8.43k | RESPONSE stringlengths 75 104k |
|---|---|
Add the cog menu button to the toolbar. | def setup_options_button(self):
"""Add the cog menu button to the toolbar."""
if not self.options_button:
self.options_button = create_toolbutton(
self, text=_('Options'), icon=ima.icon('tooloptions'))
actions = self.actions + [MENU_SEPARATOR] + self.plugin... |
Option has changed | def option_changed(self, option, value):
"""Option has changed"""
setattr(self, to_text_string(option), value)
self.shellwidget.set_namespace_view_settings()
self.refresh_table() |
Return dict editor view settings | def get_view_settings(self):
"""Return dict editor view settings"""
settings = {}
for name in REMOTE_SETTINGS:
settings[name] = getattr(self, name)
return settings |
Refresh variable table | def refresh_table(self):
"""Refresh variable table"""
if self.is_visible and self.isVisible():
self.shellwidget.refresh_namespacebrowser()
try:
self.editor.resizeRowToContents()
except TypeError:
pass |
Set data. | def set_data(self, data):
"""Set data."""
if data != self.editor.model.get_data():
self.editor.set_data(data)
self.editor.adjust_columns() |
Import data from text file. | def import_data(self, filenames=None):
"""Import data from text file."""
title = _("Import data")
if filenames is None:
if self.filename is None:
basedir = getcwd_or_home()
else:
basedir = osp.dirname(self.filename)
file... |
Save data | def save_data(self, filename=None):
"""Save data"""
if filename is None:
filename = self.filename
if filename is None:
filename = getcwd_or_home()
filename, _selfilter = getsavefilename(self, _("Save data"),
... |
Apply changes callback | def apply_changes(self):
"""Apply changes callback"""
if self.is_modified:
self.save_to_conf()
if self.apply_callback is not None:
self.apply_callback()
# Since the language cannot be retrieved by CONF and the language
# is needed ... |
Return page widget | def get_page(self, index=None):
"""Return page widget"""
if index is None:
widget = self.pages_widget.currentWidget()
else:
widget = self.pages_widget.widget(index)
return widget.widget() |
Reimplement Qt method | def accept(self):
"""Reimplement Qt method"""
for index in range(self.pages_widget.count()):
configpage = self.get_page(index)
if not configpage.is_valid():
return
configpage.apply_changes()
QDialog.accept(self) |
Reimplement Qt method to be able to save the widget s size from the main application | def resizeEvent(self, event):
"""
Reimplement Qt method to be able to save the widget's size from the
main application
"""
QDialog.resizeEvent(self, event)
self.size_change.emit(self.size()) |
Return True if all widget contents are valid | def is_valid(self):
"""Return True if all widget contents are valid"""
for lineedit in self.lineedits:
if lineedit in self.validate_data and lineedit.isEnabled():
validator, invalid_msg = self.validate_data[lineedit]
text = to_text_string(lineedit.text())... |
Load settings from configuration file | def load_from_conf(self):
"""Load settings from configuration file"""
for checkbox, (option, default) in list(self.checkboxes.items()):
checkbox.setChecked(self.get_option(option, default))
# QAbstractButton works differently for PySide and PyQt
if not API == 'py... |
Save settings to configuration file | def save_to_conf(self):
"""Save settings to configuration file"""
for checkbox, (option, _default) in list(self.checkboxes.items()):
self.set_option(option, checkbox.isChecked())
for radiobutton, (option, _default) in list(self.radiobuttons.items()):
self.set_option(... |
Select directory | def select_directory(self, edit):
"""Select directory"""
basedir = to_text_string(edit.text())
if not osp.isdir(basedir):
basedir = getcwd_or_home()
title = _("Select directory")
directory = getexistingdirectory(self, title, basedir)
if directory:
... |
Select File | def select_file(self, edit, filters=None):
"""Select File"""
basedir = osp.dirname(to_text_string(edit.text()))
if not osp.isdir(basedir):
basedir = getcwd_or_home()
if filters is None:
filters = _("All files (*)")
title = _("Select file")
... |
choices: couples ( name key ) | def create_combobox(self, text, choices, option, default=NoDefault,
tip=None, restart=False):
"""choices: couples (name, key)"""
label = QLabel(text)
combobox = QComboBox()
if tip is not None:
combobox.setToolTip(tip)
for name, key in ch... |
choices: couples ( name key ) | def create_file_combobox(self, text, choices, option, default=NoDefault,
tip=None, restart=False, filters=None,
adjust_to_contents=False,
default_line_edit=False):
"""choices: couples (name, key)"""
combobox = Fi... |
Option = None - > setting plugin font | def create_fontgroup(self, option=None, text=None, title=None,
tip=None, fontfilters=None, without_group=False):
"""Option=None -> setting plugin font"""
if title:
fontlabel = QLabel(title)
else:
fontlabel = QLabel(_("Font"))
font... |
Create simple tab widget page: widgets added in a vertical layout | def create_tab(self, *widgets):
"""Create simple tab widget page: widgets added in a vertical layout"""
widget = QWidget()
layout = QVBoxLayout()
for widg in widgets:
layout.addWidget(widg)
layout.addStretch(1)
widget.setLayout(layout)
return w... |
Prompt the user with a request to restart. | def prompt_restart_required(self):
"""Prompt the user with a request to restart."""
restart_opts = self.restart_options
changed_opts = self.changed_options
options = [restart_opts[o] for o in changed_opts if o in restart_opts]
if len(options) == 1:
msg_start =... |
After an application style change the paintEvent updates the custom defined stylesheet. | def _refresh(self):
"""After an application style change, the paintEvent updates the
custom defined stylesheet.
"""
padding = self.height()
css_base = """QLineEdit {{
border: none;
padding-right: {padding}px;
... |
Update the status and set_status to update the icons to display. | def update_status(self, value, value_set):
"""Update the status and set_status to update the icons to display."""
self._status = value
self._status_set = value_set
self.repaint()
self.update() |
Qt Override. | def paintEvent(self, event):
"""Qt Override.
Include a validation icon to the left of the line edit.
"""
super(IconLineEdit, self).paintEvent(event)
painter = QPainter(self)
rect = self.geometry()
space = int((rect.height())/6)
h = rect.height() - space
... |
Register plugin in Spyder s main window | def register_plugin(self):
"""Register plugin in Spyder's main window"""
self.main.restore_scrollbar_position.connect(
self.restore_scrollbar_position)
self.main.add_dockwidget(self) |
DockWidget visibility has changed | def visibility_changed(self, enable):
"""DockWidget visibility has changed"""
super(SpyderPluginWidget, self).visibility_changed(enable)
if enable:
self.explorer.is_visible.emit() |
Restoring scrollbar position after main window is visible | def restore_scrollbar_position(self):
"""Restoring scrollbar position after main window is visible"""
scrollbar_pos = self.get_option('scrollbar_position', None)
if scrollbar_pos is not None:
self.explorer.treewidget.set_scrollbar_position(scrollbar_pos) |
Save configuration: tree widget state | def save_config(self):
"""Save configuration: tree widget state"""
for option, value in list(self.explorer.get_options().items()):
self.set_option(option, value)
self.set_option('expanded_state',
self.explorer.treewidget.get_expanded_state())
sel... |
Load configuration: tree widget state | def load_config(self):
"""Load configuration: tree widget state"""
expanded_state = self.get_option('expanded_state', None)
# Sometimes the expanded state option may be truncated in .ini file
# (for an unknown reason), in this case it would be converted to a
# string by 'use... |
Double - click event | def activated(self, item):
"""Double-click event"""
data = self.data.get(id(item))
if data is not None:
fname, lineno = data
self.sig_edit_goto.emit(fname, lineno, '') |
Removing obsolete items | def remove_obsolete_items(self):
"""Removing obsolete items"""
self.rdata = [(filename, data) for filename, data in self.rdata
if is_module_or_package(filename)] |
Checks if there is an update available. | def check_update_available(self):
"""Checks if there is an update available.
It takes as parameters the current version of Spyder and a list of
valid cleaned releases in chronological order.
Example: ['2.3.2', '2.3.3' ...] or with github ['2.3.4', '2.3.3' ...]
"""
# Don'... |
Main method of the WorkerUpdates worker | def start(self):
"""Main method of the WorkerUpdates worker"""
if is_anaconda():
self.url = 'https://repo.anaconda.com/pkgs/main'
if os.name == 'nt':
self.url += '/win-64/repodata.json'
elif sys.platform == 'darwin':
self.url += '/osx-6... |
Event filter for search_text widget. Emits signals when presing Enter and Shift + Enter. This signals are used for search forward and backward. Also a crude hack to get tab working in the Find/ Replace boxes. | def eventFilter(self, widget, event):
"""Event filter for search_text widget.
Emits signals when presing Enter and Shift+Enter.
This signals are used for search forward and backward.
Also, a crude hack to get tab working in the Find/Replace boxes.
"""
if event.typ... |
Create shortcuts for this widget | def create_shortcuts(self, parent):
"""Create shortcuts for this widget"""
# Configurable
findnext = config_shortcut(self.find_next, context='_',
name='Find next', parent=parent)
findprev = config_shortcut(self.find_previous, context='_',
... |
Toggle the highlight all results feature | def toggle_highlighting(self, state):
"""Toggle the 'highlight all results' feature"""
if self.editor is not None:
if state:
self.highlight_matches()
else:
self.clear_matches() |
Overrides Qt Method | def show(self, hide_replace=True):
"""Overrides Qt Method"""
QWidget.show(self)
self.visibility_changed.emit(True)
self.change_number_matches()
if self.editor is not None:
if hide_replace:
if self.replace_widgets[0].isVisible():
... |
Overrides Qt Method | def hide(self):
"""Overrides Qt Method"""
for widget in self.replace_widgets:
widget.hide()
QWidget.hide(self)
self.visibility_changed.emit(False)
if self.editor is not None:
self.editor.setFocus()
self.clear_matches() |
Show replace widgets | def show_replace(self):
"""Show replace widgets"""
self.show(hide_replace=False)
for widget in self.replace_widgets:
widget.show() |
Refresh widget | def refresh(self):
"""Refresh widget"""
if self.isHidden():
if self.editor is not None:
self.clear_matches()
return
state = self.editor is not None
for widget in self.widgets:
widget.setEnabled(state)
if state:
... |
Set associated editor/ web page: codeeditor. base. TextEditBaseWidget browser. WebView | def set_editor(self, editor, refresh=True):
"""
Set associated editor/web page:
codeeditor.base.TextEditBaseWidget
browser.WebView
"""
self.editor = editor
# Note: This is necessary to test widgets/editor.py
# in Qt builds that don't have w... |
Find next occurrence | def find_next(self):
"""Find next occurrence"""
state = self.find(changed=False, forward=True, rehighlight=False,
multiline_replace_check=False)
self.editor.setFocus()
self.search_text.add_current_text()
return state |
Find previous occurrence | def find_previous(self):
"""Find previous occurrence"""
state = self.find(changed=False, forward=False, rehighlight=False,
multiline_replace_check=False)
self.editor.setFocus()
return state |
Find text has been edited ( this slot won t be triggered when setting the search pattern combo box text programmatically ) | def text_has_been_edited(self, text):
"""Find text has been edited (this slot won't be triggered when
setting the search pattern combo box text programmatically)"""
self.find(changed=True, forward=True, start_highlight_timer=True) |
Highlight found results | def highlight_matches(self):
"""Highlight found results"""
if self.is_code_editor and self.highlight_button.isChecked():
text = self.search_text.currentText()
words = self.words_button.isChecked()
regexp = self.re_button.isChecked()
self.editor.highl... |
Call the find function | def find(self, changed=True, forward=True,
rehighlight=True, start_highlight_timer=False, multiline_replace_check=True):
"""Call the find function"""
# When several lines are selected in the editor and replace box is activated,
# dynamic search is deactivated to prevent changin... |
Replace and find | def replace_find(self, focus_replace_text=False, replace_all=False):
"""Replace and find"""
if (self.editor is not None):
replace_text = to_text_string(self.replace_text.currentText())
search_text = to_text_string(self.search_text.currentText())
re_pattern = None... |
Replace and find in the current selection | def replace_find_selection(self, focus_replace_text=False):
"""Replace and find in the current selection"""
if self.editor is not None:
replace_text = to_text_string(self.replace_text.currentText())
search_text = to_text_string(self.search_text.currentText())
cas... |
Change number of match and total matches. | def change_number_matches(self, current_match=0, total_matches=0):
"""Change number of match and total matches."""
if current_match and total_matches:
matches_string = u"{} {} {}".format(current_match, _(u"of"),
total_matches)
s... |
Monkey patching rope See [ 1 ] [ 2 ] [ 3 ] [ 4 ] and [ 5 ] in module docstring. | def apply():
"""Monkey patching rope
See [1], [2], [3], [4] and [5] in module docstring."""
from spyder.utils.programs import is_module_installed
if is_module_installed('rope', '<0.9.4'):
import rope
raise ImportError("rope %s can't be patched" % rope.VERSION)
# [1] Patchi... |
Override Qt method. | def paintEvent(self, event):
"""Override Qt method."""
painter = QPainter(self)
color = QColor(self.color)
color.setAlphaF(.5)
painter.setPen(color)
offset = self.editor.document().documentMargin() + \
self.editor.contentOffset().x()
for _, line_numb... |
Return a list of actions related to plugin | def get_plugin_actions(self):
"""Return a list of actions related to plugin"""
return [self.rich_text_action, self.plain_text_action,
self.show_source_action, MENU_SEPARATOR,
self.auto_import_action] |
Register plugin in Spyder s main window | def register_plugin(self):
"""Register plugin in Spyder's main window"""
self.focus_changed.connect(self.main.plugin_focus_changed)
self.main.add_dockwidget(self)
self.main.console.set_help(self)
self.internal_shell = self.main.console.shell
self.console = self.ma... |
Refresh widget | def refresh_plugin(self):
"""Refresh widget"""
if self._starting_up:
self._starting_up = False
self.switch_to_rich_text()
self.show_intro_message() |
Update font from Preferences | def update_font(self):
"""Update font from Preferences"""
color_scheme = self.get_color_scheme()
font = self.get_plugin_font()
rich_font = self.get_plugin_font(rich_text=True)
self.set_plain_text_font(font, color_scheme=color_scheme)
self.set_rich_text_font(rich_f... |
Apply configuration file s plugin settings | def apply_plugin_settings(self, options):
"""Apply configuration file's plugin settings"""
color_scheme_n = 'color_scheme_name'
color_scheme_o = self.get_color_scheme()
connect_n = 'connect_to_oi'
wrap_n = 'wrap'
wrap_o = self.get_option(wrap_n)
self.wrap_a... |
Set rich text mode font | def set_rich_text_font(self, font):
"""Set rich text mode font"""
self.rich_text.set_font(font, fixed_font=self.get_plugin_font()) |
Set plain text mode font | def set_plain_text_font(self, font, color_scheme=None):
"""Set plain text mode font"""
self.plain_text.set_font(font, color_scheme=color_scheme) |
Toggle wrap mode | def toggle_wrap_mode(self, checked):
"""Toggle wrap mode"""
self.plain_text.editor.toggle_wrap_mode(checked)
self.set_option('wrap', checked) |
Switch to plain text mode | def switch_to_plain_text(self):
"""Switch to plain text mode"""
self.rich_help = False
self.plain_text.show()
self.rich_text.hide()
self.plain_text_action.setChecked(True) |
Switch to rich text mode | def switch_to_rich_text(self):
"""Switch to rich text mode"""
self.rich_help = True
self.plain_text.hide()
self.rich_text.show()
self.rich_text_action.setChecked(True)
self.show_source_action.setChecked(False) |
Set plain text docs | def set_plain_text(self, text, is_code):
"""Set plain text docs"""
# text is coming from utils.dochelpers.getdoc
if type(text) is dict:
name = text['name']
if name:
rst_title = ''.join(['='*len(name), '\n', name, '\n',
... |
Set rich text | def set_rich_text_html(self, html_text, base_url):
"""Set rich text"""
self.rich_text.set_html(html_text, base_url)
self.save_text([self.rich_text.set_html, html_text, base_url]) |
Show text in rich mode | def show_rich_text(self, text, collapse=False, img_path=''):
"""Show text in rich mode"""
self.switch_to_plugin()
self.switch_to_rich_text()
context = generate_context(collapse=collapse, img_path=img_path,
css_path=self.css_path)
self.rend... |
Show text in plain mode | def show_plain_text(self, text):
"""Show text in plain mode"""
self.switch_to_plugin()
self.switch_to_plain_text()
self.set_plain_text(text, is_code=False) |
Show the Spyder tutorial in the Help plugin opening it if needed | def show_tutorial(self):
"""Show the Spyder tutorial in the Help plugin, opening it if needed"""
self.switch_to_plugin()
tutorial_path = get_module_source_path('spyder.plugins.help.utils')
tutorial = osp.join(tutorial_path, 'tutorial.rst')
text = open(tutorial).read()
... |
Set object analyzed by Help | def set_object_text(self, text, force_refresh=False, ignore_unknown=False):
"""Set object analyzed by Help"""
if (self.locked and not force_refresh):
return
self.switch_to_console_source()
add_to_combo = True
if text is None:
text = to_text_string... |
Use the help plugin to show docstring dictionary computed with introspection plugin from the Editor plugin | def set_editor_doc(self, doc, force_refresh=False):
"""
Use the help plugin to show docstring dictionary computed
with introspection plugin from the Editor plugin
"""
if (self.locked and not force_refresh):
return
self.switch_to_editor_source()
... |
Load history from a text file in user home directory | def load_history(self, obj=None):
"""Load history from a text file in user home directory"""
if osp.isfile(self.LOG_PATH):
history = [line.replace('\n', '')
for line in open(self.LOG_PATH, 'r').readlines()]
else:
history = []
return h... |
Save history to a text file in user home directory | def save_history(self):
"""Save history to a text file in user home directory"""
# Don't fail when saving search history to disk
# See issues 8878 and 6864
try:
search_history = [to_text_string(self.combo.itemText(index))
for index in range... |
Toggle plain text docstring | def toggle_plain_text(self, checked):
"""Toggle plain text docstring"""
if checked:
self.docstring = checked
self.switch_to_plain_text()
self.force_refresh()
self.set_option('rich_mode', not checked) |
Toggle show source code | def toggle_show_source(self, checked):
"""Toggle show source code"""
if checked:
self.switch_to_plain_text()
self.docstring = not checked
self.force_refresh()
self.set_option('rich_mode', not checked) |
Toggle between sphinxified docstrings or plain ones | def toggle_rich_text(self, checked):
"""Toggle between sphinxified docstrings or plain ones"""
if checked:
self.docstring = not checked
self.switch_to_rich_text()
self.set_option('rich_mode', checked) |
Toggle automatic import feature | def toggle_auto_import(self, checked):
"""Toggle automatic import feature"""
self.combo.validate_current_text()
self.set_option('automatic_import', checked)
self.force_refresh() |
Update locked state icon | def _update_lock_icon(self):
"""Update locked state icon"""
icon = ima.icon('lock') if self.locked else ima.icon('lock_open')
self.locked_button.setIcon(icon)
tip = _("Unlock") if self.locked else _("Lock")
self.locked_button.setToolTip(tip) |
Return shell which is currently bound to Help or another running shell if it has been terminated | def get_shell(self):
"""
Return shell which is currently bound to Help,
or another running shell if it has been terminated
"""
if (not hasattr(self.shell, 'get_doc') or
(hasattr(self.shell, 'is_running') and
not self.shell.is_running())):
... |
Transform doc string dictionary to HTML and show it | def render_sphinx_doc(self, doc, context=None, css_path=CSS_PATH):
"""Transform doc string dictionary to HTML and show it"""
# Math rendering option could have changed
if self.main.editor is not None:
fname = self.main.editor.get_current_filename()
dname = osp.dirnam... |
Set our sphinx documentation based on thread result | def _on_sphinx_thread_html_ready(self, html_text):
"""Set our sphinx documentation based on thread result"""
self._sphinx_thread.wait()
self.set_rich_text_html(html_text, QUrl.fromLocalFile(self.css_path)) |
Display error message on Sphinx rich text failure | def _on_sphinx_thread_error_msg(self, error_msg):
""" Display error message on Sphinx rich text failure"""
self._sphinx_thread.wait()
self.plain_text_action.setChecked(True)
sphinx_ver = programs.get_module_version('sphinx')
QMessageBox.critical(self,
_(... |
Show help | def show_help(self, obj_text, ignore_unknown=False):
"""Show help"""
shell = self.get_shell()
if shell is None:
return
obj_text = to_text_string(obj_text)
if not shell.is_defined(obj_text):
if self.get_option('automatic_import') and \
... |
Checks if the textCursor is in the decoration. | def contains_cursor(self, cursor):
"""
Checks if the textCursor is in the decoration.
:param cursor: The text cursor to test
:type cursor: QtGui.QTextCursor
:returns: True if the cursor is over the selection
"""
start = self.cursor.selectionStart()
end =... |
Select the entire line but starts at the first non whitespace character and stops at the non - whitespace character.: return: | def select_line(self):
"""
Select the entire line but starts at the first non whitespace character
and stops at the non-whitespace character.
:return:
"""
self.cursor.movePosition(self.cursor.StartOfBlock)
text = self.cursor.block().text()
lindent = len(te... |
Underlines the text. | def set_as_underlined(self, color=Qt.blue):
"""
Underlines the text.
:param color: underline color.
"""
self.format.setUnderlineStyle(
QTextCharFormat.SingleUnderline)
self.format.setUnderlineColor(color) |
Underlines text as a spellcheck error. | def set_as_spell_check(self, color=Qt.blue):
"""
Underlines text as a spellcheck error.
:param color: Underline color
:type color: QtGui.QColor
"""
self.format.setUnderlineStyle(
QTextCharFormat.SpellCheckUnderline)
self.format.setUnderlineColor(color... |
Highlights text as a syntax error. | def set_as_error(self, color=Qt.red):
"""
Highlights text as a syntax error.
:param color: Underline color
:type color: QtGui.QColor
"""
self.format.setUnderlineStyle(
QTextCharFormat.WaveUnderline)
self.format.setUnderlineColor(color) |
Highlights text as a syntax warning. | def set_as_warning(self, color=QColor("orange")):
"""
Highlights text as a syntax warning.
:param color: Underline color
:type color: QtGui.QColor
"""
self.format.setUnderlineStyle(
QTextCharFormat.WaveUnderline)
self.format.setUnderlineColor(color) |
Run analysis | def run(self):
"""Run analysis"""
try:
self.results = self.checker(self.source_code)
except Exception as e:
logger.error(e, exc_info=True) |
Close threads associated to parent_id | def close_threads(self, parent):
"""Close threads associated to parent_id"""
logger.debug("Call ThreadManager's 'close_threads'")
if parent is None:
# Closing all threads
self.pending_threads = []
threadlist = []
for threads in list(self.sta... |
Add thread to queue | def add_thread(self, checker, end_callback, source_code, parent):
"""Add thread to queue"""
parent_id = id(parent)
thread = AnalysisThread(self, checker, source_code)
self.end_callbacks[id(thread)] = end_callback
self.pending_threads.append((thread, parent_id))
logg... |
Update queue | def update_queue(self):
"""Update queue"""
started = 0
for parent_id, threadlist in list(self.started_threads.items()):
still_running = []
for thread in threadlist:
if thread.isFinished():
end_callback = self.end_callbacks.pop(id... |
Editor s text has changed | def text_changed(self):
"""Editor's text has changed"""
self.default = False
self.editor.document().changed_since_autosave = True
self.text_changed_at.emit(self.filename,
self.editor.get_position('cursor')) |
Run TODO finder | def run_todo_finder(self):
"""Run TODO finder"""
if self.editor.is_python():
self.threadmanager.add_thread(codeanalysis.find_tasks,
self.todo_finished,
self.get_source_code(), self) |
Set TODO results and update markers in editor | def set_todo_results(self, results):
"""Set TODO results and update markers in editor"""
self.todo_results = results
self.editor.process_todo(results) |
Bookmarks list has changed. | def bookmarks_changed(self):
"""Bookmarks list has changed."""
bookmarks = self.editor.get_bookmarks()
if self.editor.bookmarks != bookmarks:
self.editor.bookmarks = bookmarks
self.sig_save_bookmarks.emit(self.filename, repr(bookmarks)) |
Update list of corresponpding ids and tabs. | def _update_id_list(self):
"""Update list of corresponpding ids and tabs."""
self.id_list = [id(self.editor.tabs.widget(_i))
for _i in range(self.editor.tabs.count())] |
Remove editors that are not longer open. | def refresh(self):
"""Remove editors that are not longer open."""
self._update_id_list()
for _id in self.history[:]:
if _id not in self.id_list:
self.history.remove(_id) |
Insert the widget ( at tab index ) in the position i ( index ). | def insert(self, i, tab_index):
"""Insert the widget (at tab index) in the position i (index)."""
_id = id(self.editor.tabs.widget(tab_index))
self.history.insert(i, _id) |
Remove the widget at the corresponding tab_index. | def remove(self, tab_index):
"""Remove the widget at the corresponding tab_index."""
_id = id(self.editor.tabs.widget(tab_index))
if _id in self.history:
self.history.remove(_id) |
Remove previous entrances of a tab and add it as the latest. | def remove_and_append(self, index):
"""Remove previous entrances of a tab, and add it as the latest."""
while index in self:
self.remove(index)
self.append(index) |
Fill ListWidget with the tabs texts. Add elements in inverse order of stack_history. | def load_data(self):
"""Fill ListWidget with the tabs texts.
Add elements in inverse order of stack_history.
"""
for index in reversed(self.stack_history):
text = self.tabs.tabText(index)
text = text.replace('&', '')
item = QListWidgetItem(i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.