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:
Mathieu Virbel 2010-12-16 23:27:37 +01:00
parent be5769017e
commit 992a56e7a3
4 changed files with 23 additions and 18 deletions

View File

@ -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

View File

@ -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 *
'''

View File

@ -26,4 +26,4 @@ class ClipboardBase(object):
Clipboard = core_select_lib('clipboard', (
('pygame', 'clipboard_pygame', 'ClipboardPygame'),
('dummy', 'clipboard_dummy', 'ClipboardDummy')
))()
), True)

View File

@ -405,5 +405,5 @@ class WindowBase(EventDispatcher):
# Load the appropriate provider
Window = core_select_lib('window', (
('pygame', 'window_pygame', 'WindowPygame'),
))()
), True)