Code stringlengths 103 85.9k | Summary listlengths 0 94 |
|---|---|
Please provide a description of the function:def check_update_available(self):
# Don't perform any check for development versions
if 'dev' in self.version:
return (False, latest_release)
# Filter releases
if is_stable_version(self.version):
releases = [r... | [
"Checks if there is an update available.\n\n It takes as parameters the current version of Spyder and a list of\n valid cleaned releases in chronological order.\n Example: ['2.3.2', '2.3.3' ...] or with github ['2.3.4', '2.3.3' ...]\n "
] |
Please provide a description of the function:def start(self):
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... | [
"Main method of the WorkerUpdates worker"
] |
Please provide a description of the function:def eventFilter(self, widget, event):
if event.type() == QEvent.KeyPress:
key = event.key()
shift = event.modifiers() & Qt.ShiftModifier
if key == Qt.Key_Return:
if shift:
self.... | [
"Event filter for search_text widget.\r\n\r\n Emits signals when presing Enter and Shift+Enter.\r\n This signals are used for search forward and backward.\r\n Also, a crude hack to get tab working in the Find/Replace boxes.\r\n "
] |
Please provide a description of the function:def create_shortcuts(self, parent):
# Configurable
findnext = config_shortcut(self.find_next, context='_',
name='Find next', parent=parent)
findprev = config_shortcut(self.find_previous, context='_',
... | [
"Create shortcuts for this widget"
] |
Please provide a description of the function:def toggle_highlighting(self, state):
if self.editor is not None:
if state:
self.highlight_matches()
else:
self.clear_matches() | [
"Toggle the 'highlight all results' feature"
] |
Please provide a description of the function:def show(self, hide_replace=True):
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"
] |
Please provide a description of the function:def hide(self):
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... | [
"Overrides Qt Method"
] |
Please provide a description of the function:def show_replace(self):
self.show(hide_replace=False)
for widget in self.replace_widgets:
widget.show() | [
"Show replace widgets"
] |
Please provide a description of the function:def refresh(self):
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)
... | [
"Refresh widget"
] |
Please provide a description of the function:def set_editor(self, editor, refresh=True):
self.editor = editor
# Note: This is necessary to test widgets/editor.py
# in Qt builds that don't have web widgets
try:
from qtpy.QtWebEngineWidgets import QWebEngineView
... | [
"\r\n Set associated editor/web page:\r\n codeeditor.base.TextEditBaseWidget\r\n browser.WebView\r\n "
] |
Please provide a description of the function:def find_next(self):
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 next occurrence"
] |
Please provide a description of the function:def find_previous(self):
state = self.find(changed=False, forward=False, rehighlight=False,
multiline_replace_check=False)
self.editor.setFocus()
return state | [
"Find previous occurrence"
] |
Please provide a description of the function:def text_has_been_edited(self, text):
self.find(changed=True, forward=True, start_highlight_timer=True) | [
"Find text has been edited (this slot won't be triggered when \r\n setting the search pattern combo box text programmatically)"
] |
Please provide a description of the function:def highlight_matches(self):
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()
s... | [
"Highlight found results"
] |
Please provide a description of the function:def find(self, changed=True, forward=True,
rehighlight=True, start_highlight_timer=False, multiline_replace_check=True):
# When several lines are selected in the editor and replace box is activated,
# dynamic search is deactivated t... | [
"Call the find function"
] |
Please provide a description of the function:def replace_find(self, focus_replace_text=False, replace_all=False):
if (self.editor is not None):
replace_text = to_text_string(self.replace_text.currentText())
search_text = to_text_string(self.search_text.currentText())
... | [
"Replace and find"
] |
Please provide a description of the function:def replace_find_selection(self, focus_replace_text=False):
if self.editor is not None:
replace_text = to_text_string(self.replace_text.currentText())
search_text = to_text_string(self.search_text.currentText())
case ... | [
"Replace and find in the current selection"
] |
Please provide a description of the function:def change_number_matches(self, current_match=0, total_matches=0):
if current_match and total_matches:
matches_string = u"{} {} {}".format(current_match, _(u"of"),
total_matches)
sel... | [
"Change number of match and total matches."
] |
Please provide a description of the function:def apply():
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] Patching project.Project for compatibility wit... | [
"Monkey patching rope\r\n\r\n See [1], [2], [3], [4] and [5] in module docstring.",
"Returns a `PyObject` if the module was found."
] |
Please provide a description of the function:def paintEvent(self, event):
painter = QPainter(self)
color = QColor(self.color)
color.setAlphaF(.5)
painter.setPen(color)
offset = self.editor.document().documentMargin() + \
self.editor.contentOffset().x()
... | [
"Override Qt method."
] |
Please provide a description of the function:def get_plugin_actions(self):
return [self.rich_text_action, self.plain_text_action,
self.show_source_action, MENU_SEPARATOR,
self.auto_import_action] | [
"Return a list of actions related to plugin"
] |
Please provide a description of the function:def register_plugin(self):
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... | [
"Register plugin in Spyder's main window"
] |
Please provide a description of the function:def refresh_plugin(self):
if self._starting_up:
self._starting_up = False
self.switch_to_rich_text()
self.show_intro_message() | [
"Refresh widget"
] |
Please provide a description of the function:def update_font(self):
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_... | [
"Update font from Preferences"
] |
Please provide a description of the function:def apply_plugin_settings(self, options):
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_acti... | [
"Apply configuration file's plugin settings"
] |
Please provide a description of the function:def set_rich_text_font(self, font):
self.rich_text.set_font(font, fixed_font=self.get_plugin_font()) | [
"Set rich text mode font"
] |
Please provide a description of the function:def set_plain_text_font(self, font, color_scheme=None):
self.plain_text.set_font(font, color_scheme=color_scheme) | [
"Set plain text mode font"
] |
Please provide a description of the function:def toggle_wrap_mode(self, checked):
self.plain_text.editor.toggle_wrap_mode(checked)
self.set_option('wrap', checked) | [
"Toggle wrap mode"
] |
Please provide a description of the function:def switch_to_plain_text(self):
self.rich_help = False
self.plain_text.show()
self.rich_text.hide()
self.plain_text_action.setChecked(True) | [
"Switch to plain text mode"
] |
Please provide a description of the function:def switch_to_rich_text(self):
self.rich_help = True
self.plain_text.hide()
self.rich_text.show()
self.rich_text_action.setChecked(True)
self.show_source_action.setChecked(False) | [
"Switch to rich text mode"
] |
Please provide a description of the function:def set_plain_text(self, text, is_code):
# 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 plain text docs"
] |
Please provide a description of the function:def set_rich_text_html(self, html_text, base_url):
self.rich_text.set_html(html_text, base_url)
self.save_text([self.rich_text.set_html, html_text, base_url]) | [
"Set rich text"
] |
Please provide a description of the function:def show_rich_text(self, text, collapse=False, img_path=''):
self.switch_to_plugin()
self.switch_to_rich_text()
context = generate_context(collapse=collapse, img_path=img_path,
css_path=self.css_path)
... | [
"Show text in rich mode"
] |
Please provide a description of the function:def show_plain_text(self, text):
self.switch_to_plugin()
self.switch_to_plain_text()
self.set_plain_text(text, is_code=False) | [
"Show text in plain mode"
] |
Please provide a description of the function:def show_tutorial(self):
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()
self.show_rich_text(tex... | [
"Show the Spyder tutorial in the Help plugin, opening it if needed"
] |
Please provide a description of the function:def set_object_text(self, text, force_refresh=False, ignore_unknown=False):
if (self.locked and not force_refresh):
return
self.switch_to_console_source()
add_to_combo = True
if text is None:
text = to... | [
"Set object analyzed by Help"
] |
Please provide a description of the function:def set_editor_doc(self, doc, force_refresh=False):
if (self.locked and not force_refresh):
return
self.switch_to_editor_source()
self._last_editor_doc = doc
self.object_edit.setText(doc['obj_text'])
if se... | [
"\r\n Use the help plugin to show docstring dictionary computed\r\n with introspection plugin from the Editor plugin\r\n "
] |
Please provide a description of the function:def load_history(self, obj=None):
if osp.isfile(self.LOG_PATH):
history = [line.replace('\n', '')
for line in open(self.LOG_PATH, 'r').readlines()]
else:
history = []
return history | [
"Load history from a text file in user home directory"
] |
Please provide a description of the function:def save_history(self):
# 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(self.combo... | [
"Save history to a text file in user home directory"
] |
Please provide a description of the function:def toggle_plain_text(self, checked):
if checked:
self.docstring = checked
self.switch_to_plain_text()
self.force_refresh()
self.set_option('rich_mode', not checked) | [
"Toggle plain text docstring"
] |
Please provide a description of the function:def toggle_show_source(self, checked):
if checked:
self.switch_to_plain_text()
self.docstring = not checked
self.force_refresh()
self.set_option('rich_mode', not checked) | [
"Toggle show source code"
] |
Please provide a description of the function:def toggle_rich_text(self, checked):
if checked:
self.docstring = not checked
self.switch_to_rich_text()
self.set_option('rich_mode', checked) | [
"Toggle between sphinxified docstrings or plain ones"
] |
Please provide a description of the function:def toggle_auto_import(self, checked):
self.combo.validate_current_text()
self.set_option('automatic_import', checked)
self.force_refresh() | [
"Toggle automatic import feature"
] |
Please provide a description of the function:def _update_lock_icon(self):
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) | [
"Update locked state icon"
] |
Please provide a description of the function:def get_shell(self):
if (not hasattr(self.shell, 'get_doc') or
(hasattr(self.shell, 'is_running') and
not self.shell.is_running())):
self.shell = None
if self.main.ipyconsole is not None:
... | [
"\r\n Return shell which is currently bound to Help,\r\n or another running shell if it has been terminated\r\n "
] |
Please provide a description of the function:def render_sphinx_doc(self, doc, context=None, css_path=CSS_PATH):
# Math rendering option could have changed
if self.main.editor is not None:
fname = self.main.editor.get_current_filename()
dname = osp.dirname(fname)
... | [
"Transform doc string dictionary to HTML and show it"
] |
Please provide a description of the function:def _on_sphinx_thread_html_ready(self, html_text):
self._sphinx_thread.wait()
self.set_rich_text_html(html_text, QUrl.fromLocalFile(self.css_path)) | [
"Set our sphinx documentation based on thread result"
] |
Please provide a description of the function:def _on_sphinx_thread_error_msg(self, error_msg):
self._sphinx_thread.wait()
self.plain_text_action.setChecked(True)
sphinx_ver = programs.get_module_version('sphinx')
QMessageBox.critical(self,
_('Help'),
... | [
" Display error message on Sphinx rich text failure"
] |
Please provide a description of the function:def show_help(self, obj_text, ignore_unknown=False):
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('automat... | [
"Show help"
] |
Please provide a description of the function:def contains_cursor(self, cursor):
start = self.cursor.selectionStart()
end = self.cursor.selectionEnd()
if cursor.atBlockEnd():
end -= 1
return start <= cursor.position() <= end | [
"\n Checks if the textCursor is in the decoration.\n\n :param cursor: The text cursor to test\n :type cursor: QtGui.QTextCursor\n\n :returns: True if the cursor is over the selection\n "
] |
Please provide a description of the function:def select_line(self):
self.cursor.movePosition(self.cursor.StartOfBlock)
text = self.cursor.block().text()
lindent = len(text) - len(text.lstrip())
self.cursor.setPosition(self.cursor.block().position() + lindent)
self.cursor... | [
"\n Select the entire line but starts at the first non whitespace character\n and stops at the non-whitespace character.\n :return:\n "
] |
Please provide a description of the function:def set_as_underlined(self, color=Qt.blue):
self.format.setUnderlineStyle(
QTextCharFormat.SingleUnderline)
self.format.setUnderlineColor(color) | [
"\n Underlines the text.\n\n :param color: underline color.\n "
] |
Please provide a description of the function:def set_as_spell_check(self, color=Qt.blue):
self.format.setUnderlineStyle(
QTextCharFormat.SpellCheckUnderline)
self.format.setUnderlineColor(color) | [
"\n Underlines text as a spellcheck error.\n\n :param color: Underline color\n :type color: QtGui.QColor\n "
] |
Please provide a description of the function:def set_as_error(self, color=Qt.red):
self.format.setUnderlineStyle(
QTextCharFormat.WaveUnderline)
self.format.setUnderlineColor(color) | [
"\n Highlights text as a syntax error.\n\n :param color: Underline color\n :type color: QtGui.QColor\n "
] |
Please provide a description of the function:def set_as_warning(self, color=QColor("orange")):
self.format.setUnderlineStyle(
QTextCharFormat.WaveUnderline)
self.format.setUnderlineColor(color) | [
"\n Highlights text as a syntax warning.\n\n :param color: Underline color\n :type color: QtGui.QColor\n "
] |
Please provide a description of the function:def run(self):
try:
self.results = self.checker(self.source_code)
except Exception as e:
logger.error(e, exc_info=True) | [
"Run analysis"
] |
Please provide a description of the function:def close_threads(self, parent):
logger.debug("Call ThreadManager's 'close_threads'")
if parent is None:
# Closing all threads
self.pending_threads = []
threadlist = []
for threads in list(self.s... | [
"Close threads associated to parent_id"
] |
Please provide a description of the function:def add_thread(self, checker, end_callback, source_code, parent):
parent_id = id(parent)
thread = AnalysisThread(self, checker, source_code)
self.end_callbacks[id(thread)] = end_callback
self.pending_threads.append((thread, paren... | [
"Add thread to queue"
] |
Please provide a description of the function:def update_queue(self):
started = 0
for parent_id, threadlist in list(self.started_threads.items()):
still_running = []
for thread in threadlist:
if thread.isFinished():
end_callback ... | [
"Update queue"
] |
Please provide a description of the function:def text_changed(self):
self.default = False
self.editor.document().changed_since_autosave = True
self.text_changed_at.emit(self.filename,
self.editor.get_position('cursor')) | [
"Editor's text has changed"
] |
Please provide a description of the function:def run_todo_finder(self):
if self.editor.is_python():
self.threadmanager.add_thread(codeanalysis.find_tasks,
self.todo_finished,
self.get_source_code(), sel... | [
"Run TODO finder"
] |
Please provide a description of the function:def set_todo_results(self, results):
self.todo_results = results
self.editor.process_todo(results) | [
"Set TODO results and update markers in editor"
] |
Please provide a description of the function:def bookmarks_changed(self):
bookmarks = self.editor.get_bookmarks()
if self.editor.bookmarks != bookmarks:
self.editor.bookmarks = bookmarks
self.sig_save_bookmarks.emit(self.filename, repr(bookmarks)) | [
"Bookmarks list has changed."
] |
Please provide a description of the function:def _update_id_list(self):
self.id_list = [id(self.editor.tabs.widget(_i))
for _i in range(self.editor.tabs.count())] | [
"Update list of corresponpding ids and tabs."
] |
Please provide a description of the function:def refresh(self):
self._update_id_list()
for _id in self.history[:]:
if _id not in self.id_list:
self.history.remove(_id) | [
"Remove editors that are not longer open."
] |
Please provide a description of the function:def insert(self, i, tab_index):
_id = id(self.editor.tabs.widget(tab_index))
self.history.insert(i, _id) | [
"Insert the widget (at tab index) in the position i (index)."
] |
Please provide a description of the function:def remove(self, tab_index):
_id = id(self.editor.tabs.widget(tab_index))
if _id in self.history:
self.history.remove(_id) | [
"Remove the widget at the corresponding tab_index."
] |
Please provide a description of the function:def remove_and_append(self, index):
while index in self:
self.remove(index)
self.append(index) | [
"Remove previous entrances of a tab, and add it as the latest."
] |
Please provide a description of the function:def load_data(self):
for index in reversed(self.stack_history):
text = self.tabs.tabText(index)
text = text.replace('&', '')
item = QListWidgetItem(ima.icon('TextFileIcon'), text)
self.addItem(item) | [
"Fill ListWidget with the tabs texts.\r\n\r\n Add elements in inverse order of stack_history.\r\n "
] |
Please provide a description of the function:def item_selected(self, item=None):
if item is None:
item = self.currentItem()
# stack history is in inverse order
try:
index = self.stack_history[-(self.currentRow()+1)]
except IndexError:
... | [
"Change to the selected document and hide this widget."
] |
Please provide a description of the function:def select_row(self, steps):
row = (self.currentRow() + steps) % self.count()
self.setCurrentRow(row) | [
"Move selected row a number of steps.\r\n\r\n Iterates in a cyclic behaviour.\r\n "
] |
Please provide a description of the function:def set_dialog_position(self):
left = self.editor.geometry().width()/2 - self.width()/2
top = self.editor.tabs.tabBar().geometry().height()
self.move(self.editor.mapToGlobal(QPoint(left, top))) | [
"Positions the tab switcher in the top-center of the editor."
] |
Please provide a description of the function:def keyReleaseEvent(self, event):
if self.isVisible():
qsc = get_shortcut(context='Editor', name='Go to next file')
for key in qsc.split('+'):
key = key.lower()
if ((key == 'ctrl' and event.key(... | [
"Reimplement Qt method.\r\n\r\n Handle \"most recent used\" tab behavior,\r\n When ctrl is released and tab_switcher is visible, tab will be changed.\r\n "
] |
Please provide a description of the function:def keyPressEvent(self, event):
if event.key() == Qt.Key_Down:
self.select_row(1)
elif event.key() == Qt.Key_Up:
self.select_row(-1) | [
"Reimplement Qt method to allow cyclic behavior."
] |
Please provide a description of the function:def focusOutEvent(self, event):
event.ignore()
# Inspired from CompletionWidget.focusOutEvent() in file
# widgets/sourcecode/base.py line 212
if sys.platform == "darwin":
if event.reason() != Qt.ActiveWindowFocusReas... | [
"Reimplement Qt method to close the widget when loosing focus."
] |
Please provide a description of the function:def create_shortcuts(self):
# --- Configurable shortcuts
inspect = config_shortcut(self.inspect_current_object, context='Editor',
name='Inspect current object', parent=self)
set_breakpoint = config_short... | [
"Create local shortcuts"
] |
Please provide a description of the function:def setup_editorstack(self, parent, layout):
layout.setSpacing(1)
self.fname_label = QLabel()
self.fname_label.setStyleSheet(
"QLabel {margin: 0px; padding: 3px;}")
layout.addWidget(self.fname_label)
men... | [
"Setup editorstack's layout"
] |
Please provide a description of the function:def update_fname_label(self):
filename = to_text_string(self.get_current_filename())
if len(filename) > 100:
shorten_filename = u'...' + filename[-100:]
else:
shorten_filename = filename
self.fname_label... | [
"Upadte file name label."
] |
Please provide a description of the function:def closeEvent(self, event):
self.threadmanager.close_all_threads()
self.analysis_timer.timeout.disconnect(self.analyze_script)
# Remove editor references from the outline explorer settings
if self.outlineexplorer is not None:
... | [
"Overrides QWidget closeEvent()."
] |
Please provide a description of the function:def clone_from(self, other):
for other_finfo in other.data:
self.clone_editor_from(other_finfo, set_current=True)
self.set_stack_index(other.get_stack_index()) | [
"Clone EditorStack from other instance"
] |
Please provide a description of the function:def open_fileswitcher_dlg(self):
if not self.tabs.count():
return
if self.fileswitcher_dlg is not None and \
self.fileswitcher_dlg.is_visible:
self.fileswitcher_dlg.hide()
self.fileswitcher_dlg.is_... | [
"Open file list management dialog box"
] |
Please provide a description of the function:def go_to_line(self, line=None):
if line is not None:
# When this method is called from the flileswitcher, a line
# number is specified, so there is no need for the dialog.
self.get_current_editor().go_to_line(line)
... | [
"Go to line dialog"
] |
Please provide a description of the function:def set_or_clear_breakpoint(self):
if self.data:
editor = self.get_current_editor()
editor.debugger.toogle_breakpoint() | [
"Set/clear breakpoint"
] |
Please provide a description of the function:def set_or_edit_conditional_breakpoint(self):
if self.data:
editor = self.get_current_editor()
editor.debugger.toogle_breakpoint(edit_condition=True) | [
"Set conditional breakpoint"
] |
Please provide a description of the function:def set_bookmark(self, slot_num):
if self.data:
editor = self.get_current_editor()
editor.add_bookmark(slot_num) | [
"Bookmark current position to given slot."
] |
Please provide a description of the function:def inspect_current_object(self):
editor = self.get_current_editor()
editor.sig_display_signature.connect(self.display_signature_help)
line, col = editor.get_cursor_line_column()
editor.request_hover(line, col) | [
"Inspect current object in the Help plugin"
] |
Please provide a description of the function:def initialize_outlineexplorer(self):
for index in range(self.get_stack_count()):
if index != self.get_stack_index():
self._refresh_outlineexplorer(index=index) | [
"This method is called separately from 'set_oulineexplorer' to avoid\r\n doing unnecessary updates when there are multiple editor windows"
] |
Please provide a description of the function:def get_tab_text(self, index, is_modified=None, is_readonly=None):
files_path_list = [finfo.filename for finfo in self.data]
fname = self.data[index].filename
fname = sourcecode.disambiguate_fname(files_path_list, fname)
return s... | [
"Return tab title."
] |
Please provide a description of the function:def get_tab_tip(self, filename, is_modified=None, is_readonly=None):
text = u"%s — %s"
text = self.__modified_readonly_title(text,
is_modified, is_readonly)
if self.tempfile_path is not None\... | [
"Return tab menu title"
] |
Please provide a description of the function:def __setup_menu(self):
self.menu.clear()
if self.data:
actions = self.menu_actions
else:
actions = (self.new_action, self.open_action)
self.setFocus() # --> Editor.__get_focus_editortabwidget
... | [
"Setup tab context menu before showing it"
] |
Please provide a description of the function:def has_filename(self, filename):
fixpath = lambda path: osp.normcase(osp.realpath(path))
for index, finfo in enumerate(self.data):
if fixpath(filename) == fixpath(finfo.filename):
return index
return None | [
"Return the self.data index position for the filename.\r\n\r\n Args:\r\n filename: Name of the file to search for in self.data.\r\n\r\n Returns:\r\n The self.data index for the filename. Returns None\r\n if the filename is not found in self.data.\r\n "
] |
Please provide a description of the function:def set_current_filename(self, filename, focus=True):
index = self.has_filename(filename)
if index is not None:
if focus:
self.set_stack_index(index)
editor = self.data[index].editor
if focus... | [
"Set current filename and return the associated editor instance."
] |
Please provide a description of the function:def is_file_opened(self, filename=None):
if filename is None:
# Is there any file opened?
return len(self.data) > 0
else:
return self.has_filename(filename) | [
"Return if filename is in the editor stack.\r\n\r\n Args:\r\n filename: Name of the file to search for. If filename is None,\r\n then checks if any file is open.\r\n\r\n Returns:\r\n True: If filename is None and a file is open.\r\n False: If filename i... |
Please provide a description of the function:def get_index_from_filename(self, filename):
filenames = [d.filename for d in self.data]
return filenames.index(filename) | [
"\r\n Return the position index of a file in the tab bar of the editorstack\r\n from its name.\r\n "
] |
Please provide a description of the function:def move_editorstack_data(self, start, end):
if start < 0 or end < 0:
return
else:
steps = abs(end - start)
direction = (end-start) // steps # +1 for right, -1 for left
data = self.data
s... | [
"Reorder editorstack.data so it is synchronized with the tab bar when\r\n tabs are moved."
] |
Please provide a description of the function:def close_file(self, index=None, force=False):
current_index = self.get_stack_index()
count = self.get_stack_count()
if index is None:
if count > 0:
index = current_index
else:
... | [
"Close file (index=None -> close current file)\r\n Keep current file index unchanged (if current file\r\n that is being closed)"
] |
Please provide a description of the function:def poll_open_file_languages(self):
languages = []
for index in range(self.get_stack_count()):
languages.append(
self.tabs.widget(index).language.lower())
return set(languages) | [
"Get list of current opened files' languages"
] |
Please provide a description of the function:def notify_server_ready(self, language, config):
for index in range(self.get_stack_count()):
editor = self.tabs.widget(index)
if editor.language.lower() == language:
editor.start_lsp_services(config) | [
"Notify language server availability to code editors."
] |
Please provide a description of the function:def close_all_right(self):
num = self.get_stack_index()
n = self.get_stack_count()
for i in range(num, n-1):
self.close_file(num+1) | [
" Close all files opened to the right "
] |
Please provide a description of the function:def close_all_but_this(self):
self.close_all_right()
for i in range(0, self.get_stack_count()-1 ):
self.close_file(0) | [
"Close all files but the current one"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.