Code
stringlengths
103
85.9k
Summary
listlengths
0
94
Please provide a description of the function:def setup_project_view(self): for i in [1, 2, 3]: self.hideColumn(i) self.setHeaderHidden(True) # Disable the view of .spyproject. self.filter_directories()
[ "Setup view for projects" ]
Please provide a description of the function:def setup_common_actions(self): actions = super(ExplorerTreeWidget, self).setup_common_actions() if self.show_cd_only is None: # Enabling the 'show current directory only' option but do not # allow the user to disable it ...
[ "Setup context menu common actions" ]
Please provide a description of the function:def toggle_show_cd_only(self, checked): self.parent_widget.sig_option_changed.emit('show_cd_only', checked) self.show_cd_only = checked if checked: if self.__last_folder is not None: self.set_current_folder(s...
[ "Toggle show current directory only mode" ]
Please provide a description of the function:def set_current_folder(self, folder): index = self.fsmodel.setRootPath(folder) self.__last_folder = folder if self.show_cd_only: if self.__original_root_index is None: self.__original_root_index = self.rootIn...
[ "Set current folder and return associated model index" ]
Please provide a description of the function:def refresh(self, new_path=None, force_current=False): if new_path is None: new_path = getcwd_or_home() if force_current: index = self.set_current_folder(new_path) self.expand(index) self.setCurr...
[ "Refresh widget\r\n force=False: won't refresh widget if path has not changed" ]
Please provide a description of the function:def go_to_parent_directory(self): self.chdir(osp.abspath(osp.join(getcwd_or_home(), os.pardir)))
[ "Go to parent directory" ]
Please provide a description of the function:def update_history(self, directory): try: directory = osp.abspath(to_text_string(directory)) if directory in self.history: self.histindex = self.history.index(directory) except Exception: use...
[ "Update browse history" ]
Please provide a description of the function:def chdir(self, directory=None, browsing_history=False): if directory is not None: directory = osp.abspath(to_text_string(directory)) if browsing_history: directory = self.history[self.histindex] elif directory i...
[ "Set directory as working directory" ]
Please provide a description of the function:def toggle_icontext(self, state): self.sig_option_changed.emit('show_icontext', state) for widget in self.action_widgets: if widget is not self.button_menu: if state: widget.setToolButtonStyle(Qt....
[ "Toggle icon text" ]
Please provide a description of the function:def set_data(self, data): self._data = data keys = list(data.keys()) self.breakpoints = [] for key in keys: bp_list = data[key] if bp_list: for item in data[key]: se...
[ "Set model data" ]
Please provide a description of the function:def sort(self, column, order=Qt.DescendingOrder): if column == 0: self.breakpoints.sort( key=lambda breakpoint: breakpoint[1]) self.breakpoints.sort( key=lambda breakpoint: osp.basename(breakpoint...
[ "Overriding sort method" ]
Please provide a description of the function:def data(self, index, role=Qt.DisplayRole): if not index.isValid(): return to_qvariant() if role == Qt.DisplayRole: if index.column() == 0: value = osp.basename(self.get_value(index)) ret...
[ "Return data at table index" ]
Please provide a description of the function:def setup_table(self): self.horizontalHeader().setStretchLastSection(True) self.adjust_columns() self.columnAt(0) # Sorting columns self.setSortingEnabled(False) self.sortByColumn(0, Qt.DescendingOrder)
[ "Setup table" ]
Please provide a description of the function:def mouseDoubleClickEvent(self, event): index_clicked = self.indexAt(event.pos()) if self.model.breakpoints: filename = self.model.breakpoints[index_clicked.row()][0] line_number_str = self.model.breakpoints[index_clicked...
[ "Reimplement Qt method" ]
Please provide a description of the function:def get_languages(self): languages = ['python'] all_options = CONF.options(self.CONF_SECTION) for option in all_options: if option in [l.lower() for l in LSP_LANGUAGES]: languages.append(option) return lang...
[ "\n Get the list of languages we need to start servers and create\n clients for.\n " ]
Please provide a description of the function:def get_root_path(self, language): path = None # Get path of the current project if self.main and self.main.projects: path = self.main.projects.get_active_project_path() # If there's no project, use the output of getcwd_...
[ "\n Get root path to pass to the LSP servers.\n\n This can be the current project path or the output of\n getcwd_or_home (except for Python, see below).\n " ]
Please provide a description of the function:def reinitialize_all_clients(self): for language in self.clients: language_client = self.clients[language] if language_client['status'] == self.RUNNING: folder = self.get_root_path(language) instance = ...
[ "\n Send a new initialize message to each LSP server when the project\n path has changed so they can update the respective server root paths.\n " ]
Please provide a description of the function:def start_client(self, language): started = False if language in self.clients: language_client = self.clients[language] queue = self.register_queue[language] # Don't start LSP services when testing unless we deman...
[ "Start an LSP client for a given language." ]
Please provide a description of the function:def generate_python_config(self): python_config = PYTHON_CONFIG.copy() # Server options cmd = self.get_option('advanced/command_launch') host = self.get_option('advanced/host') port = self.get_option('advanced/port') ...
[ "\n Update Python server configuration with the options saved in our\n config system.\n " ]
Please provide a description of the function:def setup_page(self): settings_group = QGroupBox(_("Settings")) hist_spin = self.create_spinbox( _("History depth: "), _(" entries"), 'max_entries', min_=10, max_=10000, step=10, ...
[ "Setup config page widgets and options." ]
Please provide a description of the function:def transcode(text, input=PREFERRED_ENCODING, output=PREFERRED_ENCODING): try: return text.decode("cp437").encode("cp1252") except UnicodeError: try: return text.decode("cp437").encode(output) except UnicodeError: ...
[ "Transcode a text string" ]
Please provide a description of the function:def to_unicode_from_fs(string): if not is_string(string): # string is a QString string = to_text_string(string.toUtf8(), 'utf-8') else: if is_binary_string(string): try: unic = string.decode(FS_ENCODING) ...
[ "\r\n Return a unicode version of string decoded using the file system encoding.\r\n " ]
Please provide a description of the function:def to_fs_from_unicode(unic): if is_unicode(unic): try: string = unic.encode(FS_ENCODING) except (UnicodeError, TypeError): pass else: return string return unic
[ "\r\n Return a byte string version of unic encoded using the file \r\n system encoding.\r\n " ]
Please provide a description of the function:def get_coding(text, force_chardet=False): if not force_chardet: for line in text.splitlines()[:2]: try: result = CODING_RE.search(to_text_string(line)) except UnicodeDecodeError: # This could fa...
[ "\r\n Function to get the coding of a text.\r\n @param text text to inspect (string)\r\n @return coding string\r\n " ]
Please provide a description of the function:def decode(text): try: if text.startswith(BOM_UTF8): # UTF-8 with BOM return to_text_string(text[len(BOM_UTF8):], 'utf-8'), 'utf-8-bom' elif text.startswith(BOM_UTF16): # UTF-16 with BOM return ...
[ "\r\n Function to decode a text.\r\n @param text text to decode (string)\r\n @return decoded text and encoding\r\n " ]
Please provide a description of the function:def to_unicode(string): if not is_unicode(string): for codec in CODECS: try: unic = to_text_string(string, codec) except UnicodeError: pass except TypeError: break ...
[ "Convert a string to unicode" ]
Please provide a description of the function:def write(text, filename, encoding='utf-8', mode='wb'): text, encoding = encode(text, encoding) if 'a' in mode: with open(filename, mode) as textfile: textfile.write(text) else: with atomic_write(filename, ...
[ "\r\n Write 'text' to file ('filename') assuming 'encoding' in an atomic way\r\n Return (eventually new) encoding\r\n " ]
Please provide a description of the function:def writelines(lines, filename, encoding='utf-8', mode='wb'): return write(os.linesep.join(lines), filename, encoding, mode)
[ "\r\n Write 'lines' to file ('filename') assuming 'encoding'\r\n Return (eventually new) encoding\r\n " ]
Please provide a description of the function:def read(filename, encoding='utf-8'): text, encoding = decode( open(filename, 'rb').read() ) return text, encoding
[ "\r\n Read text from file ('filename')\r\n Return text and encoding\r\n " ]
Please provide a description of the function:def readlines(filename, encoding='utf-8'): text, encoding = read(filename, encoding) return text.split(os.linesep), encoding
[ "\r\n Read lines from file ('filename')\r\n Return lines and encoding\r\n " ]
Please provide a description of the function:def _get_pygments_extensions(): # NOTE: Leave this import here to keep startup process fast! import pygments.lexers as lexers extensions = [] for lx in lexers.get_all_lexers(): lexer_exts = lx[2] if lexer_exts: # Reference: ...
[ "Return all file type extensions supported by Pygments" ]
Please provide a description of the function:def get_filter(filetypes, ext): if not ext: return ALL_FILTER for title, ftypes in filetypes: if ext in ftypes: return _create_filter(title, ftypes) else: return ''
[ "Return filter associated to file extension" ]
Please provide a description of the function:def get_edit_filetypes(): # The filter details are not hidden on Windows, so we can't use # all Pygments extensions on that platform if os.name == 'nt': supported_exts = [] else: try: supported_exts = _get_pygments_extensions(...
[ "Get all file types supported by the Editor" ]
Please provide a description of the function:def is_ubuntu(): if sys.platform.startswith('linux') and osp.isfile('/etc/lsb-release'): release_info = open('/etc/lsb-release').read() if 'Ubuntu' in release_info: return True else: return False else: retu...
[ "Detect if we are running in an Ubuntu-based distribution" ]
Please provide a description of the function:def is_gtk_desktop(): if sys.platform.startswith('linux'): xdg_desktop = os.environ.get('XDG_CURRENT_DESKTOP', '') if xdg_desktop: gtk_desktops = ['Unity', 'GNOME', 'XFCE'] if any([xdg_desktop.startswith(d) for d in gtk_deskto...
[ "Detect if we are running in a Gtk-based desktop" ]
Please provide a description of the function:def is_kde_desktop(): if sys.platform.startswith('linux'): xdg_desktop = os.environ.get('XDG_CURRENT_DESKTOP', '') if xdg_desktop: if 'KDE' in xdg_desktop: return True else: return False ...
[ "Detect if we are running in a KDE desktop" ]
Please provide a description of the function:def _get_relative_pythonpath(self): # Workaround to replace os.path.relpath (new in Python v2.6): offset = len(self.root_path)+len(os.pathsep) return [path[offset:] for path in self.pythonpath]
[ "Return PYTHONPATH list as relative paths" ]
Please provide a description of the function:def _set_relative_pythonpath(self, value): self.pythonpath = [osp.abspath(osp.join(self.root_path, path)) for path in value]
[ "Set PYTHONPATH list relative paths" ]
Please provide a description of the function:def is_in_pythonpath(self, dirname): return fixpath(dirname) in [fixpath(_p) for _p in self.pythonpath]
[ "Return True if dirname is in project's PYTHONPATH" ]
Please provide a description of the function:def remove_from_pythonpath(self, path): pathlist = self.get_pythonpath() if path in pathlist: pathlist.pop(pathlist.index(path)) self.set_pythonpath(pathlist) return True else: return Fa...
[ "Remove path from project's PYTHONPATH\r\n Return True if path was removed, False if it was not found" ]
Please provide a description of the function:def add_to_pythonpath(self, path): pathlist = self.get_pythonpath() if path in pathlist: return False else: pathlist.insert(0, path) self.set_pythonpath(pathlist) return True
[ "Add path to project's PYTHONPATH\r\n Return True if path was added, False if it was already there" ]
Please provide a description of the function:def get_package_data(name, extlist): flist = [] # Workaround to replace os.path.relpath (not available until Python 2.6): offset = len(name)+len(os.pathsep) for dirpath, _dirnames, filenames in os.walk(name): for fname in filenames: i...
[ "Return data files for package *name* with extensions in *extlist*" ]
Please provide a description of the function:def get_subpackages(name): splist = [] for dirpath, _dirnames, _filenames in os.walk(name): if osp.isfile(osp.join(dirpath, '__init__.py')): splist.append(".".join(dirpath.split(os.sep))) return splist
[ "Return subpackages of package *name*" ]
Please provide a description of the function:def get_python_doc_path(): if os.name == 'nt': doc_path = osp.join(sys.prefix, "Doc") if not osp.isdir(doc_path): return python_chm = [path for path in os.listdir(doc_path) if re.match(r"(?i)Python[0-9...
[ "\r\n Return Python documentation path\r\n (Windows: return the PythonXX.chm path if available)\r\n " ]
Please provide a description of the function:def set_opengl_implementation(option): if option == 'software': QCoreApplication.setAttribute(Qt.AA_UseSoftwareOpenGL) if QQuickWindow is not None: QQuickWindow.setSceneGraphBackend(QSGRendererInterface.Software) elif option == ...
[ "\r\n Set the OpenGL implementation used by Spyder.\r\n\r\n See issue 7447 for the details.\r\n " ]
Please provide a description of the function:def setup_logging(cli_options): if cli_options.debug_info or get_debug_level() > 0: levels = {2: logging.INFO, 3: logging.DEBUG} log_level = levels[get_debug_level()] log_format = '%(asctime)s [%(levelname)s] [%(name)s] -> %(message)s' ...
[ "Setup logging with cli options defined by the user." ]
Please provide a description of the function:def qt_message_handler(msg_type, msg_log_context, msg_string): BLACKLIST = [ 'QMainWidget::resizeDocks: all sizes need to be larger than 0', ] if DEV or msg_string not in BLACKLIST: print(msg_string)
[ "\r\n Qt warning messages are intercepted by this handler.\r\n\r\n On some operating systems, warning messages might be displayed\r\n even if the actual message does not apply. This filter adds a\r\n blacklist for messages that are being printed for no apparent\r\n reason. Anything else will get prin...
Please provide a description of the function:def initialize(): # This doesn't create our QApplication, just holds a reference to # MAIN_APP, created above to show our splash screen as early as # possible app = qapplication() # --- Set application icon app.setWindowIcon(APP_ICON) ...
[ "Initialize Qt, patching sys.exit and eventually setting up ETS", "Spyder's fake QApplication", "Do nothing because the Qt mainloop is already running" ]
Please provide a description of the function:def run_spyder(app, options, args): #TODO: insert here # Main window main = MainWindow(options) try: main.setup() except BaseException: if main.console is not None: try: main.console.shell.exit_in...
[ "\r\n Create and show Spyder's main window\r\n Start QApplication event loop\r\n " ]
Please provide a description of the function:def main(): # **** For Pytest **** # We need to create MainWindow **here** to avoid passing pytest # options to Spyder if running_under_pytest(): try: from unittest.mock import Mock except ImportError: fro...
[ "Main function" ]
Please provide a description of the function:def create_toolbar(self, title, object_name, iconsize=24): toolbar = self.addToolBar(title) toolbar.setObjectName(object_name) toolbar.setIconSize(QSize(iconsize, iconsize)) self.toolbarslist.append(toolbar) return toolb...
[ "Create and return toolbar with *title* and *object_name*" ]
Please provide a description of the function:def setup(self): logger.info("*** Start of MainWindow setup ***") logger.info("Applying theme configuration...") ui_theme = CONF.get('appearance', 'ui_theme') color_scheme = CONF.get('appearance', 'selected') if ui_t...
[ "Setup main window", "Add installed Python module doc action to help submenu" ]
Please provide a description of the function:def post_visible_setup(self): self.restore_scrollbar_position.emit() # [Workaround for Issue 880] # QDockWidget objects are not painted if restored as floating # windows, so we must dock them before showing the mainwindow, ...
[ "Actions to be performed only after the main window's `show` method\r\n was triggered" ]
Please provide a description of the function:def set_window_title(self): if DEV is not None: title = u"Spyder %s (Python %s.%s)" % (__version__, sys.version_info[0], sys.version_info[1...
[ "Set window title." ]
Please provide a description of the function:def report_missing_dependencies(self): missing_deps = dependencies.missing_dependencies() if missing_deps: QMessageBox.critical(self, _('Error'), _("<b>You have missing dependencies!</b>" "<br><br><...
[ "Show a QMessageBox with a list of missing hard dependencies" ]
Please provide a description of the function:def load_window_settings(self, prefix, default=False, section='main'): get_func = CONF.get_default if default else CONF.get window_size = get_func(section, prefix+'size') prefs_dialog_size = get_func(section, prefix+'prefs_dialog_size') ...
[ "Load window layout settings from userconfig-based configuration\r\n with *prefix*, under *section*\r\n default: if True, do not restore inner layout" ]
Please provide a description of the function:def get_window_settings(self): window_size = (self.window_size.width(), self.window_size.height()) is_fullscreen = self.isFullScreen() if is_fullscreen: is_maximized = self.maximized_flag else: is_maximi...
[ "Return current window settings\r\n Symetric to the 'set_window_settings' setter" ]
Please provide a description of the function:def set_window_settings(self, hexstate, window_size, prefs_dialog_size, pos, is_maximized, is_fullscreen): self.setUpdatesEnabled(False) self.window_size = QSize(window_size[0], window_size[1]) # width,height ...
[ "Set window settings\r\n Symetric to the 'get_window_settings' accessor" ]
Please provide a description of the function:def save_current_window_settings(self, prefix, section='main', none_state=False): win_size = self.window_size prefs_size = self.prefs_dialog_size CONF.set(section, prefix+'size', (win_size.width(), ...
[ "Save current window settings with *prefix* in\r\n the userconfig-based configuration, under *section*" ]
Please provide a description of the function:def tabify_plugins(self, first, second): self.tabifyDockWidget(first.dockwidget, second.dockwidget)
[ "Tabify plugin dockwigdets" ]
Please provide a description of the function:def setup_layout(self, default=False): prefix = 'window' + '/' settings = self.load_window_settings(prefix, default) hexstate = settings[0] self.first_spyder_run = False if hexstate is None: # First Spyder...
[ "Setup window layout" ]
Please provide a description of the function:def setup_default_layouts(self, index, settings): self.setUpdatesEnabled(False) first_spyder_run = bool(self.first_spyder_run) # Store copy if first_spyder_run: self.set_window_settings(*settings) else: ...
[ "Setup default layouts when run for the first time." ]
Please provide a description of the function:def reset_window_layout(self): answer = QMessageBox.warning(self, _("Warning"), _("Window layout will be reset to default settings: " "this affects window position, size and dockwidgets.\n" ...
[ "Reset window layout to default" ]
Please provide a description of the function:def quick_layout_save(self): get = CONF.get set_ = CONF.set names = get('quick_layouts', 'names') order = get('quick_layouts', 'order') active = get('quick_layouts', 'active') dlg = self.dialog_layout_save(sel...
[ "Save layout dialog" ]
Please provide a description of the function:def quick_layout_settings(self): get = CONF.get set_ = CONF.set section = 'quick_layouts' names = get(section, 'names') order = get(section, 'order') active = get(section, 'active') dlg = self.dia...
[ "Layout settings dialog" ]
Please provide a description of the function:def quick_layout_switch(self, index): section = 'quick_layouts' try: settings = self.load_window_settings('layout_{}/'.format(index), section=section) (hexstate, window_...
[ "Switch to quick layout number *index*" ]
Please provide a description of the function:def _update_show_toolbars_action(self): if self.toolbars_visible: text = _("Hide toolbars") tip = _("Hide toolbars") else: text = _("Show toolbars") tip = _("Show toolbars") self.show_to...
[ "Update the text displayed in the menu entry." ]
Please provide a description of the function:def save_visible_toolbars(self): toolbars = [] for toolbar in self.visible_toolbars: toolbars.append(toolbar.objectName()) CONF.set('main', 'last_visible_toolbars', toolbars)
[ "Saves the name of the visible toolbars in the .ini file." ]
Please provide a description of the function:def get_visible_toolbars(self): toolbars = [] for toolbar in self.toolbarslist: if toolbar.toggleViewAction().isChecked(): toolbars.append(toolbar) self.visible_toolbars = toolbars
[ "Collects the visible toolbars." ]
Please provide a description of the function:def load_last_visible_toolbars(self): toolbars_names = CONF.get('main', 'last_visible_toolbars', default=[]) if toolbars_names: dic = {} for toolbar in self.toolbarslist: dic[toolbar.objectName()] = too...
[ "Loads the last visible toolbars from the .ini file." ]
Please provide a description of the function:def show_toolbars(self): value = not self.toolbars_visible CONF.set('main', 'toolbars_visible', value) if value: self.save_visible_toolbars() else: self.get_visible_toolbars() for toolbar in s...
[ "Show/Hides toolbars." ]
Please provide a description of the function:def valid_project(self): try: path = self.projects.get_active_project_path() except AttributeError: return if bool(path): if not self.projects.is_valid_project(path): if path: ...
[ "Handle an invalid active project." ]
Please provide a description of the function:def show_shortcuts(self, menu): for element in getattr(self, menu + '_menu_actions'): if element and isinstance(element, QAction): if element._shown_shortcut is not None: element.setShortcut(element._shown...
[ "Show action shortcuts in menu" ]
Please provide a description of the function:def hide_shortcuts(self, menu): for element in getattr(self, menu + '_menu_actions'): if element and isinstance(element, QAction): if element._shown_shortcut is not None: element.setShortcut(QKeySequence()...
[ "Hide action shortcuts in menu" ]
Please provide a description of the function:def get_focus_widget_properties(self): from spyder.plugins.editor.widgets.editor import TextEditBaseWidget from spyder.plugins.ipythonconsole.widgets import ControlWidget widget = QApplication.focusWidget() textedit_properties ...
[ "Get properties of focus widget\r\n Returns tuple (widget, properties) where properties is a tuple of\r\n booleans: (is_console, not_readonly, readwrite_editor)" ]
Please provide a description of the function:def update_edit_menu(self): widget, textedit_properties = self.get_focus_widget_properties() if textedit_properties is None: # widget is not an editor/console return # !!! Below this line, widget is expected to be a QPlainTex...
[ "Update edit menu" ]
Please provide a description of the function:def update_search_menu(self): # Disabling all actions except the last one # (which is Find in files) to begin with for child in self.search_menu.actions()[:-1]: child.setEnabled(False) widget, textedit_properties =...
[ "Update search menu" ]
Please provide a description of the function:def set_splash(self, message): if self.splash is None: return if message: logger.info(message) self.splash.show() self.splash.showMessage(message, Qt.AlignBottom | Qt.AlignCenter | ...
[ "Set splash message" ]
Please provide a description of the function:def closeEvent(self, event): if self.closing(True): event.accept() else: event.ignore()
[ "closeEvent reimplementation" ]
Please provide a description of the function:def resizeEvent(self, event): if not self.isMaximized() and not self.fullscreen_flag: self.window_size = self.size() QMainWindow.resizeEvent(self, event) # To be used by the tour to be able to resize self.sig_resiz...
[ "Reimplement Qt method" ]
Please provide a description of the function:def moveEvent(self, event): if not self.isMaximized() and not self.fullscreen_flag: self.window_position = self.pos() QMainWindow.moveEvent(self, event) # To be used by the tour to be able to move self.sig_moved.em...
[ "Reimplement Qt method" ]
Please provide a description of the function:def hideEvent(self, event): try: for plugin in (self.widgetlist + self.thirdparty_plugins): if plugin.isAncestorOf(self.last_focused_widget): plugin.visibility_changed(True) QMainWindow.hideEv...
[ "Reimplement Qt method" ]
Please provide a description of the function:def change_last_focused_widget(self, old, now): if (now is None and QApplication.activeWindow() is not None): QApplication.activeWindow().setFocus() self.last_focused_widget = QApplication.focusWidget() elif now is not No...
[ "To keep track of to the last focused widget" ]
Please provide a description of the function:def closing(self, cancelable=False): if self.already_closed or self.is_starting_up: return True if cancelable and CONF.get('main', 'prompt_on_exit'): reply = QMessageBox.critical(self, 'Spyder', ...
[ "Exit tasks" ]
Please provide a description of the function:def add_dockwidget(self, child): dockwidget, location = child.create_dockwidget() if CONF.get('main', 'vertical_dockwidget_titlebars'): dockwidget.setFeatures(dockwidget.features()| QDockWidget.Dock...
[ "Add QDockWidget and toggleViewAction" ]
Please provide a description of the function:def toggle_lock(self, value): self.interface_locked = value CONF.set('main', 'panes_locked', value) # Apply lock to panes for plugin in (self.widgetlist + self.thirdparty_plugins): if self.interface_locked: ...
[ "Lock/Unlock dockwidgets and toolbars" ]
Please provide a description of the function:def maximize_dockwidget(self, restore=False): if self.state_before_maximizing is None: if restore: return # Select plugin to maximize self.state_before_maximizing = self.saveState() foc...
[ "Shortcut: Ctrl+Alt+Shift+M\r\n First call: maximize current dockwidget\r\n Second call (or restore=True): restore original window layout" ]
Please provide a description of the function:def add_to_toolbar(self, toolbar, widget): actions = widget.toolbar_actions if actions is not None: add_actions(toolbar, actions)
[ "Add widget actions to toolbar" ]
Please provide a description of the function:def about(self): versions = get_versions() # Show Git revision for development version revlink = '' if versions['revision']: rev = versions['revision'] revlink = " (<a href='https://github.com/spyder-ide...
[ "Create About Spyder dialog with general information.", "\r\n <b>Spyder {spyder_ver}</b> {revision}\r\n <br>The Scientific Python Development Environment |\r\n <a href=\"{website_url}\">Spyder-IDE.org</a>\r\n <br>Copyright &copy; 2009-2019 Spyder Project Contributors an...
Please provide a description of the function:def show_dependencies(self): from spyder.widgets.dependencies import DependenciesDialog dlg = DependenciesDialog(self) dlg.set_data(dependencies.DEPENDENCIES) dlg.exec_()
[ "Show Spyder's Dependencies dialog box" ]
Please provide a description of the function:def render_issue(self, description='', traceback=''): # Get component versions versions = get_versions() # Get git revision for development version revision = '' if versions['revision']: revision = version...
[ "Render issue before sending it to Github", "\\\r\n## Description\r\n\r\n{description}\r\n\r\n{error_section}\r\n\r\n## Versions\r\n\r\n* Spyder version: {spyder_version} {commit}\r\n* Python version: {python_version}\r\n* Qt version: {qt_version}\r\n* {qt_api_name} version: {qt_api_version}\r\n* Operating System...
Please provide a description of the function:def report_issue(self, body=None, title=None, open_webpage=False): if body is None: from spyder.widgets.reporterror import SpyderErrorDialog report_dlg = SpyderErrorDialog(self, is_report=True) report_dlg.show() ...
[ "Report a Spyder issue to github, generating body text if needed." ]
Please provide a description of the function:def global_callback(self): widget = QApplication.focusWidget() action = self.sender() callback = from_qvariant(action.data(), to_text_string) from spyder.plugins.editor.widgets.editor import TextEditBaseWidget from spyde...
[ "Global callback" ]
Please provide a description of the function:def open_external_console(self, fname, wdir, args, interact, debug, python, python_args, systerm, post_mortem=False): if systerm: # Running script in an external system terminal try: ...
[ "Open external console" ]
Please provide a description of the function:def execute_in_external_console(self, lines, focus_to_editor): console = self.ipyconsole console.switch_to_plugin() console.execute_code(lines) if focus_to_editor: self.editor.switch_to_plugin()
[ "\r\n Execute lines in IPython console and eventually set focus\r\n to the Editor.\r\n " ]
Please provide a description of the function:def open_file(self, fname, external=False): fname = to_text_string(fname) ext = osp.splitext(fname)[1] if encoding.is_text_file(fname): self.editor.load(fname) elif self.variableexplorer is not None and ext in IMPORT...
[ "\r\n Open filename with the appropriate application\r\n Redirect to the right widget (txt -> editor, spydata -> workspace, ...)\r\n or open file outside Spyder (if extension is not supported)\r\n " ]
Please provide a description of the function:def open_external_file(self, fname): fname = encoding.to_unicode_from_fs(fname) if osp.isfile(fname): self.open_file(fname, external=True) elif osp.isfile(osp.join(CWD, fname)): self.open_file(osp.join(CWD, fname...
[ "\r\n Open external files that can be handled either by the Editor or the\r\n variable explorer inside Spyder.\r\n " ]
Please provide a description of the function:def get_spyder_pythonpath(self): active_path = [p for p in self.path if p not in self.not_active_path] return active_path + self.project_path
[ "Return Spyder PYTHONPATH" ]
Please provide a description of the function:def add_path_to_sys_path(self): for path in reversed(self.get_spyder_pythonpath()): sys.path.insert(1, path)
[ "Add Spyder path to sys.path" ]
Please provide a description of the function:def remove_path_from_sys_path(self): for path in self.path + self.project_path: while path in sys.path: sys.path.remove(path)
[ "Remove Spyder path from sys.path" ]