ui#
Various generic utility classes and functions used to define the UI.
- bookmarks.ui.MESSAGE_BOX_STYLESHEET#
Stylesheet used to style our custom
QMessageBox
.- Type:
str
- bookmarks.ui.PUSH_BUTTON_STYLESHEET#
Stylesheet used to style our custom
QPushButton
.- Type:
str
Classes:
|
Generic list model used to store custom data. |
|
A utility class for creating a square icon button. |
|
Informative message box used for notifying the user of an error. |
|
Custom QLabel used by the GalleryWidget to display an image. |
|
A generic gallery widget used to let the user pick an item. |
|
|
|
Custom line edit widget with a single underline. |
|
Widget used to display a status message over the list widget. |
|
A custom list widget used to display selectable item. |
|
A custom list widget used to display selectable item. |
Custom delegate to display label-like QListWidgetItems. |
|
|
Informative message box used for notifying the user of an event. |
|
Informative message box used for notifying the user of success. |
|
Custom button class. |
|
QLabel used for static aliased label. |
Functions:
|
Utility method for adding a description field. |
|
Utility method for creating a label. |
|
Utility method for adding a line editor. |
|
Utility method for creating a row widget. |
|
Utility method for creating a group widget. |
|
Utility method for retuning a QIcon to use in the context menu. |
|
A progress bar used during the conversion process. |
|
Paints a decorative background icon to the middle of the given widget. |
- class bookmarks.ui.AbstractListModel(parent=None)[source]#
Bases:
QAbstractListModel
Generic list model used to store custom data.
Methods:
data
(self, index[, role])flags
(self, index)index
(self, row[, column, parent])rowCount
(self[, parent])- data(self, index: PySide2.QtCore.QModelIndex, role: int = PySide2.QtCore.Qt.ItemDataRole.DisplayRole) Any [source]#
- class bookmarks.ui.ClickableIconButton(pixmap, colors, size, description='', state=False, parent=None)[source]#
Bases:
QLabel
A utility class for creating a square icon button.
- Parameters:
pixmap (str) – The name of the resource file without the extension.
colors (tuple(QColor, QColor)) – A tuple of QColors, for enabled and
disabled states.
size (int) – The value for width and height.
description (str) – A user readable description of the action the button performs.
state (bool) – Optional button state. ‘False’ by default.
parent (QObject) – The widget’s parent.
- Signals:
clicked (QtCore.Signal()): doubleClicked (QtCore.Signal()): message (QtCore.Signal(str)):
- Returns:
Description of returned object.
- Return type:
type
Methods:
contextMenuEvent
(event)Event handler.
enterEvent
(event)Event handler.
leaveEvent
(event)Event handler.
mouseDoubleClickEvent
(event)Event handler.
mouseReleaseEvent
(event)Event handler.
paintEvent
(event)Event handler.
pixmap
(self)
- class bookmarks.ui.ErrorBox(*args, **kwargs)[source]#
Bases:
MessageBox
Informative message box used for notifying the user of an error.
- class bookmarks.ui.GalleryItem(label, data, thumbnail, height=common.size(common.size_row_height) * 2, parent=None)[source]#
Bases:
QLabel
Custom QLabel used by the GalleryWidget to display an image.
- Parameters:
label (str) – An informative label.
data (str) – The item’s data. This will be emitted by the clicked signal.
thumbnail (str) – Path to an image file.
height (int or float, optional) – The item’s width/height in pixels.
Methods:
enterEvent
(self, event)leaveEvent
(self, event)mouseReleaseEvent
(self, ev)paintEvent
(self, arg__1)
- class bookmarks.ui.GalleryWidget(columns=5, item_height=common.size(common.size_row_height) * 2, label='Pick an item', parent=None)[source]#
Bases:
QDialog
A generic gallery widget used to let the user pick an item.
- itemSelected#
Emitted when the user clicks the item.
- Type:
Signal -> str
Methods:
Initializes data.
Abstract method used to generate the values needed to display items.
paintEvent
(self, event)showEvent
(event)Show event handler.
- class bookmarks.ui.Label(text, color=common.color(common.color_secondary_text), parent=None)[source]#
Bases:
QLabel
Methods:
enterEvent
(event)Event handler.
leaveEvent
(event)Event handler.
showEvent
(event)Event handler.
- class bookmarks.ui.LineEdit(parent=None)[source]#
Bases:
QLineEdit
Custom line edit widget with a single underline.
- class bookmarks.ui.ListOverlayWidget(parent=None)[source]#
Bases:
QWidget
Widget used to display a status message over the list widget.
Methods:
paintEvent
(event)Custom paint event used to paint the widget's message.
- class bookmarks.ui.ListViewWidget(default_message='No items', default_icon='icon', parent=None)[source]#
Bases:
QListView
A custom list widget used to display selectable item.
Methods:
eventFilter
(widget, event)Event filter handler.
mouseMoveEvent
(self, e)resizeEvent
(self, e)
- class bookmarks.ui.ListWidget(default_message='No items', default_icon='icon', parent=None)[source]#
Bases:
QListWidget
A custom list widget used to display selectable item.
Methods:
addItem
(-> None)eventFilter
(widget, event)Event filter handler.
resizeEvent
(self, e)
- class bookmarks.ui.ListWidgetDelegate[source]#
Bases:
QStyledItemDelegate
Custom delegate to display label-like QListWidgetItems.
Methods:
createEditor
(parent, option, index)Custom editor for editing the template's name.
paint
(self, painter, option, index)sizeHint
(self, option, index)updateEditorGeometry
(editor, option, index)Updates the size of the editor widget.
- paint(self, painter: PySide2.QtGui.QPainter, option: PySide2.QtWidgets.QStyleOptionViewItem, index: PySide2.QtCore.QModelIndex) None [source]#
- class bookmarks.ui.MessageBox(*args, **kwargs)[source]#
Bases:
QDialog
Informative message box used for notifying the user of an event.
- buttonClicked#
Emitted when the user click a button.
- Type:
Signal -> str
Methods:
- class bookmarks.ui.OkBox(*args, **kwargs)[source]#
Bases:
MessageBox
Informative message box used for notifying the user of success.
- class bookmarks.ui.PaintedButton(text, height=None, width=None, parent=None)[source]#
Bases:
QPushButton
Custom button class.
Methods:
paintEvent
(event)Event handler.
- class bookmarks.ui.PaintedLabel(text, color=common.color(common.color_text), size=common.size(common.size_font_medium), parent=None)[source]#
Bases:
QLabel
QLabel used for static aliased label.
Methods:
enterEvent
(event)Event handler.
leaveEvent
(event)Event handler.
paintEvent
(event)Event handler.
- bookmarks.ui.add_description(text, label=' ', color=common.color(common.color_secondary_text), padding=common.size(common.size_margin), parent=None)[source]#
Utility method for adding a description field.
- Returns:
the added QLabel.
- Return type:
QLabel
- bookmarks.ui.add_label(text, parent=None)[source]#
Utility method for creating a label.
- Returns:
label widget.
- Return type:
QLabel
- bookmarks.ui.add_line_edit(label, parent=None)[source]#
Utility method for adding a line editor.
- Returns:
line editor widget.
- Return type:
QLineEdit
- bookmarks.ui.add_row(label, color=common.color(common.color_secondary_text), padding=common.size(common.size_margin), height=common.size(common.size_row_height), cls=None, vertical=False, parent=None)[source]#
Utility method for creating a row widget.
- Returns:
The newly created row.
- Return type:
QWidget
- bookmarks.ui.get_group(parent=None, vertical=True, margin=common.size(common.size_margin))[source]#
Utility method for creating a group widget.
- Returns:
group widget.
- Return type:
QGroupBox
- bookmarks.ui.get_icon(name, color=common.color(common.color_disabled_text), size=common.size(common.size_row_height), opacity=1.0, resource=common.GuiResource)[source]#
Utility method for retuning a QIcon to use in the context menu.
- Parameters:
name (str) – The name of the icon.
color (QColor or None) – The color of the icon.
size (QtGui.QSize or None) – The size of the icon.
opacity (float) – The opacity of the icon.
resource (str) – The resource source for the icon.
- Returns:
The QIcon.
- Return type:
QtGui.QIcon
- bookmarks.ui.get_progress_bar(title, label, start, end, parent=None)[source]#
A progress bar used during the conversion process.
- Parameters:
title (str) – The title of the progress bar window.
label (str) – The current progress description.
start (int) – The range start.
end (int) – The range end.
parent (QObject, optional) – A QWidget instance
- Returns:
A widget instance.
- Return type:
QProgressBar