mirror of https://github.com/kivy/kivy.git
Merge pull request #2286 from kivy/image_loader
uix:Image delayed importing of loader. Import it only when used
This commit is contained in:
commit
e25f19c59d
|
@ -445,8 +445,6 @@ class Image(EventDispatcher):
|
|||
else:
|
||||
raise Exception('Unable to load image type {0!r}'.format(arg))
|
||||
|
||||
# check if the image hase sequences for animation in it
|
||||
self._img_iterate()
|
||||
|
||||
def remove_from_cache(self):
|
||||
'''Remove the Image from cache. This facilitates re-loading of
|
||||
|
|
|
@ -55,9 +55,10 @@ from kivy.core.image import Image as CoreImage
|
|||
from kivy.resources import resource_find
|
||||
from kivy.properties import StringProperty, ObjectProperty, ListProperty, \
|
||||
AliasProperty, BooleanProperty, NumericProperty
|
||||
from kivy.loader import Loader
|
||||
from kivy.logger import Logger
|
||||
|
||||
# delayed imports
|
||||
Loader = None
|
||||
|
||||
class Image(Widget):
|
||||
'''Image class, see module documentation for more information.
|
||||
|
@ -303,6 +304,9 @@ class AsyncImage(Image):
|
|||
def __init__(self, **kwargs):
|
||||
self._coreimage = None
|
||||
super(AsyncImage, self).__init__(**kwargs)
|
||||
global Loader
|
||||
if not Loader:
|
||||
from kivy.loader import Loader
|
||||
self.bind(source=self._load_source)
|
||||
if self.source:
|
||||
self._load_source()
|
||||
|
|
Loading…
Reference in New Issue