def _init_toolbar(self): Fltk.Fl_File_Icon.load_system_icons() self._fc = Fltk.Fl_File_Chooser(".", "*", Fltk.Fl_File_Chooser.CREATE, "Save Figure") self._fc.hide() t1, t2, w, h = self.canvas.figure.bbox.bounds w, h = int(w), int(h) self._group = Fltk.Fl_Pack(0, h + 2, 1000, 26) self._group.type(Fltk.FL_HORIZONTAL) self._axes = self.canvas.figure.axes self.naxes = len(self._axes) self.omenu = AxisMenu(toolbar=self) self.bHome = FLTKButton(text="Home", file="home.ppm", command=self.home, argument=self) self.bBack = FLTKButton(text="Back", file="back.ppm", command=self.back, argument=self) self.bForward = FLTKButton(text="Forward", file="forward.ppm", command=self.forward, argument=self) self.bPan = FLTKButton(text="Pan/Zoom", file="move.ppm", command=self.pan, argument=self, type="pushed") self.bZoom = FLTKButton(text="Zoom to rectangle", file="zoom_to_rect.ppm", command=self.zoom, argument=self, type="pushed") self.bsubplot = FLTKButton(text="Configure Subplots", file="subplots.ppm", command=self.configure_subplots, argument=self, type="pushed") self.bSave = FLTKButton(text="Save", file="filesave.ppm", command=save_figure, argument=self) self._group.end() self.message = Fltk.Fl_Output(0, 0, w, 8) self._group.add_resizable(self.message) self.update()
def __init__(self, canvas, figman): #xmin, xmax = canvas.figure.bbox.intervalx().get_bounds() #height, width = 50, xmax-xmin self.canvas = canvas self.figman = figman Fltk.Fl_File_Icon.load_system_icons() self._fc = Fltk.Fl_File_Chooser( ".", "*", Fltk.Fl_File_Chooser.CREATE, "Save Figure" ) self._fc.hide() t1,t2,w,h = canvas.figure.bbox.get_bounds() w, h = int(w), int(h) self._group = Fltk.Fl_Pack(0,h+2,1000,26) self._group.type(Fltk.FL_HORIZONTAL) self._axes=self.canvas.figure.axes self.naxes = len(self._axes) self.omenu = AxisMenu( toolbar=self) self.bLeft = FLTKButton( text="Left", file="stock_left.ppm", command=pan,argument=(self,1,'x'),type="repeat") self.bRight = FLTKButton( text="Right", file="stock_right.ppm", command=pan,argument=(self,-1,'x'),type="repeat") self.bZoomInX = FLTKButton( text="ZoomInX",file="stock_zoom-in.ppm", command=zoom,argument=(self,1,'x'),type="repeat") self.bZoomOutX = FLTKButton( text="ZoomOutX", file="stock_zoom-out.ppm", command=zoom, argument=(self,-1,'x'),type="repeat") self.bUp = FLTKButton( text="Up", file="stock_up.ppm", command=pan,argument=(self,1,'y'),type="repeat") self.bDown = FLTKButton( text="Down", file="stock_down.ppm", command=pan,argument=(self,-1,'y'),type="repeat") self.bZoomInY = FLTKButton( text="ZoomInY", file="stock_zoom-in.ppm", command=zoom,argument=(self,1,'y'),type="repeat") self.bZoomOutY = FLTKButton( text="ZoomOutY",file="stock_zoom-out.ppm", command=zoom, argument=(self,-1,'y'),type="repeat") self.bSave = FLTKButton( text="Save", file="stock_save_as.ppm", command=save_figure, argument=self) self._group.end()
def load(self, obj): filefile = fltk.Fl_File_Chooser('.', '*.param', fltk.FL_SINGLE, 'load parameter file') filefile.show() while filefile.shown(): fltk.Fl.wait() if filefile.count() == 1: # f = file(self.viewer.title+'param', 'r') f = open(filefile.value(), 'rb') objVals = pickle.load(f) f.close() for k, v in objVals.iteritems(): if k in self.valObjects.keys(): self.valObjects[k].value(v)