naturtag.widgets.images module#

Generic image widgets and base classes for other page-specific widgets. Includes plain images, cards, scrollable lists, and fullscreen image views.

class naturtag.widgets.images.FAIcon(icon_str, parent=None, secondary=False, size=(32, 32))#

Bases: QLabel

A QLabel for displaying a FontAwesome icon

set_enabled(enabled=True)#
staticMetaObject = PySide6.QtCore.QMetaObject("FAIcon" inherits "QLabel": )#
class naturtag.widgets.images.FullscreenPhoto(*args, **kwargs)#

Bases: NavButtonsMixin, PixmapLabel

A fullscreen photo widget with nav buttons

staticMetaObject = PySide6.QtCore.QMetaObject("FullscreenPhoto" inherits "PixmapLabel": )#
class naturtag.widgets.images.HoverIcon(*args, **kwargs)#

Bases: FAIcon

IconLabel with a hover effect and click event

mousePressEvent(_)#

Placeholder to accept mouse press events

mouseReleaseEvent(self, ev: PySide6.QtGui.QMouseEvent) None#
on_click#
staticMetaObject = PySide6.QtCore.QMetaObject("HoverIcon" inherits "FAIcon": Methods:   #47 type=Signal, signature=on_click(PyObject), parameters=PyObject )#
class naturtag.widgets.images.HoverMixin(*args, hover_icon=False, hover_event=True, **kwargs)#

Bases: object

Mixin that adds a transparent overlay to darken the image on hover (handled in QSS)

Parameters:
  • hover_icon (bool) – Add an ‘open’ icon on hover

  • hover_event (bool) – Set to False to disable overlay on hover (e.g., to use parent widget hover event instead)

enterEvent(event)#
leaveEvent(event)#
resizeEvent(event)#
class naturtag.widgets.images.HoverPhoto(*args, hover_icon=False, hover_event=True, **kwargs)#

Bases: HoverMixin, PixmapLabel

PixmapLabel with a hover effect

staticMetaObject = PySide6.QtCore.QMetaObject("HoverPhoto" inherits "PixmapLabel": )#
class naturtag.widgets.images.IconLabel(icon_str, text, size=(32, 32), parent=None, **kwargs)#

Bases: QWidget

set_text(text)#
staticMetaObject = PySide6.QtCore.QMetaObject("IconLabel" inherits "QWidget": )#
class naturtag.widgets.images.IconLabelList(parent=None)#

Bases: QWidget

Widget that uses a grid to display a list of icons with labels

add_line(icon_str, text, size=22, **kwargs)#
clear()#
staticMetaObject = PySide6.QtCore.QMetaObject("IconLabelList" inherits "QWidget": )#
class naturtag.widgets.images.ImageWindow#

Bases: StylableWidget

Display local images in fullscreen as a separate window

Keyboard shortcuts: Escape to close window, Left and Right to cycle through images

display_image_fullscreen(selected_path, image_paths)#

Open window to a selected image, and save other available image paths for navigation

property idx: int#

The index of the currently selected image

on_remove#

Request for image to be removed from list

remove_image()#

Remove the current image from the list

select_image_idx(idx)#

Select an image by index

select_next_image()#
select_prev_image()#
set_pixmap_path(path)#
staticMetaObject = PySide6.QtCore.QMetaObject("ImageWindow" inherits "StylableWidget": Methods:   #34 type=Signal, signature=on_remove(PyObject), parameters=PyObject )#
wrap_idx(increment)#

Increment and wrap the index around to the other side of the list

class naturtag.widgets.images.InfoCard(card_id=None)#

Bases: StylableWidget

Card containing a thumbnail and additional details

add_row(item)#

Add a layout or widget as a row of info to the card

enterEvent(event)#

Note on hover effect: * Thumbnail: this method triggers overlay * Card background: Handled in QSS

leaveEvent(self, event: PySide6.QtCore.QEvent) None#
mousePressEvent(_)#

Placeholder to accept mouse press events

mouseReleaseEvent(self, event: PySide6.QtGui.QMouseEvent) None#
on_click#
staticMetaObject = PySide6.QtCore.QMetaObject("InfoCard" inherits "StylableWidget": Methods:   #34 type=Signal, signature=on_click(int), parameters=int )#
class naturtag.widgets.images.InfoCardList(parent=None)#

Bases: StylableWidget

A scrollable list of InfoCards

add_card(card, thumbnail_url, idx=None)#

Add a card immediately, and load its thumbnail from a separate thread

property cards: Iterator[InfoCard]#
clear()#
contains(card_id)#
Return type:

bool

get_card_by_id(card_id)#
Return type:

Optional[InfoCard]

move_card(card_id, idx=0)#

Move a card to the specified position, if found; return False otherwise

Return type:

bool

staticMetaObject = PySide6.QtCore.QMetaObject("InfoCardList" inherits "StylableWidget": )#
class naturtag.widgets.images.NavButtonsMixin(*args, **kwargs)#

Bases: object

Mixin for fullscreen images that adds left and right navigation buttons

resizeEvent(event)#

Position nav buttons on left/right center

class naturtag.widgets.images.PixmapLabel(parent=None, pixmap=None, path=None, url=None, description=None, resample=True, rounded=False, scale=True, idx=0)#

Bases: QLabel

A QLabel containing a pixmap that preserves its aspect ratio when resizing, with optional description text

clear(self) None#
heightForWidth(width)#
Return type:

int

mousePressEvent(_)#

Placeholder to accept mouse press events

mouseReleaseEvent(self, ev: PySide6.QtGui.QMouseEvent) None#
on_click#
paintEvent(event)#

Optionally draw rounded corners and/or image description text

resizeEvent(self, event: PySide6.QtGui.QResizeEvent) None#
scaledPixmap()#
Return type:

QPixmap

setPixmap(pixmap)#
sizeHint()#
Return type:

QSize

staticMetaObject = PySide6.QtCore.QMetaObject("PixmapLabel" inherits "QLabel": Methods:   #47 type=Signal, signature=on_click(QLabel*), parameters=QLabel* )#
naturtag.widgets.images.format_int(value)#
Return type:

str

naturtag.widgets.images.set_pixmap(pixmap_label, *args, **kwargs)#

Fetch an image from either a local path or remote URL.

naturtag.widgets.images.set_pixmap_async(pixmap_label, priority=Priority.NormalPriority, **kwargs)#

Fetch an image from a separate thread, and render it in the main thread when complete