svgen.display
index
/home/vkottler/src/vkottler/workspace/svgen/svgen/display.py

A module for working with common display assets.

 
Classes
       
builtins.tuple(builtins.object)
AspectRatio

 
class AspectRatio(builtins.tuple)
    AspectRatio(width: int, height: int, final: bool = False)
 
A class to storge a width and height ratio.
 
 
Method resolution order:
AspectRatio
builtins.tuple
builtins.object

Methods defined here:
__eq__(self, other) -> bool
Determine if two aspect ratios are equivalent.
__getnewargs__(self)
Return self as a plain tuple.  Used by copy and pickle.
__repr__(self)
Return a nicely formatted representation string
__str__(self) -> str
Get this aspect ratio as a string.
_asdict(self)
Return a new dict which maps field names to their values.
_replace(self, /, **kwds)
Return a new AspectRatio object replacing specified fields with new values
as_str(self, delim: str = ':') -> str
Get this aspect ratio as a string.
rotate(self) -> 'AspectRatio'
Get this aspect ratio rotated.

Class methods defined here:
_make(iterable) from builtins.type
Make a new AspectRatio object from a sequence or iterable

Static methods defined here:
__new__(_cls, width: int, height: int, final: bool = False)
Create new instance of AspectRatio(width, height, final)
create(wxh: str, delim: str = ':') -> 'AspectRatio'
Create an aspect ration from a string.

Readonly properties defined here:
args
Get inkscape command-line arguments.
landscape
Determine if this ratio is landscape.
over_height
Express this ratio as one of width over height.
portrait
Determine if this ratio is portrait.
square
Determine if this is a square aspect ratio.

Data descriptors defined here:
width
Alias for field number 0
height
Alias for field number 1
final
Alias for field number 2

Data and other attributes defined here:
__annotations__ = {'final': <class 'bool'>, 'height': <class 'int'>, 'width': <class 'int'>}
__match_args__ = ('width', 'height', 'final')
__orig_bases__ = (<function NamedTuple>,)
_field_defaults = {'final': False}
_fields = ('width', 'height', 'final')

Methods inherited from builtins.tuple:
__add__(self, value, /)
Return self+value.
__contains__(self, key, /)
Return bool(key in self).
__ge__(self, value, /)
Return self>=value.
__getattribute__(self, name, /)
Return getattr(self, name).
__getitem__(self, key, /)
Return self[key].
__gt__(self, value, /)
Return self>value.
__hash__(self, /)
Return hash(self).
__iter__(self, /)
Implement iter(self).
__le__(self, value, /)
Return self<=value.
__len__(self, /)
Return len(self).
__lt__(self, value, /)
Return self<value.
__mul__(self, value, /)
Return self*value.
__ne__(self, value, /)
Return self!=value.
__rmul__(self, value, /)
Return value*self.
count(self, value, /)
Return number of occurrences of value.
index(self, value, start=0, stop=9223372036854775807, /)
Return first index of value.
 
Raises ValueError if the value is not present.

Class methods inherited from builtins.tuple:
__class_getitem__(...) from builtins.type
See PEP 585

 
Functions
       
common_sizes(ratio: Union[str, svgen.display.AspectRatio, svgen.attribute.viewbox.ViewBox]) -> Iterator[svgen.display.AspectRatio]
Iterate over common sizes for a given aspect ratio.
isclose(a, b, *, rel_tol=1e-09, abs_tol=0.0)
Determine whether two floating point numbers are close in value.
 
  rel_tol
    maximum difference for being considered "close", relative to the
    magnitude of the input values
  abs_tol
    maximum difference for being considered "close", regardless of the
    magnitude of the input values
 
Return True if a is close in value to b, and False otherwise.
 
For the values to be considered close, the difference between them
must be smaller than at least one of the tolerances.
 
-inf, inf and NaN behave similarly to the IEEE 754 Standard.  That
is, NaN is not close to anything, even itself.  inf and -inf are
only close to themselves.

 
Data
        COMMON_RATIOS = ['16:9', '16:10', '4:3', '5:4', '1:1', '256:135', '32:9', '21:9', '3:2', '4:1']
COMMON_SIZES = {'1200:480': [AspectRatio(width=1200, height=480, final=True)], '16:10': [AspectRatio(width=1280, height=800, final=True), AspectRatio(width=1920, height=1200, final=True)], '16:9': [AspectRatio(width=1366, height=768, final=True), AspectRatio(width=1920, height=1080, final=True), AspectRatio(width=2560, height=1440, final=True)], '17:9': [AspectRatio(width=4096, height=2160, final=True)], '189:124': [AspectRatio(width=3024, height=1984, final=True)], '1:1': [AspectRatio(width=512, height=512, final=True), AspectRatio(width=1024, height=1024, final=True), AspectRatio(width=1920, height=1920, final=True), AspectRatio(width=16, height=16, final=True), AspectRatio(width=24, height=24, final=True), AspectRatio(width=32, height=32, final=True), AspectRatio(width=64, height=64, final=True), AspectRatio(width=128, height=128, final=True), AspectRatio(width=256, height=256, final=True)], '205:78': [AspectRatio(width=820, height=312, final=True)], '21:9': [AspectRatio(width=2560, height=1080, final=True), AspectRatio(width=3440, height=1440, final=True)], '2560:423': [AspectRatio(width=2560, height=423, final=True)], '32:9': [AspectRatio(width=3840, height=1080, final=True), AspectRatio(width=5120, height=1440, final=True)], ...}
DEFAULT_DELIM = ':'
ICON_SIZES = [16, 24, 32, 64, 128, 256]
Iterator = typing.Iterator
List = typing.List
Union = typing.Union