Application.images#

This is responsible for serving images to the GUI. This can be extended to receiving images from the DoPy server when it becomes a reality.

Attributes#

Classes#

Image

Dataclass that stores images that are served by the ImageManager. Dearpygui cannot display PImage.Image from Pillow

ImageManager

Does what the name suggests, creates Images. Regardless of wherever it is from, the interface stays the same

Functions#

next_available_path(→ pathlib.Path)

Module Contents#

Application.images.logger#
Application.images.next_available_path(path: pathlib.Path) pathlib.Path#
class Application.images.Image(path: pathlib.Path, raw_image: PIL.Image.Image, main_image_dimensions, thumbnail_dimensions)#

Dataclass that stores images that are served by the ImageManager. Dearpygui cannot display PImage.Image from Pillow directly, so this converts the image into a numpy array that dearpygui can display as a texture. The image is also padded with black borders if it’s aspect ratio doesn’t fit the ImageWindow.

_version#
path#
raw_image#
main_image_dimensions#
thumbnail_dimensions#
save()#
dpg_texture()#
thumbnail()#
dpg_raw()#
get_scaled_image(factor=0.15)#
classmethod frompath(path: pathlib.Path, main_image_dimensions: Tuple[int, int], thumbnail_dimensions: Tuple[int, int], _version=None)#

Creates an Image object from the path of the image.

Args:

path (Path): Path to the image

Returns:

Image

classmethod fromserver(roll, id)#

Implement this function when the server is up and running. This doesn’t work right now.

Args:

roll (str): id (str):

class Application.images.ImageManager(mode: Literal['online', 'offline'], main_image_dimensions, thumbnail_dimensions)#

Does what the name suggests, creates Images. Regardless of wherever it is from, the interface stays the same

mode#
current_index = 0#
main_image_dimensions#
thumbnail_dimensions#
images: list[pathlib.Path] = []#
classmethod from_path(path: pathlib.Path, main_image_dimensions, thumbnail_dimensions)#
classmethod from_file_list(files: list[pathlib.Path], main_image_dimensions, thumbnail_dimensions)#
classmethod from_server(url)#
end_index()#
load(index, force_reload=False)#

Returns an Image object, given an index

Args:

index (int): The index of the roll that needs to be loaded

Returns:

load_in_background()#

Loads all the images in the background using ShittMultiThreading from utils.py This works because the images are cached.

peek(index)#

Returns an image object without moving the current_index

Args:

index (int): The index of the image we want to view

Returns: Image

next()#

Helper function to peek the next image

Returns:

Image

previous()#

Helper function to peek the previous image

Returns:

Image