INSTRUCTION stringlengths 1 8.43k | RESPONSE stringlengths 75 104k |
|---|---|
Add current text to combo box history if valid | def add_current_text_if_valid(self):
"""Add current text to combo box history if valid"""
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) |
Show tip | def show_tip(self, tip=""):
"""Show tip"""
QToolTip.showText(self.mapToGlobal(self.pos()), tip, self) |
Validate entered path | def validate(self, qstr, editing=True):
"""Validate entered path"""
if self.selected_text == qstr and qstr != '':
self.valid.emit(True, True)
return
valid = self.is_valid(qstr)
if editing:
if valid:
self.valid.emit(True, False... |
Handle focus in event restoring to display the status icon. | def focusInEvent(self, event):
"""Handle focus in event restoring to display the status icon."""
show_status = getattr(self.lineEdit(), 'show_status_icon', None)
if show_status:
show_status()
QComboBox.focusInEvent(self, event) |
Handle focus out event restoring the last valid selected path. | def focusOutEvent(self, event):
"""Handle focus out event restoring the last valid selected path."""
# Calling asynchronously the 'add_current_text' to avoid crash
# https://groups.google.com/group/spyderlib/browse_thread/thread/2257abf530e210bd
if not self.is_valid():
l... |
Find available completion options. | def _complete_options(self):
"""Find available completion options."""
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 |
If several options available a double tab displays options. | def double_tab_complete(self):
"""If several options available a double tab displays options."""
opts = self._complete_options()
if len(opts) > 1:
self.completer().complete() |
If there is a single option available one tab completes the option. | def tab_complete(self):
"""
If there is a single option available one tab completes the option.
"""
opts = self._complete_options()
if len(opts) == 1:
self.set_current_text(opts[0] + os.sep)
self.hide_completer() |
Return True if string is valid | def is_valid(self, qstr=None):
"""Return True if string is valid"""
if qstr is None:
qstr = self.currentText()
return osp.isdir(to_text_string(qstr)) |
Action to be executed when a valid item has been selected | def selected(self):
"""Action to be executed when a valid item has been selected"""
self.selected_text = self.currentText()
self.valid.emit(True, True)
self.open_dir.emit(self.selected_text) |
Add current text to combo box history ( convenient method ). If path ends in os separator ( \ windows/ unix ) remove it. | def add_current_text(self):
"""
Add current text to combo box history (convenient method).
If path ends in os separator ("\" windows, "/" unix) remove it.
"""
text = self.currentText()
if osp.isdir(text) and text:
if text[-1] == os.sep:
... |
Add a tooltip showing the full path of the currently highlighted item of the PathComboBox. | def add_tooltip_to_highlighted_item(self, index):
"""
Add a tooltip showing the full path of the currently highlighted item
of the PathComboBox.
"""
self.setItemData(index, self.itemText(index), Qt.ToolTipRole) |
Return True if string is valid | def is_valid(self, qstr=None):
"""Return True if string is valid"""
if qstr is None:
qstr = self.currentText()
return QUrl(qstr).isValid() |
Return True if string is valid | def is_valid(self, qstr=None):
"""Return True if string is valid"""
if qstr is None:
qstr = self.currentText()
return osp.isfile(to_text_string(qstr)) |
Return True if string is valid | def is_valid(self, qstr=None):
"""Return True if string is valid"""
if qstr is None:
qstr = self.currentText()
return is_module_or_package(to_text_string(qstr)) |
Action to be executed when a valid item has been selected | def selected(self):
"""Action to be executed when a valid item has been selected"""
EditableComboBox.selected(self)
self.open_dir.emit(self.currentText()) |
Bind historylog instance to this console Not used anymore since v2. 0 | def set_historylog(self, historylog):
"""Bind historylog instance to this console
Not used anymore since v2.0"""
historylog.add_history(self.shell.history_filename)
self.shell.append_to_history.connect(historylog.append_to_history) |
Perform actions before parent main window is closed | def closing_plugin(self, cancelable=False):
"""Perform actions before parent main window is closed"""
self.dialog_manager.close_all()
self.shell.exit_interpreter()
return True |
Return a list of actions related to plugin | def get_plugin_actions(self):
"""Return a list of actions related to plugin"""
quit_action = create_action(self, _("&Quit"),
icon=ima.icon('exit'),
tip=_("Quit"),
triggered=self.quit)
... |
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)
# Connecting the following signal once the dockwidget has been created:
self.shell.exception_occurred.connect(se... |
Exception ocurred in the internal console. Show a QDialog or the internal console to warn the user. | def exception_occurred(self, text, is_traceback):
"""
Exception ocurred in the internal console.
Show a QDialog or the internal console to warn the user.
"""
# Skip errors without traceback or dismiss
if (not is_traceback and self.error_dlg is None) or self.dismis... |
Close error dialog. | def close_error_dlg(self):
"""Close error dialog."""
if self.error_dlg.dismiss_box.isChecked():
self.dismiss_error = True
self.error_dlg.reject() |
Show sys. path | def show_syspath(self):
"""Show sys.path"""
editor = CollectionsEditor(parent=self)
editor.setup(sys.path, title="sys.path", readonly=True,
width=600, icon=ima.icon('syspath'))
self.dialog_manager.show(editor) |
Run a Python script | def run_script(self, filename=None, silent=False, set_focus=False,
args=None):
"""Run a Python script"""
if filename is None:
self.shell.interpreter.restore_stds()
filename, _selfilter = getopenfilename(
self, _("Run Python script"), g... |
Go to error if relevant | def go_to_error(self, text):
"""Go to error if relevant"""
match = get_error_match(to_text_string(text))
if match:
fname, lnb = match.groups()
self.edit_script(fname, int(lnb)) |
Edit script | def edit_script(self, filename=None, goto=-1):
"""Edit script"""
# Called from InternalShell
if not hasattr(self, 'main') \
or not hasattr(self.main, 'editor'):
self.shell.external_editor(filename, goto)
return
if filename is not None:
... |
Execute lines and give focus to shell | def execute_lines(self, lines):
"""Execute lines and give focus to shell"""
self.shell.execute_lines(to_text_string(lines))
self.shell.setFocus() |
Change external editor path | def change_exteditor(self):
"""Change external editor path"""
path, valid = QInputDialog.getText(self, _('External editor'),
_('External editor executable path:'),
QLineEdit.Normal,
self.get_option('external_editor/path')... |
Toggle wrap mode | def toggle_wrap_mode(self, checked):
"""Toggle wrap mode"""
self.shell.toggle_wrap_mode(checked)
self.set_option('wrap', checked) |
Toggle automatic code completion | def toggle_codecompletion(self, checked):
"""Toggle automatic code completion"""
self.shell.set_codecompletion_auto(checked)
self.set_option('codecompletion/auto', checked) |
Reimplement Qt method Inform Qt about the types of data that the widget accepts | def dragEnterEvent(self, event):
"""Reimplement Qt method
Inform Qt about the types of data that the widget accepts"""
source = event.mimeData()
if source.hasUrls():
if mimedata2url(source):
event.acceptProposedAction()
else:
... |
Reimplement Qt method Unpack dropped data and handle it | def dropEvent(self, event):
"""Reimplement Qt method
Unpack dropped data and handle it"""
source = event.mimeData()
if source.hasUrls():
pathlist = mimedata2url(source)
self.shell.drop_pathlist(pathlist)
elif source.hasText():
lines = t... |
Function executed when running the script with the - install switch | def install():
"""Function executed when running the script with the -install switch"""
# Create Spyder start menu folder
# Don't use CSIDL_COMMON_PROGRAMS because it requres admin rights
# This is consistent with use of CSIDL_DESKTOPDIRECTORY below
# CSIDL_COMMON_PROGRAMS =
# C:\ProgramDa... |
Function executed when running the script with the - remove switch | def remove():
"""Function executed when running the script with the -remove switch"""
current = True # only affects current user
root = winreg.HKEY_CURRENT_USER if current else winreg.HKEY_LOCAL_MACHINE
for key in (KEY_C1 % ("", EWS), KEY_C1 % ("NoCon", EWS),
KEY_C0 % ("", EWS), KE... |
This function generates a list of tours. The index argument is used to retrieve a particular tour. If None is passed it will return the full list of tours. If instead - 1 is given this function will return a test tour To add more tours a new variable needs to be created to hold the list of dicts and the tours variable ... | def get_tour(index):
"""
This function generates a list of tours.
The index argument is used to retrieve a particular tour. If None is
passed, it will return the full list of tours. If instead -1 is given,
this function will return a test tour
To add more tours a new variable needs... |
Override Qt method | def paintEvent(self, event):
"""Override Qt method"""
painter = QPainter(self)
painter.setRenderHint(QPainter.Antialiasing)
# Decoration
painter.fillPath(self.path_current, QBrush(self.color))
painter.strokePath(self.path_decoration, QPen(self.color_decoration,
... |
Override Qt method | def reject(self):
"""Override Qt method"""
if not self.is_fade_running():
key = Qt.Key_Escape
self.key_pressed = key
self.sig_key_pressed.emit() |
override Qt method | def mousePressEvent(self, event):
"""override Qt method"""
# Raise the main application window on click
self.parent.raise_()
self.raise_()
if event.button() == Qt.RightButton:
pass |
Set data that is displayed in each step of the tour. | def _set_data(self):
"""Set data that is displayed in each step of the tour."""
self.setting_data = True
step, steps, frames = self.step_current, self.steps, self.frames
current = '{0}/{1}'.format(step + 1, steps)
frame = frames[step]
combobox_frames = [u"{0}. {1}... |
Confirm if the tour loses focus and hides the tips. | def lost_focus(self):
"""Confirm if the tour loses focus and hides the tips."""
if (self.is_running and not self.any_has_focus() and
not self.setting_data and not self.hidden):
self.hide_tips() |
Confirm if the tour regains focus and unhides the tips. | def gain_focus(self):
"""Confirm if the tour regains focus and unhides the tips."""
if (self.is_running and self.any_has_focus() and
not self.setting_data and self.hidden):
self.unhide_tips() |
Returns if tour or any of its components has focus. | def any_has_focus(self):
"""Returns if tour or any of its components has focus."""
f = (self.hasFocus() or self.parent.hasFocus() or
self.tips.hasFocus() or self.canvas.hasFocus())
return f |
Reimplemented to handle communications between the figure explorer and the kernel. | def _handle_display_data(self, msg):
"""
Reimplemented to handle communications between the figure explorer
and the kernel.
"""
img = None
data = msg['content']['data']
if 'image/svg+xml' in data:
fmt = 'image/svg+xml'
img = data['image/svg... |
Get file language from filename | def get_file_language(filename, text=None):
"""Get file language from filename"""
ext = osp.splitext(filename)[1]
if ext.startswith('.'):
ext = ext[1:] # file extension with leading dot
language = ext
if not ext:
if text is None:
text, _enc = encoding.read(filenam... |
Line edit s text has changed | def text_has_changed(self, text):
"""Line edit's text has changed"""
text = to_text_string(text)
if text:
self.lineno = int(text)
else:
self.lineno = None |
Save fig to fname in the format specified by fmt. | def save_figure_tofile(fig, fmt, fname):
"""Save fig to fname in the format specified by fmt."""
root, ext = osp.splitext(fname)
if ext == '.png' and fmt == 'image/svg+xml':
qimg = svg_to_image(fig)
qimg.save(fname)
else:
if fmt == 'image/svg+xml' and is_unicode(fig):
... |
Append a number to root to form a filename that does not already exist in dirname. | def get_unique_figname(dirname, root, ext):
"""
Append a number to "root" to form a filename that does not already exist
in "dirname".
"""
i = 1
figname = root + '_%d' % i + ext
while True:
if osp.exists(osp.join(dirname, figname)):
i += 1
figname = root + '_%... |
Setup the figure browser with provided settings. | def setup(self, mute_inline_plotting=None, show_plot_outline=None):
"""Setup the figure browser with provided settings."""
assert self.shellwidget is not None
self.mute_inline_plotting = mute_inline_plotting
self.show_plot_outline = show_plot_outline
if self.figviewer is not No... |
Setup the toolbar | def setup_toolbar(self):
"""Setup the toolbar"""
savefig_btn = create_toolbutton(
self, icon=ima.icon('filesave'),
tip=_("Save Image As..."),
triggered=self.save_figure)
saveall_btn = create_toolbutton(
self, icon=ima.icon('save_al... |
Setup the actions to show in the cog menu. | def setup_option_actions(self, mute_inline_plotting, show_plot_outline):
"""Setup the actions to show in the cog menu."""
self.setup_in_progress = True
self.mute_inline_action = create_action(
self, _("Mute inline plotting"),
tip=_("Mute inline plotting in the ipython con... |
Create shortcuts for this widget. | def create_shortcuts(self):
"""Create shortcuts for this widget."""
# Configurable
copyfig = config_shortcut(self.copy_figure, context='plots',
name='copy', parent=self)
prevfig = config_shortcut(self.go_previous_thumbnail, context='plots',
... |
Handle when the value of an option has changed | def option_changed(self, option, value):
"""Handle when the value of an option has changed"""
setattr(self, to_text_string(option), value)
self.shellwidget.set_namespace_view_settings()
if self.setup_in_progress is False:
self.sig_option_changed.emit(option, value) |
Draw a frame around the figure viewer if state is True. | def show_fig_outline_in_viewer(self, state):
"""Draw a frame around the figure viewer if state is True."""
if state is True:
self.figviewer.figcanvas.setStyleSheet(
"FigureCanvas{border: 1px solid lightgrey;}")
else:
self.figviewer.figcanvas.setStyleSh... |
Bind the shellwidget instance to the figure browser | def set_shellwidget(self, shellwidget):
"""Bind the shellwidget instance to the figure browser"""
self.shellwidget = shellwidget
shellwidget.set_figurebrowser(self)
shellwidget.sig_new_inline_figure.connect(self._handle_new_figure) |
Copy figure from figviewer to clipboard. | def copy_figure(self):
"""Copy figure from figviewer to clipboard."""
if self.figviewer and self.figviewer.figcanvas.fig:
self.figviewer.figcanvas.copy_figure() |
Setup the FigureCanvas. | def setup_figcanvas(self):
"""Setup the FigureCanvas."""
self.figcanvas = FigureCanvas(background_color=self.background_color)
self.figcanvas.installEventFilter(self)
self.setWidget(self.figcanvas) |
Set a new figure in the figure canvas. | def load_figure(self, fig, fmt):
"""Set a new figure in the figure canvas."""
self.figcanvas.load_figure(fig, fmt)
self.scale_image()
self.figcanvas.repaint() |
A filter to control the zooming and panning of the figure canvas. | def eventFilter(self, widget, event):
"""A filter to control the zooming and panning of the figure canvas."""
# ---- Zooming
if event.type() == QEvent.Wheel:
modifiers = QApplication.keyboardModifiers()
if modifiers == Qt.ControlModifier:
if event.angleDe... |
Scale the image up by one scale step. | def zoom_in(self):
"""Scale the image up by one scale step."""
if self._scalefactor <= self._sfmax:
self._scalefactor += 1
self.scale_image()
self._adjust_scrollbar(self._scalestep)
self.sig_zoom_changed.emit(self.get_scaling()) |
Scale the image down by one scale step. | def zoom_out(self):
"""Scale the image down by one scale step."""
if self._scalefactor >= self._sfmin:
self._scalefactor -= 1
self.scale_image()
self._adjust_scrollbar(1/self._scalestep)
self.sig_zoom_changed.emit(self.get_scaling()) |
Scale the image size. | def scale_image(self):
"""Scale the image size."""
new_width = int(self.figcanvas.fwidth *
self._scalestep ** self._scalefactor)
new_height = int(self.figcanvas.fheight *
self._scalestep ** self._scalefactor)
self.figcanvas.setFixedSize(ne... |
Adjust the scrollbar position to take into account the zooming of the figure. | def _adjust_scrollbar(self, f):
"""
Adjust the scrollbar position to take into account the zooming of
the figure.
"""
# Adjust horizontal scrollbar :
hb = self.horizontalScrollBar()
hb.setValue(int(f * hb.value() + ((f - 1) * hb.pageStep()/2)))
# Adjust t... |
Setup the main layout of the widget. | def setup_gui(self):
"""Setup the main layout of the widget."""
scrollarea = self.setup_scrollarea()
up_btn, down_btn = self.setup_arrow_buttons()
self.setFixedWidth(150)
layout = QVBoxLayout(self)
layout.setContentsMargins(0, 0, 0, 0)
layout.setSpacing(0)
... |
Setup the scrollarea that will contain the FigureThumbnails. | def setup_scrollarea(self):
"""Setup the scrollarea that will contain the FigureThumbnails."""
self.view = QWidget()
self.scene = QGridLayout(self.view)
self.scene.setColumnStretch(0, 100)
self.scene.setColumnStretch(2, 100)
self.scrollarea = QScrollArea()
self.... |
Setup the up and down arrow buttons that are placed at the top and bottom of the scrollarea. | def setup_arrow_buttons(self):
"""
Setup the up and down arrow buttons that are placed at the top and
bottom of the scrollarea.
"""
# Get the height of the up/down arrow of the default vertical
# scrollbar :
vsb = self.scrollarea.verticalScrollBar()
style ... |
Save all the figures to a file. | def save_all_figures_as(self):
"""Save all the figures to a file."""
self.redirect_stdio.emit(False)
dirname = getexistingdirectory(self, caption='Save all figures',
basedir=getcwd_or_home())
self.redirect_stdio.emit(True)
if dirname:
... |
Save all figure in dirname. | def save_all_figures_todir(self, dirname):
"""Save all figure in dirname."""
fignames = []
for thumbnail in self._thumbnails:
fig = thumbnail.canvas.fig
fmt = thumbnail.canvas.fmt
fext = {'image/png': '.png',
'image/jpeg': '.jpg',
... |
Save the currently selected figure. | def save_current_figure_as(self):
"""Save the currently selected figure."""
if self.current_thumbnail is not None:
self.save_figure_as(self.current_thumbnail.canvas.fig,
self.current_thumbnail.canvas.fmt) |
Save the figure to a file. | def save_figure_as(self, fig, fmt):
"""Save the figure to a file."""
fext, ffilt = {
'image/png': ('.png', 'PNG (*.png)'),
'image/jpeg': ('.jpg', 'JPEG (*.jpg;*.jpeg;*.jpe;*.jfif)'),
'image/svg+xml': ('.svg', 'SVG (*.svg);;PNG (*.png)')}[fmt]
figname = get_un... |
Remove all thumbnails. | def remove_all_thumbnails(self):
"""Remove all thumbnails."""
for thumbnail in self._thumbnails:
self.layout().removeWidget(thumbnail)
thumbnail.sig_canvas_clicked.disconnect()
thumbnail.sig_remove_figure.disconnect()
thumbnail.sig_save_figure.disconnect()... |
Remove thumbnail. | def remove_thumbnail(self, thumbnail):
"""Remove thumbnail."""
if thumbnail in self._thumbnails:
index = self._thumbnails.index(thumbnail)
self._thumbnails.remove(thumbnail)
self.layout().removeWidget(thumbnail)
thumbnail.deleteLater()
thumbnail.sig_canvas... |
Set the currently selected thumbnail. | def set_current_thumbnail(self, thumbnail):
"""Set the currently selected thumbnail."""
self.current_thumbnail = thumbnail
self.figure_viewer.load_figure(
thumbnail.canvas.fig, thumbnail.canvas.fmt)
for thumbnail in self._thumbnails:
thumbnail.highlight_canvas... |
Select the thumbnail previous to the currently selected one. | def go_previous_thumbnail(self):
"""Select the thumbnail previous to the currently selected one."""
if self.current_thumbnail is not None:
index = self._thumbnails.index(self.current_thumbnail) - 1
index = index if index >= 0 else len(self._thumbnails) - 1
self.set_cu... |
Select thumbnail next to the currently selected one. | def go_next_thumbnail(self):
"""Select thumbnail next to the currently selected one."""
if self.current_thumbnail is not None:
index = self._thumbnails.index(self.current_thumbnail) + 1
index = 0 if index >= len(self._thumbnails) else index
self.set_current_index(inde... |
Scroll to the selected item of ThumbnailScrollBar. | def scroll_to_item(self, index):
"""Scroll to the selected item of ThumbnailScrollBar."""
spacing_between_items = self.scene.verticalSpacing()
height_view = self.scrollarea.viewport().height()
height_item = self.scene.itemAt(index).sizeHint().height()
height_view_excluding_item =... |
Scroll the scrollbar of the scrollarea up by a single step. | def go_up(self):
"""Scroll the scrollbar of the scrollarea up by a single step."""
vsb = self.scrollarea.verticalScrollBar()
vsb.setValue(int(vsb.value() - vsb.singleStep())) |
Setup the main layout of the widget. | def setup_gui(self):
"""Setup the main layout of the widget."""
layout = QGridLayout(self)
layout.setContentsMargins(0, 0, 0, 0)
layout.addWidget(self.canvas, 0, 1)
layout.addLayout(self.setup_toolbar(), 0, 3, 2, 1)
layout.setColumnStretch(0, 100)
layout.setColum... |
Setup the toolbar. | def setup_toolbar(self):
"""Setup the toolbar."""
self.savefig_btn = create_toolbutton(
self, icon=ima.icon('filesave'),
tip=_("Save Image As..."),
triggered=self.emit_save_figure)
self.delfig_btn = create_toolbutton(
self, icon=ima.icon('editclear... |
Set a colored frame around the FigureCanvas if highlight is True. | def highlight_canvas(self, highlight):
"""
Set a colored frame around the FigureCanvas if highlight is True.
"""
colorname = self.canvas.palette().highlight().color().name()
if highlight:
self.canvas.setStyleSheet(
"FigureCanvas{border: 1px solid %... |
A filter that is used to send a signal when the figure canvas is clicked. | def eventFilter(self, widget, event):
"""
A filter that is used to send a signal when the figure canvas is
clicked.
"""
if event.type() == QEvent.MouseButtonPress:
if event.button() == Qt.LeftButton:
self.sig_canvas_clicked.emit(self)
return su... |
Emit a signal when the toolbutton to save the figure is clicked. | def emit_save_figure(self):
"""
Emit a signal when the toolbutton to save the figure is clicked.
"""
self.sig_save_figure.emit(self.canvas.fig, self.canvas.fmt) |
Popup context menu. | def context_menu_requested(self, event):
"""Popup context menu."""
if self.fig:
pos = QPoint(event.x(), event.y())
context_menu = QMenu(self)
context_menu.addAction(ima.icon('editcopy'), "Copy Image",
self.copy_figure,
... |
Copy figure to clipboard. | def copy_figure(self):
"""Copy figure to clipboard."""
if self.fmt in ['image/png', 'image/jpeg']:
qpixmap = QPixmap()
qpixmap.loadFromData(self.fig, self.fmt.upper())
QApplication.clipboard().setImage(qpixmap.toImage())
elif self.fmt == 'image/svg+xml':
... |
Blink figure once. | def blink_figure(self):
"""Blink figure once."""
if self.fig:
self._blink_flag = not self._blink_flag
self.repaint()
if self._blink_flag:
timer = QTimer()
timer.singleShot(40, self.blink_figure) |
Clear the figure that was painted on the widget. | def clear_canvas(self):
"""Clear the figure that was painted on the widget."""
self.fig = None
self.fmt = None
self._qpix_buffer = []
self.repaint() |
Load the figure from a png jpg or svg image convert it in a QPixmap and force a repaint of the widget. | def load_figure(self, fig, fmt):
"""
Load the figure from a png, jpg, or svg image, convert it in
a QPixmap, and force a repaint of the widget.
"""
self.fig = fig
self.fmt = fmt
if fmt in ['image/png', 'image/jpeg']:
self._qpix_orig = QPixmap()
... |
Qt method override to paint a custom image on the Widget. | def paintEvent(self, event):
"""Qt method override to paint a custom image on the Widget."""
super(FigureCanvas, self).paintEvent(event)
# Prepare the rect on which the image is going to be painted :
fw = self.frameWidth()
rect = QRect(0 + fw, 0 + fw,
self.si... |
Custom Python executable value has been changed | def python_executable_changed(self, pyexec):
"""Custom Python executable value has been changed"""
if not self.cus_exec_radio.isChecked():
return False
def_pyexec = get_python_executable()
if not is_text_string(pyexec):
pyexec = to_text_string(pyexec.toUtf8(... |
Set UMR excluded modules name list | def set_umr_namelist(self):
"""Set UMR excluded modules name list"""
arguments, valid = QInputDialog.getText(self, _('UMR'),
_("Set the list of excluded modules as "
"this: <i>numpy, scipy</i>"),
... |
Update the list of interpreters used and the current one. | def set_custom_interpreters_list(self, value):
"""Update the list of interpreters used and the current one."""
custom_list = self.get_option('custom_interpreters_list')
if value not in custom_list and value != get_python_executable():
custom_list.append(value)
self.s... |
Check that the used custom interpreters are still valid. | def validate_custom_interpreters_list(self):
"""Check that the used custom interpreters are still valid."""
custom_list = self.get_option('custom_interpreters_list')
valid_custom_list = []
for value in custom_list:
if (osp.isfile(value) and programs.is_python_interpreter... |
Extends: meth: spyder. api. EditorExtension. on_install method to set the editor instance as the parent widget. | def on_install(self, editor):
"""
Extends :meth:`spyder.api.EditorExtension.on_install` method to set the
editor instance as the parent widget.
.. warning:: Don't forget to call **super** if you override this
method!
:param editor: editor instance
:type edit... |
Fills the panel background using QPalette. | def paintEvent(self, event):
"""Fills the panel background using QPalette."""
if self.isVisible() and self.position != self.Position.FLOATING:
# fill background
self._background_brush = QBrush(QColor(
self.editor.sideareas_color))
self._foreground_pen ... |
Shows/ Hides the panel. | def setVisible(self, visible):
"""
Shows/Hides the panel.
Automatically call PanelsManager.refresh_panels.
:param visible: Visible state
"""
logger.debug('%s visibility changed', self.name)
super(Panel, self).setVisible(visible)
if self.editor:
... |
Set geometry for floating panels. | def set_geometry(self, crect):
"""Set geometry for floating panels.
Normally you don't need to override this method, you should override
`geometry` instead.
"""
x0, y0, width, height = self.geometry()
if width is None:
width = crect.width()
if height... |
We decided to replace pyzmq s openssh_tunnel method to work around issue https:// github. com/ zeromq/ pyzmq/ issues/ 589 which was solved in pyzmq https:// github. com/ zeromq/ pyzmq/ pull/ 615 | def openssh_tunnel(self, lport, rport, server, remoteip='127.0.0.1',
keyfile=None, password=None, timeout=0.4):
"""
We decided to replace pyzmq's openssh_tunnel method to work around
issue https://github.com/zeromq/pyzmq/issues/589 which was solved
in pyzmq https://github.com/zeromq/p... |
Configure associated namespace browser widget | def configure_namespacebrowser(self):
"""Configure associated namespace browser widget"""
# Update namespace view
self.sig_namespace_view.connect(lambda data:
self.namespacebrowser.process_remote_view(data))
# Update properties of variables
self.sig_var_properties.co... |
Set the namespace view settings | def set_namespace_view_settings(self):
"""Set the namespace view settings"""
if self.namespacebrowser:
settings = to_text_string(
self.namespacebrowser.get_view_settings())
code =(u"get_ipython().kernel.namespace_view_settings = %s" %
settings)
... |
Ask kernel for a value | def get_value(self, name):
"""Ask kernel for a value"""
code = u"get_ipython().kernel.get_value('%s')" % name
if self._reading:
method = self.kernel_client.input
code = u'!' + code
else:
method = self.silent_execute
# Wait until the kernel ret... |
Set value for a variable | def set_value(self, name, value):
"""Set value for a variable"""
value = to_text_string(value)
code = u"get_ipython().kernel.set_value('%s', %s, %s)" % (name, value,
PY2)
if self._reading:
self.kernel_client.i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.