Db Object

El objeto unico llamado db, se encarga de guardar y cargar los tamaños de una imagen determinada. El guardado solo deberia ser usado en las versiones de ordenador del juego.

object gallerynpy.db

The only instance for the SizesDb class. A reassignment is not recommended.

contains(path: str, named: bool = False, folder: str = None) bool

Checks if there is a size for the given path.

Parameters:
  • path – The image filepath or image name.

  • named – If true, the path is considered as an image name.

  • folder – The base folder of the path. If given, will be joined with the path param.

get_size(path: str, named: bool = False, folder: str = None) Size | None

Gets from the json object the size for the given path.

Parameters:
  • path – The image filepath or image name.

  • named – If true, the path is considered as an image name.

  • folder – The base folder of the path. If given, will be joined with the path param.

Returns:

The size for the path or None if it doesn’t present.

put_size(path: str, size: Size, named: bool = False, folder: str = None)

Puts from the json object the size for the given path.

Parameters:
  • path – The image filepath or image name.

  • size – The image size to put.

  • named – If true, the path is considered as an image name.

  • folder – The base folder of the path. If given, will be joined with the path param.

save()

Saves the current json object as a json file.