pytwitcher.cache.PixmapLoader

class pytwitcher.cache.PixmapLoader(session)[source]

Bases: dict

A dict like object that can loads and stores pixmaps

Keys are urls to pictures. Values are QtGui.QPixmap. If the key is not in the dict, the picture will be downloaded, stored and returned.

__init__(session)[source]

Initialize a new, empty cache that uses the given session for downloads.

Parameters:session (requests.Session) – The session used for downloads
Raises:None

Methods

__init__(session) Initialize a new, empty cache that uses the given session for downloads.
clear(() -> None.  Remove all items from D.)
copy(() -> a shallow copy of D)
fromkeys(...) v defaults to None.
get((k[,d]) -> D[k] if k in D, ...)
has_key((k) -> True if D has a key k, else False)
items(() -> list of D’s (key, value) pairs, ...)
iteritems(() -> an iterator over the (key, ...)
iterkeys(() -> an iterator over the keys of D)
itervalues(...)
keys(() -> list of D’s keys)
load_picture(url) Load the picutre at the given url
pop((k[,d]) -> v, ...) If key is not found, d is returned if given, otherwise KeyError is raised
popitem(() -> (k, v), ...) 2-tuple; but raise KeyError if D is empty.
setdefault((k[,d]) -> D.get(k,d), ...)
update(([E, ...) If E present and has a .keys() method, does: for k in E: D[k] = E[k]
values(() -> list of D’s values)
viewitems(...)
viewkeys(...)
viewvalues(...)
load_picture(url)[source]

Load the picutre at the given url

Parameters:url
Returns:a pixmap with the picture
Return type:QtGui.QPixmap
Raises:requests.HTTPError