Code stringlengths 103 85.9k | Summary listlengths 0 94 |
|---|---|
Please provide a description of the function:def closing_plugin(self, cancelable=False):
self.save_history()
self.set_option('zoom_factor',
self.pydocbrowser.webview.get_zoom_factor())
return True | [
"Perform actions before parent main window is closed"
] |
Please provide a description of the function:def synchronize(self):
answer = QMessageBox.question(self, _("Synchronize"),
_("This will synchronize Spyder's path list with "
"<b>PYTHONPATH</b> environment variable for current user, "
"allowing you... | [
"\r\n Synchronize Spyder's path list with PYTHONPATH environment variable\r\n Only apply to: current user, on Windows platforms\r\n "
] |
Please provide a description of the function:def update_list(self):
self.listwidget.clear()
for name in self.pathlist+self.ro_pathlist:
item = QListWidgetItem(name)
item.setIcon(ima.icon('DirClosedIcon'))
if name in self.ro_pathlist:
it... | [
"Update path list"
] |
Please provide a description of the function:def refresh(self, row=None):
for widget in self.selection_widgets:
widget.setEnabled(self.listwidget.currentItem() is not None)
not_empty = self.listwidget.count() > 0
if self.sync_button is not None:
self.sync_b... | [
"Refresh widget"
] |
Please provide a description of the function:def eventFilter(self, widget, event):
if ((event.type() == QEvent.MouseButtonPress and
not self.geometry().contains(event.globalPos())) or
(event.type() == QEvent.KeyPress and
event.key() == Qt.Key_Escap... | [
"Catch clicks outside the object and ESC key press."
] |
Please provide a description of the function:def edit_tab(self, index):
# Sets focus, shows cursor
self.setFocus(True)
# Updates tab index
self.tab_index = index
# Gets tab size and shrinks to avoid overlapping tab borders
rect = self.main.tabRect(in... | [
"Activate the edit tab."
] |
Please provide a description of the function:def edit_finished(self):
# Hides editor
self.hide()
if isinstance(self.tab_index, int) and self.tab_index >= 0:
# We are editing a valid tab, update name
tab_text = to_text_string(self.text())
self... | [
"On clean exit, update tab name."
] |
Please provide a description of the function:def mousePressEvent(self, event):
if event.button() == Qt.LeftButton:
self.__drag_start_pos = QPoint(event.pos())
QTabBar.mousePressEvent(self, event) | [
"Reimplement Qt method"
] |
Please provide a description of the function:def dragEnterEvent(self, event):
mimeData = event.mimeData()
formats = list(mimeData.formats())
if "parent-id" in formats and \
int(mimeData.data("parent-id")) == id(self.ancestor):
event.acceptProposedAction()
... | [
"Override Qt method"
] |
Please provide a description of the function:def dropEvent(self, event):
mimeData = event.mimeData()
index_from = int(mimeData.data("source-index"))
index_to = self.tabAt(event.pos())
if index_to == -1:
index_to = self.count()
if int(mimeData.data("tab... | [
"Override Qt method"
] |
Please provide a description of the function:def mouseDoubleClickEvent(self, event):
if self.rename_tabs is True and \
event.buttons() == Qt.MouseButtons(Qt.LeftButton):
# Tab index
index = self.tabAt(event.pos())
if index >= 0:
... | [
"Override Qt method to trigger the tab name editor."
] |
Please provide a description of the function:def update_browse_tabs_menu(self):
self.browse_tabs_menu.clear()
names = []
dirnames = []
for index in range(self.count()):
if self.menu_use_tooltips:
text = to_text_string(self.tabToolTip(index))
... | [
"Update browse tabs menu"
] |
Please provide a description of the function:def set_corner_widgets(self, corner_widgets):
assert isinstance(corner_widgets, dict)
assert all(key in (Qt.TopLeftCorner, Qt.TopRightCorner)
for key in corner_widgets)
self.corner_widgets.update(corner_widgets)
... | [
"\r\n Set tabs corner widgets\r\n corner_widgets: dictionary of (corner, widgets)\r\n corner: Qt.TopLeftCorner or Qt.TopRightCorner\r\n widgets: list of widgets (may contains integers to add spacings)\r\n "
] |
Please provide a description of the function:def contextMenuEvent(self, event):
self.setCurrentIndex(self.tabBar().tabAt(event.pos()))
if self.menu:
self.menu.popup(event.globalPos()) | [
"Override Qt method"
] |
Please provide a description of the function:def mousePressEvent(self, event):
if event.button() == Qt.MidButton:
index = self.tabBar().tabAt(event.pos())
if index >= 0:
self.sig_close_tab.emit(index)
event.accept()
return
... | [
"Override Qt method"
] |
Please provide a description of the function:def keyPressEvent(self, event):
ctrl = event.modifiers() & Qt.ControlModifier
key = event.key()
handled = False
if ctrl and self.count() > 0:
index = self.currentIndex()
if key == Qt.Key_PageUp:
... | [
"Override Qt method"
] |
Please provide a description of the function:def tab_navigate(self, delta=1):
if delta > 0 and self.currentIndex() == self.count()-1:
index = delta-1
elif delta < 0 and self.currentIndex() == 0:
index = self.count()+delta
else:
index = self.cur... | [
"Ctrl+Tab"
] |
Please provide a description of the function:def set_close_function(self, func):
state = func is not None
if state:
self.sig_close_tab.connect(func)
try:
# Assuming Qt >= 4.5
QTabWidget.setTabsClosable(self, state)
self.tabCloseReq... | [
"Setting Tabs close function\r\n None -> tabs are not closable"
] |
Please provide a description of the function:def move_tab(self, index_from, index_to):
self.move_data.emit(index_from, index_to)
tip, text = self.tabToolTip(index_from), self.tabText(index_from)
icon, widget = self.tabIcon(index_from), self.widget(index_from)
current_widg... | [
"Move tab inside a tabwidget"
] |
Please provide a description of the function:def move_tab_from_another_tabwidget(self, tabwidget_from,
index_from, index_to):
# We pass self object IDs as QString objs, because otherwise it would
# depend on the platform: long for 64bit... | [
"Move tab from a tabwidget to another"
] |
Please provide a description of the function:def get_run_configuration(fname):
configurations = _get_run_configurations()
for filename, options in configurations:
if fname == filename:
runconf = RunConfiguration()
runconf.set(options)
return runconf | [
"Return script *fname* run configuration"
] |
Please provide a description of the function:def select_directory(self):
basedir = to_text_string(self.wd_edit.text())
if not osp.isdir(basedir):
basedir = getcwd_or_home()
directory = getexistingdirectory(self, _("Select directory"), basedir)
if directory:
... | [
"Select directory"
] |
Please provide a description of the function:def add_widgets(self, *widgets_or_spacings):
layout = self.layout()
for widget_or_spacing in widgets_or_spacings:
if isinstance(widget_or_spacing, int):
layout.addSpacing(widget_or_spacing)
else:
... | [
"Add widgets/spacing to dialog vertical layout"
] |
Please provide a description of the function:def add_button_box(self, stdbtns):
bbox = QDialogButtonBox(stdbtns)
run_btn = bbox.addButton(_("Run"), QDialogButtonBox.AcceptRole)
run_btn.clicked.connect(self.run_btn_clicked)
bbox.accepted.connect(self.accept)
bbox.re... | [
"Create dialog button box and add it to the dialog layout"
] |
Please provide a description of the function:def setup(self, fname):
self.filename = fname
self.runconfigoptions = RunConfigOptions(self)
self.runconfigoptions.set(RunConfiguration(fname).get())
self.add_widgets(self.runconfigoptions)
self.add_button_box(QDialogBut... | [
"Setup Run Configuration dialog with filename *fname*"
] |
Please provide a description of the function:def accept(self):
if not self.runconfigoptions.is_valid():
return
configurations = _get_run_configurations()
configurations.insert(0, (self.filename, self.runconfigoptions.get()))
_set_run_configurations(configuratio... | [
"Reimplement Qt method"
] |
Please provide a description of the function:def setup(self, fname):
combo_label = QLabel(_("Select a run configuration:"))
self.combo = QComboBox()
self.combo.setMaxVisibleItems(20)
self.combo.setSizeAdjustPolicy(QComboBox.AdjustToMinimumContentsLength)
self.combo... | [
"Setup Run Configuration dialog with filename *fname*"
] |
Please provide a description of the function:def accept(self):
configurations = []
for index in range(self.stack.count()):
filename = to_text_string(self.combo.itemText(index))
runconfigoptions = self.stack.widget(index)
if index == self.stack.currentIn... | [
"Reimplement Qt method"
] |
Please provide a description of the function:def paintEvent(self, event):
painter = QPainter(self)
painter.fillRect(event.rect(), self.editor.sideareas_color)
# This is needed to make that the font size of line numbers
# be the same as the text one when zooming
# See Iss... | [
"Override Qt method.\n\n Painting line number area\n "
] |
Please provide a description of the function:def mouseMoveEvent(self, event):
line_number = self.editor.get_linenumber_from_mouse_event(event)
block = self.editor.document().findBlockByNumber(line_number-1)
data = block.userData()
# this disables pyflakes messages if there is a... | [
"Override Qt method.\n\n Show code analisis, if left button pressed select lines.\n "
] |
Please provide a description of the function:def mousePressEvent(self, event):
line_number = self.editor.get_linenumber_from_mouse_event(event)
self._pressed = line_number
self._released = line_number
self.editor.select_lines(self._pressed,
self.... | [
"Override Qt method\n\n Select line, and starts selection\n "
] |
Please provide a description of the function:def compute_width(self):
if not self._enabled:
return 0
digits = 1
maxb = max(1, self.editor.blockCount())
while maxb >= 10:
maxb /= 10
digits += 1
if self._margin:
margin = 3+se... | [
"Compute and return line number area width"
] |
Please provide a description of the function:def setup_margins(self, linenumbers=True, markers=True):
self._margin = linenumbers
self._markers_margin = markers
self.set_enabled(linenumbers or markers) | [
"\n Setup margin settings\n (except font, now set in editor.set_font)\n "
] |
Please provide a description of the function:def process_python_symbol_data(oedata):
symbol_list = []
for key in oedata:
val = oedata[key]
if val and key != 'found_cell_separators':
if val.is_class_or_function():
symbol_list.append((key, val.def_name, val.fold_le... | [
"Returns a list with line number, definition name, fold and token."
] |
Please provide a description of the function:def get_python_symbol_icons(oedata):
class_icon = ima.icon('class')
method_icon = ima.icon('method')
function_icon = ima.icon('function')
private_icon = ima.icon('private1')
super_private_icon = ima.icon('private2')
symbols = process_python_symb... | [
"Return a list of icons for oedata of a python file."
] |
Please provide a description of the function:def shorten_paths(path_list, is_unsaved):
# TODO: at the end, if the path is too long, should do a more dumb kind of
# shortening, but not completely dumb.
# Convert the path strings to a list of tokens and start building the
# new_path using the drive
... | [
"\n Takes a list of paths and tries to \"intelligently\" shorten them all. The\n aim is to make it clear to the user where the paths differ, as that is\n likely what they care about. Note that this operates on a list of paths\n not on individual paths.\n\n If the path ends in an actual file name, it ... |
Please provide a description of the function:def focusOutEvent(self, event):
self.clicked_outside = True
return super(QLineEdit, self).focusOutEvent(event) | [
"\n Detect when the focus goes out of this widget.\n\n This is used to make the file switcher leave focus on the\n last selected file by the user.\n "
] |
Please provide a description of the function:def save_initial_state(self):
paths = self.paths
self.initial_widget = self.get_widget()
self.initial_cursors = {}
for i, editor in enumerate(self.widgets):
if editor is self.initial_widget:
self.initial_p... | [
"Save initial cursors and initial active widget."
] |
Please provide a description of the function:def restore_initial_state(self):
self.list.clear()
self.is_visible = False
widgets = self.widgets_by_path
if not self.edit.clicked_outside:
for path in self.initial_cursors:
cursor = self.initial_cursors[p... | [
"Restores initial cursors and initial active editor."
] |
Please provide a description of the function:def set_dialog_position(self):
parent = self.parent()
geo = parent.geometry()
width = self.list.width() # This has been set in setup
left = parent.geometry().width()/2 - width/2
# Note: the +1 pixel on the top makes it look b... | [
"Positions the file switcher dialog."
] |
Please provide a description of the function:def get_item_size(self, content):
strings = []
if content:
for rich_text in content:
label = QLabel(rich_text)
label.setTextFormat(Qt.PlainText)
strings.append(label.text())
... | [
"\n Get the max size (width and height) for the elements of a list of\n strings as a QLabel.\n "
] |
Please provide a description of the function:def fix_size(self, content):
# Update size of dialog based on relative size of the parent
if content:
width, height = self.get_item_size(content)
# Width
parent = self.parent()
relative_width = parent.... | [
"\n Adjusts the width and height of the file switcher\n based on the relative size of the parent and content.\n "
] |
Please provide a description of the function:def select_row(self, steps):
row = self.current_row() + steps
if 0 <= row < self.count():
self.set_current_row(row) | [
"Select row in list widget based on a number of steps with direction.\n\n Steps can be positive (next rows) or negative (previous rows).\n "
] |
Please provide a description of the function:def previous_row(self):
if self.mode == self.SYMBOL_MODE:
self.select_row(-1)
return
prev_row = self.current_row() - 1
if prev_row >= 0:
title = self.list.item(prev_row).text()
else:
tit... | [
"Select previous row in list widget."
] |
Please provide a description of the function:def next_row(self):
if self.mode == self.SYMBOL_MODE:
self.select_row(+1)
return
next_row = self.current_row() + 1
if next_row < self.count():
if '</b></big><br>' in self.list.item(next_row).text():
... | [
"Select next row in list widget."
] |
Please provide a description of the function:def get_stack_index(self, stack_index, plugin_index):
other_plugins_count = sum([other_tabs[0].count() \
for other_tabs in \
self.plugins_tabs[:plugin_index]])
real_index = stack_i... | [
"Get the real index of the selected item."
] |
Please provide a description of the function:def get_plugin_data(self, plugin):
# The data object is named "data" in the editor plugin while it is
# named "clients" in the notebook plugin.
try:
data = plugin.get_current_tab_manager().data
except AttributeError:
... | [
"Get the data object of the plugin's current tab manager."
] |
Please provide a description of the function:def get_plugin_tabwidget(self, plugin):
# The tab widget is named "tabs" in the editor plugin while it is
# named "tabwidget" in the notebook plugin.
try:
tabwidget = plugin.get_current_tab_manager().tabs
except AttributeE... | [
"Get the tabwidget of the plugin's current tab manager."
] |
Please provide a description of the function:def get_widget(self, index=None, path=None, tabs=None):
if (index and tabs) or (path and tabs):
return tabs.widget(index)
elif self.plugin:
return self.get_plugin_tabwidget(self.plugin).currentWidget()
else:
... | [
"Get widget by index.\n\n If no tabs and index specified the current active widget is returned.\n "
] |
Please provide a description of the function:def set_editor_cursor(self, editor, cursor):
pos = cursor.position()
anchor = cursor.anchor()
new_cursor = QTextCursor()
if pos == anchor:
new_cursor.movePosition(pos)
else:
new_cursor.movePosition(anc... | [
"Set the cursor of an editor."
] |
Please provide a description of the function:def goto_line(self, line_number):
if line_number:
line_number = int(line_number)
try:
self.plugin.go_to_line(line_number)
except AttributeError:
pass | [
"Go to specified line number in current active editor."
] |
Please provide a description of the function:def item_selection_changed(self):
row = self.current_row()
if self.count() and row >= 0:
if '</b></big><br>' in self.list.currentItem().text() and row == 0:
self.next_row()
if self.mode == self.FILE_MODE:
... | [
"List widget item selection change handler."
] |
Please provide a description of the function:def setup_file_list(self, filter_text, current_path):
short_paths = shorten_paths(self.paths, self.save_status)
paths = self.paths
icons = self.icons
results = []
trying_for_line_number = ':' in filter_text
# Get opti... | [
"Setup list widget content for file list display."
] |
Please provide a description of the function:def setup_symbol_list(self, filter_text, current_path):
# Get optional symbol name
filter_text, symbol_text = filter_text.split('@')
# Fetch the Outline explorer data, get the icons and values
oedata = self.get_symbol_list()
... | [
"Setup list widget content for symbol list display."
] |
Please provide a description of the function:def setup(self):
if len(self.plugins_tabs) == 0:
self.close()
return
self.list.clear()
current_path = self.current_path
filter_text = self.filter_text
# Get optional line or symbol to define mode and ... | [
"Setup list widget content."
] |
Please provide a description of the function:def add_plugin(self, plugin, tabs, data, icon):
self.plugins_tabs.append((tabs, plugin))
self.plugins_data.append((data, icon))
self.plugins_instances.append(plugin) | [
"Add a plugin to display its files."
] |
Please provide a description of the function:def is_binary(filename):
logger.debug('is_binary: %(filename)r', locals())
# Check if the file extension is in a list of known binary types
binary_extensions = ['pyc', 'iso', 'zip', 'pdf']
for ext in binary_extensions:
if filename.endswith(ext):... | [
"\n :param filename: File to check.\n :returns: True if it's a binary file, otherwise False.\n "
] |
Please provide a description of the function:def get_vcs_info(path):
for info in SUPPORTED:
vcs_path = osp.join(path, info['rootdir'])
if osp.isdir(vcs_path):
return info | [
"Return support status dict if path is under VCS root"
] |
Please provide a description of the function:def get_vcs_root(path):
previous_path = path
while get_vcs_info(path) is None:
path = abspardir(path)
if path == previous_path:
return
else:
previous_path = path
return osp.abspath(path) | [
"Return VCS root directory path\r\n Return None if path is not within a supported VCS repository"
] |
Please provide a description of the function:def run_vcs_tool(path, action):
info = get_vcs_info(get_vcs_root(path))
tools = info['actions'][action]
for tool, args in tools:
if programs.find_program(tool):
if not running_under_pytest():
programs.run_program(to... | [
"If path is a valid VCS repository, run the corresponding VCS tool\r\n Supported VCS actions: 'commit', 'browse'\r\n Return False if the VCS tool is not installed"
] |
Please provide a description of the function:def get_hg_revision(repopath):
try:
assert osp.isdir(osp.join(repopath, '.hg'))
proc = programs.run_program('hg', ['id', '-nib', repopath])
output, _err = proc.communicate()
# output is now: ('eba7273c69df+ 2015+ default\n', Non... | [
"Return Mercurial revision for the repository located at repopath\r\n Result is a tuple (global, local, branch), with None values on error\r\n For example:\r\n >>> get_hg_revision(\".\")\r\n ('eba7273c69df+', '2015+', 'default')\r\n "
] |
Please provide a description of the function:def get_git_revision(repopath):
try:
git = programs.find_program('git')
assert git is not None and osp.isdir(osp.join(repopath, '.git'))
commit = programs.run_program(git, ['rev-parse', '--short', 'HEAD'],
... | [
"\r\n Return Git revision for the repository located at repopath\r\n \r\n Result is a tuple (latest commit hash, branch), with None values on\r\n error\r\n "
] |
Please provide a description of the function:def get_git_refs(repopath):
tags = []
branches = []
branch = ''
files_modifed = []
if os.path.isfile(repopath):
repopath = os.path.dirname(repopath)
try:
git = programs.find_program('git')
# Files modifie... | [
"\r\n Return Git active branch, state, branches (plus tags).\r\n "
] |
Please provide a description of the function:def is_module_or_package(path):
is_module = osp.isfile(path) and osp.splitext(path)[1] in ('.py', '.pyw')
is_package = osp.isdir(path) and osp.isfile(osp.join(path, '__init__.py'))
return is_module or is_package | [
"Return True if path is a Python module/package"
] |
Please provide a description of the function:def event(self, event):
if (event.type() == QEvent.KeyPress) and (event.key() == Qt.Key_Tab):
self.sig_tab_pressed.emit(True)
self.numpress += 1
if self.numpress == 1:
self.presstimer = QTimer.singleS... | [
"Qt Override.\r\n\r\n Filter tab keys and process double tab keys.\r\n "
] |
Please provide a description of the function:def keyPressEvent(self, event):
if event.key() == Qt.Key_Return or event.key() == Qt.Key_Enter:
if self.add_current_text_if_valid():
self.selected()
self.hide_completer()
elif event.key() == Qt.Key_Es... | [
"Qt Override.\r\n\r\n Handle key press events.\r\n "
] |
Please provide a description of the function:def handle_keypress(self):
if self.numpress == 2:
self.sig_double_tab_pressed.emit(True)
self.numpress = 0 | [
"When hitting tab, it handles if single or double tab"
] |
Please provide a description of the function:def add_text(self, text):
index = self.findText(text)
while index != -1:
self.removeItem(index)
index = self.findText(text)
self.insertItem(0, text)
index = self.findText('')
if index != -1:
... | [
"Add text to combo box: add a new item if text is not found in\r\n combo box items."
] |
Please provide a description of the function:def add_current_text_if_valid(self):
valid = self.is_valid(self.currentText())
if valid or valid is None:
self.add_current_text()
return True
else:
self.set_current_text(self.selected_text) | [
"Add current text to combo box history if valid"
] |
Please provide a description of the function:def show_tip(self, tip=""):
QToolTip.showText(self.mapToGlobal(self.pos()), tip, self) | [
"Show tip"
] |
Please provide a description of the function:def validate(self, qstr, editing=True):
if self.selected_text == qstr and qstr != '':
self.valid.emit(True, True)
return
valid = self.is_valid(qstr)
if editing:
if valid:
self.vali... | [
"Validate entered path"
] |
Please provide a description of the function:def focusInEvent(self, event):
show_status = getattr(self.lineEdit(), 'show_status_icon', None)
if show_status:
show_status()
QComboBox.focusInEvent(self, event) | [
"Handle focus in event restoring to display the status icon."
] |
Please provide a description of the function:def focusOutEvent(self, event):
# Calling asynchronously the 'add_current_text' to avoid crash
# https://groups.google.com/group/spyderlib/browse_thread/thread/2257abf530e210bd
if not self.is_valid():
lineedit = self.lineEdit... | [
"Handle focus out event restoring the last valid selected path."
] |
Please provide a description of the function:def _complete_options(self):
text = to_text_string(self.currentText())
opts = glob.glob(text + "*")
opts = sorted([opt for opt in opts if osp.isdir(opt)])
self.setCompleter(QCompleter(opts, self))
return opts | [
"Find available completion options."
] |
Please provide a description of the function:def double_tab_complete(self):
opts = self._complete_options()
if len(opts) > 1:
self.completer().complete() | [
"If several options available a double tab displays options."
] |
Please provide a description of the function:def tab_complete(self):
opts = self._complete_options()
if len(opts) == 1:
self.set_current_text(opts[0] + os.sep)
self.hide_completer() | [
"\r\n If there is a single option available one tab completes the option.\r\n "
] |
Please provide a description of the function:def is_valid(self, qstr=None):
if qstr is None:
qstr = self.currentText()
return osp.isdir(to_text_string(qstr)) | [
"Return True if string is valid"
] |
Please provide a description of the function:def selected(self):
self.selected_text = self.currentText()
self.valid.emit(True, True)
self.open_dir.emit(self.selected_text) | [
"Action to be executed when a valid item has been selected"
] |
Please provide a description of the function:def add_current_text(self):
text = self.currentText()
if osp.isdir(text) and text:
if text[-1] == os.sep:
text = text[:-1]
self.add_text(text) | [
"\r\n Add current text to combo box history (convenient method).\r\n If path ends in os separator (\"\\\" windows, \"/\" unix) remove it.\r\n "
] |
Please provide a description of the function:def add_tooltip_to_highlighted_item(self, index):
self.setItemData(index, self.itemText(index), Qt.ToolTipRole) | [
"\r\n Add a tooltip showing the full path of the currently highlighted item\r\n of the PathComboBox.\r\n "
] |
Please provide a description of the function:def is_valid(self, qstr=None):
if qstr is None:
qstr = self.currentText()
return QUrl(qstr).isValid() | [
"Return True if string is valid"
] |
Please provide a description of the function:def is_valid(self, qstr=None):
if qstr is None:
qstr = self.currentText()
return osp.isfile(to_text_string(qstr)) | [
"Return True if string is valid"
] |
Please provide a description of the function:def is_valid(self, qstr=None):
if qstr is None:
qstr = self.currentText()
return is_module_or_package(to_text_string(qstr)) | [
"Return True if string is valid"
] |
Please provide a description of the function:def selected(self):
EditableComboBox.selected(self)
self.open_dir.emit(self.currentText()) | [
"Action to be executed when a valid item has been selected"
] |
Please provide a description of the function:def set_historylog(self, historylog):
historylog.add_history(self.shell.history_filename)
self.shell.append_to_history.connect(historylog.append_to_history) | [
"Bind historylog instance to this console\r\n Not used anymore since v2.0"
] |
Please provide a description of the function:def closing_plugin(self, cancelable=False):
self.dialog_manager.close_all()
self.shell.exit_interpreter()
return True | [
"Perform actions before parent main window is closed"
] |
Please provide a description of the function:def get_plugin_actions(self):
quit_action = create_action(self, _("&Quit"),
icon=ima.icon('exit'),
tip=_("Quit"),
triggered=self.quit)
... | [
"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)
# Connecting the following signal once the dockwidget has been created:
self.shell.exception_occurred.connect(se... | [
"Register plugin in Spyder's main window"
] |
Please provide a description of the function:def exception_occurred(self, text, is_traceback):
# Skip errors without traceback or dismiss
if (not is_traceback and self.error_dlg is None) or self.dismiss_error:
return
if CONF.get('main', 'show_internal_errors'):
... | [
"\r\n Exception ocurred in the internal console.\r\n\r\n Show a QDialog or the internal console to warn the user.\r\n "
] |
Please provide a description of the function:def close_error_dlg(self):
if self.error_dlg.dismiss_box.isChecked():
self.dismiss_error = True
self.error_dlg.reject() | [
"Close error dialog."
] |
Please provide a description of the function:def show_syspath(self):
editor = CollectionsEditor(parent=self)
editor.setup(sys.path, title="sys.path", readonly=True,
width=600, icon=ima.icon('syspath'))
self.dialog_manager.show(editor) | [
"Show sys.path"
] |
Please provide a description of the function:def run_script(self, filename=None, silent=False, set_focus=False,
args=None):
if filename is None:
self.shell.interpreter.restore_stds()
filename, _selfilter = getopenfilename(
self, _("Ru... | [
"Run a Python script"
] |
Please provide a description of the function:def go_to_error(self, text):
match = get_error_match(to_text_string(text))
if match:
fname, lnb = match.groups()
self.edit_script(fname, int(lnb)) | [
"Go to error if relevant"
] |
Please provide a description of the function:def edit_script(self, filename=None, goto=-1):
# Called from InternalShell
if not hasattr(self, 'main') \
or not hasattr(self.main, 'editor'):
self.shell.external_editor(filename, goto)
return
if file... | [
"Edit script"
] |
Please provide a description of the function:def execute_lines(self, lines):
self.shell.execute_lines(to_text_string(lines))
self.shell.setFocus() | [
"Execute lines and give focus to shell"
] |
Please provide a description of the function:def change_exteditor(self):
path, valid = QInputDialog.getText(self, _('External editor'),
_('External editor executable path:'),
QLineEdit.Normal,
self.get_option('external_e... | [
"Change external editor path"
] |
Please provide a description of the function:def toggle_wrap_mode(self, checked):
self.shell.toggle_wrap_mode(checked)
self.set_option('wrap', checked) | [
"Toggle wrap mode"
] |
Please provide a description of the function:def toggle_codecompletion(self, checked):
self.shell.set_codecompletion_auto(checked)
self.set_option('codecompletion/auto', checked) | [
"Toggle automatic code completion"
] |
Please provide a description of the function:def dragEnterEvent(self, event):
source = event.mimeData()
if source.hasUrls():
if mimedata2url(source):
event.acceptProposedAction()
else:
event.ignore()
elif source.hasText():
... | [
"Reimplement Qt method\r\n Inform Qt about the types of data that the widget accepts"
] |
Please provide a description of the function:def dropEvent(self, event):
source = event.mimeData()
if source.hasUrls():
pathlist = mimedata2url(source)
self.shell.drop_pathlist(pathlist)
elif source.hasText():
lines = to_text_string(source.text... | [
"Reimplement Qt method\r\n Unpack dropped data and handle it"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.