shadereditor: allow to use another image in command line

This commit is contained in:
Mathieu Virbel 2014-12-04 15:53:43 +01:00
parent 2dc6501569
commit 2de85b48d5
2 changed files with 8 additions and 2 deletions

View File

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

View File

@ -36,4 +36,4 @@
Rectangle:
size: self.size
pos: self.pos
source: 'data/logo/kivy-icon-512.png'
source: root.source