Application.images ================== .. py:module:: Application.images .. autoapi-nested-parse:: 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 ---------- .. autoapisummary:: Application.images.logger Classes ------- .. autoapisummary:: Application.images.Image Application.images.ImageManager Functions --------- .. autoapisummary:: Application.images.next_available_path Module Contents --------------- .. py:data:: logger .. py:function:: next_available_path(path: pathlib.Path) -> pathlib.Path .. py:class:: 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. .. py:attribute:: _version .. py:attribute:: path .. py:attribute:: raw_image .. py:attribute:: main_image_dimensions .. py:attribute:: thumbnail_dimensions .. py:method:: save() .. py:method:: dpg_texture() .. py:method:: thumbnail() .. py:method:: dpg_raw() .. py:method:: get_scaled_image(factor=0.15) .. py:method:: frompath(path: pathlib.Path, main_image_dimensions: Tuple[int, int], thumbnail_dimensions: Tuple[int, int], _version=None) :classmethod: Creates an Image object from the path of the image. Args: path (Path): Path to the image Returns: Image .. py:method:: fromserver(roll, id) :classmethod: Implement this function when the server is up and running. This doesn't work right now. Args: roll (str): id (str): .. py:class:: 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 .. py:attribute:: mode .. py:attribute:: current_index :value: 0 .. py:attribute:: main_image_dimensions .. py:attribute:: thumbnail_dimensions .. py:attribute:: images :type: list[pathlib.Path] :value: [] .. py:method:: from_path(path: pathlib.Path, main_image_dimensions, thumbnail_dimensions) :classmethod: .. py:method:: from_file_list(files: list[pathlib.Path], main_image_dimensions, thumbnail_dimensions) :classmethod: .. py:method:: from_server(url) :classmethod: .. py:method:: end_index() .. py:method:: 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: .. py:method:: load_in_background() Loads all the images in the background using ShittMultiThreading from utils.py This works because the images are cached. .. py:method:: 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 .. py:method:: next() Helper function to peek the next image Returns: Image .. py:method:: previous() Helper function to peek the previous image Returns: Image