# pyqode.core.panels

This package contains the core panels

class `pyqode.core.panels.``LineNumberPanel`

  Bases: `pyqode.core.api.panel.Panel`

  The liner number panel displays the document line numbers.

  `cancel_selection`()

    Cancel line selection.

  `leaveEvent`(event)

    Cancels selection

  `line_number_area_width`()

    Computes the lineNumber area width depending on the number of lines in the document

    Returns: | Widtg

  `mouseMoveEvent`(e)

    Updates end of selection if we are currently selecting

  `mousePressEvent`(e)

    Starts selecting

  `mouseReleaseEvent`(event)

    Cancels selection

  `paintEvent`(event)

    Paints the line numbers

  `sizeHint`()

    Returns the panel size hint (as the panel is on the left, we only need to compute the width

class `pyqode.core.panels.``Marker`(position, icon='', description='', parent=None)

  Bases: `pyqode.core.qt.QtCore.QObject`

  A marker is an icon draw on a marker panel at a specific line position and with a possible tooltip.

  `description`

    Gets the marker description.

  `icon`

    Gets the icon file name. Read-only.

  `position`

    Gets the marker position (line number) :type: int

class `pyqode.core.panels.``MarkerPanel`

  Bases: `pyqode.core.api.panel.Panel`

  This panels takes care of drawing icons at a specific line number.

  Use addMarker, removeMarker and clearMarkers to manage the collection of displayed makers.

  You can create a user editable panel (e.g. a breakpoints panel) by using the following signals:

  > - `pyqode.core.panels.MarkerPanel.add_marker_requested`
  > - `pyqode.core.panels.MarkerPanel.remove_marker_requested`

  `add_marker`(marker)

    Adds the marker to the panel.

    Parameters: | marker (pyqode.core.Marker) – Marker to add

  `clear_markers`()

    Clears the markers list

  `leaveEvent`(*args, **kwargs)

    Hide tooltip when leaving the panel region.

  `marker_for_line`(line)

    Returns the marker that is displayed at the specified line number if any.

    Parameters: | line – The marker line.
    Returns: | Marker of None
    Return type: | pyqode.core.Marker

  `mouseMoveEvent`(event)

    Requests a tooltip if the cursor is currently over a marker.

  `mousePressEvent`(event)

    Handle mouse press:

    > - emit add marker signal if there were no marker under the mouse cursor
    > - emit remove marker signal if there were one or more markers under the mouse cursor.

  `remove_marker`(marker)

    Removes a marker from the panel

    Parameters: | marker (pyqode.core.Marker) – Marker to remove

  `sizeHint`()

    Returns the panel size hint. (fixed with of 16px)

class `pyqode.core.panels.``SearchAndReplacePanel`

  Bases: `pyqode.core.api.panel.Panel`, `pyqode.core.ui.search_panel_ui.Ui_SearchPanel`

  This panel allow the user to search and replace some text in the current editor.

  It uses the QTextDocument API to search for some text. Search operation is performed in a background thread.

  The search panel can also be used programatically.

  To do that, the client code first requests a search using `requestSearch()` and connects to `search_finished`.

  The results of the search can then be retrieved using `cptOccurrences` and `getOccurrences()`.

  The client code may now navigate through occurrences using `select_next()` or `select_previous()`, or replace the occurrences with a specific text using `replace()` or `replace_all()`.

  `close_panel`()

    Closes the panel

  `get_occurences`()

    Returns the list of text occurrences.

    An occurrence is a tuple that contains start and end positions.

    Returns: | List of tuple(int, int)

  `replace`(text=None)

    Replaces the selected occurrence.

    Parameters: | text – The replacement text. If it is None, the lineEditReplace’s text is used instead.

    :return True if the text could be replace properly, False if there is
      no more occurrences to replace.
  `replace_all`(text=None)

    Replaces all occurrences in the editor’s document.

    Parameters: | text – The replacement text. If None, the content of the lineEdit replace will be used instead

  `request_search`(txt=None)

    Requests a search operation.

    Parameters: | txt – The text to replace. If None, the content of lineEditSearch is used instead.

  `select_next`()

    Selects the next occurrence.

    Returns: | True in case of success, false if no occurrence could be selected.

  `select_previous`()

    Selects previous occurrence.

    Returns: | True in case of success, false if no occurrence could be selected.

  `background`

    Text decoration background

  `foreground`

    Text decoration foreground