partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | BaseComboBox.add_current_text_if_valid | Add current text to combo box history if valid | spyder/widgets/comboboxes.py | 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) | 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) | [
"Add",
"current",
"text",
"to",
"combo",
"box",
"history",
"if",
"valid"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/comboboxes.py#L120-L127 | [
"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"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | EditableComboBox.show_tip | Show tip | spyder/widgets/comboboxes.py | def show_tip(self, tip=""):
"""Show tip"""
QToolTip.showText(self.mapToGlobal(self.pos()), tip, self) | def show_tip(self, tip=""):
"""Show tip"""
QToolTip.showText(self.mapToGlobal(self.pos()), tip, self) | [
"Show",
"tip"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/comboboxes.py#L168-L170 | [
"def",
"show_tip",
"(",
"self",
",",
"tip",
"=",
"\"\"",
")",
":",
"QToolTip",
".",
"showText",
"(",
"self",
".",
"mapToGlobal",
"(",
"self",
".",
"pos",
"(",
")",
")",
",",
"tip",
",",
"self",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | EditableComboBox.validate | Validate entered path | spyder/widgets/comboboxes.py | 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... | 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... | [
"Validate",
"entered",
"path"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/comboboxes.py#L177-L188 | [
"def",
"validate",
"(",
"self",
",",
"qstr",
",",
"editing",
"=",
"True",
")",
":",
"if",
"self",
".",
"selected_text",
"==",
"qstr",
"and",
"qstr",
"!=",
"''",
":",
"self",
".",
"valid",
".",
"emit",
"(",
"True",
",",
"True",
")",
"return",
"valid... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | PathComboBox.focusInEvent | Handle focus in event restoring to display the status icon. | spyder/widgets/comboboxes.py | 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) | 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",
"in",
"event",
"restoring",
"to",
"display",
"the",
"status",
"icon",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/comboboxes.py#L220-L225 | [
"def",
"focusInEvent",
"(",
"self",
",",
"event",
")",
":",
"show_status",
"=",
"getattr",
"(",
"self",
".",
"lineEdit",
"(",
")",
",",
"'show_status_icon'",
",",
"None",
")",
"if",
"show_status",
":",
"show_status",
"(",
")",
"QComboBox",
".",
"focusInEve... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | PathComboBox.focusOutEvent | Handle focus out event restoring the last valid selected path. | spyder/widgets/comboboxes.py | 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... | 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... | [
"Handle",
"focus",
"out",
"event",
"restoring",
"the",
"last",
"valid",
"selected",
"path",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/comboboxes.py#L227-L238 | [
"def",
"focusOutEvent",
"(",
"self",
",",
"event",
")",
":",
"# Calling asynchronously the 'add_current_text' to avoid crash\r",
"# https://groups.google.com/group/spyderlib/browse_thread/thread/2257abf530e210bd\r",
"if",
"not",
"self",
".",
"is_valid",
"(",
")",
":",
"lineedit",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | PathComboBox._complete_options | Find available completion options. | spyder/widgets/comboboxes.py | 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 | 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 | [
"Find",
"available",
"completion",
"options",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/comboboxes.py#L241-L247 | [
"def",
"_complete_options",
"(",
"self",
")",
":",
"text",
"=",
"to_text_string",
"(",
"self",
".",
"currentText",
"(",
")",
")",
"opts",
"=",
"glob",
".",
"glob",
"(",
"text",
"+",
"\"*\"",
")",
"opts",
"=",
"sorted",
"(",
"[",
"opt",
"for",
"opt",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | PathComboBox.double_tab_complete | If several options available a double tab displays options. | spyder/widgets/comboboxes.py | 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() | 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",
"several",
"options",
"available",
"a",
"double",
"tab",
"displays",
"options",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/comboboxes.py#L249-L253 | [
"def",
"double_tab_complete",
"(",
"self",
")",
":",
"opts",
"=",
"self",
".",
"_complete_options",
"(",
")",
"if",
"len",
"(",
"opts",
")",
">",
"1",
":",
"self",
".",
"completer",
"(",
")",
".",
"complete",
"(",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | PathComboBox.tab_complete | If there is a single option available one tab completes the option. | spyder/widgets/comboboxes.py | 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() | 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() | [
"If",
"there",
"is",
"a",
"single",
"option",
"available",
"one",
"tab",
"completes",
"the",
"option",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/comboboxes.py#L255-L262 | [
"def",
"tab_complete",
"(",
"self",
")",
":",
"opts",
"=",
"self",
".",
"_complete_options",
"(",
")",
"if",
"len",
"(",
"opts",
")",
"==",
"1",
":",
"self",
".",
"set_current_text",
"(",
"opts",
"[",
"0",
"]",
"+",
"os",
".",
"sep",
")",
"self",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | PathComboBox.is_valid | Return True if string is valid | spyder/widgets/comboboxes.py | 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)) | 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)) | [
"Return",
"True",
"if",
"string",
"is",
"valid"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/comboboxes.py#L264-L268 | [
"def",
"is_valid",
"(",
"self",
",",
"qstr",
"=",
"None",
")",
":",
"if",
"qstr",
"is",
"None",
":",
"qstr",
"=",
"self",
".",
"currentText",
"(",
")",
"return",
"osp",
".",
"isdir",
"(",
"to_text_string",
"(",
"qstr",
")",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | PathComboBox.selected | Action to be executed when a valid item has been selected | spyder/widgets/comboboxes.py | 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) | 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) | [
"Action",
"to",
"be",
"executed",
"when",
"a",
"valid",
"item",
"has",
"been",
"selected"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/comboboxes.py#L270-L274 | [
"def",
"selected",
"(",
"self",
")",
":",
"self",
".",
"selected_text",
"=",
"self",
".",
"currentText",
"(",
")",
"self",
".",
"valid",
".",
"emit",
"(",
"True",
",",
"True",
")",
"self",
".",
"open_dir",
".",
"emit",
"(",
"self",
".",
"selected_tex... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | PathComboBox.add_current_text | Add current text to combo box history (convenient method).
If path ends in os separator ("\" windows, "/" unix) remove it. | spyder/widgets/comboboxes.py | 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:
... | 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",
"current",
"text",
"to",
"combo",
"box",
"history",
"(",
"convenient",
"method",
")",
".",
"If",
"path",
"ends",
"in",
"os",
"separator",
"(",
"\\",
"windows",
"/",
"unix",
")",
"remove",
"it",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/comboboxes.py#L276-L285 | [
"def",
"add_current_text",
"(",
"self",
")",
":",
"text",
"=",
"self",
".",
"currentText",
"(",
")",
"if",
"osp",
".",
"isdir",
"(",
"text",
")",
"and",
"text",
":",
"if",
"text",
"[",
"-",
"1",
"]",
"==",
"os",
".",
"sep",
":",
"text",
"=",
"t... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | PathComboBox.add_tooltip_to_highlighted_item | Add a tooltip showing the full path of the currently highlighted item
of the PathComboBox. | spyder/widgets/comboboxes.py | 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) | 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) | [
"Add",
"a",
"tooltip",
"showing",
"the",
"full",
"path",
"of",
"the",
"currently",
"highlighted",
"item",
"of",
"the",
"PathComboBox",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/comboboxes.py#L287-L292 | [
"def",
"add_tooltip_to_highlighted_item",
"(",
"self",
",",
"index",
")",
":",
"self",
".",
"setItemData",
"(",
"index",
",",
"self",
".",
"itemText",
"(",
"index",
")",
",",
"Qt",
".",
"ToolTipRole",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | UrlComboBox.is_valid | Return True if string is valid | spyder/widgets/comboboxes.py | def is_valid(self, qstr=None):
"""Return True if string is valid"""
if qstr is None:
qstr = self.currentText()
return QUrl(qstr).isValid() | 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"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/comboboxes.py#L303-L307 | [
"def",
"is_valid",
"(",
"self",
",",
"qstr",
"=",
"None",
")",
":",
"if",
"qstr",
"is",
"None",
":",
"qstr",
"=",
"self",
".",
"currentText",
"(",
")",
"return",
"QUrl",
"(",
"qstr",
")",
".",
"isValid",
"(",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | FileComboBox.is_valid | Return True if string is valid | spyder/widgets/comboboxes.py | 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)) | 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"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/comboboxes.py#L329-L333 | [
"def",
"is_valid",
"(",
"self",
",",
"qstr",
"=",
"None",
")",
":",
"if",
"qstr",
"is",
"None",
":",
"qstr",
"=",
"self",
".",
"currentText",
"(",
")",
"return",
"osp",
".",
"isfile",
"(",
"to_text_string",
"(",
"qstr",
")",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | PythonModulesComboBox.is_valid | Return True if string is valid | spyder/widgets/comboboxes.py | 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)) | 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)) | [
"Return",
"True",
"if",
"string",
"is",
"valid"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/comboboxes.py#L351-L355 | [
"def",
"is_valid",
"(",
"self",
",",
"qstr",
"=",
"None",
")",
":",
"if",
"qstr",
"is",
"None",
":",
"qstr",
"=",
"self",
".",
"currentText",
"(",
")",
"return",
"is_module_or_package",
"(",
"to_text_string",
"(",
"qstr",
")",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | PythonModulesComboBox.selected | Action to be executed when a valid item has been selected | spyder/widgets/comboboxes.py | def selected(self):
"""Action to be executed when a valid item has been selected"""
EditableComboBox.selected(self)
self.open_dir.emit(self.currentText()) | def selected(self):
"""Action to be executed when a valid item has been selected"""
EditableComboBox.selected(self)
self.open_dir.emit(self.currentText()) | [
"Action",
"to",
"be",
"executed",
"when",
"a",
"valid",
"item",
"has",
"been",
"selected"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/comboboxes.py#L357-L360 | [
"def",
"selected",
"(",
"self",
")",
":",
"EditableComboBox",
".",
"selected",
"(",
"self",
")",
"self",
".",
"open_dir",
".",
"emit",
"(",
"self",
".",
"currentText",
"(",
")",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Console.set_historylog | Bind historylog instance to this console
Not used anymore since v2.0 | spyder/plugins/console/plugin.py | 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) | 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) | [
"Bind",
"historylog",
"instance",
"to",
"this",
"console",
"Not",
"used",
"anymore",
"since",
"v2",
".",
"0"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/plugin.py#L106-L110 | [
"def",
"set_historylog",
"(",
"self",
",",
"historylog",
")",
":",
"historylog",
".",
"add_history",
"(",
"self",
".",
"shell",
".",
"history_filename",
")",
"self",
".",
"shell",
".",
"append_to_history",
".",
"connect",
"(",
"historylog",
".",
"append_to_his... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Console.closing_plugin | Perform actions before parent main window is closed | spyder/plugins/console/plugin.py | 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 | 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 | [
"Perform",
"actions",
"before",
"parent",
"main",
"window",
"is",
"closed"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/plugin.py#L133-L137 | [
"def",
"closing_plugin",
"(",
"self",
",",
"cancelable",
"=",
"False",
")",
":",
"self",
".",
"dialog_manager",
".",
"close_all",
"(",
")",
"self",
".",
"shell",
".",
"exit_interpreter",
"(",
")",
"return",
"True"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Console.get_plugin_actions | Return a list of actions related to plugin | spyder/plugins/console/plugin.py | 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)
... | 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)
... | [
"Return",
"a",
"list",
"of",
"actions",
"related",
"to",
"plugin"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/plugin.py#L142-L191 | [
"def",
"get_plugin_actions",
"(",
"self",
")",
":",
"quit_action",
"=",
"create_action",
"(",
"self",
",",
"_",
"(",
"\"&Quit\"",
")",
",",
"icon",
"=",
"ima",
".",
"icon",
"(",
"'exit'",
")",
",",
"tip",
"=",
"_",
"(",
"\"Quit\"",
")",
",",
"trigger... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Console.register_plugin | Register plugin in Spyder's main window | spyder/plugins/console/plugin.py | 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... | 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... | [
"Register",
"plugin",
"in",
"Spyder",
"s",
"main",
"window"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/plugin.py#L193-L198 | [
"def",
"register_plugin",
"(",
"self",
")",
":",
"self",
".",
"focus_changed",
".",
"connect",
"(",
"self",
".",
"main",
".",
"plugin_focus_changed",
")",
"self",
".",
"main",
".",
"add_dockwidget",
"(",
"self",
")",
"# Connecting the following signal once the doc... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Console.exception_occurred | Exception ocurred in the internal console.
Show a QDialog or the internal console to warn the user. | spyder/plugins/console/plugin.py | 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... | 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... | [
"Exception",
"ocurred",
"in",
"the",
"internal",
"console",
".",
"Show",
"a",
"QDialog",
"or",
"the",
"internal",
"console",
"to",
"warn",
"the",
"user",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/plugin.py#L200-L220 | [
"def",
"exception_occurred",
"(",
"self",
",",
"text",
",",
"is_traceback",
")",
":",
"# Skip errors without traceback or dismiss\r",
"if",
"(",
"not",
"is_traceback",
"and",
"self",
".",
"error_dlg",
"is",
"None",
")",
"or",
"self",
".",
"dismiss_error",
":",
"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Console.close_error_dlg | Close error dialog. | spyder/plugins/console/plugin.py | def close_error_dlg(self):
"""Close error dialog."""
if self.error_dlg.dismiss_box.isChecked():
self.dismiss_error = True
self.error_dlg.reject() | def close_error_dlg(self):
"""Close error dialog."""
if self.error_dlg.dismiss_box.isChecked():
self.dismiss_error = True
self.error_dlg.reject() | [
"Close",
"error",
"dialog",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/plugin.py#L222-L226 | [
"def",
"close_error_dlg",
"(",
"self",
")",
":",
"if",
"self",
".",
"error_dlg",
".",
"dismiss_box",
".",
"isChecked",
"(",
")",
":",
"self",
".",
"dismiss_error",
"=",
"True",
"self",
".",
"error_dlg",
".",
"reject",
"(",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Console.show_syspath | Show sys.path | spyder/plugins/console/plugin.py | 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) | 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) | [
"Show",
"sys",
".",
"path"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/plugin.py#L244-L249 | [
"def",
"show_syspath",
"(",
"self",
")",
":",
"editor",
"=",
"CollectionsEditor",
"(",
"parent",
"=",
"self",
")",
"editor",
".",
"setup",
"(",
"sys",
".",
"path",
",",
"title",
"=",
"\"sys.path\"",
",",
"readonly",
"=",
"True",
",",
"width",
"=",
"600... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Console.run_script | Run a Python script | spyder/plugins/console/plugin.py | 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... | 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... | [
"Run",
"a",
"Python",
"script"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/plugin.py#L252-L276 | [
"def",
"run_script",
"(",
"self",
",",
"filename",
"=",
"None",
",",
"silent",
"=",
"False",
",",
"set_focus",
"=",
"False",
",",
"args",
"=",
"None",
")",
":",
"if",
"filename",
"is",
"None",
":",
"self",
".",
"shell",
".",
"interpreter",
".",
"rest... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Console.go_to_error | Go to error if relevant | spyder/plugins/console/plugin.py | 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)) | 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)) | [
"Go",
"to",
"error",
"if",
"relevant"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/plugin.py#L279-L284 | [
"def",
"go_to_error",
"(",
"self",
",",
"text",
")",
":",
"match",
"=",
"get_error_match",
"(",
"to_text_string",
"(",
"text",
")",
")",
"if",
"match",
":",
"fname",
",",
"lnb",
"=",
"match",
".",
"groups",
"(",
")",
"self",
".",
"edit_script",
"(",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Console.edit_script | Edit script | spyder/plugins/console/plugin.py | 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:
... | 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:
... | [
"Edit",
"script"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/plugin.py#L286-L294 | [
"def",
"edit_script",
"(",
"self",
",",
"filename",
"=",
"None",
",",
"goto",
"=",
"-",
"1",
")",
":",
"# Called from InternalShell\r",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'main'",
")",
"or",
"not",
"hasattr",
"(",
"self",
".",
"main",
",",
"'ed... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Console.execute_lines | Execute lines and give focus to shell | spyder/plugins/console/plugin.py | def execute_lines(self, lines):
"""Execute lines and give focus to shell"""
self.shell.execute_lines(to_text_string(lines))
self.shell.setFocus() | def execute_lines(self, lines):
"""Execute lines and give focus to shell"""
self.shell.execute_lines(to_text_string(lines))
self.shell.setFocus() | [
"Execute",
"lines",
"and",
"give",
"focus",
"to",
"shell"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/plugin.py#L296-L299 | [
"def",
"execute_lines",
"(",
"self",
",",
"lines",
")",
":",
"self",
".",
"shell",
".",
"execute_lines",
"(",
"to_text_string",
"(",
"lines",
")",
")",
"self",
".",
"shell",
".",
"setFocus",
"(",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Console.change_exteditor | Change external editor path | spyder/plugins/console/plugin.py | 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')... | 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')... | [
"Change",
"external",
"editor",
"path"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/plugin.py#L313-L320 | [
"def",
"change_exteditor",
"(",
"self",
")",
":",
"path",
",",
"valid",
"=",
"QInputDialog",
".",
"getText",
"(",
"self",
",",
"_",
"(",
"'External editor'",
")",
",",
"_",
"(",
"'External editor executable path:'",
")",
",",
"QLineEdit",
".",
"Normal",
",",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Console.toggle_wrap_mode | Toggle wrap mode | spyder/plugins/console/plugin.py | def toggle_wrap_mode(self, checked):
"""Toggle wrap mode"""
self.shell.toggle_wrap_mode(checked)
self.set_option('wrap', checked) | def toggle_wrap_mode(self, checked):
"""Toggle wrap mode"""
self.shell.toggle_wrap_mode(checked)
self.set_option('wrap', checked) | [
"Toggle",
"wrap",
"mode"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/plugin.py#L323-L326 | [
"def",
"toggle_wrap_mode",
"(",
"self",
",",
"checked",
")",
":",
"self",
".",
"shell",
".",
"toggle_wrap_mode",
"(",
"checked",
")",
"self",
".",
"set_option",
"(",
"'wrap'",
",",
"checked",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Console.toggle_codecompletion | Toggle automatic code completion | spyder/plugins/console/plugin.py | def toggle_codecompletion(self, checked):
"""Toggle automatic code completion"""
self.shell.set_codecompletion_auto(checked)
self.set_option('codecompletion/auto', checked) | def toggle_codecompletion(self, checked):
"""Toggle automatic code completion"""
self.shell.set_codecompletion_auto(checked)
self.set_option('codecompletion/auto', checked) | [
"Toggle",
"automatic",
"code",
"completion"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/plugin.py#L329-L332 | [
"def",
"toggle_codecompletion",
"(",
"self",
",",
"checked",
")",
":",
"self",
".",
"shell",
".",
"set_codecompletion_auto",
"(",
"checked",
")",
"self",
".",
"set_option",
"(",
"'codecompletion/auto'",
",",
"checked",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Console.dragEnterEvent | Reimplement Qt method
Inform Qt about the types of data that the widget accepts | spyder/plugins/console/plugin.py | 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:
... | 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",
"Inform",
"Qt",
"about",
"the",
"types",
"of",
"data",
"that",
"the",
"widget",
"accepts"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/plugin.py#L335-L345 | [
"def",
"dragEnterEvent",
"(",
"self",
",",
"event",
")",
":",
"source",
"=",
"event",
".",
"mimeData",
"(",
")",
"if",
"source",
".",
"hasUrls",
"(",
")",
":",
"if",
"mimedata2url",
"(",
"source",
")",
":",
"event",
".",
"acceptProposedAction",
"(",
")... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Console.dropEvent | Reimplement Qt method
Unpack dropped data and handle it | spyder/plugins/console/plugin.py | 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... | 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... | [
"Reimplement",
"Qt",
"method",
"Unpack",
"dropped",
"data",
"and",
"handle",
"it"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/plugin.py#L347-L358 | [
"def",
"dropEvent",
"(",
"self",
",",
"event",
")",
":",
"source",
"=",
"event",
".",
"mimeData",
"(",
")",
"if",
"source",
".",
"hasUrls",
"(",
")",
":",
"pathlist",
"=",
"mimedata2url",
"(",
"source",
")",
"self",
".",
"shell",
".",
"drop_pathlist",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | install | Function executed when running the script with the -install switch | scripts/spyder_win_post_install.py | 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... | 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",
"-",
"install",
"switch"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/scripts/spyder_win_post_install.py#L113-L170 | [
"def",
"install",
"(",
")",
":",
"# Create Spyder start menu folder\r",
"# Don't use CSIDL_COMMON_PROGRAMS because it requres admin rights\r",
"# This is consistent with use of CSIDL_DESKTOPDIRECTORY below\r",
"# CSIDL_COMMON_PROGRAMS =\r",
"# C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Progr... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | remove | Function executed when running the script with the -remove switch | scripts/spyder_win_post_install.py | 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... | 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... | [
"Function",
"executed",
"when",
"running",
"the",
"script",
"with",
"the",
"-",
"remove",
"switch"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/scripts/spyder_win_post_install.py#L173-L222 | [
"def",
"remove",
"(",
")",
":",
"current",
"=",
"True",
"# only affects current user\r",
"root",
"=",
"winreg",
".",
"HKEY_CURRENT_USER",
"if",
"current",
"else",
"winreg",
".",
"HKEY_LOCAL_MACHINE",
"for",
"key",
"in",
"(",
"KEY_C1",
"%",
"(",
"\"\"",
",",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | get_tour | 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
... | spyder/app/tour.py | 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... | 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... | [
"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",
".",... | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/tour.py#L82-L277 | [
"def",
"get_tour",
"(",
"index",
")",
":",
"sw",
"=",
"SpyderWidgets",
"qtconsole_link",
"=",
"\"https://qtconsole.readthedocs.io/en/stable/index.html\"",
"# This test should serve as example of keys to use in the tour frame dics\r",
"test",
"=",
"[",
"{",
"'title'",
":",
"\"We... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | FadingCanvas.paintEvent | Override Qt method | spyder/app/tour.py | 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,
... | 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"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/tour.py#L500-L507 | [
"def",
"paintEvent",
"(",
"self",
",",
"event",
")",
":",
"painter",
"=",
"QPainter",
"(",
"self",
")",
"painter",
".",
"setRenderHint",
"(",
"QPainter",
".",
"Antialiasing",
")",
"# Decoration\r",
"painter",
".",
"fillPath",
"(",
"self",
".",
"path_current"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | FadingCanvas.reject | Override Qt method | spyder/app/tour.py | 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() | 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"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/tour.py#L512-L517 | [
"def",
"reject",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"is_fade_running",
"(",
")",
":",
"key",
"=",
"Qt",
".",
"Key_Escape",
"self",
".",
"key_pressed",
"=",
"key",
"self",
".",
"sig_key_pressed",
".",
"emit",
"(",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | FadingTipBox.mousePressEvent | override Qt method | spyder/app/tour.py | 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 | 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 | [
"override",
"Qt",
"method"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/tour.py#L804-L811 | [
"def",
"mousePressEvent",
"(",
"self",
",",
"event",
")",
":",
"# Raise the main application window on click\r",
"self",
".",
"parent",
".",
"raise_",
"(",
")",
"self",
".",
"raise_",
"(",
")",
"if",
"event",
".",
"button",
"(",
")",
"==",
"Qt",
".",
"Righ... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | AnimatedTour._set_data | Set data that is displayed in each step of the tour. | spyder/app/tour.py | 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}... | 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}... | [
"Set",
"data",
"that",
"is",
"displayed",
"in",
"each",
"step",
"of",
"the",
"tour",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/tour.py#L1001-L1061 | [
"def",
"_set_data",
"(",
"self",
")",
":",
"self",
".",
"setting_data",
"=",
"True",
"step",
",",
"steps",
",",
"frames",
"=",
"self",
".",
"step_current",
",",
"self",
".",
"steps",
",",
"self",
".",
"frames",
"current",
"=",
"'{0}/{1}'",
".",
"format... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | AnimatedTour.lost_focus | Confirm if the tour loses focus and hides the tips. | spyder/app/tour.py | 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() | 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",
"loses",
"focus",
"and",
"hides",
"the",
"tips",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/tour.py#L1239-L1243 | [
"def",
"lost_focus",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"is_running",
"and",
"not",
"self",
".",
"any_has_focus",
"(",
")",
"and",
"not",
"self",
".",
"setting_data",
"and",
"not",
"self",
".",
"hidden",
")",
":",
"self",
".",
"hide_tips",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | AnimatedTour.gain_focus | Confirm if the tour regains focus and unhides the tips. | spyder/app/tour.py | 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() | 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() | [
"Confirm",
"if",
"the",
"tour",
"regains",
"focus",
"and",
"unhides",
"the",
"tips",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/tour.py#L1245-L1249 | [
"def",
"gain_focus",
"(",
"self",
")",
":",
"if",
"(",
"self",
".",
"is_running",
"and",
"self",
".",
"any_has_focus",
"(",
")",
"and",
"not",
"self",
".",
"setting_data",
"and",
"self",
".",
"hidden",
")",
":",
"self",
".",
"unhide_tips",
"(",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | AnimatedTour.any_has_focus | Returns if tour or any of its components has focus. | spyder/app/tour.py | 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 | 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 | [
"Returns",
"if",
"tour",
"or",
"any",
"of",
"its",
"components",
"has",
"focus",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/tour.py#L1251-L1255 | [
"def",
"any_has_focus",
"(",
"self",
")",
":",
"f",
"=",
"(",
"self",
".",
"hasFocus",
"(",
")",
"or",
"self",
".",
"parent",
".",
"hasFocus",
"(",
")",
"or",
"self",
".",
"tips",
".",
"hasFocus",
"(",
")",
"or",
"self",
".",
"canvas",
".",
"hasF... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | FigureBrowserWidget._handle_display_data | Reimplemented to handle communications between the figure explorer
and the kernel. | spyder/plugins/ipythonconsole/widgets/figurebrowser.py | 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... | 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... | [
"Reimplemented",
"to",
"handle",
"communications",
"between",
"the",
"figure",
"explorer",
"and",
"the",
"kernel",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/figurebrowser.py#L40-L76 | [
"def",
"_handle_display_data",
"(",
"self",
",",
"msg",
")",
":",
"img",
"=",
"None",
"data",
"=",
"msg",
"[",
"'content'",
"]",
"[",
"'data'",
"]",
"if",
"'image/svg+xml'",
"in",
"data",
":",
"fmt",
"=",
"'image/svg+xml'",
"img",
"=",
"data",
"[",
"'i... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | get_file_language | Get file language from filename | spyder/plugins/editor/widgets/codeeditor.py | 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... | 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... | [
"Get",
"file",
"language",
"from",
"filename"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/codeeditor.py#L175-L193 | [
"def",
"get_file_language",
"(",
"filename",
",",
"text",
"=",
"None",
")",
":",
"ext",
"=",
"osp",
".",
"splitext",
"(",
"filename",
")",
"[",
"1",
"]",
"if",
"ext",
".",
"startswith",
"(",
"'.'",
")",
":",
"ext",
"=",
"ext",
"[",
"1",
":",
"]",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | GoToLineDialog.text_has_changed | Line edit's text has changed | spyder/plugins/editor/widgets/codeeditor.py | 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 | 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 | [
"Line",
"edit",
"s",
"text",
"has",
"changed"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/codeeditor.py#L157-L163 | [
"def",
"text_has_changed",
"(",
"self",
",",
"text",
")",
":",
"text",
"=",
"to_text_string",
"(",
"text",
")",
"if",
"text",
":",
"self",
".",
"lineno",
"=",
"int",
"(",
"text",
")",
"else",
":",
"self",
".",
"lineno",
"=",
"None"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | save_figure_tofile | Save fig to fname in the format specified by fmt. | spyder/plugins/plots/widgets/figurebrowser.py | 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):
... | 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):
... | [
"Save",
"fig",
"to",
"fname",
"in",
"the",
"format",
"specified",
"by",
"fmt",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L38-L49 | [
"def",
"save_figure_tofile",
"(",
"fig",
",",
"fmt",
",",
"fname",
")",
":",
"root",
",",
"ext",
"=",
"osp",
".",
"splitext",
"(",
"fname",
")",
"if",
"ext",
"==",
"'.png'",
"and",
"fmt",
"==",
"'image/svg+xml'",
":",
"qimg",
"=",
"svg_to_image",
"(",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | get_unique_figname | Append a number to "root" to form a filename that does not already exist
in "dirname". | spyder/plugins/plots/widgets/figurebrowser.py | 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 + '_%... | 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 + '_%... | [
"Append",
"a",
"number",
"to",
"root",
"to",
"form",
"a",
"filename",
"that",
"does",
"not",
"already",
"exist",
"in",
"dirname",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L52-L64 | [
"def",
"get_unique_figname",
"(",
"dirname",
",",
"root",
",",
"ext",
")",
":",
"i",
"=",
"1",
"figname",
"=",
"root",
"+",
"'_%d'",
"%",
"i",
"+",
"ext",
"while",
"True",
":",
"if",
"osp",
".",
"exists",
"(",
"osp",
".",
"join",
"(",
"dirname",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | FigureBrowser.setup | Setup the figure browser with provided settings. | spyder/plugins/plots/widgets/figurebrowser.py | 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... | 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",
"figure",
"browser",
"with",
"provided",
"settings",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L97-L136 | [
"def",
"setup",
"(",
"self",
",",
"mute_inline_plotting",
"=",
"None",
",",
"show_plot_outline",
"=",
"None",
")",
":",
"assert",
"self",
".",
"shellwidget",
"is",
"not",
"None",
"self",
".",
"mute_inline_plotting",
"=",
"mute_inline_plotting",
"self",
".",
"s... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | FigureBrowser.setup_toolbar | Setup the toolbar | spyder/plugins/plots/widgets/figurebrowser.py | 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... | 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",
"toolbar"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L138-L212 | [
"def",
"setup_toolbar",
"(",
"self",
")",
":",
"savefig_btn",
"=",
"create_toolbutton",
"(",
"self",
",",
"icon",
"=",
"ima",
".",
"icon",
"(",
"'filesave'",
")",
",",
"tip",
"=",
"_",
"(",
"\"Save Image As...\"",
")",
",",
"triggered",
"=",
"self",
".",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | FigureBrowser.setup_option_actions | Setup the actions to show in the cog menu. | spyder/plugins/plots/widgets/figurebrowser.py | 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... | 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... | [
"Setup",
"the",
"actions",
"to",
"show",
"in",
"the",
"cog",
"menu",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L214-L233 | [
"def",
"setup_option_actions",
"(",
"self",
",",
"mute_inline_plotting",
",",
"show_plot_outline",
")",
":",
"self",
".",
"setup_in_progress",
"=",
"True",
"self",
".",
"mute_inline_action",
"=",
"create_action",
"(",
"self",
",",
"_",
"(",
"\"Mute inline plotting\"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | FigureBrowser.create_shortcuts | Create shortcuts for this widget. | spyder/plugins/plots/widgets/figurebrowser.py | 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',
... | 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',
... | [
"Create",
"shortcuts",
"for",
"this",
"widget",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L255-L265 | [
"def",
"create_shortcuts",
"(",
"self",
")",
":",
"# Configurable",
"copyfig",
"=",
"config_shortcut",
"(",
"self",
".",
"copy_figure",
",",
"context",
"=",
"'plots'",
",",
"name",
"=",
"'copy'",
",",
"parent",
"=",
"self",
")",
"prevfig",
"=",
"config_short... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | FigureBrowser.option_changed | Handle when the value of an option has changed | spyder/plugins/plots/widgets/figurebrowser.py | 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) | 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) | [
"Handle",
"when",
"the",
"value",
"of",
"an",
"option",
"has",
"changed"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L277-L282 | [
"def",
"option_changed",
"(",
"self",
",",
"option",
",",
"value",
")",
":",
"setattr",
"(",
"self",
",",
"to_text_string",
"(",
"option",
")",
",",
"value",
")",
"self",
".",
"shellwidget",
".",
"set_namespace_view_settings",
"(",
")",
"if",
"self",
".",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | FigureBrowser.show_fig_outline_in_viewer | Draw a frame around the figure viewer if state is True. | spyder/plugins/plots/widgets/figurebrowser.py | 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... | 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... | [
"Draw",
"a",
"frame",
"around",
"the",
"figure",
"viewer",
"if",
"state",
"is",
"True",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L284-L291 | [
"def",
"show_fig_outline_in_viewer",
"(",
"self",
",",
"state",
")",
":",
"if",
"state",
"is",
"True",
":",
"self",
".",
"figviewer",
".",
"figcanvas",
".",
"setStyleSheet",
"(",
"\"FigureCanvas{border: 1px solid lightgrey;}\"",
")",
"else",
":",
"self",
".",
"f... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | FigureBrowser.set_shellwidget | Bind the shellwidget instance to the figure browser | spyder/plugins/plots/widgets/figurebrowser.py | 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) | 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) | [
"Bind",
"the",
"shellwidget",
"instance",
"to",
"the",
"figure",
"browser"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L293-L297 | [
"def",
"set_shellwidget",
"(",
"self",
",",
"shellwidget",
")",
":",
"self",
".",
"shellwidget",
"=",
"shellwidget",
"shellwidget",
".",
"set_figurebrowser",
"(",
"self",
")",
"shellwidget",
".",
"sig_new_inline_figure",
".",
"connect",
"(",
"self",
".",
"_handl... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | FigureBrowser.copy_figure | Copy figure from figviewer to clipboard. | spyder/plugins/plots/widgets/figurebrowser.py | def copy_figure(self):
"""Copy figure from figviewer to clipboard."""
if self.figviewer and self.figviewer.figcanvas.fig:
self.figviewer.figcanvas.copy_figure() | def copy_figure(self):
"""Copy figure from figviewer to clipboard."""
if self.figviewer and self.figviewer.figcanvas.fig:
self.figviewer.figcanvas.copy_figure() | [
"Copy",
"figure",
"from",
"figviewer",
"to",
"clipboard",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L349-L352 | [
"def",
"copy_figure",
"(",
"self",
")",
":",
"if",
"self",
".",
"figviewer",
"and",
"self",
".",
"figviewer",
".",
"figcanvas",
".",
"fig",
":",
"self",
".",
"figviewer",
".",
"figcanvas",
".",
"copy_figure",
"(",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | FigureViewer.setup_figcanvas | Setup the FigureCanvas. | spyder/plugins/plots/widgets/figurebrowser.py | def setup_figcanvas(self):
"""Setup the FigureCanvas."""
self.figcanvas = FigureCanvas(background_color=self.background_color)
self.figcanvas.installEventFilter(self)
self.setWidget(self.figcanvas) | def setup_figcanvas(self):
"""Setup the FigureCanvas."""
self.figcanvas = FigureCanvas(background_color=self.background_color)
self.figcanvas.installEventFilter(self)
self.setWidget(self.figcanvas) | [
"Setup",
"the",
"FigureCanvas",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L382-L386 | [
"def",
"setup_figcanvas",
"(",
"self",
")",
":",
"self",
".",
"figcanvas",
"=",
"FigureCanvas",
"(",
"background_color",
"=",
"self",
".",
"background_color",
")",
"self",
".",
"figcanvas",
".",
"installEventFilter",
"(",
"self",
")",
"self",
".",
"setWidget",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | FigureViewer.load_figure | Set a new figure in the figure canvas. | spyder/plugins/plots/widgets/figurebrowser.py | 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() | 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() | [
"Set",
"a",
"new",
"figure",
"in",
"the",
"figure",
"canvas",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L388-L392 | [
"def",
"load_figure",
"(",
"self",
",",
"fig",
",",
"fmt",
")",
":",
"self",
".",
"figcanvas",
".",
"load_figure",
"(",
"fig",
",",
"fmt",
")",
"self",
".",
"scale_image",
"(",
")",
"self",
".",
"figcanvas",
".",
"repaint",
"(",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | FigureViewer.eventFilter | A filter to control the zooming and panning of the figure canvas. | spyder/plugins/plots/widgets/figurebrowser.py | 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... | 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... | [
"A",
"filter",
"to",
"control",
"the",
"zooming",
"and",
"panning",
"of",
"the",
"figure",
"canvas",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L394-L438 | [
"def",
"eventFilter",
"(",
"self",
",",
"widget",
",",
"event",
")",
":",
"# ---- Zooming",
"if",
"event",
".",
"type",
"(",
")",
"==",
"QEvent",
".",
"Wheel",
":",
"modifiers",
"=",
"QApplication",
".",
"keyboardModifiers",
"(",
")",
"if",
"modifiers",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | FigureViewer.zoom_in | Scale the image up by one scale step. | spyder/plugins/plots/widgets/figurebrowser.py | 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()) | 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",
"up",
"by",
"one",
"scale",
"step",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L441-L447 | [
"def",
"zoom_in",
"(",
"self",
")",
":",
"if",
"self",
".",
"_scalefactor",
"<=",
"self",
".",
"_sfmax",
":",
"self",
".",
"_scalefactor",
"+=",
"1",
"self",
".",
"scale_image",
"(",
")",
"self",
".",
"_adjust_scrollbar",
"(",
"self",
".",
"_scalestep",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | FigureViewer.zoom_out | Scale the image down by one scale step. | spyder/plugins/plots/widgets/figurebrowser.py | 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()) | 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",
"down",
"by",
"one",
"scale",
"step",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L449-L455 | [
"def",
"zoom_out",
"(",
"self",
")",
":",
"if",
"self",
".",
"_scalefactor",
">=",
"self",
".",
"_sfmin",
":",
"self",
".",
"_scalefactor",
"-=",
"1",
"self",
".",
"scale_image",
"(",
")",
"self",
".",
"_adjust_scrollbar",
"(",
"1",
"/",
"self",
".",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | FigureViewer.scale_image | Scale the image size. | spyder/plugins/plots/widgets/figurebrowser.py | 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... | 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... | [
"Scale",
"the",
"image",
"size",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L457-L463 | [
"def",
"scale_image",
"(",
"self",
")",
":",
"new_width",
"=",
"int",
"(",
"self",
".",
"figcanvas",
".",
"fwidth",
"*",
"self",
".",
"_scalestep",
"**",
"self",
".",
"_scalefactor",
")",
"new_height",
"=",
"int",
"(",
"self",
".",
"figcanvas",
".",
"f... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | FigureViewer._adjust_scrollbar | Adjust the scrollbar position to take into account the zooming of
the figure. | spyder/plugins/plots/widgets/figurebrowser.py | 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... | 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... | [
"Adjust",
"the",
"scrollbar",
"position",
"to",
"take",
"into",
"account",
"the",
"zooming",
"of",
"the",
"figure",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L474-L485 | [
"def",
"_adjust_scrollbar",
"(",
"self",
",",
"f",
")",
":",
"# Adjust horizontal scrollbar :",
"hb",
"=",
"self",
".",
"horizontalScrollBar",
"(",
")",
"hb",
".",
"setValue",
"(",
"int",
"(",
"f",
"*",
"hb",
".",
"value",
"(",
")",
"+",
"(",
"(",
"f",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ThumbnailScrollBar.setup_gui | Setup the main layout of the widget. | spyder/plugins/plots/widgets/figurebrowser.py | 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)
... | 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",
"main",
"layout",
"of",
"the",
"widget",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L504-L515 | [
"def",
"setup_gui",
"(",
"self",
")",
":",
"scrollarea",
"=",
"self",
".",
"setup_scrollarea",
"(",
")",
"up_btn",
",",
"down_btn",
"=",
"self",
".",
"setup_arrow_buttons",
"(",
")",
"self",
".",
"setFixedWidth",
"(",
"150",
")",
"layout",
"=",
"QVBoxLayou... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ThumbnailScrollBar.setup_scrollarea | Setup the scrollarea that will contain the FigureThumbnails. | spyder/plugins/plots/widgets/figurebrowser.py | 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.... | 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",
"scrollarea",
"that",
"will",
"contain",
"the",
"FigureThumbnails",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L517-L539 | [
"def",
"setup_scrollarea",
"(",
"self",
")",
":",
"self",
".",
"view",
"=",
"QWidget",
"(",
")",
"self",
".",
"scene",
"=",
"QGridLayout",
"(",
"self",
".",
"view",
")",
"self",
".",
"scene",
".",
"setColumnStretch",
"(",
"0",
",",
"100",
")",
"self"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ThumbnailScrollBar.setup_arrow_buttons | Setup the up and down arrow buttons that are placed at the top and
bottom of the scrollarea. | spyder/plugins/plots/widgets/figurebrowser.py | 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 ... | 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 ... | [
"Setup",
"the",
"up",
"and",
"down",
"arrow",
"buttons",
"that",
"are",
"placed",
"at",
"the",
"top",
"and",
"bottom",
"of",
"the",
"scrollarea",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L541-L566 | [
"def",
"setup_arrow_buttons",
"(",
"self",
")",
":",
"# Get the height of the up/down arrow of the default vertical",
"# scrollbar :",
"vsb",
"=",
"self",
".",
"scrollarea",
".",
"verticalScrollBar",
"(",
")",
"style",
"=",
"vsb",
".",
"style",
"(",
")",
"opt",
"=",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ThumbnailScrollBar.save_all_figures_as | Save all the figures to a file. | spyder/plugins/plots/widgets/figurebrowser.py | 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:
... | 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",
"the",
"figures",
"to",
"a",
"file",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L573-L580 | [
"def",
"save_all_figures_as",
"(",
"self",
")",
":",
"self",
".",
"redirect_stdio",
".",
"emit",
"(",
"False",
")",
"dirname",
"=",
"getexistingdirectory",
"(",
"self",
",",
"caption",
"=",
"'Save all figures'",
",",
"basedir",
"=",
"getcwd_or_home",
"(",
")",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ThumbnailScrollBar.save_all_figures_todir | Save all figure in dirname. | spyder/plugins/plots/widgets/figurebrowser.py | 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',
... | 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",
"all",
"figure",
"in",
"dirname",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L582-L595 | [
"def",
"save_all_figures_todir",
"(",
"self",
",",
"dirname",
")",
":",
"fignames",
"=",
"[",
"]",
"for",
"thumbnail",
"in",
"self",
".",
"_thumbnails",
":",
"fig",
"=",
"thumbnail",
".",
"canvas",
".",
"fig",
"fmt",
"=",
"thumbnail",
".",
"canvas",
".",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ThumbnailScrollBar.save_current_figure_as | Save the currently selected figure. | spyder/plugins/plots/widgets/figurebrowser.py | 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) | 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",
"currently",
"selected",
"figure",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L597-L601 | [
"def",
"save_current_figure_as",
"(",
"self",
")",
":",
"if",
"self",
".",
"current_thumbnail",
"is",
"not",
"None",
":",
"self",
".",
"save_figure_as",
"(",
"self",
".",
"current_thumbnail",
".",
"canvas",
".",
"fig",
",",
"self",
".",
"current_thumbnail",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ThumbnailScrollBar.save_figure_as | Save the figure to a file. | spyder/plugins/plots/widgets/figurebrowser.py | 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... | 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... | [
"Save",
"the",
"figure",
"to",
"a",
"file",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L603-L620 | [
"def",
"save_figure_as",
"(",
"self",
",",
"fig",
",",
"fmt",
")",
":",
"fext",
",",
"ffilt",
"=",
"{",
"'image/png'",
":",
"(",
"'.png'",
",",
"'PNG (*.png)'",
")",
",",
"'image/jpeg'",
":",
"(",
"'.jpg'",
",",
"'JPEG (*.jpg;*.jpeg;*.jpe;*.jfif)'",
")",
"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ThumbnailScrollBar.remove_all_thumbnails | Remove all thumbnails. | spyder/plugins/plots/widgets/figurebrowser.py | 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()... | 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",
"all",
"thumbnails",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L656-L666 | [
"def",
"remove_all_thumbnails",
"(",
"self",
")",
":",
"for",
"thumbnail",
"in",
"self",
".",
"_thumbnails",
":",
"self",
".",
"layout",
"(",
")",
".",
"removeWidget",
"(",
"thumbnail",
")",
"thumbnail",
".",
"sig_canvas_clicked",
".",
"disconnect",
"(",
")"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ThumbnailScrollBar.remove_thumbnail | Remove thumbnail. | spyder/plugins/plots/widgets/figurebrowser.py | 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... | 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... | [
"Remove",
"thumbnail",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L668-L685 | [
"def",
"remove_thumbnail",
"(",
"self",
",",
"thumbnail",
")",
":",
"if",
"thumbnail",
"in",
"self",
".",
"_thumbnails",
":",
"index",
"=",
"self",
".",
"_thumbnails",
".",
"index",
"(",
"thumbnail",
")",
"self",
".",
"_thumbnails",
".",
"remove",
"(",
"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ThumbnailScrollBar.set_current_thumbnail | Set the currently selected thumbnail. | spyder/plugins/plots/widgets/figurebrowser.py | 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... | 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... | [
"Set",
"the",
"currently",
"selected",
"thumbnail",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L698-L704 | [
"def",
"set_current_thumbnail",
"(",
"self",
",",
"thumbnail",
")",
":",
"self",
".",
"current_thumbnail",
"=",
"thumbnail",
"self",
".",
"figure_viewer",
".",
"load_figure",
"(",
"thumbnail",
".",
"canvas",
".",
"fig",
",",
"thumbnail",
".",
"canvas",
".",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ThumbnailScrollBar.go_previous_thumbnail | Select the thumbnail previous to the currently selected one. | spyder/plugins/plots/widgets/figurebrowser.py | 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... | 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",
"the",
"thumbnail",
"previous",
"to",
"the",
"currently",
"selected",
"one",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L706-L712 | [
"def",
"go_previous_thumbnail",
"(",
"self",
")",
":",
"if",
"self",
".",
"current_thumbnail",
"is",
"not",
"None",
":",
"index",
"=",
"self",
".",
"_thumbnails",
".",
"index",
"(",
"self",
".",
"current_thumbnail",
")",
"-",
"1",
"index",
"=",
"index",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ThumbnailScrollBar.go_next_thumbnail | Select thumbnail next to the currently selected one. | spyder/plugins/plots/widgets/figurebrowser.py | 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... | 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... | [
"Select",
"thumbnail",
"next",
"to",
"the",
"currently",
"selected",
"one",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L714-L720 | [
"def",
"go_next_thumbnail",
"(",
"self",
")",
":",
"if",
"self",
".",
"current_thumbnail",
"is",
"not",
"None",
":",
"index",
"=",
"self",
".",
"_thumbnails",
".",
"index",
"(",
"self",
".",
"current_thumbnail",
")",
"+",
"1",
"index",
"=",
"0",
"if",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ThumbnailScrollBar.scroll_to_item | Scroll to the selected item of ThumbnailScrollBar. | spyder/plugins/plots/widgets/figurebrowser.py | 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 =... | 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",
"to",
"the",
"selected",
"item",
"of",
"ThumbnailScrollBar",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L722-L738 | [
"def",
"scroll_to_item",
"(",
"self",
",",
"index",
")",
":",
"spacing_between_items",
"=",
"self",
".",
"scene",
".",
"verticalSpacing",
"(",
")",
"height_view",
"=",
"self",
".",
"scrollarea",
".",
"viewport",
"(",
")",
".",
"height",
"(",
")",
"height_i... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | ThumbnailScrollBar.go_up | Scroll the scrollbar of the scrollarea up by a single step. | spyder/plugins/plots/widgets/figurebrowser.py | 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())) | 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())) | [
"Scroll",
"the",
"scrollbar",
"of",
"the",
"scrollarea",
"up",
"by",
"a",
"single",
"step",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L741-L744 | [
"def",
"go_up",
"(",
"self",
")",
":",
"vsb",
"=",
"self",
".",
"scrollarea",
".",
"verticalScrollBar",
"(",
")",
"vsb",
".",
"setValue",
"(",
"int",
"(",
"vsb",
".",
"value",
"(",
")",
"-",
"vsb",
".",
"singleStep",
"(",
")",
")",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | FigureThumbnail.setup_gui | Setup the main layout of the widget. | spyder/plugins/plots/widgets/figurebrowser.py | 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... | 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",
"main",
"layout",
"of",
"the",
"widget",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L767-L776 | [
"def",
"setup_gui",
"(",
"self",
")",
":",
"layout",
"=",
"QGridLayout",
"(",
"self",
")",
"layout",
".",
"setContentsMargins",
"(",
"0",
",",
"0",
",",
"0",
",",
"0",
")",
"layout",
".",
"addWidget",
"(",
"self",
".",
"canvas",
",",
"0",
",",
"1",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | FigureThumbnail.setup_toolbar | Setup the toolbar. | spyder/plugins/plots/widgets/figurebrowser.py | 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... | 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... | [
"Setup",
"the",
"toolbar",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L778-L796 | [
"def",
"setup_toolbar",
"(",
"self",
")",
":",
"self",
".",
"savefig_btn",
"=",
"create_toolbutton",
"(",
"self",
",",
"icon",
"=",
"ima",
".",
"icon",
"(",
"'filesave'",
")",
",",
"tip",
"=",
"_",
"(",
"\"Save Image As...\"",
")",
",",
"triggered",
"=",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | FigureThumbnail.highlight_canvas | Set a colored frame around the FigureCanvas if highlight is True. | spyder/plugins/plots/widgets/figurebrowser.py | 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 %... | 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 %... | [
"Set",
"a",
"colored",
"frame",
"around",
"the",
"FigureCanvas",
"if",
"highlight",
"is",
"True",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L798-L807 | [
"def",
"highlight_canvas",
"(",
"self",
",",
"highlight",
")",
":",
"colorname",
"=",
"self",
".",
"canvas",
".",
"palette",
"(",
")",
".",
"highlight",
"(",
")",
".",
"color",
"(",
")",
".",
"name",
"(",
")",
"if",
"highlight",
":",
"self",
".",
"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | FigureThumbnail.eventFilter | A filter that is used to send a signal when the figure canvas is
clicked. | spyder/plugins/plots/widgets/figurebrowser.py | 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... | 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... | [
"A",
"filter",
"that",
"is",
"used",
"to",
"send",
"a",
"signal",
"when",
"the",
"figure",
"canvas",
"is",
"clicked",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L809-L817 | [
"def",
"eventFilter",
"(",
"self",
",",
"widget",
",",
"event",
")",
":",
"if",
"event",
".",
"type",
"(",
")",
"==",
"QEvent",
".",
"MouseButtonPress",
":",
"if",
"event",
".",
"button",
"(",
")",
"==",
"Qt",
".",
"LeftButton",
":",
"self",
".",
"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | FigureThumbnail.emit_save_figure | Emit a signal when the toolbutton to save the figure is clicked. | spyder/plugins/plots/widgets/figurebrowser.py | 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) | 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) | [
"Emit",
"a",
"signal",
"when",
"the",
"toolbutton",
"to",
"save",
"the",
"figure",
"is",
"clicked",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L819-L823 | [
"def",
"emit_save_figure",
"(",
"self",
")",
":",
"self",
".",
"sig_save_figure",
".",
"emit",
"(",
"self",
".",
"canvas",
".",
"fig",
",",
"self",
".",
"canvas",
".",
"fmt",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | FigureCanvas.context_menu_requested | Popup context menu. | spyder/plugins/plots/widgets/figurebrowser.py | 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,
... | 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,
... | [
"Popup",
"context",
"menu",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L853-L862 | [
"def",
"context_menu_requested",
"(",
"self",
",",
"event",
")",
":",
"if",
"self",
".",
"fig",
":",
"pos",
"=",
"QPoint",
"(",
"event",
".",
"x",
"(",
")",
",",
"event",
".",
"y",
"(",
")",
")",
"context_menu",
"=",
"QMenu",
"(",
"self",
")",
"c... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | FigureCanvas.copy_figure | Copy figure to clipboard. | spyder/plugins/plots/widgets/figurebrowser.py | 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':
... | 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':
... | [
"Copy",
"figure",
"to",
"clipboard",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L865-L876 | [
"def",
"copy_figure",
"(",
"self",
")",
":",
"if",
"self",
".",
"fmt",
"in",
"[",
"'image/png'",
",",
"'image/jpeg'",
"]",
":",
"qpixmap",
"=",
"QPixmap",
"(",
")",
"qpixmap",
".",
"loadFromData",
"(",
"self",
".",
"fig",
",",
"self",
".",
"fmt",
"."... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | FigureCanvas.blink_figure | Blink figure once. | spyder/plugins/plots/widgets/figurebrowser.py | 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) | 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) | [
"Blink",
"figure",
"once",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L878-L885 | [
"def",
"blink_figure",
"(",
"self",
")",
":",
"if",
"self",
".",
"fig",
":",
"self",
".",
"_blink_flag",
"=",
"not",
"self",
".",
"_blink_flag",
"self",
".",
"repaint",
"(",
")",
"if",
"self",
".",
"_blink_flag",
":",
"timer",
"=",
"QTimer",
"(",
")"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | FigureCanvas.clear_canvas | Clear the figure that was painted on the widget. | spyder/plugins/plots/widgets/figurebrowser.py | def clear_canvas(self):
"""Clear the figure that was painted on the widget."""
self.fig = None
self.fmt = None
self._qpix_buffer = []
self.repaint() | def clear_canvas(self):
"""Clear the figure that was painted on the widget."""
self.fig = None
self.fmt = None
self._qpix_buffer = []
self.repaint() | [
"Clear",
"the",
"figure",
"that",
"was",
"painted",
"on",
"the",
"widget",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L887-L892 | [
"def",
"clear_canvas",
"(",
"self",
")",
":",
"self",
".",
"fig",
"=",
"None",
"self",
".",
"fmt",
"=",
"None",
"self",
".",
"_qpix_buffer",
"=",
"[",
"]",
"self",
".",
"repaint",
"(",
")"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | FigureCanvas.load_figure | Load the figure from a png, jpg, or svg image, convert it in
a QPixmap, and force a repaint of the widget. | spyder/plugins/plots/widgets/figurebrowser.py | 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()
... | 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()
... | [
"Load",
"the",
"figure",
"from",
"a",
"png",
"jpg",
"or",
"svg",
"image",
"convert",
"it",
"in",
"a",
"QPixmap",
"and",
"force",
"a",
"repaint",
"of",
"the",
"widget",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L894-L910 | [
"def",
"load_figure",
"(",
"self",
",",
"fig",
",",
"fmt",
")",
":",
"self",
".",
"fig",
"=",
"fig",
"self",
".",
"fmt",
"=",
"fmt",
"if",
"fmt",
"in",
"[",
"'image/png'",
",",
"'image/jpeg'",
"]",
":",
"self",
".",
"_qpix_orig",
"=",
"QPixmap",
"(... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | FigureCanvas.paintEvent | Qt method override to paint a custom image on the Widget. | spyder/plugins/plots/widgets/figurebrowser.py | 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... | 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... | [
"Qt",
"method",
"override",
"to",
"paint",
"a",
"custom",
"image",
"on",
"the",
"Widget",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L912-L943 | [
"def",
"paintEvent",
"(",
"self",
",",
"event",
")",
":",
"super",
"(",
"FigureCanvas",
",",
"self",
")",
".",
"paintEvent",
"(",
"event",
")",
"# Prepare the rect on which the image is going to be painted :",
"fw",
"=",
"self",
".",
"frameWidth",
"(",
")",
"rec... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainInterpreterConfigPage.python_executable_changed | Custom Python executable value has been changed | spyder/preferences/maininterpreter.py | 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(... | 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(... | [
"Custom",
"Python",
"executable",
"value",
"has",
"been",
"changed"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/maininterpreter.py#L151-L168 | [
"def",
"python_executable_changed",
"(",
"self",
",",
"pyexec",
")",
":",
"if",
"not",
"self",
".",
"cus_exec_radio",
".",
"isChecked",
"(",
")",
":",
"return",
"False",
"def_pyexec",
"=",
"get_python_executable",
"(",
")",
"if",
"not",
"is_text_string",
"(",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainInterpreterConfigPage.set_umr_namelist | Set UMR excluded modules name list | spyder/preferences/maininterpreter.py | 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>"),
... | 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>"),
... | [
"Set",
"UMR",
"excluded",
"modules",
"name",
"list"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/maininterpreter.py#L193-L232 | [
"def",
"set_umr_namelist",
"(",
"self",
")",
":",
"arguments",
",",
"valid",
"=",
"QInputDialog",
".",
"getText",
"(",
"self",
",",
"_",
"(",
"'UMR'",
")",
",",
"_",
"(",
"\"Set the list of excluded modules as \"",
"\"this: <i>numpy, scipy</i>\"",
")",
",",
"QLi... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainInterpreterConfigPage.set_custom_interpreters_list | Update the list of interpreters used and the current one. | spyder/preferences/maininterpreter.py | 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... | 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... | [
"Update",
"the",
"list",
"of",
"interpreters",
"used",
"and",
"the",
"current",
"one",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/maininterpreter.py#L234-L239 | [
"def",
"set_custom_interpreters_list",
"(",
"self",
",",
"value",
")",
":",
"custom_list",
"=",
"self",
".",
"get_option",
"(",
"'custom_interpreters_list'",
")",
"if",
"value",
"not",
"in",
"custom_list",
"and",
"value",
"!=",
"get_python_executable",
"(",
")",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | MainInterpreterConfigPage.validate_custom_interpreters_list | Check that the used custom interpreters are still valid. | spyder/preferences/maininterpreter.py | 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... | 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... | [
"Check",
"that",
"the",
"used",
"custom",
"interpreters",
"are",
"still",
"valid",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/maininterpreter.py#L241-L249 | [
"def",
"validate_custom_interpreters_list",
"(",
"self",
")",
":",
"custom_list",
"=",
"self",
".",
"get_option",
"(",
"'custom_interpreters_list'",
")",
"valid_custom_list",
"=",
"[",
"]",
"for",
"value",
"in",
"custom_list",
":",
"if",
"(",
"osp",
".",
"isfile... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Panel.on_install | 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 editor: spyder.plugins.editor.widgets.codeeditor.CodeE... | spyder/api/panel.py | 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... | 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... | [
"Extends",
":",
"meth",
":",
"spyder",
".",
"api",
".",
"EditorExtension",
".",
"on_install",
"method",
"to",
"set",
"the",
"editor",
"instance",
"as",
"the",
"parent",
"widget",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/api/panel.py#L92-L114 | [
"def",
"on_install",
"(",
"self",
",",
"editor",
")",
":",
"EditorExtension",
".",
"on_install",
"(",
"self",
",",
"editor",
")",
"self",
".",
"setParent",
"(",
"editor",
")",
"self",
".",
"setPalette",
"(",
"QApplication",
".",
"instance",
"(",
")",
"."... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Panel.paintEvent | Fills the panel background using QPalette. | spyder/api/panel.py | 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 ... | 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 ... | [
"Fills",
"the",
"panel",
"background",
"using",
"QPalette",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/api/panel.py#L116-L125 | [
"def",
"paintEvent",
"(",
"self",
",",
"event",
")",
":",
"if",
"self",
".",
"isVisible",
"(",
")",
"and",
"self",
".",
"position",
"!=",
"self",
".",
"Position",
".",
"FLOATING",
":",
"# fill background",
"self",
".",
"_background_brush",
"=",
"QBrush",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Panel.setVisible | Shows/Hides the panel.
Automatically call PanelsManager.refresh_panels.
:param visible: Visible state | spyder/api/panel.py | 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:
... | 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:
... | [
"Shows",
"/",
"Hides",
"the",
"panel",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/api/panel.py#L127-L138 | [
"def",
"setVisible",
"(",
"self",
",",
"visible",
")",
":",
"logger",
".",
"debug",
"(",
"'%s visibility changed'",
",",
"self",
".",
"name",
")",
"super",
"(",
"Panel",
",",
"self",
")",
".",
"setVisible",
"(",
"visible",
")",
"if",
"self",
".",
"edit... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | Panel.set_geometry | Set geometry for floating panels.
Normally you don't need to override this method, you should override
`geometry` instead. | spyder/api/panel.py | 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... | 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... | [
"Set",
"geometry",
"for",
"floating",
"panels",
"."
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/api/panel.py#L149-L170 | [
"def",
"set_geometry",
"(",
"self",
",",
"crect",
")",
":",
"x0",
",",
"y0",
",",
"width",
",",
"height",
"=",
"self",
".",
"geometry",
"(",
")",
"if",
"width",
"is",
"None",
":",
"width",
"=",
"crect",
".",
"width",
"(",
")",
"if",
"height",
"is... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | openssh_tunnel | 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 | spyder/plugins/ipythonconsole/utils/ssh.py | 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... | 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... | [
"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... | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/utils/ssh.py#L23-L98 | [
"def",
"openssh_tunnel",
"(",
"self",
",",
"lport",
",",
"rport",
",",
"server",
",",
"remoteip",
"=",
"'127.0.0.1'",
",",
"keyfile",
"=",
"None",
",",
"password",
"=",
"None",
",",
"timeout",
"=",
"0.4",
")",
":",
"ssh",
"=",
"\"ssh \"",
"if",
"keyfil... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | NamepaceBrowserWidget.configure_namespacebrowser | Configure associated namespace browser widget | spyder/plugins/ipythonconsole/widgets/namespacebrowser.py | 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... | 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... | [
"Configure",
"associated",
"namespace",
"browser",
"widget"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/namespacebrowser.py#L55-L63 | [
"def",
"configure_namespacebrowser",
"(",
"self",
")",
":",
"# Update namespace view",
"self",
".",
"sig_namespace_view",
".",
"connect",
"(",
"lambda",
"data",
":",
"self",
".",
"namespacebrowser",
".",
"process_remote_view",
"(",
"data",
")",
")",
"# Update proper... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | NamepaceBrowserWidget.set_namespace_view_settings | Set the namespace view settings | spyder/plugins/ipythonconsole/widgets/namespacebrowser.py | 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)
... | 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)
... | [
"Set",
"the",
"namespace",
"view",
"settings"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/namespacebrowser.py#L73-L80 | [
"def",
"set_namespace_view_settings",
"(",
"self",
")",
":",
"if",
"self",
".",
"namespacebrowser",
":",
"settings",
"=",
"to_text_string",
"(",
"self",
".",
"namespacebrowser",
".",
"get_view_settings",
"(",
")",
")",
"code",
"=",
"(",
"u\"get_ipython().kernel.na... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | NamepaceBrowserWidget.get_value | Ask kernel for a value | spyder/plugins/ipythonconsole/widgets/namespacebrowser.py | 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... | 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... | [
"Ask",
"kernel",
"for",
"a",
"value"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/namespacebrowser.py#L82-L108 | [
"def",
"get_value",
"(",
"self",
",",
"name",
")",
":",
"code",
"=",
"u\"get_ipython().kernel.get_value('%s')\"",
"%",
"name",
"if",
"self",
".",
"_reading",
":",
"method",
"=",
"self",
".",
"kernel_client",
".",
"input",
"code",
"=",
"u'!'",
"+",
"code",
... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
train | NamepaceBrowserWidget.set_value | Set value for a variable | spyder/plugins/ipythonconsole/widgets/namespacebrowser.py | 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... | 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... | [
"Set",
"value",
"for",
"a",
"variable"
] | spyder-ide/spyder | python | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/namespacebrowser.py#L110-L119 | [
"def",
"set_value",
"(",
"self",
",",
"name",
",",
"value",
")",
":",
"value",
"=",
"to_text_string",
"(",
"value",
")",
"code",
"=",
"u\"get_ipython().kernel.set_value('%s', %s, %s)\"",
"%",
"(",
"name",
",",
"value",
",",
"PY2",
")",
"if",
"self",
".",
"... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.