Commits

Matthew Turk committed e05144e

Now things are starting to come together with the layout.

Comments (0)

Files changed (2)

 #:import kivy kivy
 #:import win kivy.core.window
 
+FloatLayout:
+
 <VolumeRendering>:
     id: vr_widget
+    on_size: self.center = win.Window.center
+    size: 640, 640
+    size_hint: None, None
     GridLayout:
+        center: 0, 0
         size: 640, 640
-        size_hint: None, None
+        id: layout
         cols: 2
         padding: 0
         Slider:
             size_hint_x: None
             size_hint_y: None
         Button:
-            size: 128, 128
-            size_hint_x: None
-            size_hint_y: None
-            label: 'Render'
+            size_hint_x: 0.5
+            size_hint_y: 0.6
+            text: 'Render'
             on_release: vr_widget.render()
         Slider:
             id: 'val_slider'
 from yt.mods import *
-
+import yt.utilities.amr_utils as au
+import cStringIO
 from kivy.lang import Builder
 from kivy.uix.widget import Widget
 from kivy.uix.gridlayout import GridLayout
 from kivy.uix.floatlayout import FloatLayout
 from kivy.properties import ObjectProperty
 
-Builder.load_file('vr_widget.kv')
-
 class VolumeRendering(Scatter):
     g_width = ObjectProperty(0.01, allownone=False)
     g_center = ObjectProperty(0.5, allownone=False)
         tf.sample_colormap(v, w)
         self.cam.transfer_function = tf
         self.cam.snapshot("temp.png")
-        print self.children[0].children
+        self.children[0].children[2].source = ""
         self.children[0].children[2].source = "temp.png"
 
-class MyApp(App):
+class YTApp(App):
     def build(self):
-        parent = FloatLayout()
+        root=self.root
         add_new = Button(text='Add New', pos_hint={'x':0.0, 'y':0.0},
                          width=96, height=96, size_hint=(None, None))
-        parent.add_widget(add_new)
+        root.add_widget(add_new)
         def new_widget(obj):
             cam = pf.h.camera([0.5, 0.5, 0.5], [1.0, 1.0, 1.0],
                               0.25, (512, 512), None)
             vr = VolumeRendering(cam = cam)
-            parent.add_widget(vr)
+            root.add_widget(vr)
         new_widget(None)
         add_new.bind(on_release = new_widget)
-        return parent
 
 pf = load("/home/mturk/data/JHK-DD0030/galaxy0030")
 dd = pf.h.all_data()
 mi, ma = na.log10(dd.quantities["Extrema"]("Density")[0])
 
 if __name__ in ('__android__', '__main__'):
-    MyApp().run()
+    YTApp().run()