Merge branch 'master' of github.com:tito/kivy

This commit is contained in:
Thomas Hansen 2010-11-09 16:24:12 -06:00
commit 9db7152b35
3 changed files with 14 additions and 1 deletions

View File

@ -3,13 +3,24 @@
from kivy.app import App
from kivy.clock import Clock
from kivy.lang import Builder
from kivy.core.window import Window
class KvApp(App):
def _print_fps(self, *largs):
print 'FPS: %2.4f (real draw: %d)' % (
Clock.get_fps(), Clock.get_rfps())
def _reload_keypress(self, instance, code, *largs):
if code != 286:
return
for child in Window.children[:]:
Window.remove_widget(child)
root = Builder.load_file(self.options['filename'])
Window.add_widget(root)
def build(self):
Clock.schedule_interval(self._print_fps, 1)
Window.bind(on_keyboard=self._reload_keypress)
return Builder.load_file(self.options['filename'])
if __name__ == '__main__':

View File

@ -91,10 +91,12 @@ cdef class Canvas:
cpdef add_canvas(self, Canvas canvas):
if not canvas in self._children:
self._children.append(canvas)
self._need_compile = 1
cpdef remove_canvas(self, Canvas canvas):
if canvas in self._children:
self._children.remove(canvas)
self._need_compile = 1
cdef add(self, GraphicInstruction instruction):
self.need_compile = 1

View File

@ -336,7 +336,7 @@ class Widget(EventDispatcher):
children = ListProperty([])
#: Parent
parent = ObjectProperty(None)
parent = ObjectProperty(None, allownone=True)
#: Size hint X
size_hint_x = NumericProperty(1, allownone=True)