Code
stringlengths
103
85.9k
Summary
listlengths
0
94
Please provide a description of the function:def install(): # Create Spyder start menu folder # Don't use CSIDL_COMMON_PROGRAMS because it requres admin rights # This is consistent with use of CSIDL_DESKTOPDIRECTORY below # CSIDL_COMMON_PROGRAMS = # C:\ProgramData\Microsoft\Windows\Start ...
[ "Function executed when running the script with the -install switch" ]
Please provide a description of the function:def remove(): current = True # only affects current user root = winreg.HKEY_CURRENT_USER if current else winreg.HKEY_LOCAL_MACHINE for key in (KEY_C1 % ("", EWS), KEY_C1 % ("NoCon", EWS), KEY_C0 % ("", EWS), KEY_C0 % ("NoCon", EWS)): ...
[ "Function executed when running the script with the -remove switch" ]
Please provide a description of the function:def get_tour(index): sw = SpyderWidgets qtconsole_link = "https://qtconsole.readthedocs.io/en/stable/index.html" # This test should serve as example of keys to use in the tour frame dics test = [{'title': "Welcome to Spyder introduction tour", ...
[ "\r\n This function generates a list of tours.\r\n \r\n The index argument is used to retrieve a particular tour. If None is\r\n passed, it will return the full list of tours. If instead -1 is given,\r\n this function will return a test tour\r\n\r\n To add more tours a new variable needs to be cre...
Please provide a description of the function:def paintEvent(self, event): painter = QPainter(self) painter.setRenderHint(QPainter.Antialiasing) # Decoration painter.fillPath(self.path_current, QBrush(self.color)) painter.strokePath(self.path_decoration, QPen(self.c...
[ "Override Qt method" ]
Please provide a description of the function:def reject(self): if not self.is_fade_running(): key = Qt.Key_Escape self.key_pressed = key self.sig_key_pressed.emit()
[ "Override Qt method" ]
Please provide a description of the function:def mousePressEvent(self, event): # Raise the main application window on click self.parent.raise_() self.raise_() if event.button() == Qt.RightButton: pass
[ "override Qt method" ]
Please provide a description of the function:def _set_data(self): self.setting_data = True step, steps, frames = self.step_current, self.steps, self.frames current = '{0}/{1}'.format(step + 1, steps) frame = frames[step] combobox_frames = [u"{0}. {1}".format(i+1,...
[ "Set data that is displayed in each step of the tour." ]
Please provide a description of the function:def lost_focus(self): if (self.is_running and not self.any_has_focus() and not self.setting_data and not self.hidden): self.hide_tips()
[ "Confirm if the tour loses focus and hides the tips." ]
Please provide a description of the function:def gain_focus(self): if (self.is_running and self.any_has_focus() and not self.setting_data and self.hidden): self.unhide_tips()
[ "Confirm if the tour regains focus and unhides the tips." ]
Please provide a description of the function:def any_has_focus(self): f = (self.hasFocus() or self.parent.hasFocus() or self.tips.hasFocus() or self.canvas.hasFocus()) return f
[ "Returns if tour or any of its components has focus." ]
Please provide a description of the function:def _handle_display_data(self, msg): img = None data = msg['content']['data'] if 'image/svg+xml' in data: fmt = 'image/svg+xml' img = data['image/svg+xml'] elif 'image/png' in data: # PNG data is ba...
[ "\n Reimplemented to handle communications between the figure explorer\n and the kernel.\n " ]
Please provide a description of the function:def get_file_language(filename, text=None): ext = osp.splitext(filename)[1] if ext.startswith('.'): ext = ext[1:] # file extension with leading dot language = ext if not ext: if text is None: text, _enc = encoding.read...
[ "Get file language from filename" ]
Please provide a description of the function:def text_has_changed(self, text): text = to_text_string(text) if text: self.lineno = int(text) else: self.lineno = None
[ "Line edit's text has changed" ]
Please provide a description of the function:def save_figure_tofile(fig, fmt, fname): root, ext = osp.splitext(fname) if ext == '.png' and fmt == 'image/svg+xml': qimg = svg_to_image(fig) qimg.save(fname) else: if fmt == 'image/svg+xml' and is_unicode(fig): fig = fig...
[ "Save fig to fname in the format specified by fmt." ]
Please provide a description of the function:def get_unique_figname(dirname, root, ext): i = 1 figname = root + '_%d' % i + ext while True: if osp.exists(osp.join(dirname, figname)): i += 1 figname = root + '_%d' % i + ext else: return osp.join(dirnam...
[ "\n Append a number to \"root\" to form a filename that does not already exist\n in \"dirname\".\n " ]
Please provide a description of the function:def setup(self, mute_inline_plotting=None, show_plot_outline=None): assert self.shellwidget is not None self.mute_inline_plotting = mute_inline_plotting self.show_plot_outline = show_plot_outline if self.figviewer is not None: ...
[ "Setup the figure browser with provided settings." ]
Please provide a description of the function:def setup_toolbar(self): savefig_btn = create_toolbutton( self, icon=ima.icon('filesave'), tip=_("Save Image As..."), triggered=self.save_figure) saveall_btn = create_toolbutton( self, ...
[ "Setup the toolbar" ]
Please provide a description of the function:def setup_option_actions(self, mute_inline_plotting, show_plot_outline): self.setup_in_progress = True self.mute_inline_action = create_action( self, _("Mute inline plotting"), tip=_("Mute inline plotting in the ipython consol...
[ "Setup the actions to show in the cog menu." ]
Please provide a description of the function:def create_shortcuts(self): # Configurable copyfig = config_shortcut(self.copy_figure, context='plots', name='copy', parent=self) prevfig = config_shortcut(self.go_previous_thumbnail, context='plots', ...
[ "Create shortcuts for this widget." ]
Please provide a description of the function:def option_changed(self, option, value): setattr(self, to_text_string(option), value) self.shellwidget.set_namespace_view_settings() if self.setup_in_progress is False: self.sig_option_changed.emit(option, value)
[ "Handle when the value of an option has changed" ]
Please provide a description of the function:def show_fig_outline_in_viewer(self, state): if state is True: self.figviewer.figcanvas.setStyleSheet( "FigureCanvas{border: 1px solid lightgrey;}") else: self.figviewer.figcanvas.setStyleSheet("FigureCanva...
[ "Draw a frame around the figure viewer if state is True." ]
Please provide a description of the function:def set_shellwidget(self, shellwidget): self.shellwidget = shellwidget shellwidget.set_figurebrowser(self) shellwidget.sig_new_inline_figure.connect(self._handle_new_figure)
[ "Bind the shellwidget instance to the figure browser" ]
Please provide a description of the function:def copy_figure(self): if self.figviewer and self.figviewer.figcanvas.fig: self.figviewer.figcanvas.copy_figure()
[ "Copy figure from figviewer to clipboard." ]
Please provide a description of the function:def setup_figcanvas(self): self.figcanvas = FigureCanvas(background_color=self.background_color) self.figcanvas.installEventFilter(self) self.setWidget(self.figcanvas)
[ "Setup the FigureCanvas." ]
Please provide a description of the function:def load_figure(self, fig, fmt): self.figcanvas.load_figure(fig, fmt) self.scale_image() self.figcanvas.repaint()
[ "Set a new figure in the figure canvas." ]
Please provide a description of the function:def eventFilter(self, widget, event): # ---- Zooming if event.type() == QEvent.Wheel: modifiers = QApplication.keyboardModifiers() if modifiers == Qt.ControlModifier: if event.angleDelta().y() > 0: ...
[ "A filter to control the zooming and panning of the figure canvas." ]
Please provide a description of the function:def zoom_in(self): if self._scalefactor <= self._sfmax: self._scalefactor += 1 self.scale_image() self._adjust_scrollbar(self._scalestep) self.sig_zoom_changed.emit(self.get_scaling())
[ "Scale the image up by one scale step." ]
Please provide a description of the function:def zoom_out(self): if self._scalefactor >= self._sfmin: self._scalefactor -= 1 self.scale_image() self._adjust_scrollbar(1/self._scalestep) self.sig_zoom_changed.emit(self.get_scaling())
[ "Scale the image down by one scale step." ]
Please provide a description of the function:def scale_image(self): new_width = int(self.figcanvas.fwidth * self._scalestep ** self._scalefactor) new_height = int(self.figcanvas.fheight * self._scalestep ** self._scalefactor) self.figcanv...
[ "Scale the image size." ]
Please provide a description of the function:def _adjust_scrollbar(self, f): # Adjust horizontal scrollbar : hb = self.horizontalScrollBar() hb.setValue(int(f * hb.value() + ((f - 1) * hb.pageStep()/2))) # Adjust the vertical scrollbar : vb = self.verticalScrollBar() ...
[ "\n Adjust the scrollbar position to take into account the zooming of\n the figure.\n " ]
Please provide a description of the function:def setup_gui(self): scrollarea = self.setup_scrollarea() up_btn, down_btn = self.setup_arrow_buttons() self.setFixedWidth(150) layout = QVBoxLayout(self) layout.setContentsMargins(0, 0, 0, 0) layout.setSpacing(0) ...
[ "Setup the main layout of the widget." ]
Please provide a description of the function:def setup_scrollarea(self): self.view = QWidget() self.scene = QGridLayout(self.view) self.scene.setColumnStretch(0, 100) self.scene.setColumnStretch(2, 100) self.scrollarea = QScrollArea() self.scrollarea.setWidget(...
[ "Setup the scrollarea that will contain the FigureThumbnails." ]
Please provide a description of the function:def setup_arrow_buttons(self): # Get the height of the up/down arrow of the default vertical # scrollbar : vsb = self.scrollarea.verticalScrollBar() style = vsb.style() opt = QStyleOptionSlider() vsb.initStyleOption(op...
[ "\n Setup the up and down arrow buttons that are placed at the top and\n bottom of the scrollarea.\n " ]
Please provide a description of the function:def save_all_figures_as(self): self.redirect_stdio.emit(False) dirname = getexistingdirectory(self, caption='Save all figures', basedir=getcwd_or_home()) self.redirect_stdio.emit(True) if dirname...
[ "Save all the figures to a file." ]
Please provide a description of the function:def save_all_figures_todir(self, dirname): fignames = [] for thumbnail in self._thumbnails: fig = thumbnail.canvas.fig fmt = thumbnail.canvas.fmt fext = {'image/png': '.png', 'image/jpeg': '.jpg...
[ "Save all figure in dirname." ]
Please provide a description of the function:def save_current_figure_as(self): if self.current_thumbnail is not None: self.save_figure_as(self.current_thumbnail.canvas.fig, self.current_thumbnail.canvas.fmt)
[ "Save the currently selected figure." ]
Please provide a description of the function:def save_figure_as(self, fig, fmt): fext, ffilt = { 'image/png': ('.png', 'PNG (*.png)'), 'image/jpeg': ('.jpg', 'JPEG (*.jpg;*.jpeg;*.jpe;*.jfif)'), 'image/svg+xml': ('.svg', 'SVG (*.svg);;PNG (*.png)')}[fmt] fig...
[ "Save the figure to a file." ]
Please provide a description of the function:def remove_all_thumbnails(self): for thumbnail in self._thumbnails: self.layout().removeWidget(thumbnail) thumbnail.sig_canvas_clicked.disconnect() thumbnail.sig_remove_figure.disconnect() thumbnail.sig_save_fi...
[ "Remove all thumbnails." ]
Please provide a description of the function:def remove_thumbnail(self, thumbnail): if thumbnail in self._thumbnails: index = self._thumbnails.index(thumbnail) self._thumbnails.remove(thumbnail) self.layout().removeWidget(thumbnail) thumbnail.deleteLater() ...
[ "Remove thumbnail." ]
Please provide a description of the function:def set_current_thumbnail(self, thumbnail): self.current_thumbnail = thumbnail self.figure_viewer.load_figure( thumbnail.canvas.fig, thumbnail.canvas.fmt) for thumbnail in self._thumbnails: thumbnail.highlight_canv...
[ "Set the currently selected thumbnail." ]
Please provide a description of the function:def go_previous_thumbnail(self): if self.current_thumbnail is not None: index = self._thumbnails.index(self.current_thumbnail) - 1 index = index if index >= 0 else len(self._thumbnails) - 1 self.set_current_index(index) ...
[ "Select the thumbnail previous to the currently selected one." ]
Please provide a description of the function:def go_next_thumbnail(self): if self.current_thumbnail is not None: index = self._thumbnails.index(self.current_thumbnail) + 1 index = 0 if index >= len(self._thumbnails) else index self.set_current_index(index) ...
[ "Select thumbnail next to the currently selected one." ]
Please provide a description of the function:def scroll_to_item(self, index): spacing_between_items = self.scene.verticalSpacing() height_view = self.scrollarea.viewport().height() height_item = self.scene.itemAt(index).sizeHint().height() height_view_excluding_item = max(0, hei...
[ "Scroll to the selected item of ThumbnailScrollBar." ]
Please provide a description of the function:def go_up(self): vsb = self.scrollarea.verticalScrollBar() vsb.setValue(int(vsb.value() - vsb.singleStep()))
[ "Scroll the scrollbar of the scrollarea up by a single step." ]
Please provide a description of the function:def setup_gui(self): layout = QGridLayout(self) layout.setContentsMargins(0, 0, 0, 0) layout.addWidget(self.canvas, 0, 1) layout.addLayout(self.setup_toolbar(), 0, 3, 2, 1) layout.setColumnStretch(0, 100) layout.setCo...
[ "Setup the main layout of the widget." ]
Please provide a description of the function:def setup_toolbar(self): self.savefig_btn = create_toolbutton( self, icon=ima.icon('filesave'), tip=_("Save Image As..."), triggered=self.emit_save_figure) self.delfig_btn = create_toolbutton( self, ico...
[ "Setup the toolbar." ]
Please provide a description of the function:def highlight_canvas(self, highlight): colorname = self.canvas.palette().highlight().color().name() if highlight: self.canvas.setStyleSheet( "FigureCanvas{border: 1px solid %s;}" % colorname) else: ...
[ "\n Set a colored frame around the FigureCanvas if highlight is True.\n " ]
Please provide a description of the function:def eventFilter(self, widget, event): if event.type() == QEvent.MouseButtonPress: if event.button() == Qt.LeftButton: self.sig_canvas_clicked.emit(self) return super(FigureThumbnail, self).eventFilter(widget, event)
[ "\n A filter that is used to send a signal when the figure canvas is\n clicked.\n " ]
Please provide a description of the function:def emit_save_figure(self): self.sig_save_figure.emit(self.canvas.fig, self.canvas.fmt)
[ "\n Emit a signal when the toolbutton to save the figure is clicked.\n " ]
Please provide a description of the function:def context_menu_requested(self, event): if self.fig: pos = QPoint(event.x(), event.y()) context_menu = QMenu(self) context_menu.addAction(ima.icon('editcopy'), "Copy Image", self.copy_fi...
[ "Popup context menu." ]
Please provide a description of the function:def copy_figure(self): if self.fmt in ['image/png', 'image/jpeg']: qpixmap = QPixmap() qpixmap.loadFromData(self.fig, self.fmt.upper()) QApplication.clipboard().setImage(qpixmap.toImage()) elif self.fmt == 'image/s...
[ "Copy figure to clipboard." ]
Please provide a description of the function:def blink_figure(self): if self.fig: self._blink_flag = not self._blink_flag self.repaint() if self._blink_flag: timer = QTimer() timer.singleShot(40, self.blink_figure)
[ "Blink figure once." ]
Please provide a description of the function:def clear_canvas(self): self.fig = None self.fmt = None self._qpix_buffer = [] self.repaint()
[ "Clear the figure that was painted on the widget." ]
Please provide a description of the function:def load_figure(self, fig, fmt): self.fig = fig self.fmt = fmt if fmt in ['image/png', 'image/jpeg']: self._qpix_orig = QPixmap() self._qpix_orig.loadFromData(fig, fmt.upper()) elif fmt == 'image/svg+xml': ...
[ "\n Load the figure from a png, jpg, or svg image, convert it in\n a QPixmap, and force a repaint of the widget.\n " ]
Please provide a description of the function:def paintEvent(self, event): super(FigureCanvas, self).paintEvent(event) # Prepare the rect on which the image is going to be painted : fw = self.frameWidth() rect = QRect(0 + fw, 0 + fw, self.size().width() - 2 *...
[ "Qt method override to paint a custom image on the Widget." ]
Please provide a description of the function:def python_executable_changed(self, pyexec): if not self.cus_exec_radio.isChecked(): return False def_pyexec = get_python_executable() if not is_text_string(pyexec): pyexec = to_text_string(pyexec.toUtf8(), 'utf-...
[ "Custom Python executable value has been changed" ]
Please provide a description of the function:def set_umr_namelist(self): arguments, valid = QInputDialog.getText(self, _('UMR'), _("Set the list of excluded modules as " "this: <i>numpy, scipy</i>"), ...
[ "Set UMR excluded modules name list" ]
Please provide a description of the function:def set_custom_interpreters_list(self, value): custom_list = self.get_option('custom_interpreters_list') if value not in custom_list and value != get_python_executable(): custom_list.append(value) self.set_option('custom_...
[ "Update the list of interpreters used and the current one." ]
Please provide a description of the function:def validate_custom_interpreters_list(self): custom_list = self.get_option('custom_interpreters_list') valid_custom_list = [] for value in custom_list: if (osp.isfile(value) and programs.is_python_interpreter(value) ...
[ "Check that the used custom interpreters are still valid." ]
Please provide a description of the function:def on_install(self, editor): EditorExtension.on_install(self, editor) self.setParent(editor) self.setPalette(QApplication.instance().palette()) self.setFont(QApplication.instance().font()) self.editor.panels.refresh() ...
[ "\n Extends :meth:`spyder.api.EditorExtension.on_install` method to set the\n editor instance as the parent widget.\n\n .. warning:: Don't forget to call **super** if you override this\n method!\n\n :param editor: editor instance\n :type editor: spyder.plugins.editor.wi...
Please provide a description of the function:def paintEvent(self, event): if self.isVisible() and self.position != self.Position.FLOATING: # fill background self._background_brush = QBrush(QColor( self.editor.sideareas_color)) self._foreground_pen = Q...
[ "Fills the panel background using QPalette." ]
Please provide a description of the function:def setVisible(self, visible): logger.debug('%s visibility changed', self.name) super(Panel, self).setVisible(visible) if self.editor: self.editor.panels.refresh()
[ "\n Shows/Hides the panel.\n\n Automatically call PanelsManager.refresh_panels.\n\n :param visible: Visible state\n " ]
Please provide a description of the function:def set_geometry(self, crect): x0, y0, width, height = self.geometry() if width is None: width = crect.width() if height is None: height = crect.height() # Calculate editor coordinates with their offsets ...
[ "Set geometry for floating panels.\n\n Normally you don't need to override this method, you should override\n `geometry` instead.\n " ]
Please provide a description of the function:def openssh_tunnel(self, lport, rport, server, remoteip='127.0.0.1', keyfile=None, password=None, timeout=0.4): ssh = "ssh " if keyfile: ssh += "-i " + keyfile if ':' in server: server, port = server.split(':') ssh...
[ "\n We decided to replace pyzmq's openssh_tunnel method to work around\n issue https://github.com/zeromq/pyzmq/issues/589 which was solved\n in pyzmq https://github.com/zeromq/pyzmq/pull/615\n " ]
Please provide a description of the function:def configure_namespacebrowser(self): # Update namespace view self.sig_namespace_view.connect(lambda data: self.namespacebrowser.process_remote_view(data)) # Update properties of variables self.sig_var_properties.connect(...
[ "Configure associated namespace browser widget" ]
Please provide a description of the function:def set_namespace_view_settings(self): if self.namespacebrowser: settings = to_text_string( self.namespacebrowser.get_view_settings()) code =(u"get_ipython().kernel.namespace_view_settings = %s" % se...
[ "Set the namespace view settings" ]
Please provide a description of the function:def get_value(self, name): code = u"get_ipython().kernel.get_value('%s')" % name if self._reading: method = self.kernel_client.input code = u'!' + code else: method = self.silent_execute # Wait unt...
[ "Ask kernel for a value" ]
Please provide a description of the function:def set_value(self, name, value): value = to_text_string(value) code = u"get_ipython().kernel.set_value('%s', %s, %s)" % (name, value, PY2) if self._reading: self....
[ "Set value for a variable" ]
Please provide a description of the function:def remove_value(self, name): code = u"get_ipython().kernel.remove_value('%s')" % name if self._reading: self.kernel_client.input(u'!' + code) else: self.silent_execute(code)
[ "Remove a variable" ]
Please provide a description of the function:def copy_value(self, orig_name, new_name): code = u"get_ipython().kernel.copy_value('%s', '%s')" % (orig_name, new_name) if self._reading: self.kernel_client.input(u'!' + co...
[ "Copy a variable" ]
Please provide a description of the function:def _handle_spyder_msg(self, msg): spyder_msg_type = msg['content'].get('spyder_msg_type') if spyder_msg_type == 'data': # Deserialize data try: if PY2: value = cloudpickle.loads(msg['buffer...
[ "\n Handle internal spyder messages\n " ]
Please provide a description of the function:def _handle_execute_reply(self, msg): msg_id = msg['parent_header']['msg_id'] info = self._request_info['execute'].get(msg_id) # unset reading flag, because if execute finished, raw_input can't # still be pending. self._readin...
[ "\n Reimplemented to handle communications between Spyder\n and the kernel\n " ]
Please provide a description of the function:def _handle_status(self, msg): state = msg['content'].get('execution_state', '') msg_type = msg['parent_header'].get('msg_type', '') if state == 'starting': # This is needed to show the time a kernel # has been alive i...
[ "\n Reimplemented to refresh the namespacebrowser after kernel\n restarts\n " ]
Please provide a description of the function:def closeEvent(self, event): self.plugin.dockwidget.setWidget(self.plugin) self.plugin.dockwidget.setVisible(True) self.plugin.switch_to_plugin() QMainWindow.closeEvent(self, event) self.plugin.undocked_window = None
[ "Reimplement Qt method." ]
Please provide a description of the function:def initialize_plugin_in_mainwindow_layout(self): if self.get_option('first_time', True): try: self.on_first_registration() except NotImplementedError: return self.set_option('first_time', F...
[ "\n If this is the first time the plugin is shown, perform actions to\n initialize plugin position in Spyder's window layout.\n\n Use on_first_registration to define the actions to be run\n by your plugin\n " ]
Please provide a description of the function:def update_margins(self): layout = self.layout() if self.default_margins is None: self.default_margins = layout.getContentsMargins() if CONF.get('main', 'use_custom_margin'): margin = CONF.get('main', 'custom_margin') ...
[ "Update plugin margins" ]
Please provide a description of the function:def update_plugin_title(self): if self.dockwidget is not None: win = self.dockwidget elif self.undocked_window is not None: win = self.undocked_window else: return win.setWindowTitle(self.get_plugin...
[ "Update plugin title, i.e. dockwidget or window title" ]
Please provide a description of the function:def create_dockwidget(self): # Creating dock widget dock = SpyderDockWidget(self.get_plugin_title(), self.main) # Set properties dock.setObjectName(self.__class__.__name__+"_dw") dock.setAllowedAreas(self.ALLOWED_AREAS) ...
[ "Add to parent QMainWindow as a dock widget" ]
Please provide a description of the function:def create_configwidget(self, parent): if self.CONFIGWIDGET_CLASS is not None: configwidget = self.CONFIGWIDGET_CLASS(self, parent) configwidget.initialize() return configwidget
[ "Create configuration dialog box page widget" ]
Please provide a description of the function:def get_plugin_font(self, rich_text=False): if rich_text: option = 'rich_font' font_size_delta = self.RICH_FONT_SIZE_DELTA else: option = 'font' font_size_delta = self.FONT_SIZE_DELTA return g...
[ "\n Return plugin font option.\n\n All plugins in Spyder use a global font. This is a convenience method\n in case some plugins will have a delta size based on the default size.\n " ]
Please provide a description of the function:def show_message(self, message, timeout=0): self.main.statusBar().showMessage(message, timeout)
[ "Show message in main window's status bar" ]
Please provide a description of the function:def create_toggle_view_action(self): title = self.get_plugin_title() if self.CONF_SECTION == 'editor': title = _('Editor') if self.shortcut is not None: action = create_action(self, title, ...
[ "Associate a toggle view action with each plugin" ]
Please provide a description of the function:def toggle_view(self, checked): if not self.dockwidget: return if checked: self.dockwidget.show() self.dockwidget.raise_() else: self.dockwidget.hide()
[ "Toggle view" ]
Please provide a description of the function:def close_window(self): if self.undocked_window is not None: self.undocked_window.close() self.undocked_window = None # Oddly, these actions can appear disabled after the Dock # action is pressed s...
[ "Close QMainWindow instance that contains this plugin." ]
Please provide a description of the function:def create_window(self): self.undocked_window = window = PluginWindow(self) window.setAttribute(Qt.WA_DeleteOnClose) icon = self.get_plugin_icon() if is_text_string(icon): icon = self.get_icon(icon) window.setWindo...
[ "Create a QMainWindow instance containing this plugin." ]
Please provide a description of the function:def on_top_level_changed(self, top_level): if top_level: self.undock_action.setDisabled(True) else: self.undock_action.setDisabled(False)
[ "Actions to perform when a plugin is undocked to be moved." ]
Please provide a description of the function:def cut(self): self.truncate_selection(self.header_end_pos) if self.has_selected_text(): CodeEditor.cut(self)
[ "Cut text" ]
Please provide a description of the function:def keyPressEvent(self, event): event, text, key, ctrl, shift = restore_keyevent(event) cursor_position = self.get_position('cursor') if cursor_position < self.header_end_pos: self.restrict_cursor_position(self.header_end_pos, 'e...
[ "Reimplemented Qt Method to avoid removing the header." ]
Please provide a description of the function:def _submit_to_github(self): # Get reference to the main window if self.parent() is not None: if getattr(self.parent(), 'main', False): # This covers the case when the dialog is attached # to the internal c...
[ "Action to take when pressing the submit button." ]
Please provide a description of the function:def _show_details(self): if self.details.isVisible(): self.details.hide() self.details_btn.setText(_('Show details')) else: self.resize(570, 700) self.details.document().setPlainText('') sel...
[ "Show traceback on its own dialog" ]
Please provide a description of the function:def _contents_changed(self): desc_chars = (len(self.input_description.toPlainText()) - self.initial_chars) if desc_chars < DESC_MIN_CHARS: self.desc_chars_label.setText( u"{} {}".format(DESC_MIN_CHARS...
[ "Activate submit_btn." ]
Please provide a description of the function:def unmatched_brackets_in_line(self, text, closing_brackets_type=None): if closing_brackets_type is None: opening_brackets = self.BRACKETS_LEFT.values() closing_brackets = self.BRACKETS_RIGHT.values() else: closing...
[ "\n Checks if there is an unmatched brackets in the 'text'.\n\n The brackets type can be general or specified by closing_brackets_type\n (')', ']' or '}')\n " ]
Please provide a description of the function:def _autoinsert_brackets(self, key): char = self.BRACKETS_CHAR[key] pair = self.BRACKETS_PAIR[key] line_text = self.editor.get_text('sol', 'eol') line_to_cursor = self.editor.get_text('sol', 'cursor') cursor = self.editor.tex...
[ "Control automatic insertation of brackets in various situations." ]
Please provide a description of the function:def build_montages(image_list, image_shape, montage_shape): if len(image_shape) != 2: raise Exception('image shape must be list or tuple of length 2 (rows, cols)') if len(montage_shape) != 2: raise Exception('montage shape must be list or tuple o...
[ "\n ---------------------------------------------------------------------------------------------\n author: Kyle Hounslow\n ---------------------------------------------------------------------------------------------\n Converts a list of single images into a list of 'montage' images of specified rows a...
Please provide a description of the function:def adjust_brightness_contrast(image, brightness=0., contrast=0.): beta = 0 # See the OpenCV docs for more info on the `beta` parameter to addWeighted # https://docs.opencv.org/3.4.2/d2/de8/group__core__array.html#gafafb2513349db3bcff51f54ee5592a19 retur...
[ "\n Adjust the brightness and/or contrast of an image\n\n :param image: OpenCV BGR image\n :param contrast: Float, contrast adjustment with 0 meaning no change\n :param brightness: Float, brightness adjustment with 0 meaning no change\n " ]
Please provide a description of the function:def put_text(img, text, org, font_face, font_scale, color, thickness=1, line_type=8, bottom_left_origin=False): # Break out drawing coords x, y = org # Break text into list of text lines text_lines = text.split('\n') # Get height of text lines in p...
[ "Utility for drawing text with line breaks\n\n :param img: Image.\n :param text: Text string to be drawn.\n :param org: Bottom-left corner of the first line of the text string in the image.\n :param font_face: Font type. One of FONT_HERSHEY_SIMPLEX, FONT_HERSHEY_PLAIN, FONT_HERSHEY_DUPLEX,\n ...
Please provide a description of the function:def put_centered_text(img, text, font_face, font_scale, color, thickness=1, line_type=8): # Save img dimensions img_h, img_w = img.shape[:2] # Break text into list of text lines text_lines = text.split('\n') # Get height of text lines in pixels (he...
[ "Utility for drawing vertically & horizontally centered text with line breaks\n\n :param img: Image.\n :param text: Text string to be drawn.\n :param font_face: Font type. One of FONT_HERSHEY_SIMPLEX, FONT_HERSHEY_PLAIN, FONT_HERSHEY_DUPLEX,\n FONT_HERSHEY_COMPLEX, FONT_HERSHEY_TRI...
Please provide a description of the function:def corners_to_keypoints(corners): if corners is None: keypoints = [] else: keypoints = [cv2.KeyPoint(kp[0][0], kp[0][1], 1) for kp in corners] return keypoints
[ "function to take the corners from cv2.GoodFeaturesToTrack and return cv2.KeyPoints" ]
Please provide a description of the function:def path_to_url(path): path = os.path.normpath(os.path.abspath(path)) url = urlparse.urljoin("file:", urllib2.pathname2url(path)) return url
[ "\n Convert a path to a file: URL. The path will be made absolute and have\n quoted path parts.\n " ]
Please provide a description of the function:def is_installable_dir(path): if not os.path.isdir(path): return False setup_py = os.path.join(path, "setup.py") if os.path.isfile(setup_py): return True return False
[ "Return True if `path` is a directory containing a setup.py file." ]