Panels¶
This page contains documentation about the available pcef panels.
Folding Panel¶
Contains the generic panels (used by the generic code editor widget)
- class pcef.panels.folding.FoldIndicator(start, end)[source]¶
A fold marker is used by the FoldPanel to display code folding indicators.
A fold marker is defined by two line number (start and end) and a boolean property that tells whether the code block is folded or not.
- end = None¶
End line
- folded = None¶
Is folded ?
- hover = None¶
Is hover ?
- start = None¶
Start line
- class pcef.panels.folding.FoldPanel(parent=None)[source]¶
This Panel display folding indicators and manage folding/unfolding a text
The panel also handles line added/removed and update the indicators position automatically.
Note
It does not parse the code to put fold indicators, this is the task of a code folder mode. Instead it provides an easy way for other modes to put fold indicators on the left margin.
- IDENTIFIER = 'Folding'¶
Panel identifier
- addIndicator(start, end)[source]¶
Adds a fold indicator :param start: Start line (1 based) :param end: End line
Line numbers Panel¶
Contains the generic panels (used by the generic code editor widget)
Markers Panel¶
Contains the generic panels (used by the generic code editor widget)
- class pcef.panels.marker.Marker(position, icon, tooltip='')[source]¶
A marker is a rect drawn on a MarkersPanel at a specific block position.
- Fields:
- position: block count
- icon: QIcon to draw
- tooltip: text shown when mouse is over the marker
- class pcef.panels.marker.MarkersPanel(name, markersReadOnly=False, parent=None)[source]¶
Panel used to draw a collection of marker. A marker is 16x16 icon placed at a specific line number.
A marker is added/removed when the user click on the the widget or manually (using addMarker).
Actually if there is no marker where the user clicked, the markerAddRequested signal is emitted as we don’t known what kind of marker we must add.
When a marker is removed by the user, the markerRemoved signal is emitted.
Note
The markers position is updated whenever a line is added/removed.
Note
The markers list is cleared when a new text is set on the text edit (see QCodeEdit.newTextSet signal)
Note
If a marker goes out of documents (line number <= 0) the markerOutOfDoc is emitted.
- QSS = 'QToolTip {\n background-color: %(back)s;\n color: %(color)s;\n border: 1px solid %(color)s;\n padding: 2px;\n opacity: 220;\n }\n '¶
Stylesheet
- addMarkerRequested = <PySide.QtCore.Signal object at 0xab9efe0>¶
Signal emitted with the line number where the marker must be added
- clearingMarkers = <PySide.QtCore.Signal object at 0xaba6080>¶
Signal emitted before clearing the markers when a new text is set to give
- leaveEvent(event)[source]¶
Resets prev line to -1 when we leave otherwise the tooltip won’t be shown next time we hover the marker
- markerOutOfDoc = <PySide.QtCore.Signal object at 0xaba6040>¶
Signal emitted when a marker is out of the document. This usually
- markerRemoved = <PySide.QtCore.Signal object at 0xaba6020>¶
Signal emitted when a marker is removed by the user.
- markersReadOnly = None¶
prevent user from adding/removing markers with mouse click
- onLinesAdded(nbLines, tcPos, tcPosInBlock)[source]¶
Offsets markers positions with the number of line added
Search and replace Panel¶
Contains the search and replace Panel
- class pcef.panels.search_and_replace.QSearchPanel(parent=None)[source]¶
Search (& replace) Panel. Allow the user to search for content in the editor
All occurrences are highlighted using text decorations.
The occurrence under the cursor is selected using the find method of the plain text edit. User can go backward and forward.
The Panel add a few actions to the editor menu(search, replace, next, previous, replace, replace all)
The Panel is shown with ctrl-f for a search, ctrl-r for a search and replace.
The Panel is hidden with ESC or by using the close button (white cross).
Note
The widget use a custom ui designed in Qt Designer
- QSS = 'QWidget\n {\n background-color: %(bck)s;\n color: %(color)s;\n }\n\n QLineEdit\n {\n background-color: %(txt_bck)s;\n border: 1px solid %(highlight)s;\n border-radius: 3px;\n }\n\n QLineEdit:hover, QLineEdit:focus\n {\n border: 1px solid %(color)s;\n border-radius: 3px;\n }\n\n QPushButton\n {\n background-color: transparent;\n }\n\n QPushButton:hover\n {\n background-color: %(highlight)s;\n border: none;\n border-radius: 5px;\n color: %(color)s;\n }\n\n QPushButton:pressed\n {\n background-color: %(highlight)s;\n border: 2px black;\n border-radius: 5px;\n color: %(color)s;\n }\n\n QPushButton:disabled\n {\n color: %(highlight)s;\n }\n\n QCheckBox:hover\n {\n background-color: %(highlight)s;\n color: %(color)s;\n border-radius: 5px;\n }\n '¶
Stylesheet
- highlightOccurrences(txt, selectFirst=False)[source]¶
Highlights occurrences
Parameters: - txt – Text to highlight
- selectFirst – True to select the first occurrence
- numOccurrences¶
Nb occurrences detected
- numOccurrencesChanged = <PySide.QtCore.Signal object at 0xab9e6c0>¶
Emitted when the nbr of occurences has changed
Misc panels¶
Contains miscellaneous panels not used by the editors but that could be useful for the end user (at least them are examples or custom panels)