

from traits.api import *
from traitsui.api import *#View, Item, ButtonEditor, Group, HSplit, 
from traitsui.menu import *

import numpy as npy
import os 
import pylab as plb
import skrf as rf




class PlotTool(HasTraits):
    save_dir = Directory()
    clf = Button('Clear')
    newfig = Button('New')
    close_all = Button('Close All')
    tight_layout = Button('Tight Layout')
    draw_show = Button('Draw/Show')
    save_all_figs = Button('Save All')
    plot_format =  Enum('png',['svg','eps','jpg','png'],label='Format')
    title = String('')
    apply_title = Button('Title')
    def _clf_fired(self):
        plb.clf()
        plb.draw()
        plb.show()
    
    def _newfig_fired(self):
        plb.figure()
        plb.draw()
        plb.show()
    
    def _close_all_fired(self):
        plb.close('all')
     
    def _tight_layout_fired(self):
        plb.tight_layout()
        plb.draw()
        plb.show()
    
    def _draw_show_fired(self):
        plb.draw()
        plb.show()    
    
    def _save_all_figs_fired(self):
        rf.save_all_figs(dir=self.save_dir, format = [self.plot_format])
        plb.ion()
    
    def _apply_title_fired(self):
        plb.title(self.title)
        plb.draw();plb.show()
    
    view = View(
        Group(
            HSplit(
                Item('newfig', label='Figure\t\t'),
                Item('clf', show_label=False),
                Item('close_all', show_label=False),
                Item('tight_layout', show_label=False),
                Item('draw_show', show_label=False),
                ),
            HSplit(
                Item('apply_title', label='Formating\t'),
                Item('title', show_label=False),
                ),
            HSplit(
                Item('save_all_figs', label='Save\t\t'),
                Item('plot_format'),
                Item('save_dir', label='Directory'),
                
                )
            )
        )

@@ -87,18 +87,17 @@
  HSplit,
- 
 %0A
+
 from tra
@@ -146,17 +146,16 @@
 mport os
- 
 %0Aimport 
@@ -652,37 +652,33 @@
      plb.show()%0A
-    
 %0A
+
     def _newfig_
@@ -741,37 +741,33 @@
      plb.show()%0A
-    
 %0A
+
     def _close_a
@@ -807,22 +807,17 @@
 ('all')%0A
-     
 %0A
+
     def 
@@ -904,29 +904,25 @@
  plb.show()%0A
-    
 %0A
+
     def _dra
@@ -978,25 +978,17 @@
 b.show()
-    %0A    
+%0A
 %0A    def
@@ -1107,21 +1107,17 @@
 b.ion()%0A
-    
 %0A
+
     def 
@@ -1202,21 +1202,17 @@
 .show()%0A
-    
 %0A
+
     view
@@ -1848,32 +1848,16 @@
 tory'),%0A
-                
 %0A       

Remove trailing whitespace