/usr/share/kivy-examples/kv/kvrun.py is in python-kivy-examples 1.8.0+dfsg-2.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | #!/usr/bin/env python
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__':
import sys
import os
if len(sys.argv) < 2:
print('Usage: %s filename.kv' % os.path.basename(sys.argv[0]))
sys.exit(1)
KvApp(filename=sys.argv[1]).run()
|