mirror of https://github.com/kivy/kivy.git
if the documentation is beeing generated, don't create instance of some core providers
+ force loading of all modules in kivy
This commit is contained in:
parent
be5769017e
commit
992a56e7a3
|
@ -13,7 +13,24 @@ from glob import glob
|
|||
|
||||
os.environ['KIVY_SHADOW_WINDOW'] = '0'
|
||||
import kivy
|
||||
|
||||
# force loading of kivy modules
|
||||
import kivy.core.audio
|
||||
import kivy.core.camera
|
||||
import kivy.core.clipboard
|
||||
import kivy.core.gl
|
||||
import kivy.core.image
|
||||
import kivy.core.spelling
|
||||
import kivy.core.svg
|
||||
import kivy.core.text
|
||||
import kivy.core.video
|
||||
import kivy.core.window
|
||||
import kivy.graphics
|
||||
from kivy.factory import Factory
|
||||
|
||||
# force loading of all classes from factory
|
||||
for x in Factory.classes:
|
||||
getattr(Factory, x)
|
||||
|
||||
|
||||
# Directory of doc
|
||||
|
|
|
@ -8,12 +8,12 @@ from kivy.logger import Logger
|
|||
|
||||
if 'KIVY_DOC' in os.environ:
|
||||
# stub for sphinx generation
|
||||
def core_select_lib(category, llist):
|
||||
def core_select_lib(category, llist, create_instance=False):
|
||||
pass
|
||||
def core_register_libs(category, libs):
|
||||
pass
|
||||
else:
|
||||
def core_select_lib(category, llist):
|
||||
def core_select_lib(category, llist, create_instance=True):
|
||||
category = category.lower()
|
||||
for option, modulename, classname in llist:
|
||||
try:
|
||||
|
@ -33,6 +33,8 @@ else:
|
|||
# ok !
|
||||
Logger.info('%s: using <%s> as %s provider' %
|
||||
(category.capitalize(), option, category))
|
||||
if create_instance:
|
||||
cls = cls()
|
||||
return cls
|
||||
|
||||
except Exception as e:
|
||||
|
@ -66,17 +68,3 @@ else:
|
|||
(category.capitalize(), option))
|
||||
Logger.debug('', exc_info=e)
|
||||
|
||||
|
||||
'''
|
||||
from kivy.core.audio import *
|
||||
from kivy.core.camera import *
|
||||
from kivy.core.image import *
|
||||
from kivy.core.text import *
|
||||
from kivy.core.video import *
|
||||
from kivy.core.svg import *
|
||||
from kivy.core.spelling import *
|
||||
from kivy.core.clipboard import *
|
||||
|
||||
# only after core loading, load extensions
|
||||
from text.markup import *
|
||||
'''
|
||||
|
|
|
@ -26,4 +26,4 @@ class ClipboardBase(object):
|
|||
Clipboard = core_select_lib('clipboard', (
|
||||
('pygame', 'clipboard_pygame', 'ClipboardPygame'),
|
||||
('dummy', 'clipboard_dummy', 'ClipboardDummy')
|
||||
))()
|
||||
), True)
|
||||
|
|
|
@ -405,5 +405,5 @@ class WindowBase(EventDispatcher):
|
|||
# Load the appropriate provider
|
||||
Window = core_select_lib('window', (
|
||||
('pygame', 'window_pygame', 'WindowPygame'),
|
||||
))()
|
||||
), True)
|
||||
|
||||
|
|
Loading…
Reference in New Issue