From 2de85b48d5c40eccc0107a2578989d8802e60b23 Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Thu, 4 Dec 2014 15:53:43 +0100 Subject: [PATCH] shadereditor: allow to use another image in command line --- examples/demo/shadereditor/main.py | 8 +++++++- examples/demo/shadereditor/shadereditor.kv | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/examples/demo/shadereditor/main.py b/examples/demo/shadereditor/main.py index c28c0c76a..51a4e1990 100755 --- a/examples/demo/shadereditor/main.py +++ b/examples/demo/shadereditor/main.py @@ -1,4 +1,5 @@ #!/usr/bin/kivy +import sys import kivy kivy.require('1.0.6') @@ -72,6 +73,8 @@ Factory.register('ShaderViewer', cls=ShaderViewer) class ShaderEditor(FloatLayout): + source = StringProperty('data/logo/kivy-icon-512.png') + fs = StringProperty(''' void main (void){ gl_FragColor = frag_color * texture2D(texture0, tex_coord0); @@ -107,7 +110,10 @@ void main (void) { class ShaderEditorApp(App): def build(self): - return ShaderEditor() + kwargs = {} + if len(sys.argv) > 1: + kwargs['source'] = sys.argv[1] + return ShaderEditor(**kwargs) if __name__ == '__main__': ShaderEditorApp().run() diff --git a/examples/demo/shadereditor/shadereditor.kv b/examples/demo/shadereditor/shadereditor.kv index 072987d81..f11ef448e 100644 --- a/examples/demo/shadereditor/shadereditor.kv +++ b/examples/demo/shadereditor/shadereditor.kv @@ -36,4 +36,4 @@ Rectangle: size: self.size pos: self.pos - source: 'data/logo/kivy-icon-512.png' + source: root.source