repo stringclasses 85
values | path stringlengths 8 121 | func_name stringlengths 1 82 | original_string stringlengths 112 65.5k | language stringclasses 1
value | code stringlengths 112 65.5k | code_tokens listlengths 20 4.09k | docstring stringlengths 3 46.3k | docstring_tokens listlengths 1 564 | sha stringclasses 85
values | url stringlengths 93 218 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
spyder-ide/spyder | spyder/widgets/fileswitcher.py | FileSwitcher.next_row | def next_row(self):
"""Select next row in list widget."""
if self.mode == self.SYMBOL_MODE:
self.select_row(+1)
return
next_row = self.current_row() + 1
if next_row < self.count():
if '</b></big><br>' in self.list.item(next_row).text():
... | python | def next_row(self):
"""Select next row in list widget."""
if self.mode == self.SYMBOL_MODE:
self.select_row(+1)
return
next_row = self.current_row() + 1
if next_row < self.count():
if '</b></big><br>' in self.list.item(next_row).text():
... | [
"def",
"next_row",
"(",
"self",
")",
":",
"if",
"self",
".",
"mode",
"==",
"self",
".",
"SYMBOL_MODE",
":",
"self",
".",
"select_row",
"(",
"+",
"1",
")",
"return",
"next_row",
"=",
"self",
".",
"current_row",
"(",
")",
"+",
"1",
"if",
"next_row",
... | Select next row in list widget. | [
"Select",
"next",
"row",
"in",
"list",
"widget",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/fileswitcher.py#L520-L531 | train |
spyder-ide/spyder | spyder/widgets/fileswitcher.py | FileSwitcher.get_stack_index | def get_stack_index(self, stack_index, plugin_index):
"""Get the real index of the selected item."""
other_plugins_count = sum([other_tabs[0].count() \
for other_tabs in \
self.plugins_tabs[:plugin_index]])
real_index = stack_... | python | def get_stack_index(self, stack_index, plugin_index):
"""Get the real index of the selected item."""
other_plugins_count = sum([other_tabs[0].count() \
for other_tabs in \
self.plugins_tabs[:plugin_index]])
real_index = stack_... | [
"def",
"get_stack_index",
"(",
"self",
",",
"stack_index",
",",
"plugin_index",
")",
":",
"other_plugins_count",
"=",
"sum",
"(",
"[",
"other_tabs",
"[",
"0",
"]",
".",
"count",
"(",
")",
"for",
"other_tabs",
"in",
"self",
".",
"plugins_tabs",
"[",
":",
... | Get the real index of the selected item. | [
"Get",
"the",
"real",
"index",
"of",
"the",
"selected",
"item",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/fileswitcher.py#L533-L540 | train |
spyder-ide/spyder | spyder/widgets/fileswitcher.py | FileSwitcher.get_plugin_data | def get_plugin_data(self, plugin):
"""Get the data object of the plugin's current tab manager."""
# The data object is named "data" in the editor plugin while it is
# named "clients" in the notebook plugin.
try:
data = plugin.get_current_tab_manager().data
except Attr... | python | def get_plugin_data(self, plugin):
"""Get the data object of the plugin's current tab manager."""
# The data object is named "data" in the editor plugin while it is
# named "clients" in the notebook plugin.
try:
data = plugin.get_current_tab_manager().data
except Attr... | [
"def",
"get_plugin_data",
"(",
"self",
",",
"plugin",
")",
":",
"# The data object is named \"data\" in the editor plugin while it is",
"# named \"clients\" in the notebook plugin.",
"try",
":",
"data",
"=",
"plugin",
".",
"get_current_tab_manager",
"(",
")",
".",
"data",
"... | Get the data object of the plugin's current tab manager. | [
"Get",
"the",
"data",
"object",
"of",
"the",
"plugin",
"s",
"current",
"tab",
"manager",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/fileswitcher.py#L543-L552 | train |
spyder-ide/spyder | spyder/widgets/fileswitcher.py | FileSwitcher.get_plugin_tabwidget | def get_plugin_tabwidget(self, plugin):
"""Get the tabwidget of the plugin's current tab manager."""
# The tab widget is named "tabs" in the editor plugin while it is
# named "tabwidget" in the notebook plugin.
try:
tabwidget = plugin.get_current_tab_manager().tabs
ex... | python | def get_plugin_tabwidget(self, plugin):
"""Get the tabwidget of the plugin's current tab manager."""
# The tab widget is named "tabs" in the editor plugin while it is
# named "tabwidget" in the notebook plugin.
try:
tabwidget = plugin.get_current_tab_manager().tabs
ex... | [
"def",
"get_plugin_tabwidget",
"(",
"self",
",",
"plugin",
")",
":",
"# The tab widget is named \"tabs\" in the editor plugin while it is",
"# named \"tabwidget\" in the notebook plugin.",
"try",
":",
"tabwidget",
"=",
"plugin",
".",
"get_current_tab_manager",
"(",
")",
".",
... | Get the tabwidget of the plugin's current tab manager. | [
"Get",
"the",
"tabwidget",
"of",
"the",
"plugin",
"s",
"current",
"tab",
"manager",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/fileswitcher.py#L554-L563 | train |
spyder-ide/spyder | spyder/widgets/fileswitcher.py | FileSwitcher.get_widget | def get_widget(self, index=None, path=None, tabs=None):
"""Get widget by index.
If no tabs and index specified the current active widget is returned.
"""
if (index and tabs) or (path and tabs):
return tabs.widget(index)
elif self.plugin:
return self.get_p... | python | def get_widget(self, index=None, path=None, tabs=None):
"""Get widget by index.
If no tabs and index specified the current active widget is returned.
"""
if (index and tabs) or (path and tabs):
return tabs.widget(index)
elif self.plugin:
return self.get_p... | [
"def",
"get_widget",
"(",
"self",
",",
"index",
"=",
"None",
",",
"path",
"=",
"None",
",",
"tabs",
"=",
"None",
")",
":",
"if",
"(",
"index",
"and",
"tabs",
")",
"or",
"(",
"path",
"and",
"tabs",
")",
":",
"return",
"tabs",
".",
"widget",
"(",
... | Get widget by index.
If no tabs and index specified the current active widget is returned. | [
"Get",
"widget",
"by",
"index",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/fileswitcher.py#L565-L575 | train |
spyder-ide/spyder | spyder/widgets/fileswitcher.py | FileSwitcher.set_editor_cursor | def set_editor_cursor(self, editor, cursor):
"""Set the cursor of an editor."""
pos = cursor.position()
anchor = cursor.anchor()
new_cursor = QTextCursor()
if pos == anchor:
new_cursor.movePosition(pos)
else:
new_cursor.movePosition(anchor)
... | python | def set_editor_cursor(self, editor, cursor):
"""Set the cursor of an editor."""
pos = cursor.position()
anchor = cursor.anchor()
new_cursor = QTextCursor()
if pos == anchor:
new_cursor.movePosition(pos)
else:
new_cursor.movePosition(anchor)
... | [
"def",
"set_editor_cursor",
"(",
"self",
",",
"editor",
",",
"cursor",
")",
":",
"pos",
"=",
"cursor",
".",
"position",
"(",
")",
"anchor",
"=",
"cursor",
".",
"anchor",
"(",
")",
"new_cursor",
"=",
"QTextCursor",
"(",
")",
"if",
"pos",
"==",
"anchor",... | Set the cursor of an editor. | [
"Set",
"the",
"cursor",
"of",
"an",
"editor",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/fileswitcher.py#L577-L588 | train |
spyder-ide/spyder | spyder/widgets/fileswitcher.py | FileSwitcher.goto_line | def goto_line(self, line_number):
"""Go to specified line number in current active editor."""
if line_number:
line_number = int(line_number)
try:
self.plugin.go_to_line(line_number)
except AttributeError:
pass | python | def goto_line(self, line_number):
"""Go to specified line number in current active editor."""
if line_number:
line_number = int(line_number)
try:
self.plugin.go_to_line(line_number)
except AttributeError:
pass | [
"def",
"goto_line",
"(",
"self",
",",
"line_number",
")",
":",
"if",
"line_number",
":",
"line_number",
"=",
"int",
"(",
"line_number",
")",
"try",
":",
"self",
".",
"plugin",
".",
"go_to_line",
"(",
"line_number",
")",
"except",
"AttributeError",
":",
"pa... | Go to specified line number in current active editor. | [
"Go",
"to",
"specified",
"line",
"number",
"in",
"current",
"active",
"editor",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/fileswitcher.py#L590-L597 | train |
spyder-ide/spyder | spyder/widgets/fileswitcher.py | FileSwitcher.item_selection_changed | def item_selection_changed(self):
"""List widget item selection change handler."""
row = self.current_row()
if self.count() and row >= 0:
if '</b></big><br>' in self.list.currentItem().text() and row == 0:
self.next_row()
if self.mode == self.FILE_MODE:
... | python | def item_selection_changed(self):
"""List widget item selection change handler."""
row = self.current_row()
if self.count() and row >= 0:
if '</b></big><br>' in self.list.currentItem().text() and row == 0:
self.next_row()
if self.mode == self.FILE_MODE:
... | [
"def",
"item_selection_changed",
"(",
"self",
")",
":",
"row",
"=",
"self",
".",
"current_row",
"(",
")",
"if",
"self",
".",
"count",
"(",
")",
"and",
"row",
">=",
"0",
":",
"if",
"'</b></big><br>'",
"in",
"self",
".",
"list",
".",
"currentItem",
"(",
... | List widget item selection change handler. | [
"List",
"widget",
"item",
"selection",
"change",
"handler",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/fileswitcher.py#L609-L631 | train |
spyder-ide/spyder | spyder/widgets/fileswitcher.py | FileSwitcher.setup_file_list | def setup_file_list(self, filter_text, current_path):
"""Setup list widget content for file list display."""
short_paths = shorten_paths(self.paths, self.save_status)
paths = self.paths
icons = self.icons
results = []
trying_for_line_number = ':' in filter_text
#... | python | def setup_file_list(self, filter_text, current_path):
"""Setup list widget content for file list display."""
short_paths = shorten_paths(self.paths, self.save_status)
paths = self.paths
icons = self.icons
results = []
trying_for_line_number = ':' in filter_text
#... | [
"def",
"setup_file_list",
"(",
"self",
",",
"filter_text",
",",
"current_path",
")",
":",
"short_paths",
"=",
"shorten_paths",
"(",
"self",
".",
"paths",
",",
"self",
".",
"save_status",
")",
"paths",
"=",
"self",
".",
"paths",
"icons",
"=",
"self",
".",
... | Setup list widget content for file list display. | [
"Setup",
"list",
"widget",
"content",
"for",
"file",
"list",
"display",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/fileswitcher.py#L648-L767 | train |
spyder-ide/spyder | spyder/widgets/fileswitcher.py | FileSwitcher.setup_symbol_list | def setup_symbol_list(self, filter_text, current_path):
"""Setup list widget content for symbol list display."""
# Get optional symbol name
filter_text, symbol_text = filter_text.split('@')
# Fetch the Outline explorer data, get the icons and values
oedata = self.get_symbol_list... | python | def setup_symbol_list(self, filter_text, current_path):
"""Setup list widget content for symbol list display."""
# Get optional symbol name
filter_text, symbol_text = filter_text.split('@')
# Fetch the Outline explorer data, get the icons and values
oedata = self.get_symbol_list... | [
"def",
"setup_symbol_list",
"(",
"self",
",",
"filter_text",
",",
"current_path",
")",
":",
"# Get optional symbol name",
"filter_text",
",",
"symbol_text",
"=",
"filter_text",
".",
"split",
"(",
"'@'",
")",
"# Fetch the Outline explorer data, get the icons and values",
"... | Setup list widget content for symbol list display. | [
"Setup",
"list",
"widget",
"content",
"for",
"symbol",
"list",
"display",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/fileswitcher.py#L769-L820 | train |
spyder-ide/spyder | spyder/widgets/fileswitcher.py | FileSwitcher.setup | def setup(self):
"""Setup list widget content."""
if len(self.plugins_tabs) == 0:
self.close()
return
self.list.clear()
current_path = self.current_path
filter_text = self.filter_text
# Get optional line or symbol to define mode and method handle... | python | def setup(self):
"""Setup list widget content."""
if len(self.plugins_tabs) == 0:
self.close()
return
self.list.clear()
current_path = self.current_path
filter_text = self.filter_text
# Get optional line or symbol to define mode and method handle... | [
"def",
"setup",
"(",
"self",
")",
":",
"if",
"len",
"(",
"self",
".",
"plugins_tabs",
")",
"==",
"0",
":",
"self",
".",
"close",
"(",
")",
"return",
"self",
".",
"list",
".",
"clear",
"(",
")",
"current_path",
"=",
"self",
".",
"current_path",
"fil... | Setup list widget content. | [
"Setup",
"list",
"widget",
"content",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/fileswitcher.py#L831-L852 | train |
spyder-ide/spyder | spyder/widgets/fileswitcher.py | FileSwitcher.add_plugin | def add_plugin(self, plugin, tabs, data, icon):
"""Add a plugin to display its files."""
self.plugins_tabs.append((tabs, plugin))
self.plugins_data.append((data, icon))
self.plugins_instances.append(plugin) | python | def add_plugin(self, plugin, tabs, data, icon):
"""Add a plugin to display its files."""
self.plugins_tabs.append((tabs, plugin))
self.plugins_data.append((data, icon))
self.plugins_instances.append(plugin) | [
"def",
"add_plugin",
"(",
"self",
",",
"plugin",
",",
"tabs",
",",
"data",
",",
"icon",
")",
":",
"self",
".",
"plugins_tabs",
".",
"append",
"(",
"(",
"tabs",
",",
"plugin",
")",
")",
"self",
".",
"plugins_data",
".",
"append",
"(",
"(",
"data",
"... | Add a plugin to display its files. | [
"Add",
"a",
"plugin",
"to",
"display",
"its",
"files",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/fileswitcher.py#L862-L866 | train |
spyder-ide/spyder | spyder/utils/external/binaryornot/check.py | is_binary | def is_binary(filename):
"""
:param filename: File to check.
:returns: True if it's a binary file, otherwise False.
"""
logger.debug('is_binary: %(filename)r', locals())
# Check if the file extension is in a list of known binary types
binary_extensions = ['pyc', 'iso', 'zip', 'pdf']
for... | python | def is_binary(filename):
"""
:param filename: File to check.
:returns: True if it's a binary file, otherwise False.
"""
logger.debug('is_binary: %(filename)r', locals())
# Check if the file extension is in a list of known binary types
binary_extensions = ['pyc', 'iso', 'zip', 'pdf']
for... | [
"def",
"is_binary",
"(",
"filename",
")",
":",
"logger",
".",
"debug",
"(",
"'is_binary: %(filename)r'",
",",
"locals",
"(",
")",
")",
"# Check if the file extension is in a list of known binary types",
"binary_extensions",
"=",
"[",
"'pyc'",
",",
"'iso'",
",",
"'zip'... | :param filename: File to check.
:returns: True if it's a binary file, otherwise False. | [
":",
"param",
"filename",
":",
"File",
"to",
"check",
".",
":",
"returns",
":",
"True",
"if",
"it",
"s",
"a",
"binary",
"file",
"otherwise",
"False",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/external/binaryornot/check.py#L28-L43 | train |
spyder-ide/spyder | spyder/utils/vcs.py | get_vcs_info | def get_vcs_info(path):
"""Return support status dict if path is under VCS root"""
for info in SUPPORTED:
vcs_path = osp.join(path, info['rootdir'])
if osp.isdir(vcs_path):
return info | python | def get_vcs_info(path):
"""Return support status dict if path is under VCS root"""
for info in SUPPORTED:
vcs_path = osp.join(path, info['rootdir'])
if osp.isdir(vcs_path):
return info | [
"def",
"get_vcs_info",
"(",
"path",
")",
":",
"for",
"info",
"in",
"SUPPORTED",
":",
"vcs_path",
"=",
"osp",
".",
"join",
"(",
"path",
",",
"info",
"[",
"'rootdir'",
"]",
")",
"if",
"osp",
".",
"isdir",
"(",
"vcs_path",
")",
":",
"return",
"info"
] | Return support status dict if path is under VCS root | [
"Return",
"support",
"status",
"dict",
"if",
"path",
"is",
"under",
"VCS",
"root"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/vcs.py#L52-L57 | train |
spyder-ide/spyder | spyder/utils/vcs.py | get_vcs_root | def get_vcs_root(path):
"""Return VCS root directory path
Return None if path is not within a supported VCS repository"""
previous_path = path
while get_vcs_info(path) is None:
path = abspardir(path)
if path == previous_path:
return
else:
previous... | python | def get_vcs_root(path):
"""Return VCS root directory path
Return None if path is not within a supported VCS repository"""
previous_path = path
while get_vcs_info(path) is None:
path = abspardir(path)
if path == previous_path:
return
else:
previous... | [
"def",
"get_vcs_root",
"(",
"path",
")",
":",
"previous_path",
"=",
"path",
"while",
"get_vcs_info",
"(",
"path",
")",
"is",
"None",
":",
"path",
"=",
"abspardir",
"(",
"path",
")",
"if",
"path",
"==",
"previous_path",
":",
"return",
"else",
":",
"previo... | Return VCS root directory path
Return None if path is not within a supported VCS repository | [
"Return",
"VCS",
"root",
"directory",
"path",
"Return",
"None",
"if",
"path",
"is",
"not",
"within",
"a",
"supported",
"VCS",
"repository"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/vcs.py#L60-L70 | train |
spyder-ide/spyder | spyder/utils/vcs.py | run_vcs_tool | def run_vcs_tool(path, action):
"""If path is a valid VCS repository, run the corresponding VCS tool
Supported VCS actions: 'commit', 'browse'
Return False if the VCS tool is not installed"""
info = get_vcs_info(get_vcs_root(path))
tools = info['actions'][action]
for tool, args in tools:
... | python | def run_vcs_tool(path, action):
"""If path is a valid VCS repository, run the corresponding VCS tool
Supported VCS actions: 'commit', 'browse'
Return False if the VCS tool is not installed"""
info = get_vcs_info(get_vcs_root(path))
tools = info['actions'][action]
for tool, args in tools:
... | [
"def",
"run_vcs_tool",
"(",
"path",
",",
"action",
")",
":",
"info",
"=",
"get_vcs_info",
"(",
"get_vcs_root",
"(",
"path",
")",
")",
"tools",
"=",
"info",
"[",
"'actions'",
"]",
"[",
"action",
"]",
"for",
"tool",
",",
"args",
"in",
"tools",
":",
"if... | If path is a valid VCS repository, run the corresponding VCS tool
Supported VCS actions: 'commit', 'browse'
Return False if the VCS tool is not installed | [
"If",
"path",
"is",
"a",
"valid",
"VCS",
"repository",
"run",
"the",
"corresponding",
"VCS",
"tool",
"Supported",
"VCS",
"actions",
":",
"commit",
"browse",
"Return",
"False",
"if",
"the",
"VCS",
"tool",
"is",
"not",
"installed"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/vcs.py#L78-L93 | train |
spyder-ide/spyder | spyder/utils/vcs.py | get_hg_revision | def get_hg_revision(repopath):
"""Return Mercurial revision for the repository located at repopath
Result is a tuple (global, local, branch), with None values on error
For example:
>>> get_hg_revision(".")
('eba7273c69df+', '2015+', 'default')
"""
try:
ass... | python | def get_hg_revision(repopath):
"""Return Mercurial revision for the repository located at repopath
Result is a tuple (global, local, branch), with None values on error
For example:
>>> get_hg_revision(".")
('eba7273c69df+', '2015+', 'default')
"""
try:
ass... | [
"def",
"get_hg_revision",
"(",
"repopath",
")",
":",
"try",
":",
"assert",
"osp",
".",
"isdir",
"(",
"osp",
".",
"join",
"(",
"repopath",
",",
"'.hg'",
")",
")",
"proc",
"=",
"programs",
".",
"run_program",
"(",
"'hg'",
",",
"[",
"'id'",
",",
"'-nib'... | Return Mercurial revision for the repository located at repopath
Result is a tuple (global, local, branch), with None values on error
For example:
>>> get_hg_revision(".")
('eba7273c69df+', '2015+', 'default') | [
"Return",
"Mercurial",
"revision",
"for",
"the",
"repository",
"located",
"at",
"repopath",
"Result",
"is",
"a",
"tuple",
"(",
"global",
"local",
"branch",
")",
"with",
"None",
"values",
"on",
"error",
"For",
"example",
":",
">>>",
"get_hg_revision",
"(",
".... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/vcs.py#L100-L116 | train |
spyder-ide/spyder | spyder/utils/vcs.py | get_git_revision | def get_git_revision(repopath):
"""
Return Git revision for the repository located at repopath
Result is a tuple (latest commit hash, branch), with None values on
error
"""
try:
git = programs.find_program('git')
assert git is not None and osp.isdir(osp.join(repopat... | python | def get_git_revision(repopath):
"""
Return Git revision for the repository located at repopath
Result is a tuple (latest commit hash, branch), with None values on
error
"""
try:
git = programs.find_program('git')
assert git is not None and osp.isdir(osp.join(repopat... | [
"def",
"get_git_revision",
"(",
"repopath",
")",
":",
"try",
":",
"git",
"=",
"programs",
".",
"find_program",
"(",
"'git'",
")",
"assert",
"git",
"is",
"not",
"None",
"and",
"osp",
".",
"isdir",
"(",
"osp",
".",
"join",
"(",
"repopath",
",",
"'.git'",... | Return Git revision for the repository located at repopath
Result is a tuple (latest commit hash, branch), with None values on
error | [
"Return",
"Git",
"revision",
"for",
"the",
"repository",
"located",
"at",
"repopath",
"Result",
"is",
"a",
"tuple",
"(",
"latest",
"commit",
"hash",
"branch",
")",
"with",
"None",
"values",
"on",
"error"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/vcs.py#L119-L151 | train |
spyder-ide/spyder | spyder/utils/vcs.py | get_git_refs | def get_git_refs(repopath):
"""
Return Git active branch, state, branches (plus tags).
"""
tags = []
branches = []
branch = ''
files_modifed = []
if os.path.isfile(repopath):
repopath = os.path.dirname(repopath)
try:
git = programs.find_program('git')... | python | def get_git_refs(repopath):
"""
Return Git active branch, state, branches (plus tags).
"""
tags = []
branches = []
branch = ''
files_modifed = []
if os.path.isfile(repopath):
repopath = os.path.dirname(repopath)
try:
git = programs.find_program('git')... | [
"def",
"get_git_refs",
"(",
"repopath",
")",
":",
"tags",
"=",
"[",
"]",
"branches",
"=",
"[",
"]",
"branch",
"=",
"''",
"files_modifed",
"=",
"[",
"]",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"repopath",
")",
":",
"repopath",
"=",
"os",
".",
... | Return Git active branch, state, branches (plus tags). | [
"Return",
"Git",
"active",
"branch",
"state",
"branches",
"(",
"plus",
"tags",
")",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/utils/vcs.py#L154-L210 | train |
spyder-ide/spyder | spyder/widgets/comboboxes.py | is_module_or_package | def is_module_or_package(path):
"""Return True if path is a Python module/package"""
is_module = osp.isfile(path) and osp.splitext(path)[1] in ('.py', '.pyw')
is_package = osp.isdir(path) and osp.isfile(osp.join(path, '__init__.py'))
return is_module or is_package | python | def is_module_or_package(path):
"""Return True if path is a Python module/package"""
is_module = osp.isfile(path) and osp.splitext(path)[1] in ('.py', '.pyw')
is_package = osp.isdir(path) and osp.isfile(osp.join(path, '__init__.py'))
return is_module or is_package | [
"def",
"is_module_or_package",
"(",
"path",
")",
":",
"is_module",
"=",
"osp",
".",
"isfile",
"(",
"path",
")",
"and",
"osp",
".",
"splitext",
"(",
"path",
")",
"[",
"1",
"]",
"in",
"(",
"'.py'",
",",
"'.pyw'",
")",
"is_package",
"=",
"osp",
".",
"... | Return True if path is a Python module/package | [
"Return",
"True",
"if",
"path",
"is",
"a",
"Python",
"module",
"/",
"package"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/comboboxes.py#L336-L340 | train |
spyder-ide/spyder | spyder/widgets/comboboxes.py | BaseComboBox.event | def event(self, event):
"""Qt Override.
Filter tab keys and process double tab keys.
"""
if (event.type() == QEvent.KeyPress) and (event.key() == Qt.Key_Tab):
self.sig_tab_pressed.emit(True)
self.numpress += 1
if self.numpress == 1:
... | python | def event(self, event):
"""Qt Override.
Filter tab keys and process double tab keys.
"""
if (event.type() == QEvent.KeyPress) and (event.key() == Qt.Key_Tab):
self.sig_tab_pressed.emit(True)
self.numpress += 1
if self.numpress == 1:
... | [
"def",
"event",
"(",
"self",
",",
"event",
")",
":",
"if",
"(",
"event",
".",
"type",
"(",
")",
"==",
"QEvent",
".",
"KeyPress",
")",
"and",
"(",
"event",
".",
"key",
"(",
")",
"==",
"Qt",
".",
"Key_Tab",
")",
":",
"self",
".",
"sig_tab_pressed",... | Qt Override.
Filter tab keys and process double tab keys. | [
"Qt",
"Override",
".",
"Filter",
"tab",
"keys",
"and",
"process",
"double",
"tab",
"keys",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/comboboxes.py#L46-L57 | train |
spyder-ide/spyder | spyder/widgets/comboboxes.py | BaseComboBox.keyPressEvent | def keyPressEvent(self, event):
"""Qt Override.
Handle key press events.
"""
if event.key() == Qt.Key_Return or event.key() == Qt.Key_Enter:
if self.add_current_text_if_valid():
self.selected()
self.hide_completer()
elif event... | python | def keyPressEvent(self, event):
"""Qt Override.
Handle key press events.
"""
if event.key() == Qt.Key_Return or event.key() == Qt.Key_Enter:
if self.add_current_text_if_valid():
self.selected()
self.hide_completer()
elif event... | [
"def",
"keyPressEvent",
"(",
"self",
",",
"event",
")",
":",
"if",
"event",
".",
"key",
"(",
")",
"==",
"Qt",
".",
"Key_Return",
"or",
"event",
".",
"key",
"(",
")",
"==",
"Qt",
".",
"Key_Enter",
":",
"if",
"self",
".",
"add_current_text_if_valid",
"... | Qt Override.
Handle key press events. | [
"Qt",
"Override",
".",
"Handle",
"key",
"press",
"events",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/comboboxes.py#L59-L72 | train |
spyder-ide/spyder | spyder/widgets/comboboxes.py | BaseComboBox.handle_keypress | def handle_keypress(self):
"""When hitting tab, it handles if single or double tab"""
if self.numpress == 2:
self.sig_double_tab_pressed.emit(True)
self.numpress = 0 | python | def handle_keypress(self):
"""When hitting tab, it handles if single or double tab"""
if self.numpress == 2:
self.sig_double_tab_pressed.emit(True)
self.numpress = 0 | [
"def",
"handle_keypress",
"(",
"self",
")",
":",
"if",
"self",
".",
"numpress",
"==",
"2",
":",
"self",
".",
"sig_double_tab_pressed",
".",
"emit",
"(",
"True",
")",
"self",
".",
"numpress",
"=",
"0"
] | When hitting tab, it handles if single or double tab | [
"When",
"hitting",
"tab",
"it",
"handles",
"if",
"single",
"or",
"double",
"tab"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/comboboxes.py#L75-L79 | train |
spyder-ide/spyder | spyder/widgets/comboboxes.py | BaseComboBox.add_text | def add_text(self, text):
"""Add text to combo box: add a new item if text is not found in
combo box items."""
index = self.findText(text)
while index != -1:
self.removeItem(index)
index = self.findText(text)
self.insertItem(0, text)
index ... | python | def add_text(self, text):
"""Add text to combo box: add a new item if text is not found in
combo box items."""
index = self.findText(text)
while index != -1:
self.removeItem(index)
index = self.findText(text)
self.insertItem(0, text)
index ... | [
"def",
"add_text",
"(",
"self",
",",
"text",
")",
":",
"index",
"=",
"self",
".",
"findText",
"(",
"text",
")",
"while",
"index",
"!=",
"-",
"1",
":",
"self",
".",
"removeItem",
"(",
"index",
")",
"index",
"=",
"self",
".",
"findText",
"(",
"text",... | Add text to combo box: add a new item if text is not found in
combo box items. | [
"Add",
"text",
"to",
"combo",
"box",
":",
"add",
"a",
"new",
"item",
"if",
"text",
"is",
"not",
"found",
"in",
"combo",
"box",
"items",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/comboboxes.py#L92-L109 | train |
spyder-ide/spyder | spyder/widgets/comboboxes.py | BaseComboBox.add_current_text_if_valid | def add_current_text_if_valid(self):
"""Add current text to combo box history if valid"""
valid = self.is_valid(self.currentText())
if valid or valid is None:
self.add_current_text()
return True
else:
self.set_current_text(self.selected_text) | python | 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",
")",
":",
"valid",
"=",
"self",
".",
"is_valid",
"(",
"self",
".",
"currentText",
"(",
")",
")",
"if",
"valid",
"or",
"valid",
"is",
"None",
":",
"self",
".",
"add_current_text",
"(",
")",
"return",
"True"... | Add current text to combo box history if valid | [
"Add",
"current",
"text",
"to",
"combo",
"box",
"history",
"if",
"valid"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/comboboxes.py#L120-L127 | train |
spyder-ide/spyder | spyder/widgets/comboboxes.py | EditableComboBox.show_tip | def show_tip(self, tip=""):
"""Show tip"""
QToolTip.showText(self.mapToGlobal(self.pos()), tip, self) | python | def show_tip(self, tip=""):
"""Show tip"""
QToolTip.showText(self.mapToGlobal(self.pos()), tip, self) | [
"def",
"show_tip",
"(",
"self",
",",
"tip",
"=",
"\"\"",
")",
":",
"QToolTip",
".",
"showText",
"(",
"self",
".",
"mapToGlobal",
"(",
"self",
".",
"pos",
"(",
")",
")",
",",
"tip",
",",
"self",
")"
] | Show tip | [
"Show",
"tip"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/comboboxes.py#L168-L170 | train |
spyder-ide/spyder | spyder/widgets/comboboxes.py | EditableComboBox.validate | 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... | python | 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",
")",
":",
"if",
"self",
".",
"selected_text",
"==",
"qstr",
"and",
"qstr",
"!=",
"''",
":",
"self",
".",
"valid",
".",
"emit",
"(",
"True",
",",
"True",
")",
"return",
"valid... | Validate entered path | [
"Validate",
"entered",
"path"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/comboboxes.py#L177-L188 | train |
spyder-ide/spyder | spyder/widgets/comboboxes.py | PathComboBox.focusInEvent | 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) | python | 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",
")",
":",
"show_status",
"=",
"getattr",
"(",
"self",
".",
"lineEdit",
"(",
")",
",",
"'show_status_icon'",
",",
"None",
")",
"if",
"show_status",
":",
"show_status",
"(",
")",
"QComboBox",
".",
"focusInEve... | Handle focus in event restoring to display the status icon. | [
"Handle",
"focus",
"in",
"event",
"restoring",
"to",
"display",
"the",
"status",
"icon",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/comboboxes.py#L220-L225 | train |
spyder-ide/spyder | spyder/widgets/comboboxes.py | PathComboBox.focusOutEvent | 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... | python | 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",
")",
":",
"# 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",... | Handle focus out event restoring the last valid selected path. | [
"Handle",
"focus",
"out",
"event",
"restoring",
"the",
"last",
"valid",
"selected",
"path",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/comboboxes.py#L227-L238 | train |
spyder-ide/spyder | spyder/widgets/comboboxes.py | PathComboBox._complete_options | def _complete_options(self):
"""Find available completion options."""
text = to_text_string(self.currentText())
opts = glob.glob(text + "*")
opts = sorted([opt for opt in opts if osp.isdir(opt)])
self.setCompleter(QCompleter(opts, self))
return opts | python | 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",
")",
":",
"text",
"=",
"to_text_string",
"(",
"self",
".",
"currentText",
"(",
")",
")",
"opts",
"=",
"glob",
".",
"glob",
"(",
"text",
"+",
"\"*\"",
")",
"opts",
"=",
"sorted",
"(",
"[",
"opt",
"for",
"opt",
... | Find available completion options. | [
"Find",
"available",
"completion",
"options",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/comboboxes.py#L241-L247 | train |
spyder-ide/spyder | spyder/widgets/comboboxes.py | PathComboBox.double_tab_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() | python | 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",
")",
":",
"opts",
"=",
"self",
".",
"_complete_options",
"(",
")",
"if",
"len",
"(",
"opts",
")",
">",
"1",
":",
"self",
".",
"completer",
"(",
")",
".",
"complete",
"(",
")"
] | If several options available a double tab displays options. | [
"If",
"several",
"options",
"available",
"a",
"double",
"tab",
"displays",
"options",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/comboboxes.py#L249-L253 | train |
spyder-ide/spyder | spyder/widgets/comboboxes.py | PathComboBox.tab_complete | 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() | python | 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",
")",
":",
"opts",
"=",
"self",
".",
"_complete_options",
"(",
")",
"if",
"len",
"(",
"opts",
")",
"==",
"1",
":",
"self",
".",
"set_current_text",
"(",
"opts",
"[",
"0",
"]",
"+",
"os",
".",
"sep",
")",
"self",
... | If there is a single option available one tab completes the option. | [
"If",
"there",
"is",
"a",
"single",
"option",
"available",
"one",
"tab",
"completes",
"the",
"option",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/comboboxes.py#L255-L262 | train |
spyder-ide/spyder | spyder/widgets/comboboxes.py | PathComboBox.is_valid | def is_valid(self, qstr=None):
"""Return True if string is valid"""
if qstr is None:
qstr = self.currentText()
return osp.isdir(to_text_string(qstr)) | python | 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",
")",
":",
"if",
"qstr",
"is",
"None",
":",
"qstr",
"=",
"self",
".",
"currentText",
"(",
")",
"return",
"osp",
".",
"isdir",
"(",
"to_text_string",
"(",
"qstr",
")",
")"
] | Return True if string is valid | [
"Return",
"True",
"if",
"string",
"is",
"valid"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/comboboxes.py#L264-L268 | train |
spyder-ide/spyder | spyder/widgets/comboboxes.py | PathComboBox.selected | def selected(self):
"""Action to be executed when a valid item has been selected"""
self.selected_text = self.currentText()
self.valid.emit(True, True)
self.open_dir.emit(self.selected_text) | python | 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",
")",
":",
"self",
".",
"selected_text",
"=",
"self",
".",
"currentText",
"(",
")",
"self",
".",
"valid",
".",
"emit",
"(",
"True",
",",
"True",
")",
"self",
".",
"open_dir",
".",
"emit",
"(",
"self",
".",
"selected_tex... | Action to be executed when a valid item has been selected | [
"Action",
"to",
"be",
"executed",
"when",
"a",
"valid",
"item",
"has",
"been",
"selected"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/comboboxes.py#L270-L274 | train |
spyder-ide/spyder | spyder/widgets/comboboxes.py | PathComboBox.add_current_text | 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:
... | python | 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",
")",
":",
"text",
"=",
"self",
".",
"currentText",
"(",
")",
"if",
"osp",
".",
"isdir",
"(",
"text",
")",
"and",
"text",
":",
"if",
"text",
"[",
"-",
"1",
"]",
"==",
"os",
".",
"sep",
":",
"text",
"=",
"t... | Add current text to combo box history (convenient method).
If path ends in os separator ("\" windows, "/" unix) remove it. | [
"Add",
"current",
"text",
"to",
"combo",
"box",
"history",
"(",
"convenient",
"method",
")",
".",
"If",
"path",
"ends",
"in",
"os",
"separator",
"(",
"\\",
"windows",
"/",
"unix",
")",
"remove",
"it",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/comboboxes.py#L276-L285 | train |
spyder-ide/spyder | spyder/widgets/comboboxes.py | PathComboBox.add_tooltip_to_highlighted_item | 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) | python | 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",
")",
":",
"self",
".",
"setItemData",
"(",
"index",
",",
"self",
".",
"itemText",
"(",
"index",
")",
",",
"Qt",
".",
"ToolTipRole",
")"
] | Add a tooltip showing the full path of the currently highlighted item
of the PathComboBox. | [
"Add",
"a",
"tooltip",
"showing",
"the",
"full",
"path",
"of",
"the",
"currently",
"highlighted",
"item",
"of",
"the",
"PathComboBox",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/comboboxes.py#L287-L292 | train |
spyder-ide/spyder | spyder/widgets/comboboxes.py | UrlComboBox.is_valid | def is_valid(self, qstr=None):
"""Return True if string is valid"""
if qstr is None:
qstr = self.currentText()
return QUrl(qstr).isValid() | python | 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",
")",
":",
"if",
"qstr",
"is",
"None",
":",
"qstr",
"=",
"self",
".",
"currentText",
"(",
")",
"return",
"QUrl",
"(",
"qstr",
")",
".",
"isValid",
"(",
")"
] | Return True if string is valid | [
"Return",
"True",
"if",
"string",
"is",
"valid"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/comboboxes.py#L303-L307 | train |
spyder-ide/spyder | spyder/widgets/comboboxes.py | FileComboBox.is_valid | def is_valid(self, qstr=None):
"""Return True if string is valid"""
if qstr is None:
qstr = self.currentText()
return osp.isfile(to_text_string(qstr)) | python | 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",
")",
":",
"if",
"qstr",
"is",
"None",
":",
"qstr",
"=",
"self",
".",
"currentText",
"(",
")",
"return",
"osp",
".",
"isfile",
"(",
"to_text_string",
"(",
"qstr",
")",
")"
] | Return True if string is valid | [
"Return",
"True",
"if",
"string",
"is",
"valid"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/comboboxes.py#L329-L333 | train |
spyder-ide/spyder | spyder/widgets/comboboxes.py | PythonModulesComboBox.is_valid | def is_valid(self, qstr=None):
"""Return True if string is valid"""
if qstr is None:
qstr = self.currentText()
return is_module_or_package(to_text_string(qstr)) | python | 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",
")",
":",
"if",
"qstr",
"is",
"None",
":",
"qstr",
"=",
"self",
".",
"currentText",
"(",
")",
"return",
"is_module_or_package",
"(",
"to_text_string",
"(",
"qstr",
")",
")"
] | Return True if string is valid | [
"Return",
"True",
"if",
"string",
"is",
"valid"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/comboboxes.py#L351-L355 | train |
spyder-ide/spyder | spyder/widgets/comboboxes.py | PythonModulesComboBox.selected | def selected(self):
"""Action to be executed when a valid item has been selected"""
EditableComboBox.selected(self)
self.open_dir.emit(self.currentText()) | python | 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",
")",
":",
"EditableComboBox",
".",
"selected",
"(",
"self",
")",
"self",
".",
"open_dir",
".",
"emit",
"(",
"self",
".",
"currentText",
"(",
")",
")"
] | Action to be executed when a valid item has been selected | [
"Action",
"to",
"be",
"executed",
"when",
"a",
"valid",
"item",
"has",
"been",
"selected"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/comboboxes.py#L357-L360 | train |
spyder-ide/spyder | spyder/plugins/console/plugin.py | Console.set_historylog | 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) | python | 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",
")",
":",
"historylog",
".",
"add_history",
"(",
"self",
".",
"shell",
".",
"history_filename",
")",
"self",
".",
"shell",
".",
"append_to_history",
".",
"connect",
"(",
"historylog",
".",
"append_to_his... | Bind historylog instance to this console
Not used anymore since v2.0 | [
"Bind",
"historylog",
"instance",
"to",
"this",
"console",
"Not",
"used",
"anymore",
"since",
"v2",
".",
"0"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/plugin.py#L106-L110 | train |
spyder-ide/spyder | spyder/plugins/console/plugin.py | Console.closing_plugin | 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 | python | 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",
")",
":",
"self",
".",
"dialog_manager",
".",
"close_all",
"(",
")",
"self",
".",
"shell",
".",
"exit_interpreter",
"(",
")",
"return",
"True"
] | Perform actions before parent main window is closed | [
"Perform",
"actions",
"before",
"parent",
"main",
"window",
"is",
"closed"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/plugin.py#L133-L137 | train |
spyder-ide/spyder | spyder/plugins/console/plugin.py | Console.get_plugin_actions | 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)
... | python | 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",
")",
":",
"quit_action",
"=",
"create_action",
"(",
"self",
",",
"_",
"(",
"\"&Quit\"",
")",
",",
"icon",
"=",
"ima",
".",
"icon",
"(",
"'exit'",
")",
",",
"tip",
"=",
"_",
"(",
"\"Quit\"",
")",
",",
"trigger... | Return a list of actions related to plugin | [
"Return",
"a",
"list",
"of",
"actions",
"related",
"to",
"plugin"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/plugin.py#L142-L191 | train |
spyder-ide/spyder | spyder/plugins/console/plugin.py | Console.register_plugin | 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... | python | 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",
")",
":",
"self",
".",
"focus_changed",
".",
"connect",
"(",
"self",
".",
"main",
".",
"plugin_focus_changed",
")",
"self",
".",
"main",
".",
"add_dockwidget",
"(",
"self",
")",
"# Connecting the following signal once the doc... | Register plugin in Spyder's main window | [
"Register",
"plugin",
"in",
"Spyder",
"s",
"main",
"window"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/plugin.py#L193-L198 | train |
spyder-ide/spyder | spyder/plugins/console/plugin.py | Console.exception_occurred | 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... | python | 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",
")",
":",
"# Skip errors without traceback or dismiss\r",
"if",
"(",
"not",
"is_traceback",
"and",
"self",
".",
"error_dlg",
"is",
"None",
")",
"or",
"self",
".",
"dismiss_error",
":",
"... | Exception ocurred in the internal console.
Show a QDialog or the internal console to warn the user. | [
"Exception",
"ocurred",
"in",
"the",
"internal",
"console",
".",
"Show",
"a",
"QDialog",
"or",
"the",
"internal",
"console",
"to",
"warn",
"the",
"user",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/plugin.py#L200-L220 | train |
spyder-ide/spyder | spyder/plugins/console/plugin.py | Console.close_error_dlg | def close_error_dlg(self):
"""Close error dialog."""
if self.error_dlg.dismiss_box.isChecked():
self.dismiss_error = True
self.error_dlg.reject() | python | 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",
")",
":",
"if",
"self",
".",
"error_dlg",
".",
"dismiss_box",
".",
"isChecked",
"(",
")",
":",
"self",
".",
"dismiss_error",
"=",
"True",
"self",
".",
"error_dlg",
".",
"reject",
"(",
")"
] | Close error dialog. | [
"Close",
"error",
"dialog",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/plugin.py#L222-L226 | train |
spyder-ide/spyder | spyder/plugins/console/plugin.py | Console.show_syspath | 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) | python | 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",
")",
":",
"editor",
"=",
"CollectionsEditor",
"(",
"parent",
"=",
"self",
")",
"editor",
".",
"setup",
"(",
"sys",
".",
"path",
",",
"title",
"=",
"\"sys.path\"",
",",
"readonly",
"=",
"True",
",",
"width",
"=",
"600... | Show sys.path | [
"Show",
"sys",
".",
"path"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/plugin.py#L244-L249 | train |
spyder-ide/spyder | spyder/plugins/console/plugin.py | Console.run_script | def run_script(self, filename=None, silent=False, set_focus=False,
args=None):
"""Run a Python script"""
if filename is None:
self.shell.interpreter.restore_stds()
filename, _selfilter = getopenfilename(
self, _("Run Python script"), g... | python | 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",
")",
":",
"if",
"filename",
"is",
"None",
":",
"self",
".",
"shell",
".",
"interpreter",
".",
"rest... | Run a Python script | [
"Run",
"a",
"Python",
"script"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/plugin.py#L252-L276 | train |
spyder-ide/spyder | spyder/plugins/console/plugin.py | Console.go_to_error | 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)) | python | 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",
")",
":",
"match",
"=",
"get_error_match",
"(",
"to_text_string",
"(",
"text",
")",
")",
"if",
"match",
":",
"fname",
",",
"lnb",
"=",
"match",
".",
"groups",
"(",
")",
"self",
".",
"edit_script",
"(",
... | Go to error if relevant | [
"Go",
"to",
"error",
"if",
"relevant"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/plugin.py#L279-L284 | train |
spyder-ide/spyder | spyder/plugins/console/plugin.py | Console.edit_script | def edit_script(self, filename=None, goto=-1):
"""Edit script"""
# Called from InternalShell
if not hasattr(self, 'main') \
or not hasattr(self.main, 'editor'):
self.shell.external_editor(filename, goto)
return
if filename is not None:
... | python | 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",
")",
":",
"# Called from InternalShell\r",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'main'",
")",
"or",
"not",
"hasattr",
"(",
"self",
".",
"main",
",",
"'ed... | Edit script | [
"Edit",
"script"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/plugin.py#L286-L294 | train |
spyder-ide/spyder | spyder/plugins/console/plugin.py | Console.execute_lines | def execute_lines(self, lines):
"""Execute lines and give focus to shell"""
self.shell.execute_lines(to_text_string(lines))
self.shell.setFocus() | python | 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",
")",
":",
"self",
".",
"shell",
".",
"execute_lines",
"(",
"to_text_string",
"(",
"lines",
")",
")",
"self",
".",
"shell",
".",
"setFocus",
"(",
")"
] | Execute lines and give focus to shell | [
"Execute",
"lines",
"and",
"give",
"focus",
"to",
"shell"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/plugin.py#L296-L299 | train |
spyder-ide/spyder | spyder/plugins/console/plugin.py | Console.change_exteditor | 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')... | python | 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",
")",
":",
"path",
",",
"valid",
"=",
"QInputDialog",
".",
"getText",
"(",
"self",
",",
"_",
"(",
"'External editor'",
")",
",",
"_",
"(",
"'External editor executable path:'",
")",
",",
"QLineEdit",
".",
"Normal",
",",... | Change external editor path | [
"Change",
"external",
"editor",
"path"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/plugin.py#L313-L320 | train |
spyder-ide/spyder | spyder/plugins/console/plugin.py | Console.toggle_wrap_mode | def toggle_wrap_mode(self, checked):
"""Toggle wrap mode"""
self.shell.toggle_wrap_mode(checked)
self.set_option('wrap', checked) | python | 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",
")",
":",
"self",
".",
"shell",
".",
"toggle_wrap_mode",
"(",
"checked",
")",
"self",
".",
"set_option",
"(",
"'wrap'",
",",
"checked",
")"
] | Toggle wrap mode | [
"Toggle",
"wrap",
"mode"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/plugin.py#L323-L326 | train |
spyder-ide/spyder | spyder/plugins/console/plugin.py | Console.toggle_codecompletion | def toggle_codecompletion(self, checked):
"""Toggle automatic code completion"""
self.shell.set_codecompletion_auto(checked)
self.set_option('codecompletion/auto', checked) | python | 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",
")",
":",
"self",
".",
"shell",
".",
"set_codecompletion_auto",
"(",
"checked",
")",
"self",
".",
"set_option",
"(",
"'codecompletion/auto'",
",",
"checked",
")"
] | Toggle automatic code completion | [
"Toggle",
"automatic",
"code",
"completion"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/plugin.py#L329-L332 | train |
spyder-ide/spyder | spyder/plugins/console/plugin.py | Console.dragEnterEvent | 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:
... | python | 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",
")",
":",
"source",
"=",
"event",
".",
"mimeData",
"(",
")",
"if",
"source",
".",
"hasUrls",
"(",
")",
":",
"if",
"mimedata2url",
"(",
"source",
")",
":",
"event",
".",
"acceptProposedAction",
"(",
")... | Reimplement Qt method
Inform Qt about the types of data that the widget accepts | [
"Reimplement",
"Qt",
"method",
"Inform",
"Qt",
"about",
"the",
"types",
"of",
"data",
"that",
"the",
"widget",
"accepts"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/plugin.py#L335-L345 | train |
spyder-ide/spyder | spyder/plugins/console/plugin.py | Console.dropEvent | 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... | python | 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",
")",
":",
"source",
"=",
"event",
".",
"mimeData",
"(",
")",
"if",
"source",
".",
"hasUrls",
"(",
")",
":",
"pathlist",
"=",
"mimedata2url",
"(",
"source",
")",
"self",
".",
"shell",
".",
"drop_pathlist",
... | Reimplement Qt method
Unpack dropped data and handle it | [
"Reimplement",
"Qt",
"method",
"Unpack",
"dropped",
"data",
"and",
"handle",
"it"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/console/plugin.py#L347-L358 | train |
spyder-ide/spyder | scripts/spyder_win_post_install.py | install | 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... | python | 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",
"(",
")",
":",
"# 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... | Function executed when running the script with the -install switch | [
"Function",
"executed",
"when",
"running",
"the",
"script",
"with",
"the",
"-",
"install",
"switch"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/scripts/spyder_win_post_install.py#L113-L170 | train |
spyder-ide/spyder | scripts/spyder_win_post_install.py | remove | 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... | python | 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",
"(",
")",
":",
"current",
"=",
"True",
"# only affects current user\r",
"root",
"=",
"winreg",
".",
"HKEY_CURRENT_USER",
"if",
"current",
"else",
"winreg",
".",
"HKEY_LOCAL_MACHINE",
"for",
"key",
"in",
"(",
"KEY_C1",
"%",
"(",
"\"\"",
",",
... | Function executed when running the script with the -remove switch | [
"Function",
"executed",
"when",
"running",
"the",
"script",
"with",
"the",
"-",
"remove",
"switch"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/scripts/spyder_win_post_install.py#L173-L222 | train |
spyder-ide/spyder | spyder/app/tour.py | get_tour | 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... | python | 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",
")",
":",
"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... | 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
... | [
"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",
".",... | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/tour.py#L82-L277 | train |
spyder-ide/spyder | spyder/app/tour.py | FadingCanvas.paintEvent | 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,
... | python | 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",
")",
":",
"painter",
"=",
"QPainter",
"(",
"self",
")",
"painter",
".",
"setRenderHint",
"(",
"QPainter",
".",
"Antialiasing",
")",
"# Decoration\r",
"painter",
".",
"fillPath",
"(",
"self",
".",
"path_current"... | Override Qt method | [
"Override",
"Qt",
"method"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/tour.py#L500-L507 | train |
spyder-ide/spyder | spyder/app/tour.py | FadingCanvas.reject | 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() | python | 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",
")",
":",
"if",
"not",
"self",
".",
"is_fade_running",
"(",
")",
":",
"key",
"=",
"Qt",
".",
"Key_Escape",
"self",
".",
"key_pressed",
"=",
"key",
"self",
".",
"sig_key_pressed",
".",
"emit",
"(",
")"
] | Override Qt method | [
"Override",
"Qt",
"method"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/tour.py#L512-L517 | train |
spyder-ide/spyder | spyder/app/tour.py | FadingTipBox.mousePressEvent | 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 | python | 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",
")",
":",
"# Raise the main application window on click\r",
"self",
".",
"parent",
".",
"raise_",
"(",
")",
"self",
".",
"raise_",
"(",
")",
"if",
"event",
".",
"button",
"(",
")",
"==",
"Qt",
".",
"Righ... | override Qt method | [
"override",
"Qt",
"method"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/tour.py#L804-L811 | train |
spyder-ide/spyder | spyder/app/tour.py | AnimatedTour._set_data | 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}... | python | 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",
")",
":",
"self",
".",
"setting_data",
"=",
"True",
"step",
",",
"steps",
",",
"frames",
"=",
"self",
".",
"step_current",
",",
"self",
".",
"steps",
",",
"self",
".",
"frames",
"current",
"=",
"'{0}/{1}'",
".",
"format... | Set data that is displayed in each step of the tour. | [
"Set",
"data",
"that",
"is",
"displayed",
"in",
"each",
"step",
"of",
"the",
"tour",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/tour.py#L1001-L1061 | train |
spyder-ide/spyder | spyder/app/tour.py | AnimatedTour.lost_focus | 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() | python | 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",
")",
":",
"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. | [
"Confirm",
"if",
"the",
"tour",
"loses",
"focus",
"and",
"hides",
"the",
"tips",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/tour.py#L1239-L1243 | train |
spyder-ide/spyder | spyder/app/tour.py | AnimatedTour.gain_focus | 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() | python | 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",
")",
":",
"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. | [
"Confirm",
"if",
"the",
"tour",
"regains",
"focus",
"and",
"unhides",
"the",
"tips",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/tour.py#L1245-L1249 | train |
spyder-ide/spyder | spyder/app/tour.py | AnimatedTour.any_has_focus | def any_has_focus(self):
"""Returns if tour or any of its components has focus."""
f = (self.hasFocus() or self.parent.hasFocus() or
self.tips.hasFocus() or self.canvas.hasFocus())
return f | python | 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",
")",
":",
"f",
"=",
"(",
"self",
".",
"hasFocus",
"(",
")",
"or",
"self",
".",
"parent",
".",
"hasFocus",
"(",
")",
"or",
"self",
".",
"tips",
".",
"hasFocus",
"(",
")",
"or",
"self",
".",
"canvas",
".",
"hasF... | Returns if tour or any of its components has focus. | [
"Returns",
"if",
"tour",
"or",
"any",
"of",
"its",
"components",
"has",
"focus",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/app/tour.py#L1251-L1255 | train |
spyder-ide/spyder | spyder/plugins/ipythonconsole/widgets/figurebrowser.py | FigureBrowserWidget._handle_display_data | 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... | python | 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",
")",
":",
"img",
"=",
"None",
"data",
"=",
"msg",
"[",
"'content'",
"]",
"[",
"'data'",
"]",
"if",
"'image/svg+xml'",
"in",
"data",
":",
"fmt",
"=",
"'image/svg+xml'",
"img",
"=",
"data",
"[",
"'i... | Reimplemented to handle communications between the figure explorer
and the kernel. | [
"Reimplemented",
"to",
"handle",
"communications",
"between",
"the",
"figure",
"explorer",
"and",
"the",
"kernel",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/figurebrowser.py#L40-L76 | train |
spyder-ide/spyder | spyder/plugins/editor/widgets/codeeditor.py | get_file_language | 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... | python | 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",
")",
":",
"ext",
"=",
"osp",
".",
"splitext",
"(",
"filename",
")",
"[",
"1",
"]",
"if",
"ext",
".",
"startswith",
"(",
"'.'",
")",
":",
"ext",
"=",
"ext",
"[",
"1",
":",
"]",... | Get file language from filename | [
"Get",
"file",
"language",
"from",
"filename"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/codeeditor.py#L175-L193 | train |
spyder-ide/spyder | spyder/plugins/editor/widgets/codeeditor.py | GoToLineDialog.text_has_changed | def text_has_changed(self, text):
"""Line edit's text has changed"""
text = to_text_string(text)
if text:
self.lineno = int(text)
else:
self.lineno = None | python | 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",
")",
":",
"text",
"=",
"to_text_string",
"(",
"text",
")",
"if",
"text",
":",
"self",
".",
"lineno",
"=",
"int",
"(",
"text",
")",
"else",
":",
"self",
".",
"lineno",
"=",
"None"
] | Line edit's text has changed | [
"Line",
"edit",
"s",
"text",
"has",
"changed"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/editor/widgets/codeeditor.py#L157-L163 | train |
spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | save_figure_tofile | 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):
... | python | 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",
")",
":",
"root",
",",
"ext",
"=",
"osp",
".",
"splitext",
"(",
"fname",
")",
"if",
"ext",
"==",
"'.png'",
"and",
"fmt",
"==",
"'image/svg+xml'",
":",
"qimg",
"=",
"svg_to_image",
"(",
... | Save fig to fname in the format specified by fmt. | [
"Save",
"fig",
"to",
"fname",
"in",
"the",
"format",
"specified",
"by",
"fmt",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L38-L49 | train |
spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | get_unique_figname | 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 + '_%... | python | 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",
")",
":",
"i",
"=",
"1",
"figname",
"=",
"root",
"+",
"'_%d'",
"%",
"i",
"+",
"ext",
"while",
"True",
":",
"if",
"osp",
".",
"exists",
"(",
"osp",
".",
"join",
"(",
"dirname",
... | Append a number to "root" to form a filename that does not already exist
in "dirname". | [
"Append",
"a",
"number",
"to",
"root",
"to",
"form",
"a",
"filename",
"that",
"does",
"not",
"already",
"exist",
"in",
"dirname",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L52-L64 | train |
spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | FigureBrowser.setup | 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... | python | 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",
")",
":",
"assert",
"self",
".",
"shellwidget",
"is",
"not",
"None",
"self",
".",
"mute_inline_plotting",
"=",
"mute_inline_plotting",
"self",
".",
"s... | Setup the figure browser with provided settings. | [
"Setup",
"the",
"figure",
"browser",
"with",
"provided",
"settings",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L97-L136 | train |
spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | FigureBrowser.setup_toolbar | def setup_toolbar(self):
"""Setup the toolbar"""
savefig_btn = create_toolbutton(
self, icon=ima.icon('filesave'),
tip=_("Save Image As..."),
triggered=self.save_figure)
saveall_btn = create_toolbutton(
self, icon=ima.icon('save_al... | python | 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",
")",
":",
"savefig_btn",
"=",
"create_toolbutton",
"(",
"self",
",",
"icon",
"=",
"ima",
".",
"icon",
"(",
"'filesave'",
")",
",",
"tip",
"=",
"_",
"(",
"\"Save Image As...\"",
")",
",",
"triggered",
"=",
"self",
".",... | Setup the toolbar | [
"Setup",
"the",
"toolbar"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L138-L212 | train |
spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | FigureBrowser.setup_option_actions | 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... | python | 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",
")",
":",
"self",
".",
"setup_in_progress",
"=",
"True",
"self",
".",
"mute_inline_action",
"=",
"create_action",
"(",
"self",
",",
"_",
"(",
"\"Mute inline plotting\"... | Setup the actions to show in the cog menu. | [
"Setup",
"the",
"actions",
"to",
"show",
"in",
"the",
"cog",
"menu",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L214-L233 | train |
spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | FigureBrowser.create_shortcuts | 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',
... | python | 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",
")",
":",
"# Configurable",
"copyfig",
"=",
"config_shortcut",
"(",
"self",
".",
"copy_figure",
",",
"context",
"=",
"'plots'",
",",
"name",
"=",
"'copy'",
",",
"parent",
"=",
"self",
")",
"prevfig",
"=",
"config_short... | Create shortcuts for this widget. | [
"Create",
"shortcuts",
"for",
"this",
"widget",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L255-L265 | train |
spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | FigureBrowser.option_changed | def option_changed(self, option, value):
"""Handle when the value of an option has changed"""
setattr(self, to_text_string(option), value)
self.shellwidget.set_namespace_view_settings()
if self.setup_in_progress is False:
self.sig_option_changed.emit(option, value) | python | 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",
")",
":",
"setattr",
"(",
"self",
",",
"to_text_string",
"(",
"option",
")",
",",
"value",
")",
"self",
".",
"shellwidget",
".",
"set_namespace_view_settings",
"(",
")",
"if",
"self",
".",
... | Handle when the value of an option has changed | [
"Handle",
"when",
"the",
"value",
"of",
"an",
"option",
"has",
"changed"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L277-L282 | train |
spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | FigureBrowser.show_fig_outline_in_viewer | 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... | python | 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",
")",
":",
"if",
"state",
"is",
"True",
":",
"self",
".",
"figviewer",
".",
"figcanvas",
".",
"setStyleSheet",
"(",
"\"FigureCanvas{border: 1px solid lightgrey;}\"",
")",
"else",
":",
"self",
".",
"f... | Draw a frame around the figure viewer if state is True. | [
"Draw",
"a",
"frame",
"around",
"the",
"figure",
"viewer",
"if",
"state",
"is",
"True",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L284-L291 | train |
spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | FigureBrowser.set_shellwidget | 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) | python | 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",
")",
":",
"self",
".",
"shellwidget",
"=",
"shellwidget",
"shellwidget",
".",
"set_figurebrowser",
"(",
"self",
")",
"shellwidget",
".",
"sig_new_inline_figure",
".",
"connect",
"(",
"self",
".",
"_handl... | Bind the shellwidget instance to the figure browser | [
"Bind",
"the",
"shellwidget",
"instance",
"to",
"the",
"figure",
"browser"
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L293-L297 | train |
spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | FigureBrowser.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() | python | 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",
")",
":",
"if",
"self",
".",
"figviewer",
"and",
"self",
".",
"figviewer",
".",
"figcanvas",
".",
"fig",
":",
"self",
".",
"figviewer",
".",
"figcanvas",
".",
"copy_figure",
"(",
")"
] | Copy figure from figviewer to clipboard. | [
"Copy",
"figure",
"from",
"figviewer",
"to",
"clipboard",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L349-L352 | train |
spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | FigureViewer.setup_figcanvas | def setup_figcanvas(self):
"""Setup the FigureCanvas."""
self.figcanvas = FigureCanvas(background_color=self.background_color)
self.figcanvas.installEventFilter(self)
self.setWidget(self.figcanvas) | python | 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",
")",
":",
"self",
".",
"figcanvas",
"=",
"FigureCanvas",
"(",
"background_color",
"=",
"self",
".",
"background_color",
")",
"self",
".",
"figcanvas",
".",
"installEventFilter",
"(",
"self",
")",
"self",
".",
"setWidget",... | Setup the FigureCanvas. | [
"Setup",
"the",
"FigureCanvas",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L382-L386 | train |
spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | FigureViewer.load_figure | 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() | python | 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",
")",
":",
"self",
".",
"figcanvas",
".",
"load_figure",
"(",
"fig",
",",
"fmt",
")",
"self",
".",
"scale_image",
"(",
")",
"self",
".",
"figcanvas",
".",
"repaint",
"(",
")"
] | Set a new figure in the figure canvas. | [
"Set",
"a",
"new",
"figure",
"in",
"the",
"figure",
"canvas",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L388-L392 | train |
spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | FigureViewer.eventFilter | 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... | python | 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",
")",
":",
"# ---- Zooming",
"if",
"event",
".",
"type",
"(",
")",
"==",
"QEvent",
".",
"Wheel",
":",
"modifiers",
"=",
"QApplication",
".",
"keyboardModifiers",
"(",
")",
"if",
"modifiers",
... | A filter to control the zooming and panning of the figure canvas. | [
"A",
"filter",
"to",
"control",
"the",
"zooming",
"and",
"panning",
"of",
"the",
"figure",
"canvas",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L394-L438 | train |
spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | FigureViewer.zoom_in | 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()) | python | 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",
")",
":",
"if",
"self",
".",
"_scalefactor",
"<=",
"self",
".",
"_sfmax",
":",
"self",
".",
"_scalefactor",
"+=",
"1",
"self",
".",
"scale_image",
"(",
")",
"self",
".",
"_adjust_scrollbar",
"(",
"self",
".",
"_scalestep",
... | Scale the image up by one scale step. | [
"Scale",
"the",
"image",
"up",
"by",
"one",
"scale",
"step",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L441-L447 | train |
spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | FigureViewer.zoom_out | 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()) | python | 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",
")",
":",
"if",
"self",
".",
"_scalefactor",
">=",
"self",
".",
"_sfmin",
":",
"self",
".",
"_scalefactor",
"-=",
"1",
"self",
".",
"scale_image",
"(",
")",
"self",
".",
"_adjust_scrollbar",
"(",
"1",
"/",
"self",
".",
... | Scale the image down by one scale step. | [
"Scale",
"the",
"image",
"down",
"by",
"one",
"scale",
"step",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L449-L455 | train |
spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | FigureViewer.scale_image | 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... | python | 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",
")",
":",
"new_width",
"=",
"int",
"(",
"self",
".",
"figcanvas",
".",
"fwidth",
"*",
"self",
".",
"_scalestep",
"**",
"self",
".",
"_scalefactor",
")",
"new_height",
"=",
"int",
"(",
"self",
".",
"figcanvas",
".",
"f... | Scale the image size. | [
"Scale",
"the",
"image",
"size",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L457-L463 | train |
spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | FigureViewer._adjust_scrollbar | 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... | python | 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 horizontal scrollbar :",
"hb",
"=",
"self",
".",
"horizontalScrollBar",
"(",
")",
"hb",
".",
"setValue",
"(",
"int",
"(",
"f",
"*",
"hb",
".",
"value",
"(",
")",
"+",
"(",
"(",
"f",... | Adjust the scrollbar position to take into account the zooming of
the figure. | [
"Adjust",
"the",
"scrollbar",
"position",
"to",
"take",
"into",
"account",
"the",
"zooming",
"of",
"the",
"figure",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L474-L485 | train |
spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | ThumbnailScrollBar.setup_gui | 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)
... | python | 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",
")",
":",
"scrollarea",
"=",
"self",
".",
"setup_scrollarea",
"(",
")",
"up_btn",
",",
"down_btn",
"=",
"self",
".",
"setup_arrow_buttons",
"(",
")",
"self",
".",
"setFixedWidth",
"(",
"150",
")",
"layout",
"=",
"QVBoxLayou... | Setup the main layout of the widget. | [
"Setup",
"the",
"main",
"layout",
"of",
"the",
"widget",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L504-L515 | train |
spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | ThumbnailScrollBar.setup_scrollarea | 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.... | python | 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",
")",
":",
"self",
".",
"view",
"=",
"QWidget",
"(",
")",
"self",
".",
"scene",
"=",
"QGridLayout",
"(",
"self",
".",
"view",
")",
"self",
".",
"scene",
".",
"setColumnStretch",
"(",
"0",
",",
"100",
")",
"self"... | Setup the scrollarea that will contain the FigureThumbnails. | [
"Setup",
"the",
"scrollarea",
"that",
"will",
"contain",
"the",
"FigureThumbnails",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L517-L539 | train |
spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | ThumbnailScrollBar.setup_arrow_buttons | 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 ... | python | 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",
")",
":",
"# Get the height of the up/down arrow of the default vertical",
"# scrollbar :",
"vsb",
"=",
"self",
".",
"scrollarea",
".",
"verticalScrollBar",
"(",
")",
"style",
"=",
"vsb",
".",
"style",
"(",
")",
"opt",
"=",... | Setup the up and down arrow buttons that are placed at the top and
bottom of the scrollarea. | [
"Setup",
"the",
"up",
"and",
"down",
"arrow",
"buttons",
"that",
"are",
"placed",
"at",
"the",
"top",
"and",
"bottom",
"of",
"the",
"scrollarea",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L541-L566 | train |
spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | ThumbnailScrollBar.save_all_figures_as | 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:
... | python | 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",
")",
":",
"self",
".",
"redirect_stdio",
".",
"emit",
"(",
"False",
")",
"dirname",
"=",
"getexistingdirectory",
"(",
"self",
",",
"caption",
"=",
"'Save all figures'",
",",
"basedir",
"=",
"getcwd_or_home",
"(",
")",... | Save all the figures to a file. | [
"Save",
"all",
"the",
"figures",
"to",
"a",
"file",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L573-L580 | train |
spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | ThumbnailScrollBar.save_all_figures_todir | 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',
... | python | 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",
")",
":",
"fignames",
"=",
"[",
"]",
"for",
"thumbnail",
"in",
"self",
".",
"_thumbnails",
":",
"fig",
"=",
"thumbnail",
".",
"canvas",
".",
"fig",
"fmt",
"=",
"thumbnail",
".",
"canvas",
".",... | Save all figure in dirname. | [
"Save",
"all",
"figure",
"in",
"dirname",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L582-L595 | train |
spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | ThumbnailScrollBar.save_current_figure_as | 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) | python | 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",
")",
":",
"if",
"self",
".",
"current_thumbnail",
"is",
"not",
"None",
":",
"self",
".",
"save_figure_as",
"(",
"self",
".",
"current_thumbnail",
".",
"canvas",
".",
"fig",
",",
"self",
".",
"current_thumbnail",
... | Save the currently selected figure. | [
"Save",
"the",
"currently",
"selected",
"figure",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L597-L601 | train |
spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | ThumbnailScrollBar.save_figure_as | 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... | python | 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",
")",
":",
"fext",
",",
"ffilt",
"=",
"{",
"'image/png'",
":",
"(",
"'.png'",
",",
"'PNG (*.png)'",
")",
",",
"'image/jpeg'",
":",
"(",
"'.jpg'",
",",
"'JPEG (*.jpg;*.jpeg;*.jpe;*.jfif)'",
")",
"... | Save the figure to a file. | [
"Save",
"the",
"figure",
"to",
"a",
"file",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L603-L620 | train |
spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | ThumbnailScrollBar.remove_all_thumbnails | def remove_all_thumbnails(self):
"""Remove all thumbnails."""
for thumbnail in self._thumbnails:
self.layout().removeWidget(thumbnail)
thumbnail.sig_canvas_clicked.disconnect()
thumbnail.sig_remove_figure.disconnect()
thumbnail.sig_save_figure.disconnect()... | python | 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",
")",
":",
"for",
"thumbnail",
"in",
"self",
".",
"_thumbnails",
":",
"self",
".",
"layout",
"(",
")",
".",
"removeWidget",
"(",
"thumbnail",
")",
"thumbnail",
".",
"sig_canvas_clicked",
".",
"disconnect",
"(",
")"... | Remove all thumbnails. | [
"Remove",
"all",
"thumbnails",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L656-L666 | train |
spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | ThumbnailScrollBar.remove_thumbnail | def remove_thumbnail(self, thumbnail):
"""Remove thumbnail."""
if thumbnail in self._thumbnails:
index = self._thumbnails.index(thumbnail)
self._thumbnails.remove(thumbnail)
self.layout().removeWidget(thumbnail)
thumbnail.deleteLater()
thumbnail.sig_canvas... | python | 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",
")",
":",
"if",
"thumbnail",
"in",
"self",
".",
"_thumbnails",
":",
"index",
"=",
"self",
".",
"_thumbnails",
".",
"index",
"(",
"thumbnail",
")",
"self",
".",
"_thumbnails",
".",
"remove",
"(",
"... | Remove thumbnail. | [
"Remove",
"thumbnail",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L668-L685 | train |
spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | ThumbnailScrollBar.set_current_thumbnail | def set_current_thumbnail(self, thumbnail):
"""Set the currently selected thumbnail."""
self.current_thumbnail = thumbnail
self.figure_viewer.load_figure(
thumbnail.canvas.fig, thumbnail.canvas.fmt)
for thumbnail in self._thumbnails:
thumbnail.highlight_canvas... | python | 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",
")",
":",
"self",
".",
"current_thumbnail",
"=",
"thumbnail",
"self",
".",
"figure_viewer",
".",
"load_figure",
"(",
"thumbnail",
".",
"canvas",
".",
"fig",
",",
"thumbnail",
".",
"canvas",
".",
... | Set the currently selected thumbnail. | [
"Set",
"the",
"currently",
"selected",
"thumbnail",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L698-L704 | train |
spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | ThumbnailScrollBar.go_previous_thumbnail | 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... | python | 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",
")",
":",
"if",
"self",
".",
"current_thumbnail",
"is",
"not",
"None",
":",
"index",
"=",
"self",
".",
"_thumbnails",
".",
"index",
"(",
"self",
".",
"current_thumbnail",
")",
"-",
"1",
"index",
"=",
"index",
... | Select the thumbnail previous to the currently selected one. | [
"Select",
"the",
"thumbnail",
"previous",
"to",
"the",
"currently",
"selected",
"one",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L706-L712 | train |
spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | ThumbnailScrollBar.go_next_thumbnail | 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... | python | 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",
")",
":",
"if",
"self",
".",
"current_thumbnail",
"is",
"not",
"None",
":",
"index",
"=",
"self",
".",
"_thumbnails",
".",
"index",
"(",
"self",
".",
"current_thumbnail",
")",
"+",
"1",
"index",
"=",
"0",
"if",
... | Select thumbnail next to the currently selected one. | [
"Select",
"thumbnail",
"next",
"to",
"the",
"currently",
"selected",
"one",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L714-L720 | train |
spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | ThumbnailScrollBar.scroll_to_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 =... | python | 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",
")",
":",
"spacing_between_items",
"=",
"self",
".",
"scene",
".",
"verticalSpacing",
"(",
")",
"height_view",
"=",
"self",
".",
"scrollarea",
".",
"viewport",
"(",
")",
".",
"height",
"(",
")",
"height_i... | Scroll to the selected item of ThumbnailScrollBar. | [
"Scroll",
"to",
"the",
"selected",
"item",
"of",
"ThumbnailScrollBar",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L722-L738 | train |
spyder-ide/spyder | spyder/plugins/plots/widgets/figurebrowser.py | ThumbnailScrollBar.go_up | 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())) | python | 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",
")",
":",
"vsb",
"=",
"self",
".",
"scrollarea",
".",
"verticalScrollBar",
"(",
")",
"vsb",
".",
"setValue",
"(",
"int",
"(",
"vsb",
".",
"value",
"(",
")",
"-",
"vsb",
".",
"singleStep",
"(",
")",
")",
")"
] | Scroll the scrollbar of the scrollarea up by a single step. | [
"Scroll",
"the",
"scrollbar",
"of",
"the",
"scrollarea",
"up",
"by",
"a",
"single",
"step",
"."
] | f76836ce1b924bcc4efd3f74f2960d26a4e528e0 | https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/plots/widgets/figurebrowser.py#L741-L744 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.