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/plugins/variableexplorer/widgets/collectionseditor.py
CollectionsEditor.save_and_close_enable
def save_and_close_enable(self): """Handle the data change event to enable the save and close button.""" if self.btn_save_and_close: self.btn_save_and_close.setEnabled(True) self.btn_save_and_close.setAutoDefault(True) self.btn_save_and_close.setDefault(True)
python
def save_and_close_enable(self): """Handle the data change event to enable the save and close button.""" if self.btn_save_and_close: self.btn_save_and_close.setEnabled(True) self.btn_save_and_close.setAutoDefault(True) self.btn_save_and_close.setDefault(True)
[ "def", "save_and_close_enable", "(", "self", ")", ":", "if", "self", ".", "btn_save_and_close", ":", "self", ".", "btn_save_and_close", ".", "setEnabled", "(", "True", ")", "self", ".", "btn_save_and_close", ".", "setAutoDefault", "(", "True", ")", "self", "."...
Handle the data change event to enable the save and close button.
[ "Handle", "the", "data", "change", "event", "to", "enable", "the", "save", "and", "close", "button", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/collectionseditor.py#L1500-L1505
train
spyder-ide/spyder
spyder/plugins/variableexplorer/widgets/collectionseditor.py
RemoteCollectionsEditorTableView.get_value
def get_value(self, name): """Get the value of a variable""" value = self.shellwidget.get_value(name) # Reset temporal variable where value is saved to # save memory self.shellwidget._kernel_value = None return value
python
def get_value(self, name): """Get the value of a variable""" value = self.shellwidget.get_value(name) # Reset temporal variable where value is saved to # save memory self.shellwidget._kernel_value = None return value
[ "def", "get_value", "(", "self", ",", "name", ")", ":", "value", "=", "self", ".", "shellwidget", ".", "get_value", "(", "name", ")", "# Reset temporal variable where value is saved to\r", "# save memory\r", "self", ".", "shellwidget", ".", "_kernel_value", "=", "...
Get the value of a variable
[ "Get", "the", "value", "of", "a", "variable" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/collectionseditor.py#L1560-L1566
train
spyder-ide/spyder
spyder/plugins/variableexplorer/widgets/collectionseditor.py
RemoteCollectionsEditorTableView.new_value
def new_value(self, name, value): """Create new value in data""" try: # We need to enclose values in a list to be able to send # them to the kernel in Python 2 svalue = [cloudpickle.dumps(value, protocol=PICKLE_PROTOCOL)] # Needed to prevent memory...
python
def new_value(self, name, value): """Create new value in data""" try: # We need to enclose values in a list to be able to send # them to the kernel in Python 2 svalue = [cloudpickle.dumps(value, protocol=PICKLE_PROTOCOL)] # Needed to prevent memory...
[ "def", "new_value", "(", "self", ",", "name", ",", "value", ")", ":", "try", ":", "# We need to enclose values in a list to be able to send\r", "# them to the kernel in Python 2\r", "svalue", "=", "[", "cloudpickle", ".", "dumps", "(", "value", ",", "protocol", "=", ...
Create new value in data
[ "Create", "new", "value", "in", "data" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/collectionseditor.py#L1568-L1587
train
spyder-ide/spyder
spyder/plugins/variableexplorer/widgets/collectionseditor.py
RemoteCollectionsEditorTableView.remove_values
def remove_values(self, names): """Remove values from data""" for name in names: self.shellwidget.remove_value(name) self.shellwidget.refresh_namespacebrowser()
python
def remove_values(self, names): """Remove values from data""" for name in names: self.shellwidget.remove_value(name) self.shellwidget.refresh_namespacebrowser()
[ "def", "remove_values", "(", "self", ",", "names", ")", ":", "for", "name", "in", "names", ":", "self", ".", "shellwidget", ".", "remove_value", "(", "name", ")", "self", ".", "shellwidget", ".", "refresh_namespacebrowser", "(", ")" ]
Remove values from data
[ "Remove", "values", "from", "data" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/collectionseditor.py#L1589-L1593
train
spyder-ide/spyder
spyder/plugins/variableexplorer/widgets/collectionseditor.py
RemoteCollectionsEditorTableView.copy_value
def copy_value(self, orig_name, new_name): """Copy value""" self.shellwidget.copy_value(orig_name, new_name) self.shellwidget.refresh_namespacebrowser()
python
def copy_value(self, orig_name, new_name): """Copy value""" self.shellwidget.copy_value(orig_name, new_name) self.shellwidget.refresh_namespacebrowser()
[ "def", "copy_value", "(", "self", ",", "orig_name", ",", "new_name", ")", ":", "self", ".", "shellwidget", ".", "copy_value", "(", "orig_name", ",", "new_name", ")", "self", ".", "shellwidget", ".", "refresh_namespacebrowser", "(", ")" ]
Copy value
[ "Copy", "value" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/collectionseditor.py#L1595-L1598
train
spyder-ide/spyder
spyder/plugins/variableexplorer/widgets/collectionseditor.py
RemoteCollectionsEditorTableView.plot
def plot(self, name, funcname): """Plot item""" sw = self.shellwidget if sw._reading: sw.dbg_exec_magic('varexp', '--%s %s' % (funcname, name)) else: sw.execute("%%varexp --%s %s" % (funcname, name))
python
def plot(self, name, funcname): """Plot item""" sw = self.shellwidget if sw._reading: sw.dbg_exec_magic('varexp', '--%s %s' % (funcname, name)) else: sw.execute("%%varexp --%s %s" % (funcname, name))
[ "def", "plot", "(", "self", ",", "name", ",", "funcname", ")", ":", "sw", "=", "self", ".", "shellwidget", "if", "sw", ".", "_reading", ":", "sw", ".", "dbg_exec_magic", "(", "'varexp'", ",", "'--%s %s'", "%", "(", "funcname", ",", "name", ")", ")", ...
Plot item
[ "Plot", "item" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/collectionseditor.py#L1636-L1642
train
spyder-ide/spyder
spyder/plugins/variableexplorer/widgets/collectionseditor.py
RemoteCollectionsEditorTableView.imshow
def imshow(self, name): """Show item's image""" sw = self.shellwidget if sw._reading: sw.dbg_exec_magic('varexp', '--imshow %s' % name) else: sw.execute("%%varexp --imshow %s" % name)
python
def imshow(self, name): """Show item's image""" sw = self.shellwidget if sw._reading: sw.dbg_exec_magic('varexp', '--imshow %s' % name) else: sw.execute("%%varexp --imshow %s" % name)
[ "def", "imshow", "(", "self", ",", "name", ")", ":", "sw", "=", "self", ".", "shellwidget", "if", "sw", ".", "_reading", ":", "sw", ".", "dbg_exec_magic", "(", "'varexp'", ",", "'--imshow %s'", "%", "name", ")", "else", ":", "sw", ".", "execute", "("...
Show item's image
[ "Show", "item", "s", "image" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/collectionseditor.py#L1644-L1650
train
spyder-ide/spyder
spyder/plugins/variableexplorer/widgets/collectionseditor.py
RemoteCollectionsEditorTableView.show_image
def show_image(self, name): """Show image (item is a PIL image)""" command = "%s.show()" % name sw = self.shellwidget if sw._reading: sw.kernel_client.input(command) else: sw.execute(command)
python
def show_image(self, name): """Show image (item is a PIL image)""" command = "%s.show()" % name sw = self.shellwidget if sw._reading: sw.kernel_client.input(command) else: sw.execute(command)
[ "def", "show_image", "(", "self", ",", "name", ")", ":", "command", "=", "\"%s.show()\"", "%", "name", "sw", "=", "self", ".", "shellwidget", "if", "sw", ".", "_reading", ":", "sw", ".", "kernel_client", ".", "input", "(", "command", ")", "else", ":", ...
Show image (item is a PIL image)
[ "Show", "image", "(", "item", "is", "a", "PIL", "image", ")" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/variableexplorer/widgets/collectionseditor.py#L1652-L1659
train
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/client.py
ClientWidget.kernel_id
def kernel_id(self): """Get kernel id""" if self.connection_file is not None: json_file = osp.basename(self.connection_file) return json_file.split('.json')[0]
python
def kernel_id(self): """Get kernel id""" if self.connection_file is not None: json_file = osp.basename(self.connection_file) return json_file.split('.json')[0]
[ "def", "kernel_id", "(", "self", ")", ":", "if", "self", ".", "connection_file", "is", "not", "None", ":", "json_file", "=", "osp", ".", "basename", "(", "self", ".", "connection_file", ")", "return", "json_file", ".", "split", "(", "'.json'", ")", "[", ...
Get kernel id
[ "Get", "kernel", "id" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L194-L198
train
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/client.py
ClientWidget.stderr_file
def stderr_file(self): """Filename to save kernel stderr output.""" stderr_file = None if self.connection_file is not None: stderr_file = self.kernel_id + '.stderr' if self.stderr_dir is not None: stderr_file = osp.join(self.stderr_dir, stderr_file) ...
python
def stderr_file(self): """Filename to save kernel stderr output.""" stderr_file = None if self.connection_file is not None: stderr_file = self.kernel_id + '.stderr' if self.stderr_dir is not None: stderr_file = osp.join(self.stderr_dir, stderr_file) ...
[ "def", "stderr_file", "(", "self", ")", ":", "stderr_file", "=", "None", "if", "self", ".", "connection_file", "is", "not", "None", ":", "stderr_file", "=", "self", ".", "kernel_id", "+", "'.stderr'", "if", "self", ".", "stderr_dir", "is", "not", "None", ...
Filename to save kernel stderr output.
[ "Filename", "to", "save", "kernel", "stderr", "output", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L201-L213
train
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/client.py
ClientWidget.stderr_handle
def stderr_handle(self): """Get handle to stderr_file.""" if self.stderr_file is not None: # Needed to prevent any error that could appear. # See issue 6267 try: handle = codecs.open(self.stderr_file, 'w', encoding='utf-8') except Ex...
python
def stderr_handle(self): """Get handle to stderr_file.""" if self.stderr_file is not None: # Needed to prevent any error that could appear. # See issue 6267 try: handle = codecs.open(self.stderr_file, 'w', encoding='utf-8') except Ex...
[ "def", "stderr_handle", "(", "self", ")", ":", "if", "self", ".", "stderr_file", "is", "not", "None", ":", "# Needed to prevent any error that could appear.\r", "# See issue 6267\r", "try", ":", "handle", "=", "codecs", ".", "open", "(", "self", ".", "stderr_file"...
Get handle to stderr_file.
[ "Get", "handle", "to", "stderr_file", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L216-L228
train
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/client.py
ClientWidget.remove_stderr_file
def remove_stderr_file(self): """Remove stderr_file associated with the client.""" try: # Defer closing the stderr_handle until the client # is closed because jupyter_client needs it open # while it tries to restart the kernel self.stderr_handle.clos...
python
def remove_stderr_file(self): """Remove stderr_file associated with the client.""" try: # Defer closing the stderr_handle until the client # is closed because jupyter_client needs it open # while it tries to restart the kernel self.stderr_handle.clos...
[ "def", "remove_stderr_file", "(", "self", ")", ":", "try", ":", "# Defer closing the stderr_handle until the client\r", "# is closed because jupyter_client needs it open\r", "# while it tries to restart the kernel\r", "self", ".", "stderr_handle", ".", "close", "(", ")", "os", ...
Remove stderr_file associated with the client.
[ "Remove", "stderr_file", "associated", "with", "the", "client", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L230-L239
train
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/client.py
ClientWidget.configure_shellwidget
def configure_shellwidget(self, give_focus=True): """Configure shellwidget after kernel is started""" if give_focus: self.get_control().setFocus() # Set exit callback self.shellwidget.set_exit_callback() # To save history self.shellwidget.executing....
python
def configure_shellwidget(self, give_focus=True): """Configure shellwidget after kernel is started""" if give_focus: self.get_control().setFocus() # Set exit callback self.shellwidget.set_exit_callback() # To save history self.shellwidget.executing....
[ "def", "configure_shellwidget", "(", "self", ",", "give_focus", "=", "True", ")", ":", "if", "give_focus", ":", "self", ".", "get_control", "(", ")", ".", "setFocus", "(", ")", "# Set exit callback\r", "self", ".", "shellwidget", ".", "set_exit_callback", "(",...
Configure shellwidget after kernel is started
[ "Configure", "shellwidget", "after", "kernel", "is", "started" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L241-L292
train
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/client.py
ClientWidget.stop_button_click_handler
def stop_button_click_handler(self): """Method to handle what to do when the stop button is pressed""" self.stop_button.setDisabled(True) # Interrupt computations or stop debugging if not self.shellwidget._reading: self.interrupt_kernel() else: self...
python
def stop_button_click_handler(self): """Method to handle what to do when the stop button is pressed""" self.stop_button.setDisabled(True) # Interrupt computations or stop debugging if not self.shellwidget._reading: self.interrupt_kernel() else: self...
[ "def", "stop_button_click_handler", "(", "self", ")", ":", "self", ".", "stop_button", ".", "setDisabled", "(", "True", ")", "# Interrupt computations or stop debugging\r", "if", "not", "self", ".", "shellwidget", ".", "_reading", ":", "self", ".", "interrupt_kernel...
Method to handle what to do when the stop button is pressed
[ "Method", "to", "handle", "what", "to", "do", "when", "the", "stop", "button", "is", "pressed" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L305-L312
train
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/client.py
ClientWidget.show_kernel_error
def show_kernel_error(self, error): """Show kernel initialization errors in infowidget.""" # Replace end of line chars with <br> eol = sourcecode.get_eol_chars(error) if eol: error = error.replace(eol, '<br>') # Don't break lines in hyphens # From htt...
python
def show_kernel_error(self, error): """Show kernel initialization errors in infowidget.""" # Replace end of line chars with <br> eol = sourcecode.get_eol_chars(error) if eol: error = error.replace(eol, '<br>') # Don't break lines in hyphens # From htt...
[ "def", "show_kernel_error", "(", "self", ",", "error", ")", ":", "# Replace end of line chars with <br>\r", "eol", "=", "sourcecode", ".", "get_eol_chars", "(", "error", ")", "if", "eol", ":", "error", "=", "error", ".", "replace", "(", "eol", ",", "'<br>'", ...
Show kernel initialization errors in infowidget.
[ "Show", "kernel", "initialization", "errors", "in", "infowidget", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L314-L339
train
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/client.py
ClientWidget.get_name
def get_name(self): """Return client name""" if self.given_name is None: # Name according to host if self.hostname is None: name = _("Console") else: name = self.hostname # Adding id to name client_id = ...
python
def get_name(self): """Return client name""" if self.given_name is None: # Name according to host if self.hostname is None: name = _("Console") else: name = self.hostname # Adding id to name client_id = ...
[ "def", "get_name", "(", "self", ")", ":", "if", "self", ".", "given_name", "is", "None", ":", "# Name according to host\r", "if", "self", ".", "hostname", "is", "None", ":", "name", "=", "_", "(", "\"Console\"", ")", "else", ":", "name", "=", "self", "...
Return client name
[ "Return", "client", "name" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L341-L357
train
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/client.py
ClientWidget.get_control
def get_control(self): """Return the text widget (or similar) to give focus to""" # page_control is the widget used for paging page_control = self.shellwidget._page_control if page_control and page_control.isVisible(): return page_control else: retu...
python
def get_control(self): """Return the text widget (or similar) to give focus to""" # page_control is the widget used for paging page_control = self.shellwidget._page_control if page_control and page_control.isVisible(): return page_control else: retu...
[ "def", "get_control", "(", "self", ")", ":", "# page_control is the widget used for paging\r", "page_control", "=", "self", ".", "shellwidget", ".", "_page_control", "if", "page_control", "and", "page_control", ".", "isVisible", "(", ")", ":", "return", "page_control"...
Return the text widget (or similar) to give focus to
[ "Return", "the", "text", "widget", "(", "or", "similar", ")", "to", "give", "focus", "to" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L359-L366
train
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/client.py
ClientWidget.get_options_menu
def get_options_menu(self): """Return options menu""" env_action = create_action( self, _("Show environment variables"), icon=ima.icon('environ'), triggered=self.shellwidget.get_env ...
python
def get_options_menu(self): """Return options menu""" env_action = create_action( self, _("Show environment variables"), icon=ima.icon('environ'), triggered=self.shellwidget.get_env ...
[ "def", "get_options_menu", "(", "self", ")", ":", "env_action", "=", "create_action", "(", "self", ",", "_", "(", "\"Show environment variables\"", ")", ",", "icon", "=", "ima", ".", "icon", "(", "'environ'", ")", ",", "triggered", "=", "self", ".", "shell...
Return options menu
[ "Return", "options", "menu" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L372-L399
train
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/client.py
ClientWidget.get_toolbar_buttons
def get_toolbar_buttons(self): """Return toolbar buttons list.""" buttons = [] # Code to add the stop button if self.stop_button is None: self.stop_button = create_toolbutton( self, text=_("Stop"),...
python
def get_toolbar_buttons(self): """Return toolbar buttons list.""" buttons = [] # Code to add the stop button if self.stop_button is None: self.stop_button = create_toolbutton( self, text=_("Stop"),...
[ "def", "get_toolbar_buttons", "(", "self", ")", ":", "buttons", "=", "[", "]", "# Code to add the stop button\r", "if", "self", ".", "stop_button", "is", "None", ":", "self", ".", "stop_button", "=", "create_toolbutton", "(", "self", ",", "text", "=", "_", "...
Return toolbar buttons list.
[ "Return", "toolbar", "buttons", "list", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L401-L445
train
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/client.py
ClientWidget.add_actions_to_context_menu
def add_actions_to_context_menu(self, menu): """Add actions to IPython widget context menu""" inspect_action = create_action(self, _("Inspect current object"), QKeySequence(get_shortcut('console', 'inspect curren...
python
def add_actions_to_context_menu(self, menu): """Add actions to IPython widget context menu""" inspect_action = create_action(self, _("Inspect current object"), QKeySequence(get_shortcut('console', 'inspect curren...
[ "def", "add_actions_to_context_menu", "(", "self", ",", "menu", ")", ":", "inspect_action", "=", "create_action", "(", "self", ",", "_", "(", "\"Inspect current object\"", ")", ",", "QKeySequence", "(", "get_shortcut", "(", "'console'", ",", "'inspect current object...
Add actions to IPython widget context menu
[ "Add", "actions", "to", "IPython", "widget", "context", "menu" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L447-L479
train
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/client.py
ClientWidget.set_font
def set_font(self, font): """Set IPython widget's font""" self.shellwidget._control.setFont(font) self.shellwidget.font = font
python
def set_font(self, font): """Set IPython widget's font""" self.shellwidget._control.setFont(font) self.shellwidget.font = font
[ "def", "set_font", "(", "self", ",", "font", ")", ":", "self", ".", "shellwidget", ".", "_control", ".", "setFont", "(", "font", ")", "self", ".", "shellwidget", ".", "font", "=", "font" ]
Set IPython widget's font
[ "Set", "IPython", "widget", "s", "font" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L481-L484
train
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/client.py
ClientWidget.set_color_scheme
def set_color_scheme(self, color_scheme, reset=True): """Set IPython color scheme.""" # Needed to handle not initialized kernel_client # See issue 6996 try: self.shellwidget.set_color_scheme(color_scheme, reset) except AttributeError: pass
python
def set_color_scheme(self, color_scheme, reset=True): """Set IPython color scheme.""" # Needed to handle not initialized kernel_client # See issue 6996 try: self.shellwidget.set_color_scheme(color_scheme, reset) except AttributeError: pass
[ "def", "set_color_scheme", "(", "self", ",", "color_scheme", ",", "reset", "=", "True", ")", ":", "# Needed to handle not initialized kernel_client\r", "# See issue 6996\r", "try", ":", "self", ".", "shellwidget", ".", "set_color_scheme", "(", "color_scheme", ",", "re...
Set IPython color scheme.
[ "Set", "IPython", "color", "scheme", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L486-L493
train
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/client.py
ClientWidget.shutdown
def shutdown(self): """Shutdown kernel""" if self.get_kernel() is not None and not self.slave: self.shellwidget.kernel_manager.shutdown_kernel() if self.shellwidget.kernel_client is not None: background(self.shellwidget.kernel_client.stop_channels)
python
def shutdown(self): """Shutdown kernel""" if self.get_kernel() is not None and not self.slave: self.shellwidget.kernel_manager.shutdown_kernel() if self.shellwidget.kernel_client is not None: background(self.shellwidget.kernel_client.stop_channels)
[ "def", "shutdown", "(", "self", ")", ":", "if", "self", ".", "get_kernel", "(", ")", "is", "not", "None", "and", "not", "self", ".", "slave", ":", "self", ".", "shellwidget", ".", "kernel_manager", ".", "shutdown_kernel", "(", ")", "if", "self", ".", ...
Shutdown kernel
[ "Shutdown", "kernel" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L495-L500
train
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/client.py
ClientWidget.restart_kernel
def restart_kernel(self): """ Restart the associated kernel. Took this code from the qtconsole project Licensed under the BSD license """ sw = self.shellwidget if not running_under_pytest() and self.ask_before_restart: message = _('Are you ...
python
def restart_kernel(self): """ Restart the associated kernel. Took this code from the qtconsole project Licensed under the BSD license """ sw = self.shellwidget if not running_under_pytest() and self.ask_before_restart: message = _('Are you ...
[ "def", "restart_kernel", "(", "self", ")", ":", "sw", "=", "self", ".", "shellwidget", "if", "not", "running_under_pytest", "(", ")", "and", "self", ".", "ask_before_restart", ":", "message", "=", "_", "(", "'Are you sure you want to restart the kernel?'", ")", ...
Restart the associated kernel. Took this code from the qtconsole project Licensed under the BSD license
[ "Restart", "the", "associated", "kernel", ".", "Took", "this", "code", "from", "the", "qtconsole", "project", "Licensed", "under", "the", "BSD", "license" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L512-L555
train
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/client.py
ClientWidget.kernel_restarted_message
def kernel_restarted_message(self, msg): """Show kernel restarted/died messages.""" if not self.is_error_shown: # If there are kernel creation errors, jupyter_client will # try to restart the kernel and qtconsole prints a # message about it. # So we ...
python
def kernel_restarted_message(self, msg): """Show kernel restarted/died messages.""" if not self.is_error_shown: # If there are kernel creation errors, jupyter_client will # try to restart the kernel and qtconsole prints a # message about it. # So we ...
[ "def", "kernel_restarted_message", "(", "self", ",", "msg", ")", ":", "if", "not", "self", ".", "is_error_shown", ":", "# If there are kernel creation errors, jupyter_client will\r", "# try to restart the kernel and qtconsole prints a\r", "# message about it.\r", "# So we read the ...
Show kernel restarted/died messages.
[ "Show", "kernel", "restarted", "/", "died", "messages", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L558-L575
train
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/client.py
ClientWidget.reset_namespace
def reset_namespace(self): """Resets the namespace by removing all names defined by the user""" self.shellwidget.reset_namespace(warning=self.reset_warning, message=True)
python
def reset_namespace(self): """Resets the namespace by removing all names defined by the user""" self.shellwidget.reset_namespace(warning=self.reset_warning, message=True)
[ "def", "reset_namespace", "(", "self", ")", ":", "self", ".", "shellwidget", ".", "reset_namespace", "(", "warning", "=", "self", ".", "reset_warning", ",", "message", "=", "True", ")" ]
Resets the namespace by removing all names defined by the user
[ "Resets", "the", "namespace", "by", "removing", "all", "names", "defined", "by", "the", "user" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L593-L596
train
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/client.py
ClientWidget.show_syspath
def show_syspath(self, syspath): """Show sys.path contents.""" if syspath is not None: editor = CollectionsEditor(self) editor.setup(syspath, title="sys.path contents", readonly=True, width=600, icon=ima.icon('syspath')) self.dialog_mana...
python
def show_syspath(self, syspath): """Show sys.path contents.""" if syspath is not None: editor = CollectionsEditor(self) editor.setup(syspath, title="sys.path contents", readonly=True, width=600, icon=ima.icon('syspath')) self.dialog_mana...
[ "def", "show_syspath", "(", "self", ",", "syspath", ")", ":", "if", "syspath", "is", "not", "None", ":", "editor", "=", "CollectionsEditor", "(", "self", ")", "editor", ".", "setup", "(", "syspath", ",", "title", "=", "\"sys.path contents\"", ",", "readonl...
Show sys.path contents.
[ "Show", "sys", ".", "path", "contents", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L602-L610
train
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/client.py
ClientWidget.show_env
def show_env(self, env): """Show environment variables.""" self.dialog_manager.show(RemoteEnvDialog(env, parent=self))
python
def show_env(self, env): """Show environment variables.""" self.dialog_manager.show(RemoteEnvDialog(env, parent=self))
[ "def", "show_env", "(", "self", ",", "env", ")", ":", "self", ".", "dialog_manager", ".", "show", "(", "RemoteEnvDialog", "(", "env", ",", "parent", "=", "self", ")", ")" ]
Show environment variables.
[ "Show", "environment", "variables", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L613-L615
train
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/client.py
ClientWidget.show_time
def show_time(self, end=False): """Text to show in time_label.""" if self.time_label is None: return elapsed_time = time.monotonic() - self.t0 # System time changed to past date, so reset start. if elapsed_time < 0: self.t0 = time.monotonic() ...
python
def show_time(self, end=False): """Text to show in time_label.""" if self.time_label is None: return elapsed_time = time.monotonic() - self.t0 # System time changed to past date, so reset start. if elapsed_time < 0: self.t0 = time.monotonic() ...
[ "def", "show_time", "(", "self", ",", "end", "=", "False", ")", ":", "if", "self", ".", "time_label", "is", "None", ":", "return", "elapsed_time", "=", "time", ".", "monotonic", "(", ")", "-", "self", ".", "t0", "# System time changed to past date, so reset ...
Text to show in time_label.
[ "Text", "to", "show", "in", "time_label", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L623-L644
train
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/client.py
ClientWidget.set_elapsed_time_visible
def set_elapsed_time_visible(self, state): """Slot to show/hide elapsed time label.""" self.show_elapsed_time = state if self.time_label is not None: self.time_label.setVisible(state)
python
def set_elapsed_time_visible(self, state): """Slot to show/hide elapsed time label.""" self.show_elapsed_time = state if self.time_label is not None: self.time_label.setVisible(state)
[ "def", "set_elapsed_time_visible", "(", "self", ",", "state", ")", ":", "self", ".", "show_elapsed_time", "=", "state", "if", "self", ".", "time_label", "is", "not", "None", ":", "self", ".", "time_label", ".", "setVisible", "(", "state", ")" ]
Slot to show/hide elapsed time label.
[ "Slot", "to", "show", "/", "hide", "elapsed", "time", "label", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L651-L655
train
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/client.py
ClientWidget.set_info_page
def set_info_page(self): """Set current info_page.""" if self.info_page is not None: self.infowidget.setHtml( self.info_page, QUrl.fromLocalFile(self.css_path) )
python
def set_info_page(self): """Set current info_page.""" if self.info_page is not None: self.infowidget.setHtml( self.info_page, QUrl.fromLocalFile(self.css_path) )
[ "def", "set_info_page", "(", "self", ")", ":", "if", "self", ".", "info_page", "is", "not", "None", ":", "self", ".", "infowidget", ".", "setHtml", "(", "self", ".", "info_page", ",", "QUrl", ".", "fromLocalFile", "(", "self", ".", "css_path", ")", ")"...
Set current info_page.
[ "Set", "current", "info_page", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L657-L663
train
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/client.py
ClientWidget._create_loading_page
def _create_loading_page(self): """Create html page to show while the kernel is starting""" loading_template = Template(LOADING) loading_img = get_image_path('loading_sprites.png') if os.name == 'nt': loading_img = loading_img.replace('\\', '/') message = _("Con...
python
def _create_loading_page(self): """Create html page to show while the kernel is starting""" loading_template = Template(LOADING) loading_img = get_image_path('loading_sprites.png') if os.name == 'nt': loading_img = loading_img.replace('\\', '/') message = _("Con...
[ "def", "_create_loading_page", "(", "self", ")", ":", "loading_template", "=", "Template", "(", "LOADING", ")", "loading_img", "=", "get_image_path", "(", "'loading_sprites.png'", ")", "if", "os", ".", "name", "==", "'nt'", ":", "loading_img", "=", "loading_img"...
Create html page to show while the kernel is starting
[ "Create", "html", "page", "to", "show", "while", "the", "kernel", "is", "starting" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L666-L676
train
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/client.py
ClientWidget._create_blank_page
def _create_blank_page(self): """Create html page to show while the kernel is starting""" loading_template = Template(BLANK) page = loading_template.substitute(css_path=self.css_path) return page
python
def _create_blank_page(self): """Create html page to show while the kernel is starting""" loading_template = Template(BLANK) page = loading_template.substitute(css_path=self.css_path) return page
[ "def", "_create_blank_page", "(", "self", ")", ":", "loading_template", "=", "Template", "(", "BLANK", ")", "page", "=", "loading_template", ".", "substitute", "(", "css_path", "=", "self", ".", "css_path", ")", "return", "page" ]
Create html page to show while the kernel is starting
[ "Create", "html", "page", "to", "show", "while", "the", "kernel", "is", "starting" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L678-L682
train
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/client.py
ClientWidget._show_loading_page
def _show_loading_page(self): """Show animation while the kernel is loading.""" self.shellwidget.hide() self.infowidget.show() self.info_page = self.loading_page self.set_info_page()
python
def _show_loading_page(self): """Show animation while the kernel is loading.""" self.shellwidget.hide() self.infowidget.show() self.info_page = self.loading_page self.set_info_page()
[ "def", "_show_loading_page", "(", "self", ")", ":", "self", ".", "shellwidget", ".", "hide", "(", ")", "self", ".", "infowidget", ".", "show", "(", ")", "self", ".", "info_page", "=", "self", ".", "loading_page", "self", ".", "set_info_page", "(", ")" ]
Show animation while the kernel is loading.
[ "Show", "animation", "while", "the", "kernel", "is", "loading", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L684-L689
train
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/client.py
ClientWidget._hide_loading_page
def _hide_loading_page(self): """Hide animation shown while the kernel is loading.""" self.infowidget.hide() self.shellwidget.show() self.info_page = self.blank_page self.set_info_page() self.shellwidget.sig_prompt_ready.disconnect(self._hide_loading_page)
python
def _hide_loading_page(self): """Hide animation shown while the kernel is loading.""" self.infowidget.hide() self.shellwidget.show() self.info_page = self.blank_page self.set_info_page() self.shellwidget.sig_prompt_ready.disconnect(self._hide_loading_page)
[ "def", "_hide_loading_page", "(", "self", ")", ":", "self", ".", "infowidget", ".", "hide", "(", ")", "self", ".", "shellwidget", ".", "show", "(", ")", "self", ".", "info_page", "=", "self", ".", "blank_page", "self", ".", "set_info_page", "(", ")", "...
Hide animation shown while the kernel is loading.
[ "Hide", "animation", "shown", "while", "the", "kernel", "is", "loading", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L691-L697
train
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/client.py
ClientWidget._read_stderr
def _read_stderr(self): """Read the stderr file of the kernel.""" # We need to read stderr_file as bytes to be able to # detect its encoding with chardet f = open(self.stderr_file, 'rb') try: stderr_text = f.read() # This is needed to avoid show...
python
def _read_stderr(self): """Read the stderr file of the kernel.""" # We need to read stderr_file as bytes to be able to # detect its encoding with chardet f = open(self.stderr_file, 'rb') try: stderr_text = f.read() # This is needed to avoid show...
[ "def", "_read_stderr", "(", "self", ")", ":", "# We need to read stderr_file as bytes to be able to\r", "# detect its encoding with chardet\r", "f", "=", "open", "(", "self", ".", "stderr_file", ",", "'rb'", ")", "try", ":", "stderr_text", "=", "f", ".", "read", "("...
Read the stderr file of the kernel.
[ "Read", "the", "stderr", "file", "of", "the", "kernel", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L699-L721
train
spyder-ide/spyder
spyder/plugins/ipythonconsole/widgets/client.py
ClientWidget._show_mpl_backend_errors
def _show_mpl_backend_errors(self): """ Show possible errors when setting the selected Matplotlib backend. """ if not self.external_kernel: self.shellwidget.silent_execute( "get_ipython().kernel._show_mpl_backend_errors()") self.shellwidget....
python
def _show_mpl_backend_errors(self): """ Show possible errors when setting the selected Matplotlib backend. """ if not self.external_kernel: self.shellwidget.silent_execute( "get_ipython().kernel._show_mpl_backend_errors()") self.shellwidget....
[ "def", "_show_mpl_backend_errors", "(", "self", ")", ":", "if", "not", "self", ".", "external_kernel", ":", "self", ".", "shellwidget", ".", "silent_execute", "(", "\"get_ipython().kernel._show_mpl_backend_errors()\"", ")", "self", ".", "shellwidget", ".", "sig_prompt...
Show possible errors when setting the selected Matplotlib backend.
[ "Show", "possible", "errors", "when", "setting", "the", "selected", "Matplotlib", "backend", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/plugins/ipythonconsole/widgets/client.py#L723-L731
train
spyder-ide/spyder
spyder/widgets/mixins.py
BaseEditMixin._calculate_position
def _calculate_position(self, at_line=None, at_position=None, at_point=None): """ Calculate a global point position `QPoint(x, y)`, for a given line, local cursor position, or local point. """ # Check that no option or only one option is given: ...
python
def _calculate_position(self, at_line=None, at_position=None, at_point=None): """ Calculate a global point position `QPoint(x, y)`, for a given line, local cursor position, or local point. """ # Check that no option or only one option is given: ...
[ "def", "_calculate_position", "(", "self", ",", "at_line", "=", "None", ",", "at_position", "=", "None", ",", "at_point", "=", "None", ")", ":", "# Check that no option or only one option is given:\r", "if", "[", "at_line", ",", "at_position", ",", "at_point", "]"...
Calculate a global point position `QPoint(x, y)`, for a given line, local cursor position, or local point.
[ "Calculate", "a", "global", "point", "position", "QPoint", "(", "x", "y", ")", "for", "a", "given", "line", "local", "cursor", "position", "or", "local", "point", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L74-L114
train
spyder-ide/spyder
spyder/widgets/mixins.py
BaseEditMixin._update_stylesheet
def _update_stylesheet(self, widget): """Update the background stylesheet to make it lighter.""" if is_dark_interface(): css = qdarkstyle.load_stylesheet_from_environment() widget.setStyleSheet(css) palette = widget.palette() background = palette.col...
python
def _update_stylesheet(self, widget): """Update the background stylesheet to make it lighter.""" if is_dark_interface(): css = qdarkstyle.load_stylesheet_from_environment() widget.setStyleSheet(css) palette = widget.palette() background = palette.col...
[ "def", "_update_stylesheet", "(", "self", ",", "widget", ")", ":", "if", "is_dark_interface", "(", ")", ":", "css", "=", "qdarkstyle", ".", "load_stylesheet_from_environment", "(", ")", "widget", ".", "setStyleSheet", "(", "css", ")", "palette", "=", "widget",...
Update the background stylesheet to make it lighter.
[ "Update", "the", "background", "stylesheet", "to", "make", "it", "lighter", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L116-L131
train
spyder-ide/spyder
spyder/widgets/mixins.py
BaseEditMixin._format_text
def _format_text(self, title, text, color, ellide=False): """ Create HTML template for calltips and tooltips. This will display title and text as separate sections and add `...` if `ellide` is True and the text is too long. """ template = ''' <div sty...
python
def _format_text(self, title, text, color, ellide=False): """ Create HTML template for calltips and tooltips. This will display title and text as separate sections and add `...` if `ellide` is True and the text is too long. """ template = ''' <div sty...
[ "def", "_format_text", "(", "self", ",", "title", ",", "text", ",", "color", ",", "ellide", "=", "False", ")", ":", "template", "=", "'''\r\n <div style=\\'font-family: \"{font_family}\";\r\n font-size: {title_size}pt;\r\n ...
Create HTML template for calltips and tooltips. This will display title and text as separate sections and add `...` if `ellide` is True and the text is too long.
[ "Create", "HTML", "template", "for", "calltips", "and", "tooltips", ".", "This", "will", "display", "title", "and", "text", "as", "separate", "sections", "and", "add", "...", "if", "ellide", "is", "True", "and", "the", "text", "is", "too", "long", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L133-L183
train
spyder-ide/spyder
spyder/widgets/mixins.py
BaseEditMixin._format_signature
def _format_signature(self, signature, doc='', parameter='', parameter_doc='', color=_DEFAULT_TITLE_COLOR, is_python=False): """ Create HTML template for signature. This template will include indent after the method name, a highlight ...
python
def _format_signature(self, signature, doc='', parameter='', parameter_doc='', color=_DEFAULT_TITLE_COLOR, is_python=False): """ Create HTML template for signature. This template will include indent after the method name, a highlight ...
[ "def", "_format_signature", "(", "self", ",", "signature", ",", "doc", "=", "''", ",", "parameter", "=", "''", ",", "parameter_doc", "=", "''", ",", "color", "=", "_DEFAULT_TITLE_COLOR", ",", "is_python", "=", "False", ")", ":", "active_parameter_template", ...
Create HTML template for signature. This template will include indent after the method name, a highlight color for the active parameter and highlights for special chars.
[ "Create", "HTML", "template", "for", "signature", ".", "This", "template", "will", "include", "indent", "after", "the", "method", "name", "a", "highlight", "color", "for", "the", "active", "parameter", "and", "highlights", "for", "special", "chars", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L185-L288
train
spyder-ide/spyder
spyder/widgets/mixins.py
BaseEditMixin.show_calltip
def show_calltip(self, signature, doc='', parameter='', parameter_doc='', color=_DEFAULT_TITLE_COLOR, is_python=False): """ Show calltip. Calltips look like tooltips but will not disappear if mouse hovers them. They are useful for displaying signature informat...
python
def show_calltip(self, signature, doc='', parameter='', parameter_doc='', color=_DEFAULT_TITLE_COLOR, is_python=False): """ Show calltip. Calltips look like tooltips but will not disappear if mouse hovers them. They are useful for displaying signature informat...
[ "def", "show_calltip", "(", "self", ",", "signature", ",", "doc", "=", "''", ",", "parameter", "=", "''", ",", "parameter_doc", "=", "''", ",", "color", "=", "_DEFAULT_TITLE_COLOR", ",", "is_python", "=", "False", ")", ":", "# Find position of calltip\r", "p...
Show calltip. Calltips look like tooltips but will not disappear if mouse hovers them. They are useful for displaying signature information on methods and functions.
[ "Show", "calltip", ".", "Calltips", "look", "like", "tooltips", "but", "will", "not", "disappear", "if", "mouse", "hovers", "them", ".", "They", "are", "useful", "for", "displaying", "signature", "information", "on", "methods", "and", "functions", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L290-L315
train
spyder-ide/spyder
spyder/widgets/mixins.py
BaseEditMixin.show_tooltip
def show_tooltip(self, title, text, color=_DEFAULT_TITLE_COLOR, at_line=None, at_position=None, at_point=None): """ Show tooltip. Tooltips will disappear if mouse hovers them. They are meant for quick inspections. """ if text is not None and ...
python
def show_tooltip(self, title, text, color=_DEFAULT_TITLE_COLOR, at_line=None, at_position=None, at_point=None): """ Show tooltip. Tooltips will disappear if mouse hovers them. They are meant for quick inspections. """ if text is not None and ...
[ "def", "show_tooltip", "(", "self", ",", "title", ",", "text", ",", "color", "=", "_DEFAULT_TITLE_COLOR", ",", "at_line", "=", "None", ",", "at_position", "=", "None", ",", "at_point", "=", "None", ")", ":", "if", "text", "is", "not", "None", "and", "l...
Show tooltip. Tooltips will disappear if mouse hovers them. They are meant for quick inspections.
[ "Show", "tooltip", ".", "Tooltips", "will", "disappear", "if", "mouse", "hovers", "them", ".", "They", "are", "meant", "for", "quick", "inspections", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L317-L340
train
spyder-ide/spyder
spyder/widgets/mixins.py
BaseEditMixin.set_eol_chars
def set_eol_chars(self, text): """Set widget end-of-line (EOL) characters from text (analyzes text)""" if not is_text_string(text): # testing for QString (PyQt API#1) text = to_text_string(text) eol_chars = sourcecode.get_eol_chars(text) is_document_modified = eol_chars ...
python
def set_eol_chars(self, text): """Set widget end-of-line (EOL) characters from text (analyzes text)""" if not is_text_string(text): # testing for QString (PyQt API#1) text = to_text_string(text) eol_chars = sourcecode.get_eol_chars(text) is_document_modified = eol_chars ...
[ "def", "set_eol_chars", "(", "self", ",", "text", ")", ":", "if", "not", "is_text_string", "(", "text", ")", ":", "# testing for QString (PyQt API#1)\r", "text", "=", "to_text_string", "(", "text", ")", "eol_chars", "=", "sourcecode", ".", "get_eol_chars", "(", ...
Set widget end-of-line (EOL) characters from text (analyzes text)
[ "Set", "widget", "end", "-", "of", "-", "line", "(", "EOL", ")", "characters", "from", "text", "(", "analyzes", "text", ")" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L343-L353
train
spyder-ide/spyder
spyder/widgets/mixins.py
BaseEditMixin.get_text_with_eol
def get_text_with_eol(self): """Same as 'toPlainText', replace '\n' by correct end-of-line characters""" utext = to_text_string(self.toPlainText()) lines = utext.splitlines() linesep = self.get_line_separator() txt = linesep.join(lines) if utext.endswith('\...
python
def get_text_with_eol(self): """Same as 'toPlainText', replace '\n' by correct end-of-line characters""" utext = to_text_string(self.toPlainText()) lines = utext.splitlines() linesep = self.get_line_separator() txt = linesep.join(lines) if utext.endswith('\...
[ "def", "get_text_with_eol", "(", "self", ")", ":", "utext", "=", "to_text_string", "(", "self", ".", "toPlainText", "(", ")", ")", "lines", "=", "utext", ".", "splitlines", "(", ")", "linesep", "=", "self", ".", "get_line_separator", "(", ")", "txt", "="...
Same as 'toPlainText', replace '\n' by correct end-of-line characters
[ "Same", "as", "toPlainText", "replace", "\\", "n", "by", "correct", "end", "-", "of", "-", "line", "characters" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L362-L371
train
spyder-ide/spyder
spyder/widgets/mixins.py
BaseEditMixin.get_position
def get_position(self, subject): """Get offset in character for the given subject from the start of text edit area""" cursor = self.textCursor() if subject == 'cursor': pass elif subject == 'sol': cursor.movePosition(QTextCursor.StartOfBlock) ...
python
def get_position(self, subject): """Get offset in character for the given subject from the start of text edit area""" cursor = self.textCursor() if subject == 'cursor': pass elif subject == 'sol': cursor.movePosition(QTextCursor.StartOfBlock) ...
[ "def", "get_position", "(", "self", ",", "subject", ")", ":", "cursor", "=", "self", ".", "textCursor", "(", ")", "if", "subject", "==", "'cursor'", ":", "pass", "elif", "subject", "==", "'sol'", ":", "cursor", ".", "movePosition", "(", "QTextCursor", "....
Get offset in character for the given subject from the start of text edit area
[ "Get", "offset", "in", "character", "for", "the", "given", "subject", "from", "the", "start", "of", "text", "edit", "area" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L375-L392
train
spyder-ide/spyder
spyder/widgets/mixins.py
BaseEditMixin.set_cursor_position
def set_cursor_position(self, position): """Set cursor position""" position = self.get_position(position) cursor = self.textCursor() cursor.setPosition(position) self.setTextCursor(cursor) self.ensureCursorVisible()
python
def set_cursor_position(self, position): """Set cursor position""" position = self.get_position(position) cursor = self.textCursor() cursor.setPosition(position) self.setTextCursor(cursor) self.ensureCursorVisible()
[ "def", "set_cursor_position", "(", "self", ",", "position", ")", ":", "position", "=", "self", ".", "get_position", "(", "position", ")", "cursor", "=", "self", ".", "textCursor", "(", ")", "cursor", ".", "setPosition", "(", "position", ")", "self", ".", ...
Set cursor position
[ "Set", "cursor", "position" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L410-L416
train
spyder-ide/spyder
spyder/widgets/mixins.py
BaseEditMixin.move_cursor
def move_cursor(self, chars=0): """Move cursor to left or right (unit: characters)""" direction = QTextCursor.Right if chars > 0 else QTextCursor.Left for _i in range(abs(chars)): self.moveCursor(direction, QTextCursor.MoveAnchor)
python
def move_cursor(self, chars=0): """Move cursor to left or right (unit: characters)""" direction = QTextCursor.Right if chars > 0 else QTextCursor.Left for _i in range(abs(chars)): self.moveCursor(direction, QTextCursor.MoveAnchor)
[ "def", "move_cursor", "(", "self", ",", "chars", "=", "0", ")", ":", "direction", "=", "QTextCursor", ".", "Right", "if", "chars", ">", "0", "else", "QTextCursor", ".", "Left", "for", "_i", "in", "range", "(", "abs", "(", "chars", ")", ")", ":", "s...
Move cursor to left or right (unit: characters)
[ "Move", "cursor", "to", "left", "or", "right", "(", "unit", ":", "characters", ")" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L418-L422
train
spyder-ide/spyder
spyder/widgets/mixins.py
BaseEditMixin.is_cursor_on_first_line
def is_cursor_on_first_line(self): """Return True if cursor is on the first line""" cursor = self.textCursor() cursor.movePosition(QTextCursor.StartOfBlock) return cursor.atStart()
python
def is_cursor_on_first_line(self): """Return True if cursor is on the first line""" cursor = self.textCursor() cursor.movePosition(QTextCursor.StartOfBlock) return cursor.atStart()
[ "def", "is_cursor_on_first_line", "(", "self", ")", ":", "cursor", "=", "self", ".", "textCursor", "(", ")", "cursor", ".", "movePosition", "(", "QTextCursor", ".", "StartOfBlock", ")", "return", "cursor", ".", "atStart", "(", ")" ]
Return True if cursor is on the first line
[ "Return", "True", "if", "cursor", "is", "on", "the", "first", "line" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L424-L428
train
spyder-ide/spyder
spyder/widgets/mixins.py
BaseEditMixin.is_cursor_on_last_line
def is_cursor_on_last_line(self): """Return True if cursor is on the last line""" cursor = self.textCursor() cursor.movePosition(QTextCursor.EndOfBlock) return cursor.atEnd()
python
def is_cursor_on_last_line(self): """Return True if cursor is on the last line""" cursor = self.textCursor() cursor.movePosition(QTextCursor.EndOfBlock) return cursor.atEnd()
[ "def", "is_cursor_on_last_line", "(", "self", ")", ":", "cursor", "=", "self", ".", "textCursor", "(", ")", "cursor", ".", "movePosition", "(", "QTextCursor", ".", "EndOfBlock", ")", "return", "cursor", ".", "atEnd", "(", ")" ]
Return True if cursor is on the last line
[ "Return", "True", "if", "cursor", "is", "on", "the", "last", "line" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L430-L434
train
spyder-ide/spyder
spyder/widgets/mixins.py
BaseEditMixin.is_cursor_before
def is_cursor_before(self, position, char_offset=0): """Return True if cursor is before *position*""" position = self.get_position(position) + char_offset cursor = self.textCursor() cursor.movePosition(QTextCursor.End) if position < cursor.position(): cursor.set...
python
def is_cursor_before(self, position, char_offset=0): """Return True if cursor is before *position*""" position = self.get_position(position) + char_offset cursor = self.textCursor() cursor.movePosition(QTextCursor.End) if position < cursor.position(): cursor.set...
[ "def", "is_cursor_before", "(", "self", ",", "position", ",", "char_offset", "=", "0", ")", ":", "position", "=", "self", ".", "get_position", "(", "position", ")", "+", "char_offset", "cursor", "=", "self", ".", "textCursor", "(", ")", "cursor", ".", "m...
Return True if cursor is before *position*
[ "Return", "True", "if", "cursor", "is", "before", "*", "position", "*" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L440-L447
train
spyder-ide/spyder
spyder/widgets/mixins.py
BaseEditMixin.move_cursor_to_next
def move_cursor_to_next(self, what='word', direction='left'): """ Move cursor to next *what* ('word' or 'character') toward *direction* ('left' or 'right') """ self.__move_cursor_anchor(what, direction, QTextCursor.MoveAnchor)
python
def move_cursor_to_next(self, what='word', direction='left'): """ Move cursor to next *what* ('word' or 'character') toward *direction* ('left' or 'right') """ self.__move_cursor_anchor(what, direction, QTextCursor.MoveAnchor)
[ "def", "move_cursor_to_next", "(", "self", ",", "what", "=", "'word'", ",", "direction", "=", "'left'", ")", ":", "self", ".", "__move_cursor_anchor", "(", "what", ",", "direction", ",", "QTextCursor", ".", "MoveAnchor", ")" ]
Move cursor to next *what* ('word' or 'character') toward *direction* ('left' or 'right')
[ "Move", "cursor", "to", "next", "*", "what", "*", "(", "word", "or", "character", ")", "toward", "*", "direction", "*", "(", "left", "or", "right", ")" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L467-L472
train
spyder-ide/spyder
spyder/widgets/mixins.py
BaseEditMixin.clear_selection
def clear_selection(self): """Clear current selection""" cursor = self.textCursor() cursor.clearSelection() self.setTextCursor(cursor)
python
def clear_selection(self): """Clear current selection""" cursor = self.textCursor() cursor.clearSelection() self.setTextCursor(cursor)
[ "def", "clear_selection", "(", "self", ")", ":", "cursor", "=", "self", ".", "textCursor", "(", ")", "cursor", ".", "clearSelection", "(", ")", "self", ".", "setTextCursor", "(", "cursor", ")" ]
Clear current selection
[ "Clear", "current", "selection" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L476-L480
train
spyder-ide/spyder
spyder/widgets/mixins.py
BaseEditMixin.extend_selection_to_next
def extend_selection_to_next(self, what='word', direction='left'): """ Extend selection to next *what* ('word' or 'character') toward *direction* ('left' or 'right') """ self.__move_cursor_anchor(what, direction, QTextCursor.KeepAnchor)
python
def extend_selection_to_next(self, what='word', direction='left'): """ Extend selection to next *what* ('word' or 'character') toward *direction* ('left' or 'right') """ self.__move_cursor_anchor(what, direction, QTextCursor.KeepAnchor)
[ "def", "extend_selection_to_next", "(", "self", ",", "what", "=", "'word'", ",", "direction", "=", "'left'", ")", ":", "self", ".", "__move_cursor_anchor", "(", "what", ",", "direction", ",", "QTextCursor", ".", "KeepAnchor", ")" ]
Extend selection to next *what* ('word' or 'character') toward *direction* ('left' or 'right')
[ "Extend", "selection", "to", "next", "*", "what", "*", "(", "word", "or", "character", ")", "toward", "*", "direction", "*", "(", "left", "or", "right", ")" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L482-L487
train
spyder-ide/spyder
spyder/widgets/mixins.py
BaseEditMixin.get_text_line
def get_text_line(self, line_nb): """Return text line at line number *line_nb*""" # Taking into account the case when a file ends in an empty line, # since splitlines doesn't return that line as the last element # TODO: Make this function more efficient try: ret...
python
def get_text_line(self, line_nb): """Return text line at line number *line_nb*""" # Taking into account the case when a file ends in an empty line, # since splitlines doesn't return that line as the last element # TODO: Make this function more efficient try: ret...
[ "def", "get_text_line", "(", "self", ",", "line_nb", ")", ":", "# Taking into account the case when a file ends in an empty line,\r", "# since splitlines doesn't return that line as the last element\r", "# TODO: Make this function more efficient\r", "try", ":", "return", "to_text_string"...
Return text line at line number *line_nb*
[ "Return", "text", "line", "at", "line", "number", "*", "line_nb", "*" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L499-L507
train
spyder-ide/spyder
spyder/widgets/mixins.py
BaseEditMixin.get_text
def get_text(self, position_from, position_to): """ Return text between *position_from* and *position_to* Positions may be positions or 'sol', 'eol', 'sof', 'eof' or 'cursor' """ cursor = self.__select_text(position_from, position_to) text = to_text_string(cursor.se...
python
def get_text(self, position_from, position_to): """ Return text between *position_from* and *position_to* Positions may be positions or 'sol', 'eol', 'sof', 'eof' or 'cursor' """ cursor = self.__select_text(position_from, position_to) text = to_text_string(cursor.se...
[ "def", "get_text", "(", "self", ",", "position_from", ",", "position_to", ")", ":", "cursor", "=", "self", ".", "__select_text", "(", "position_from", ",", "position_to", ")", "text", "=", "to_text_string", "(", "cursor", ".", "selectedText", "(", ")", ")", ...
Return text between *position_from* and *position_to* Positions may be positions or 'sol', 'eol', 'sof', 'eof' or 'cursor'
[ "Return", "text", "between", "*", "position_from", "*", "and", "*", "position_to", "*", "Positions", "may", "be", "positions", "or", "sol", "eol", "sof", "eof", "or", "cursor" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L509-L522
train
spyder-ide/spyder
spyder/widgets/mixins.py
BaseEditMixin.get_character
def get_character(self, position, offset=0): """Return character at *position* with the given offset.""" position = self.get_position(position) + offset cursor = self.textCursor() cursor.movePosition(QTextCursor.End) if position < cursor.position(): cursor.setPo...
python
def get_character(self, position, offset=0): """Return character at *position* with the given offset.""" position = self.get_position(position) + offset cursor = self.textCursor() cursor.movePosition(QTextCursor.End) if position < cursor.position(): cursor.setPo...
[ "def", "get_character", "(", "self", ",", "position", ",", "offset", "=", "0", ")", ":", "position", "=", "self", ".", "get_position", "(", "position", ")", "+", "offset", "cursor", "=", "self", ".", "textCursor", "(", ")", "cursor", ".", "movePosition",...
Return character at *position* with the given offset.
[ "Return", "character", "at", "*", "position", "*", "with", "the", "given", "offset", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L524-L535
train
spyder-ide/spyder
spyder/widgets/mixins.py
BaseEditMixin.get_current_word_and_position
def get_current_word_and_position(self, completion=False): """Return current word, i.e. word at cursor position, and the start position""" cursor = self.textCursor() if cursor.hasSelection(): # Removes the selection and moves the cursor to the left side ...
python
def get_current_word_and_position(self, completion=False): """Return current word, i.e. word at cursor position, and the start position""" cursor = self.textCursor() if cursor.hasSelection(): # Removes the selection and moves the cursor to the left side ...
[ "def", "get_current_word_and_position", "(", "self", ",", "completion", "=", "False", ")", ":", "cursor", "=", "self", ".", "textCursor", "(", ")", "if", "cursor", ".", "hasSelection", "(", ")", ":", "# Removes the selection and moves the cursor to the left side\r", ...
Return current word, i.e. word at cursor position, and the start position
[ "Return", "current", "word", "i", ".", "e", ".", "word", "at", "cursor", "position", "and", "the", "start", "position" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L551-L596
train
spyder-ide/spyder
spyder/widgets/mixins.py
BaseEditMixin.get_current_word
def get_current_word(self, completion=False): """Return current word, i.e. word at cursor position""" ret = self.get_current_word_and_position(completion) if ret is not None: return ret[0]
python
def get_current_word(self, completion=False): """Return current word, i.e. word at cursor position""" ret = self.get_current_word_and_position(completion) if ret is not None: return ret[0]
[ "def", "get_current_word", "(", "self", ",", "completion", "=", "False", ")", ":", "ret", "=", "self", ".", "get_current_word_and_position", "(", "completion", ")", "if", "ret", "is", "not", "None", ":", "return", "ret", "[", "0", "]" ]
Return current word, i.e. word at cursor position
[ "Return", "current", "word", "i", ".", "e", ".", "word", "at", "cursor", "position" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L598-L602
train
spyder-ide/spyder
spyder/widgets/mixins.py
BaseEditMixin.get_current_line
def get_current_line(self): """Return current line's text""" cursor = self.textCursor() cursor.select(QTextCursor.BlockUnderCursor) return to_text_string(cursor.selectedText())
python
def get_current_line(self): """Return current line's text""" cursor = self.textCursor() cursor.select(QTextCursor.BlockUnderCursor) return to_text_string(cursor.selectedText())
[ "def", "get_current_line", "(", "self", ")", ":", "cursor", "=", "self", ".", "textCursor", "(", ")", "cursor", ".", "select", "(", "QTextCursor", ".", "BlockUnderCursor", ")", "return", "to_text_string", "(", "cursor", ".", "selectedText", "(", ")", ")" ]
Return current line's text
[ "Return", "current", "line", "s", "text" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L604-L608
train
spyder-ide/spyder
spyder/widgets/mixins.py
BaseEditMixin.get_line_at
def get_line_at(self, coordinates): """Return line at *coordinates* (QPoint)""" cursor = self.cursorForPosition(coordinates) cursor.select(QTextCursor.BlockUnderCursor) return to_text_string(cursor.selectedText()).replace(u'\u2029', '')
python
def get_line_at(self, coordinates): """Return line at *coordinates* (QPoint)""" cursor = self.cursorForPosition(coordinates) cursor.select(QTextCursor.BlockUnderCursor) return to_text_string(cursor.selectedText()).replace(u'\u2029', '')
[ "def", "get_line_at", "(", "self", ",", "coordinates", ")", ":", "cursor", "=", "self", ".", "cursorForPosition", "(", "coordinates", ")", "cursor", ".", "select", "(", "QTextCursor", ".", "BlockUnderCursor", ")", "return", "to_text_string", "(", "cursor", "."...
Return line at *coordinates* (QPoint)
[ "Return", "line", "at", "*", "coordinates", "*", "(", "QPoint", ")" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L619-L623
train
spyder-ide/spyder
spyder/widgets/mixins.py
BaseEditMixin.get_word_at
def get_word_at(self, coordinates): """Return word at *coordinates* (QPoint)""" cursor = self.cursorForPosition(coordinates) cursor.select(QTextCursor.WordUnderCursor) return to_text_string(cursor.selectedText())
python
def get_word_at(self, coordinates): """Return word at *coordinates* (QPoint)""" cursor = self.cursorForPosition(coordinates) cursor.select(QTextCursor.WordUnderCursor) return to_text_string(cursor.selectedText())
[ "def", "get_word_at", "(", "self", ",", "coordinates", ")", ":", "cursor", "=", "self", ".", "cursorForPosition", "(", "coordinates", ")", "cursor", ".", "select", "(", "QTextCursor", ".", "WordUnderCursor", ")", "return", "to_text_string", "(", "cursor", ".",...
Return word at *coordinates* (QPoint)
[ "Return", "word", "at", "*", "coordinates", "*", "(", "QPoint", ")" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L625-L629
train
spyder-ide/spyder
spyder/widgets/mixins.py
BaseEditMixin.get_block_indentation
def get_block_indentation(self, block_nb): """Return line indentation (character number)""" text = to_text_string(self.document().findBlockByNumber(block_nb).text()) text = text.replace("\t", " "*self.tab_stop_width_spaces) return len(text)-len(text.lstrip())
python
def get_block_indentation(self, block_nb): """Return line indentation (character number)""" text = to_text_string(self.document().findBlockByNumber(block_nb).text()) text = text.replace("\t", " "*self.tab_stop_width_spaces) return len(text)-len(text.lstrip())
[ "def", "get_block_indentation", "(", "self", ",", "block_nb", ")", ":", "text", "=", "to_text_string", "(", "self", ".", "document", "(", ")", ".", "findBlockByNumber", "(", "block_nb", ")", ".", "text", "(", ")", ")", "text", "=", "text", ".", "replace"...
Return line indentation (character number)
[ "Return", "line", "indentation", "(", "character", "number", ")" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L631-L635
train
spyder-ide/spyder
spyder/widgets/mixins.py
BaseEditMixin.get_selection_bounds
def get_selection_bounds(self): """Return selection bounds (block numbers)""" cursor = self.textCursor() start, end = cursor.selectionStart(), cursor.selectionEnd() block_start = self.document().findBlock(start) block_end = self.document().findBlock(end) return sort...
python
def get_selection_bounds(self): """Return selection bounds (block numbers)""" cursor = self.textCursor() start, end = cursor.selectionStart(), cursor.selectionEnd() block_start = self.document().findBlock(start) block_end = self.document().findBlock(end) return sort...
[ "def", "get_selection_bounds", "(", "self", ")", ":", "cursor", "=", "self", ".", "textCursor", "(", ")", "start", ",", "end", "=", "cursor", ".", "selectionStart", "(", ")", ",", "cursor", ".", "selectionEnd", "(", ")", "block_start", "=", "self", ".", ...
Return selection bounds (block numbers)
[ "Return", "selection", "bounds", "(", "block", "numbers", ")" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L637-L643
train
spyder-ide/spyder
spyder/widgets/mixins.py
BaseEditMixin.get_selected_text
def get_selected_text(self): """ Return text selected by current text cursor, converted in unicode Replace the unicode line separator character \u2029 by the line separator characters returned by get_line_separator """ return to_text_string(self.textCursor().selec...
python
def get_selected_text(self): """ Return text selected by current text cursor, converted in unicode Replace the unicode line separator character \u2029 by the line separator characters returned by get_line_separator """ return to_text_string(self.textCursor().selec...
[ "def", "get_selected_text", "(", "self", ")", ":", "return", "to_text_string", "(", "self", ".", "textCursor", "(", ")", ".", "selectedText", "(", ")", ")", ".", "replace", "(", "u\"\\u2029\"", ",", "self", ".", "get_line_separator", "(", ")", ")" ]
Return text selected by current text cursor, converted in unicode Replace the unicode line separator character \u2029 by the line separator characters returned by get_line_separator
[ "Return", "text", "selected", "by", "current", "text", "cursor", "converted", "in", "unicode", "Replace", "the", "unicode", "line", "separator", "character", "\\", "u2029", "by", "the", "line", "separator", "characters", "returned", "by", "get_line_separator" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L651-L659
train
spyder-ide/spyder
spyder/widgets/mixins.py
BaseEditMixin.replace
def replace(self, text, pattern=None): """Replace selected text by *text* If *pattern* is not None, replacing selected text using regular expression text substitution""" cursor = self.textCursor() cursor.beginEditBlock() if pattern is not None: seltxt =...
python
def replace(self, text, pattern=None): """Replace selected text by *text* If *pattern* is not None, replacing selected text using regular expression text substitution""" cursor = self.textCursor() cursor.beginEditBlock() if pattern is not None: seltxt =...
[ "def", "replace", "(", "self", ",", "text", ",", "pattern", "=", "None", ")", ":", "cursor", "=", "self", ".", "textCursor", "(", ")", "cursor", ".", "beginEditBlock", "(", ")", "if", "pattern", "is", "not", "None", ":", "seltxt", "=", "to_text_string"...
Replace selected text by *text* If *pattern* is not None, replacing selected text using regular expression text substitution
[ "Replace", "selected", "text", "by", "*", "text", "*", "If", "*", "pattern", "*", "is", "not", "None", "replacing", "selected", "text", "using", "regular", "expression", "text", "substitution" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L665-L678
train
spyder-ide/spyder
spyder/widgets/mixins.py
BaseEditMixin.find_multiline_pattern
def find_multiline_pattern(self, regexp, cursor, findflag): """Reimplement QTextDocument's find method Add support for *multiline* regular expressions""" pattern = to_text_string(regexp.pattern()) text = to_text_string(self.toPlainText()) try: regobj = re.comp...
python
def find_multiline_pattern(self, regexp, cursor, findflag): """Reimplement QTextDocument's find method Add support for *multiline* regular expressions""" pattern = to_text_string(regexp.pattern()) text = to_text_string(self.toPlainText()) try: regobj = re.comp...
[ "def", "find_multiline_pattern", "(", "self", ",", "regexp", ",", "cursor", ",", "findflag", ")", ":", "pattern", "=", "to_text_string", "(", "regexp", ".", "pattern", "(", ")", ")", "text", "=", "to_text_string", "(", "self", ".", "toPlainText", "(", ")",...
Reimplement QTextDocument's find method Add support for *multiline* regular expressions
[ "Reimplement", "QTextDocument", "s", "find", "method", "Add", "support", "for", "*", "multiline", "*", "regular", "expressions" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L682-L710
train
spyder-ide/spyder
spyder/widgets/mixins.py
BaseEditMixin.find_text
def find_text(self, text, changed=True, forward=True, case=False, words=False, regexp=False): """Find text""" cursor = self.textCursor() findflag = QTextDocument.FindFlag() if not forward: findflag = findflag | QTextDocument.FindBackward i...
python
def find_text(self, text, changed=True, forward=True, case=False, words=False, regexp=False): """Find text""" cursor = self.textCursor() findflag = QTextDocument.FindFlag() if not forward: findflag = findflag | QTextDocument.FindBackward i...
[ "def", "find_text", "(", "self", ",", "text", ",", "changed", "=", "True", ",", "forward", "=", "True", ",", "case", "=", "False", ",", "words", "=", "False", ",", "regexp", "=", "False", ")", ":", "cursor", "=", "self", ".", "textCursor", "(", ")"...
Find text
[ "Find", "text" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L712-L767
train
spyder-ide/spyder
spyder/widgets/mixins.py
BaseEditMixin.get_number_matches
def get_number_matches(self, pattern, source_text='', case=False, regexp=False): """Get the number of matches for the searched text.""" pattern = to_text_string(pattern) if not pattern: return 0 if not regexp: pattern = re.escap...
python
def get_number_matches(self, pattern, source_text='', case=False, regexp=False): """Get the number of matches for the searched text.""" pattern = to_text_string(pattern) if not pattern: return 0 if not regexp: pattern = re.escap...
[ "def", "get_number_matches", "(", "self", ",", "pattern", ",", "source_text", "=", "''", ",", "case", "=", "False", ",", "regexp", "=", "False", ")", ":", "pattern", "=", "to_text_string", "(", "pattern", ")", "if", "not", "pattern", ":", "return", "0", ...
Get the number of matches for the searched text.
[ "Get", "the", "number", "of", "matches", "for", "the", "searched", "text", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L773-L798
train
spyder-ide/spyder
spyder/widgets/mixins.py
BaseEditMixin.get_match_number
def get_match_number(self, pattern, case=False, regexp=False): """Get number of the match for the searched text.""" position = self.textCursor().position() source_text = self.get_text(position_from='sof', position_to=position) match_number = self.get_number_matches(pattern, ...
python
def get_match_number(self, pattern, case=False, regexp=False): """Get number of the match for the searched text.""" position = self.textCursor().position() source_text = self.get_text(position_from='sof', position_to=position) match_number = self.get_number_matches(pattern, ...
[ "def", "get_match_number", "(", "self", ",", "pattern", ",", "case", "=", "False", ",", "regexp", "=", "False", ")", ":", "position", "=", "self", ".", "textCursor", "(", ")", ".", "position", "(", ")", "source_text", "=", "self", ".", "get_text", "(",...
Get number of the match for the searched text.
[ "Get", "number", "of", "the", "match", "for", "the", "searched", "text", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L800-L807
train
spyder-ide/spyder
spyder/widgets/mixins.py
TracebackLinksMixin.mouseReleaseEvent
def mouseReleaseEvent(self, event): """Go to error""" self.QT_CLASS.mouseReleaseEvent(self, event) text = self.get_line_at(event.pos()) if get_error_match(text) and not self.has_selected_text(): if self.go_to_error is not None: self.go_to_error.emit(text...
python
def mouseReleaseEvent(self, event): """Go to error""" self.QT_CLASS.mouseReleaseEvent(self, event) text = self.get_line_at(event.pos()) if get_error_match(text) and not self.has_selected_text(): if self.go_to_error is not None: self.go_to_error.emit(text...
[ "def", "mouseReleaseEvent", "(", "self", ",", "event", ")", ":", "self", ".", "QT_CLASS", ".", "mouseReleaseEvent", "(", "self", ",", "event", ")", "text", "=", "self", ".", "get_line_at", "(", "event", ".", "pos", "(", ")", ")", "if", "get_error_match",...
Go to error
[ "Go", "to", "error" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L862-L868
train
spyder-ide/spyder
spyder/widgets/mixins.py
TracebackLinksMixin.mouseMoveEvent
def mouseMoveEvent(self, event): """Show Pointing Hand Cursor on error messages""" text = self.get_line_at(event.pos()) if get_error_match(text): if not self.__cursor_changed: QApplication.setOverrideCursor(QCursor(Qt.PointingHandCursor)) self.__...
python
def mouseMoveEvent(self, event): """Show Pointing Hand Cursor on error messages""" text = self.get_line_at(event.pos()) if get_error_match(text): if not self.__cursor_changed: QApplication.setOverrideCursor(QCursor(Qt.PointingHandCursor)) self.__...
[ "def", "mouseMoveEvent", "(", "self", ",", "event", ")", ":", "text", "=", "self", ".", "get_line_at", "(", "event", ".", "pos", "(", ")", ")", "if", "get_error_match", "(", "text", ")", ":", "if", "not", "self", ".", "__cursor_changed", ":", "QApplica...
Show Pointing Hand Cursor on error messages
[ "Show", "Pointing", "Hand", "Cursor", "on", "error", "messages" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L870-L882
train
spyder-ide/spyder
spyder/widgets/mixins.py
TracebackLinksMixin.leaveEvent
def leaveEvent(self, event): """If cursor has not been restored yet, do it now""" if self.__cursor_changed: QApplication.restoreOverrideCursor() self.__cursor_changed = False self.QT_CLASS.leaveEvent(self, event)
python
def leaveEvent(self, event): """If cursor has not been restored yet, do it now""" if self.__cursor_changed: QApplication.restoreOverrideCursor() self.__cursor_changed = False self.QT_CLASS.leaveEvent(self, event)
[ "def", "leaveEvent", "(", "self", ",", "event", ")", ":", "if", "self", ".", "__cursor_changed", ":", "QApplication", ".", "restoreOverrideCursor", "(", ")", "self", ".", "__cursor_changed", "=", "False", "self", ".", "QT_CLASS", ".", "leaveEvent", "(", "sel...
If cursor has not been restored yet, do it now
[ "If", "cursor", "has", "not", "been", "restored", "yet", "do", "it", "now" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L884-L889
train
spyder-ide/spyder
spyder/widgets/mixins.py
GetHelpMixin.show_object_info
def show_object_info(self, text, call=False, force=False): """Show signature calltip and/or docstring in the Help plugin""" text = to_text_string(text) # Show docstring help_enabled = self.help_enabled or force if force and self.help is not None: self.help.doc...
python
def show_object_info(self, text, call=False, force=False): """Show signature calltip and/or docstring in the Help plugin""" text = to_text_string(text) # Show docstring help_enabled = self.help_enabled or force if force and self.help is not None: self.help.doc...
[ "def", "show_object_info", "(", "self", ",", "text", ",", "call", "=", "False", ",", "force", "=", "False", ")", ":", "text", "=", "to_text_string", "(", "text", ")", "# Show docstring\r", "help_enabled", "=", "self", ".", "help_enabled", "or", "force", "i...
Show signature calltip and/or docstring in the Help plugin
[ "Show", "signature", "calltip", "and", "/", "or", "docstring", "in", "the", "Help", "plugin" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L917-L967
train
spyder-ide/spyder
spyder/widgets/mixins.py
SaveHistoryMixin.create_history_filename
def create_history_filename(self): """Create history_filename with INITHISTORY if it doesn't exist.""" if self.history_filename and not osp.isfile(self.history_filename): try: encoding.writelines(self.INITHISTORY, self.history_filename) except EnvironmentErro...
python
def create_history_filename(self): """Create history_filename with INITHISTORY if it doesn't exist.""" if self.history_filename and not osp.isfile(self.history_filename): try: encoding.writelines(self.INITHISTORY, self.history_filename) except EnvironmentErro...
[ "def", "create_history_filename", "(", "self", ")", ":", "if", "self", ".", "history_filename", "and", "not", "osp", ".", "isfile", "(", "self", ".", "history_filename", ")", ":", "try", ":", "encoding", ".", "writelines", "(", "self", ".", "INITHISTORY", ...
Create history_filename with INITHISTORY if it doesn't exist.
[ "Create", "history_filename", "with", "INITHISTORY", "if", "it", "doesn", "t", "exist", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L988-L994
train
spyder-ide/spyder
spyder/widgets/mixins.py
SaveHistoryMixin.add_to_history
def add_to_history(self, command): """Add command to history""" command = to_text_string(command) if command in ['', '\n'] or command.startswith('Traceback'): return if command.endswith('\n'): command = command[:-1] self.histidx = None if l...
python
def add_to_history(self, command): """Add command to history""" command = to_text_string(command) if command in ['', '\n'] or command.startswith('Traceback'): return if command.endswith('\n'): command = command[:-1] self.histidx = None if l...
[ "def", "add_to_history", "(", "self", ",", "command", ")", ":", "command", "=", "to_text_string", "(", "command", ")", "if", "command", "in", "[", "''", ",", "'\\n'", "]", "or", "command", ".", "startswith", "(", "'Traceback'", ")", ":", "return", "if", ...
Add command to history
[ "Add", "command", "to", "history" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L996-L1021
train
spyder-ide/spyder
spyder/widgets/mixins.py
BrowseHistoryMixin.browse_history
def browse_history(self, backward): """Browse history""" if self.is_cursor_before('eol') and self.hist_wholeline: self.hist_wholeline = False tocursor = self.get_current_line_to_cursor() text, self.histidx = self.find_in_history(tocursor, self.histidx, ...
python
def browse_history(self, backward): """Browse history""" if self.is_cursor_before('eol') and self.hist_wholeline: self.hist_wholeline = False tocursor = self.get_current_line_to_cursor() text, self.histidx = self.find_in_history(tocursor, self.histidx, ...
[ "def", "browse_history", "(", "self", ",", "backward", ")", ":", "if", "self", ".", "is_cursor_before", "(", "'eol'", ")", "and", "self", ".", "hist_wholeline", ":", "self", ".", "hist_wholeline", "=", "False", "tocursor", "=", "self", ".", "get_current_line...
Browse history
[ "Browse", "history" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L1035-L1052
train
spyder-ide/spyder
spyder/widgets/mixins.py
BrowseHistoryMixin.find_in_history
def find_in_history(self, tocursor, start_idx, backward): """Find text 'tocursor' in history, from index 'start_idx'""" if start_idx is None: start_idx = len(self.history) # Finding text in history step = -1 if backward else 1 idx = start_idx if len(toc...
python
def find_in_history(self, tocursor, start_idx, backward): """Find text 'tocursor' in history, from index 'start_idx'""" if start_idx is None: start_idx = len(self.history) # Finding text in history step = -1 if backward else 1 idx = start_idx if len(toc...
[ "def", "find_in_history", "(", "self", ",", "tocursor", ",", "start_idx", ",", "backward", ")", ":", "if", "start_idx", "is", "None", ":", "start_idx", "=", "len", "(", "self", ".", "history", ")", "# Finding text in history\r", "step", "=", "-", "1", "if"...
Find text 'tocursor' in history, from index 'start_idx
[ "Find", "text", "tocursor", "in", "history", "from", "index", "start_idx" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/widgets/mixins.py#L1054-L1076
train
spyder-ide/spyder
spyder/preferences/shortcuts.py
ShortcutTranslator.keyevent_to_keyseq
def keyevent_to_keyseq(self, event): """Return a QKeySequence representation of the provided QKeyEvent.""" self.keyPressEvent(event) event.accept() return self.keySequence()
python
def keyevent_to_keyseq(self, event): """Return a QKeySequence representation of the provided QKeyEvent.""" self.keyPressEvent(event) event.accept() return self.keySequence()
[ "def", "keyevent_to_keyseq", "(", "self", ",", "event", ")", ":", "self", ".", "keyPressEvent", "(", "event", ")", "event", ".", "accept", "(", ")", "return", "self", ".", "keySequence", "(", ")" ]
Return a QKeySequence representation of the provided QKeyEvent.
[ "Return", "a", "QKeySequence", "representation", "of", "the", "provided", "QKeyEvent", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L74-L78
train
spyder-ide/spyder
spyder/preferences/shortcuts.py
ShortcutLineEdit.setText
def setText(self, sequence): """Qt method extension.""" self.setToolTip(sequence) super(ShortcutLineEdit, self).setText(sequence)
python
def setText(self, sequence): """Qt method extension.""" self.setToolTip(sequence) super(ShortcutLineEdit, self).setText(sequence)
[ "def", "setText", "(", "self", ",", "sequence", ")", ":", "self", ".", "setToolTip", "(", "sequence", ")", "super", "(", "ShortcutLineEdit", ",", "self", ")", ".", "setText", "(", "sequence", ")" ]
Qt method extension.
[ "Qt", "method", "extension", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L115-L118
train
spyder-ide/spyder
spyder/preferences/shortcuts.py
ShortcutFinder.set_text
def set_text(self, text): """Set the filter text.""" text = text.strip() new_text = self.text() + text self.setText(new_text)
python
def set_text(self, text): """Set the filter text.""" text = text.strip() new_text = self.text() + text self.setText(new_text)
[ "def", "set_text", "(", "self", ",", "text", ")", ":", "text", "=", "text", ".", "strip", "(", ")", "new_text", "=", "self", ".", "text", "(", ")", "+", "text", "self", ".", "setText", "(", "new_text", ")" ]
Set the filter text.
[ "Set", "the", "filter", "text", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L136-L140
train
spyder-ide/spyder
spyder/preferences/shortcuts.py
ShortcutFinder.keyPressEvent
def keyPressEvent(self, event): """Qt Override.""" key = event.key() if key in [Qt.Key_Up]: self._parent.previous_row() elif key in [Qt.Key_Down]: self._parent.next_row() elif key in [Qt.Key_Enter, Qt.Key_Return]: self._parent.show_edit...
python
def keyPressEvent(self, event): """Qt Override.""" key = event.key() if key in [Qt.Key_Up]: self._parent.previous_row() elif key in [Qt.Key_Down]: self._parent.next_row() elif key in [Qt.Key_Enter, Qt.Key_Return]: self._parent.show_edit...
[ "def", "keyPressEvent", "(", "self", ",", "event", ")", ":", "key", "=", "event", ".", "key", "(", ")", "if", "key", "in", "[", "Qt", ".", "Key_Up", "]", ":", "self", ".", "_parent", ".", "previous_row", "(", ")", "elif", "key", "in", "[", "Qt", ...
Qt Override.
[ "Qt", "Override", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L142-L152
train
spyder-ide/spyder
spyder/preferences/shortcuts.py
ShortcutEditor.setup
def setup(self): """Setup the ShortcutEditor with the provided arguments.""" # Widgets icon_info = HelperToolButton() icon_info.setIcon(get_std_icon('MessageBoxInformation')) layout_icon_info = QVBoxLayout() layout_icon_info.setContentsMargins(0, 0, 0, 0) l...
python
def setup(self): """Setup the ShortcutEditor with the provided arguments.""" # Widgets icon_info = HelperToolButton() icon_info.setIcon(get_std_icon('MessageBoxInformation')) layout_icon_info = QVBoxLayout() layout_icon_info.setContentsMargins(0, 0, 0, 0) l...
[ "def", "setup", "(", "self", ")", ":", "# Widgets\r", "icon_info", "=", "HelperToolButton", "(", ")", "icon_info", ".", "setIcon", "(", "get_std_icon", "(", "'MessageBoxInformation'", ")", ")", "layout_icon_info", "=", "QVBoxLayout", "(", ")", "layout_icon_info", ...
Setup the ShortcutEditor with the provided arguments.
[ "Setup", "the", "ShortcutEditor", "with", "the", "provided", "arguments", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L181-L295
train
spyder-ide/spyder
spyder/preferences/shortcuts.py
ShortcutEditor.event
def event(self, event): """Qt method override.""" if event.type() in (QEvent.Shortcut, QEvent.ShortcutOverride): return True else: return super(ShortcutEditor, self).event(event)
python
def event(self, event): """Qt method override.""" if event.type() in (QEvent.Shortcut, QEvent.ShortcutOverride): return True else: return super(ShortcutEditor, self).event(event)
[ "def", "event", "(", "self", ",", "event", ")", ":", "if", "event", ".", "type", "(", ")", "in", "(", "QEvent", ".", "Shortcut", ",", "QEvent", ".", "ShortcutOverride", ")", ":", "return", "True", "else", ":", "return", "super", "(", "ShortcutEditor", ...
Qt method override.
[ "Qt", "method", "override", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L315-L320
train
spyder-ide/spyder
spyder/preferences/shortcuts.py
ShortcutEditor.keyPressEvent
def keyPressEvent(self, event): """Qt method override.""" event_key = event.key() if not event_key or event_key == Qt.Key_unknown: return if len(self._qsequences) == 4: # QKeySequence accepts a maximum of 4 different sequences. return i...
python
def keyPressEvent(self, event): """Qt method override.""" event_key = event.key() if not event_key or event_key == Qt.Key_unknown: return if len(self._qsequences) == 4: # QKeySequence accepts a maximum of 4 different sequences. return i...
[ "def", "keyPressEvent", "(", "self", ",", "event", ")", ":", "event_key", "=", "event", ".", "key", "(", ")", "if", "not", "event_key", "or", "event_key", "==", "Qt", ".", "Key_unknown", ":", "return", "if", "len", "(", "self", ".", "_qsequences", ")",...
Qt method override.
[ "Qt", "method", "override", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L322-L339
train
spyder-ide/spyder
spyder/preferences/shortcuts.py
ShortcutEditor.check_conflicts
def check_conflicts(self): """Check shortcuts for conflicts.""" conflicts = [] if len(self._qsequences) == 0: return conflicts new_qsequence = self.new_qsequence for shortcut in self.shortcuts: shortcut_qsequence = QKeySequence.fromString(str(shor...
python
def check_conflicts(self): """Check shortcuts for conflicts.""" conflicts = [] if len(self._qsequences) == 0: return conflicts new_qsequence = self.new_qsequence for shortcut in self.shortcuts: shortcut_qsequence = QKeySequence.fromString(str(shor...
[ "def", "check_conflicts", "(", "self", ")", ":", "conflicts", "=", "[", "]", "if", "len", "(", "self", ".", "_qsequences", ")", "==", "0", ":", "return", "conflicts", "new_qsequence", "=", "self", ".", "new_qsequence", "for", "shortcut", "in", "self", "....
Check shortcuts for conflicts.
[ "Check", "shortcuts", "for", "conflicts", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L341-L358
train
spyder-ide/spyder
spyder/preferences/shortcuts.py
ShortcutEditor.check_singlekey
def check_singlekey(self): """Check if the first sub-sequence of the new key sequence is valid.""" if len(self._qsequences) == 0: return True else: keystr = self._qsequences[0] valid_single_keys = (EDITOR_SINGLE_KEYS if ...
python
def check_singlekey(self): """Check if the first sub-sequence of the new key sequence is valid.""" if len(self._qsequences) == 0: return True else: keystr = self._qsequences[0] valid_single_keys = (EDITOR_SINGLE_KEYS if ...
[ "def", "check_singlekey", "(", "self", ")", ":", "if", "len", "(", "self", ".", "_qsequences", ")", "==", "0", ":", "return", "True", "else", ":", "keystr", "=", "self", ".", "_qsequences", "[", "0", "]", "valid_single_keys", "=", "(", "EDITOR_SINGLE_KEY...
Check if the first sub-sequence of the new key sequence is valid.
[ "Check", "if", "the", "first", "sub", "-", "sequence", "of", "the", "new", "key", "sequence", "is", "valid", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L372-L390
train
spyder-ide/spyder
spyder/preferences/shortcuts.py
ShortcutEditor.update_warning
def update_warning(self): """Update the warning label, buttons state and sequence text.""" new_qsequence = self.new_qsequence new_sequence = self.new_sequence self.text_new_sequence.setText( new_qsequence.toString(QKeySequence.NativeText)) conflicts = self.che...
python
def update_warning(self): """Update the warning label, buttons state and sequence text.""" new_qsequence = self.new_qsequence new_sequence = self.new_sequence self.text_new_sequence.setText( new_qsequence.toString(QKeySequence.NativeText)) conflicts = self.che...
[ "def", "update_warning", "(", "self", ")", ":", "new_qsequence", "=", "self", ".", "new_qsequence", "new_sequence", "=", "self", ".", "new_sequence", "self", ".", "text_new_sequence", ".", "setText", "(", "new_qsequence", ".", "toString", "(", "QKeySequence", "....
Update the warning label, buttons state and sequence text.
[ "Update", "the", "warning", "label", "buttons", "state", "and", "sequence", "text", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L392-L446
train
spyder-ide/spyder
spyder/preferences/shortcuts.py
ShortcutEditor.set_sequence_from_str
def set_sequence_from_str(self, sequence): """ This is a convenience method to set the new QKeySequence of the shortcut editor from a string. """ self._qsequences = [QKeySequence(s) for s in sequence.split(', ')] self.update_warning()
python
def set_sequence_from_str(self, sequence): """ This is a convenience method to set the new QKeySequence of the shortcut editor from a string. """ self._qsequences = [QKeySequence(s) for s in sequence.split(', ')] self.update_warning()
[ "def", "set_sequence_from_str", "(", "self", ",", "sequence", ")", ":", "self", ".", "_qsequences", "=", "[", "QKeySequence", "(", "s", ")", "for", "s", "in", "sequence", ".", "split", "(", "', '", ")", "]", "self", ".", "update_warning", "(", ")" ]
This is a convenience method to set the new QKeySequence of the shortcut editor from a string.
[ "This", "is", "a", "convenience", "method", "to", "set", "the", "new", "QKeySequence", "of", "the", "shortcut", "editor", "from", "a", "string", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L448-L454
train
spyder-ide/spyder
spyder/preferences/shortcuts.py
ShortcutEditor.set_sequence_to_default
def set_sequence_to_default(self): """Set the new sequence to the default value defined in the config.""" sequence = CONF.get_default( 'shortcuts', "{}/{}".format(self.context, self.name)) self._qsequences = sequence.split(', ') self.update_warning()
python
def set_sequence_to_default(self): """Set the new sequence to the default value defined in the config.""" sequence = CONF.get_default( 'shortcuts', "{}/{}".format(self.context, self.name)) self._qsequences = sequence.split(', ') self.update_warning()
[ "def", "set_sequence_to_default", "(", "self", ")", ":", "sequence", "=", "CONF", ".", "get_default", "(", "'shortcuts'", ",", "\"{}/{}\"", ".", "format", "(", "self", ".", "context", ",", "self", ".", "name", ")", ")", "self", ".", "_qsequences", "=", "...
Set the new sequence to the default value defined in the config.
[ "Set", "the", "new", "sequence", "to", "the", "default", "value", "defined", "in", "the", "config", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L456-L461
train
spyder-ide/spyder
spyder/preferences/shortcuts.py
ShortcutEditor.accept_override
def accept_override(self): """Unbind all conflicted shortcuts, and accept the new one""" conflicts = self.check_conflicts() if conflicts: for shortcut in conflicts: shortcut.key = '' self.accept()
python
def accept_override(self): """Unbind all conflicted shortcuts, and accept the new one""" conflicts = self.check_conflicts() if conflicts: for shortcut in conflicts: shortcut.key = '' self.accept()
[ "def", "accept_override", "(", "self", ")", ":", "conflicts", "=", "self", ".", "check_conflicts", "(", ")", "if", "conflicts", ":", "for", "shortcut", "in", "conflicts", ":", "shortcut", ".", "key", "=", "''", "self", ".", "accept", "(", ")" ]
Unbind all conflicted shortcuts, and accept the new one
[ "Unbind", "all", "conflicted", "shortcuts", "and", "accept", "the", "new", "one" ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L478-L484
train
spyder-ide/spyder
spyder/preferences/shortcuts.py
ShortcutsModel.current_index
def current_index(self): """Get the currently selected index in the parent table view.""" i = self._parent.proxy_model.mapToSource(self._parent.currentIndex()) return i
python
def current_index(self): """Get the currently selected index in the parent table view.""" i = self._parent.proxy_model.mapToSource(self._parent.currentIndex()) return i
[ "def", "current_index", "(", "self", ")", ":", "i", "=", "self", ".", "_parent", ".", "proxy_model", ".", "mapToSource", "(", "self", ".", "_parent", ".", "currentIndex", "(", ")", ")", "return", "i" ]
Get the currently selected index in the parent table view.
[ "Get", "the", "currently", "selected", "index", "in", "the", "parent", "table", "view", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L537-L540
train
spyder-ide/spyder
spyder/preferences/shortcuts.py
ShortcutsModel.sortByName
def sortByName(self): """Qt Override.""" self.shortcuts = sorted(self.shortcuts, key=lambda x: x.context+'/'+x.name) self.reset()
python
def sortByName(self): """Qt Override.""" self.shortcuts = sorted(self.shortcuts, key=lambda x: x.context+'/'+x.name) self.reset()
[ "def", "sortByName", "(", "self", ")", ":", "self", ".", "shortcuts", "=", "sorted", "(", "self", ".", "shortcuts", ",", "key", "=", "lambda", "x", ":", "x", ".", "context", "+", "'/'", "+", "x", ".", "name", ")", "self", ".", "reset", "(", ")" ]
Qt Override.
[ "Qt", "Override", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L542-L546
train
spyder-ide/spyder
spyder/preferences/shortcuts.py
ShortcutsModel.data
def data(self, index, role=Qt.DisplayRole): """Qt Override.""" row = index.row() if not index.isValid() or not (0 <= row < len(self.shortcuts)): return to_qvariant() shortcut = self.shortcuts[row] key = shortcut.key column = index.column() ...
python
def data(self, index, role=Qt.DisplayRole): """Qt Override.""" row = index.row() if not index.isValid() or not (0 <= row < len(self.shortcuts)): return to_qvariant() shortcut = self.shortcuts[row] key = shortcut.key column = index.column() ...
[ "def", "data", "(", "self", ",", "index", ",", "role", "=", "Qt", ".", "DisplayRole", ")", ":", "row", "=", "index", ".", "row", "(", ")", "if", "not", "index", ".", "isValid", "(", ")", "or", "not", "(", "0", "<=", "row", "<", "len", "(", "s...
Qt Override.
[ "Qt", "Override", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L554-L588
train
spyder-ide/spyder
spyder/preferences/shortcuts.py
ShortcutsModel.headerData
def headerData(self, section, orientation, role=Qt.DisplayRole): """Qt Override.""" if role == Qt.TextAlignmentRole: if orientation == Qt.Horizontal: return to_qvariant(int(Qt.AlignHCenter | Qt.AlignVCenter)) return to_qvariant(int(Qt.AlignRight | Qt.AlignVCe...
python
def headerData(self, section, orientation, role=Qt.DisplayRole): """Qt Override.""" if role == Qt.TextAlignmentRole: if orientation == Qt.Horizontal: return to_qvariant(int(Qt.AlignHCenter | Qt.AlignVCenter)) return to_qvariant(int(Qt.AlignRight | Qt.AlignVCe...
[ "def", "headerData", "(", "self", ",", "section", ",", "orientation", ",", "role", "=", "Qt", ".", "DisplayRole", ")", ":", "if", "role", "==", "Qt", ".", "TextAlignmentRole", ":", "if", "orientation", "==", "Qt", ".", "Horizontal", ":", "return", "to_qv...
Qt Override.
[ "Qt", "Override", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L590-L607
train
spyder-ide/spyder
spyder/preferences/shortcuts.py
ShortcutsModel.setData
def setData(self, index, value, role=Qt.EditRole): """Qt Override.""" if index.isValid() and 0 <= index.row() < len(self.shortcuts): shortcut = self.shortcuts[index.row()] column = index.column() text = from_qvariant(value, str) if column == SEQUENCE...
python
def setData(self, index, value, role=Qt.EditRole): """Qt Override.""" if index.isValid() and 0 <= index.row() < len(self.shortcuts): shortcut = self.shortcuts[index.row()] column = index.column() text = from_qvariant(value, str) if column == SEQUENCE...
[ "def", "setData", "(", "self", ",", "index", ",", "value", ",", "role", "=", "Qt", ".", "EditRole", ")", ":", "if", "index", ".", "isValid", "(", ")", "and", "0", "<=", "index", ".", "row", "(", ")", "<", "len", "(", "self", ".", "shortcuts", "...
Qt Override.
[ "Qt", "Override", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L617-L627
train
spyder-ide/spyder
spyder/preferences/shortcuts.py
ShortcutsModel.update_search_letters
def update_search_letters(self, text): """Update search letters with text input in search box.""" self.letters = text names = [shortcut.name for shortcut in self.shortcuts] results = get_search_scores(text, names, template='<b>{0}</b>') self.normal_text, self.rich_text, self...
python
def update_search_letters(self, text): """Update search letters with text input in search box.""" self.letters = text names = [shortcut.name for shortcut in self.shortcuts] results = get_search_scores(text, names, template='<b>{0}</b>') self.normal_text, self.rich_text, self...
[ "def", "update_search_letters", "(", "self", ",", "text", ")", ":", "self", ".", "letters", "=", "text", "names", "=", "[", "shortcut", ".", "name", "for", "shortcut", "in", "self", ".", "shortcuts", "]", "results", "=", "get_search_scores", "(", "text", ...
Update search letters with text input in search box.
[ "Update", "search", "letters", "with", "text", "input", "in", "search", "box", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L629-L635
train
spyder-ide/spyder
spyder/preferences/shortcuts.py
CustomSortFilterProxy.set_filter
def set_filter(self, text): """Set regular expression for filter.""" self.pattern = get_search_regex(text) if self.pattern: self._parent.setSortingEnabled(False) else: self._parent.setSortingEnabled(True) self.invalidateFilter()
python
def set_filter(self, text): """Set regular expression for filter.""" self.pattern = get_search_regex(text) if self.pattern: self._parent.setSortingEnabled(False) else: self._parent.setSortingEnabled(True) self.invalidateFilter()
[ "def", "set_filter", "(", "self", ",", "text", ")", ":", "self", ".", "pattern", "=", "get_search_regex", "(", "text", ")", "if", "self", ".", "pattern", ":", "self", ".", "_parent", ".", "setSortingEnabled", "(", "False", ")", "else", ":", "self", "."...
Set regular expression for filter.
[ "Set", "regular", "expression", "for", "filter", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L659-L666
train
spyder-ide/spyder
spyder/preferences/shortcuts.py
CustomSortFilterProxy.filterAcceptsRow
def filterAcceptsRow(self, row_num, parent): """Qt override. Reimplemented from base class to allow the use of custom filtering. """ model = self.sourceModel() name = model.row(row_num).name r = re.search(self.pattern, name) if r is None: r...
python
def filterAcceptsRow(self, row_num, parent): """Qt override. Reimplemented from base class to allow the use of custom filtering. """ model = self.sourceModel() name = model.row(row_num).name r = re.search(self.pattern, name) if r is None: r...
[ "def", "filterAcceptsRow", "(", "self", ",", "row_num", ",", "parent", ")", ":", "model", "=", "self", ".", "sourceModel", "(", ")", "name", "=", "model", ".", "row", "(", "row_num", ")", ".", "name", "r", "=", "re", ".", "search", "(", "self", "."...
Qt override. Reimplemented from base class to allow the use of custom filtering.
[ "Qt", "override", ".", "Reimplemented", "from", "base", "class", "to", "allow", "the", "use", "of", "custom", "filtering", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L668-L680
train
spyder-ide/spyder
spyder/preferences/shortcuts.py
ShortcutsTable.focusOutEvent
def focusOutEvent(self, e): """Qt Override.""" self.source_model.update_active_row() super(ShortcutsTable, self).focusOutEvent(e)
python
def focusOutEvent(self, e): """Qt Override.""" self.source_model.update_active_row() super(ShortcutsTable, self).focusOutEvent(e)
[ "def", "focusOutEvent", "(", "self", ",", "e", ")", ":", "self", ".", "source_model", ".", "update_active_row", "(", ")", "super", "(", "ShortcutsTable", ",", "self", ")", ".", "focusOutEvent", "(", "e", ")" ]
Qt Override.
[ "Qt", "Override", "." ]
f76836ce1b924bcc4efd3f74f2960d26a4e528e0
https://github.com/spyder-ide/spyder/blob/f76836ce1b924bcc4efd3f74f2960d26a4e528e0/spyder/preferences/shortcuts.py#L714-L717
train