Commits

Matthew Turk committed 716a91b

Added multiple slices, updating on menu dropdown changes ... adding a new
parameter file has some artifacts, and I can't quite get the selection box to
work the way I want it to in the upper left. Perhaps that should be an
optionmenu as well.

Comments (0)

Files changed (3)

fisheye/main_window.py

         print self.listbox.curselection(),
         ii = int(self.listbox.curselection()[0])
         print event, ii
-        self.image_frame_widgets[ii].lift()
-        self.image_frames[ii]._update_from_pns()
+        self.pf_frame_widgets[ii].lift()
+        self.pf_frames[ii]._update_from_pns()
 
 if __name__ == "__main__":
     root = Tk.Tk()

fisheye/parameter_file_frame.py

 
 from vm_window import SliceFrame
 
-class ActivePlot(Tk.StringVar):
-    def __init__(self, *args, **kwargs):
-        self.pf_frame = kwargs.pop("pf_frame")
-        Tk.StringVar.__init__(self, *args, **kwargs)
-
-    def set(self, *args, **kwargs):
-        Tk.StringVar(self, *args, **kwargs)
-        self.pf_frame.set_plot(self.get())
-
 class ParameterFileFrame(object):
     plot_list = None
     def __init__(self, master, pf, textarea):
 
     def recreate_plot_list(self):
         if self.plot_list is not None: self.plot_list.destroy()
-        option_list = ["%s - %s" % (i, plot) for i, plot in
+        option_list = ["%s - %s" % (i, plot.name) for i, plot in
                         enumerate(self.plot_frames)]
         self.current_plot = Tk.StringVar()
         if self.active_plot >= 0:
             self.current_plot.set(option_list[self.active_plot])
         self.plot_list = Tk.OptionMenu(self.button_frame,
-            self.current_plot, *option_list)
+            self.current_plot, *option_list, command = self.set_plot)
         self.plot_list.grid(row = 0, column = 3)
 
     def set_plot(self, plot_id):
         if isinstance(plot_id, types.StringTypes):
             plot_id = int(plot_id.split(" - ", 1)[0])
-        self.plot_frames[plot_id].lift()
+        self.plot_frame_widgets[plot_id].lift()
 
     def add_plot_frame(self, plot_frame):
         self.plot_frames.append(plot_frame)
 
     def slice_x(self):
         print "slice x"
-        # Make the widget, add the frame
         new_frame = Tk.Frame(self.plot_frame)
         self.plot_frame_widgets.append(new_frame)
         new_frame.grid(column = 0, row = 0)
-        new_plot = SliceFrame(new_frame, self.pf, self.textarea)
+        new_plot = SliceFrame(new_frame, self.pf, self.textarea, axis=0)
         self.add_plot_frame(new_plot)
-        
+
     def slice_y(self):
         print "slice y"
+        new_frame = Tk.Frame(self.plot_frame)
+        self.plot_frame_widgets.append(new_frame)
+        new_frame.grid(column = 0, row = 0)
+        new_plot = SliceFrame(new_frame, self.pf, self.textarea, axis=1)
+        self.add_plot_frame(new_plot)
 
     def slice_z(self):
         print "slice z"
+        new_frame = Tk.Frame(self.plot_frame)
+        self.plot_frame_widgets.append(new_frame)
+        new_frame.grid(column = 0, row = 0)
+        new_plot = SliceFrame(new_frame, self.pf, self.textarea, axis=2)
+        self.add_plot_frame(new_plot)
 
     def proj_x(self):
         print "proj x"

fisheye/vm_window.py

     image = None
     pf = None
     pan_n_scan = None
-    name = "Slice - x"
-    def __init__(self, master, pf, textarea):
+    def __init__(self, master, pf, textarea, axis = 0):
+        self.name = "Slice - %s" % (axis_names[axis])
+        self.axis = axis
         self.log_field = True
         frame = Tk.Frame(master, bd = 2, relief=Tk.GROOVE)
         frame.grid(row=0, column=0)
     def setup_slice(self):
         v, c = self.pf.h.find_max("Density")
         self.center = c
-        sl = self.pf.h.slice(0, c[0], "Density", center=c)
+        sl = self.pf.h.slice(self.axis, c[self.axis], "Density", center=c)
         self.pan_n_scan = self.pf.h.image_panner(sl, (512,512), "Density")
         self.pan_n_scan.set_center(c)
         self.slider["from_"] = na.log10(self.pf.h.get_smallest_dx()*128)