source: sasview/sansguiframe/src/sans/guiframe/local_perspectives/plotting/Plotter1D.py @ 8a687cfd

ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.1.1release-4.1.2release-4.2.2release_4.0.1ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change on this file since 8a687cfd was 8a687cfd, checked in by Kieran Campbell <kieranrcampbell@…>, 12 years ago

Graph appearance dialog for 2D also

  • Property mode set to 100644
File size: 25.8 KB
Line 
1
2################################################################################
3#This software was developed by the University of Tennessee as part of the
4#Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
5#project funded by the US National Science Foundation.
6#
7#See the license text in license.txt
8#
9#copyright 2008, University of Tennessee
10################################################################################
11
12
13import wx
14import sys
15import os
16import pylab
17import math
18import numpy
19import time
20
21from danse.common.plottools.PlotPanel import PlotPanel
22from danse.common.plottools.SizeDialog import SizeDialog
23from danse.common.plottools.LabelDialog import LabelDialog
24#from danse.common.plottools.plottables import Graph
25from sans.guiframe import dataFitting
26from sans.guiframe.events import EVT_NEW_PLOT
27from sans.guiframe.events import StatusEvent
28from sans.guiframe.events import NewPlotEvent
29from sans.guiframe.events import NewColorEvent
30from sans.guiframe.events import SlicerEvent
31from sans.guiframe.events import PanelOnFocusEvent
32from sans.guiframe.events import EVT_NEW_LOADED_DATA
33from sans.guiframe.utils import PanelMenu
34from sans.guiframe.dataFitting import Data1D
35from sans.guiframe.panel_base import PanelBase
36from sans.guiframe.gui_style import GUIFRAME_ICON
37from binder import BindArtist
38from appearanceDialog import appearanceDialog
39from graphAppearance import graphAppearance
40
41DEFAULT_QMAX = 0.05
42DEFAULT_QSTEP = 0.001
43DEFAULT_BEAM = 0.005
44BIN_WIDTH = 1
45IS_MAC = (sys.platform == 'darwin')
46
47
48def find_key(dic, val):
49    """return the key of dictionary dic given the value"""
50    return [k for k, v in dic.iteritems() if v == val][0]
51
52
53
54class ModelPanel1D(PlotPanel, PanelBase):
55    """
56    Plot panel for use with the GUI manager
57    """
58   
59    ## Internal name for the AUI manager
60    window_name = "plotpanel"
61    ## Title to appear on top of the window
62    window_caption = "Graph"
63    ## Flag to tell the GUI manager that this panel is not
64    #  tied to any perspective
65    ALWAYS_ON = True
66    ## Group ID
67    group_id = None
68   
69    def __init__(self, parent, id=-1, color = None,
70                 dpi=None, style=wx.NO_FULL_REPAINT_ON_RESIZE, **kwargs):
71        PlotPanel.__init__(self, parent, id=id, style=style, **kwargs)
72        PanelBase.__init__(self, parent)
73        ## Reference to the parent window
74        self.parent = parent
75        ## Plottables
76        self.plots = {}
77        #context menu
78        self._slicerpop = None
79       
80        self._available_data = []
81        self._menu_add_ids = []
82        self._symbol_labels = self.get_symbol_label()
83        self._color_labels = self.get_color_label()
84        self.currColorIndex = ""
85        self._is_changed_legend_label = False
86     
87        self.hide_menu = None
88        ## Unique ID (from gui_manager)
89        self.uid = None
90        self.x_size = None
91        ## Default locations
92        #self._default_save_location = os.getcwd()
93        self.size = None       
94        ## Graph       
95        #self.graph = Graph()
96        self.graph.xaxis("\\rm{Q}", 'A^{-1}')
97        self.graph.yaxis("\\rm{Intensity} ", "cm^{-1}")
98        self.graph.render(self)
99       
100        # In resizing event
101        self.resizing = False
102        self.canvas.set_resizing(self.resizing)
103        self.Bind(wx.EVT_SIZE, self._OnReSize)
104        self._add_more_tool()
105        self.parent.SetFocus()
106       
107       
108    def get_symbol_label(self):
109        """
110        Associates label to symbol
111        """
112        _labels = {}
113        i = 0
114        _labels['Circle'] = i
115        i += 1
116        _labels['Cross X '] = i
117        i += 1
118        _labels['Triangle Down'] = i
119        i += 1
120        _labels['Triangle Up'] = i
121        i += 1
122        _labels['Triangle Left'] = i
123        i += 1
124        _labels['Triangle Right'] = i
125        i += 1
126        _labels['Cross +'] = i
127        i += 1
128        _labels['Square'] = i
129        i += 1
130        _labels['Diamond'] = i
131        i += 1
132        _labels['Diamond'] = i
133        i += 1
134        _labels['Hexagon1'] = i
135        i += 1
136        _labels['Hexagon2'] = i
137        i += 1
138        _labels['Pentagon'] = i
139        i += 1
140        _labels['Line'] = i
141        return _labels
142   
143    def get_color_label(self):
144        """
145        Associates label to a specific color
146        """
147        _labels = {}
148        i = 0
149        _labels['Blue'] = i
150        i += 1
151        _labels['Green'] = i
152        i += 1
153        _labels['Red'] = i
154        i += 1
155        _labels['Cyan'] = i
156        i += 1
157        _labels['Magenta'] = i
158        i += 1
159        _labels['Yellow'] = i
160        i += 1
161        _labels['Black'] = i
162        return _labels
163
164   
165    def set_data(self, list=None):
166        """
167        """
168        pass
169   
170    def _reset(self):
171        """
172        Resets internal data and graph
173        """   
174        self.graph.reset()
175        self.plots      = {}
176        if self.is_zoomed:
177            self.is_zoomed = False
178       
179    def _OnReSize(self, event):   
180        """
181        On response of the resize of a panel, set axes_visiable False
182        """
183        # It was found that wx >= 2.9.3 sends an event even if no size changed.
184        # So manually recode the size (=x_size) and compare here.
185        # Massy code to work around:<
186        if self.parent._mgr != None:
187            max_panel = self.parent._mgr.GetPane(self)
188            if max_panel.IsMaximized():
189                self.parent._mgr.RestorePane(max_panel)
190                max_panel.Maximize()
191        if self.x_size != None:
192            if self.x_size == self.GetSize():
193                self.resizing = False
194                self.canvas.set_resizing(self.resizing)
195                return
196        self.x_size = self.GetSize()
197
198        # Ready for another event
199        # Do not remove this Skip. Otherwise it will get runtime error on wx>=2.9.
200        event.Skip() 
201        # set the resizing flag
202        self.resizing = True
203        self.canvas.set_resizing(self.resizing)
204        self.parent.set_schedule(True)
205        pos_x, pos_y = self.GetPositionTuple()
206        if pos_x != 0 and pos_y != 0:
207            self.size, _ = self.GetClientSizeTuple()
208        self.SetSizer(self.sizer)
209        wx.CallAfter(self.parent.disable_app_menu,self)
210       
211    def set_resizing(self, resizing=False):
212        """
213        Set the resizing (True/False)
214        """
215        self.resizing = resizing
216        #self.canvas.set_resizing(resizing)
217   
218    def schedule_full_draw(self, func='append'):   
219        """
220        Put self in schedule to full redraw list
221        """
222        # append/del this panel in the schedule list
223        self.parent.set_schedule_full_draw(self, func)
224       
225
226    def remove_data_by_id(self, id):
227        """'
228        remove data from plot
229        """
230        if id in self.plots.keys():
231            data =  self.plots[id]
232            self.graph.delete(data)
233            data_manager = self._manager.parent.get_data_manager()
234            data_list, theory_list = data_manager.get_by_id(id_list=[id])
235           
236            if id in data_list.keys():
237                data = data_list[id]
238            if id in theory_list.keys():
239                data = theory_list[id]
240            # Update Graph menu and help string       
241            h_id = self.parent._window_menu.FindItem(self.window_caption)
242            if data != None:
243                if data.__class__.__name__ == 'list':
244                    label = data[0].label
245                else:
246                    label = data.label
247            else:
248                label = '???'
249            helpString = self.parent._window_menu.GetHelpString(h_id) 
250            d_string = (' ' + str(label) +';')
251            new_tip = helpString.replace(d_string, '')
252            self.parent._window_menu.SetHelpString(h_id, new_tip) 
253
254            del self.plots[id]
255            self.graph.render(self)
256            self.subplot.figure.canvas.draw_idle()   
257            if len(self.graph.plottables) == 0:
258                #onRemove: graph is empty must be the panel must be destroyed
259                self.parent.delete_panel(self.uid)
260           
261       
262    def plot_data(self, data):
263        """
264        Data is ready to be displayed
265       
266        :param event: data event
267        """
268        if data.__class__.__name__ == 'Data2D':
269            return
270        if data.id in self.plots.keys():
271            #Recover panel prop.s
272            xlo, xhi = self.subplot.get_xlim()
273            ylo, yhi = self.subplot.get_ylim()
274            old_data = self.plots[data.id]
275            if self._is_changed_legend_label:
276                data.label = old_data.label
277            if old_data.__class__.__name__ == 'Data1D':
278                data.custom_color = old_data.custom_color
279                data.symbol = old_data.symbol
280                data.markersize = old_data.markersize
281            # Replace data
282            self.graph.replace(data)
283            self.plots[data.id] = data
284            ## Set the view scale for all plots
285            try:
286                self._onEVT_FUNC_PROPERTY()
287            except:
288                msg=" Encountered singular points..."
289                wx.PostEvent(self.parent, StatusEvent(status=\
290                    "Plotting Error: %s"% msg, info="error")) 
291            # Check if zoomed
292            toolbar_zoomed = self.toolbar.GetToolEnabled(self.toolbar._NTB2_BACK)
293            if self.is_zoomed or toolbar_zoomed:
294                # Recover the x,y limits
295                self.subplot.set_xlim((xlo, xhi))     
296                self.subplot.set_ylim((ylo, yhi)) 
297        else:
298            self.plots[data.id] = data
299            self.graph.add(self.plots[data.id]) 
300            ## Set the view scale for all plots
301            try:
302                self._onEVT_FUNC_PROPERTY()
303                if IS_MAC:
304                    # MAC: forcing to plot 2D avg
305                    self.canvas._onDrawIdle()
306            except:
307                msg=" Encountered singular points..."
308                wx.PostEvent(self.parent, StatusEvent(status=\
309                    "Plotting Error: %s"% msg, info="error")) 
310            self.toolbar.update()
311            if self.is_zoomed:
312                self.is_zoomed = False
313            # Update Graph menu and help string       
314            pos = self.parent._window_menu.FindItem(self.window_caption)
315            helpString = 'Show/Hide Graph: '
316            for plot in  self.plots.itervalues():
317                helpString += (' ' + str(plot.label) +';')
318            self.parent._window_menu.SetHelpString(pos, helpString)     
319         
320    def draw_plot(self):
321        """
322        Draw plot
323        """
324        self.draw() 
325
326    def onLeftDown(self,event): 
327        """
328        left button down and ready to drag
329        Display the position of the mouse on the statusbar
330        """
331        PlotPanel.onLeftDown(self, event)
332        ax = event.inaxes
333        if ax != None:
334            try:
335                pos_x = float(event.xdata)# / size_x
336                pos_y = float(event.ydata)# / size_y
337                pos_x = "%8.3g"% pos_x
338                pos_y = "%8.3g"% pos_y
339                self.position = str(pos_x), str(pos_y)
340                wx.PostEvent(self.parent, StatusEvent(status=self.position))
341            except:
342                self.position = None 
343        # unfocus all
344        self.parent.set_plot_unfocus() 
345        #post nd event to notify guiframe that this panel is on focus
346        wx.PostEvent(self.parent, PanelOnFocusEvent(panel=self))
347
348       
349    def _ontoggle_hide_error(self, event):
350        """
351        Toggle error display to hide or show
352        """
353        menu = event.GetEventObject()
354        id = event.GetId()
355        self.set_selected_from_menu(menu, id)
356        # Check zoom
357        xlo, xhi = self.subplot.get_xlim()
358        ylo, yhi = self.subplot.get_ylim()
359
360        selected_plot = self.plots[self.graph.selected_plottable]
361        if self.hide_menu.GetText() == "Hide Error Bar":
362            selected_plot.hide_error = True
363        else:
364            selected_plot.hide_error = False
365        ## increment graph color
366        self.graph.render(self)
367        self.subplot.figure.canvas.draw_idle() 
368        # Check if zoomed
369        toolbar_zoomed = self.toolbar.GetToolEnabled(self.toolbar._NTB2_BACK)
370        if self.is_zoomed or toolbar_zoomed:
371            # Recover the x,y limits
372            self.subplot.set_xlim((xlo, xhi))     
373            self.subplot.set_ylim((ylo, yhi)) 
374
375         
376    def _onRemove(self, event):
377        """
378        Remove a plottable from the graph and render the graph
379       
380        :param event: Menu event
381       
382        """
383        menu = event.GetEventObject()
384        id = event.GetId()
385        self.set_selected_from_menu(menu, id)
386        ## Check if there is a selected graph to remove
387        if self.graph.selected_plottable in self.plots.keys():
388            selected_plot = self.plots[self.graph.selected_plottable]
389            id = self.graph.selected_plottable
390            self.remove_data_by_id(id)
391           
392    def onContextMenu(self, event):
393        """
394        1D plot context menu
395       
396        :param event: wx context event
397       
398        """
399        self._slicerpop = PanelMenu()
400        self._slicerpop.set_plots(self.plots)
401        self._slicerpop.set_graph(self.graph)   
402        if not self.graph.selected_plottable in self.plots: 
403            # Various plot options
404            id = wx.NewId()
405            self._slicerpop.Append(id, '&Save Image', 'Save image as PNG')
406            wx.EVT_MENU(self, id, self.onSaveImage)
407            id = wx.NewId()
408            self._slicerpop.Append(id, '&Print Image', 'Print image ')
409            wx.EVT_MENU(self, id, self.onPrint)
410            id = wx.NewId()
411            self._slicerpop.Append(id, '&Print Preview', 'Print preview')
412            wx.EVT_MENU(self, id, self.onPrinterPreview)
413           
414            id = wx.NewId()
415            self._slicerpop.Append(id, '&Copy to Clipboard', 'Copy to the clipboard')
416            wx.EVT_MENU(self, id, self.OnCopyFigureMenu)
417                   
418            self._slicerpop.AppendSeparator()
419
420        for plot in self.plots.values():
421            #title = plot.title
422            name = plot.name
423            plot_menu = wx.Menu()
424            if self.graph.selected_plottable:
425                if not self.graph.selected_plottable in self.plots.keys():
426                    continue
427                if plot != self.plots[self.graph.selected_plottable]:
428                    continue
429               
430            id = wx.NewId()
431            plot_menu.Append(id, "&DataInfo", name)
432            wx.EVT_MENU(self, id, self. _onDataShow)
433            id = wx.NewId()
434            plot_menu.Append(id, "&Save Points as a File", name)
435            wx.EVT_MENU(self, id, self._onSave)
436            plot_menu.AppendSeparator()
437           
438            #add menu of other plugins
439            item_list = self.parent.get_current_context_menu(self)
440             
441            if (not item_list == None) and (not len(item_list) == 0):
442                for item in item_list:
443
444                    try:
445                        id = wx.NewId()
446                        plot_menu.Append(id, item[0], name)
447                        wx.EVT_MENU(self, id, item[2])
448                    except:
449                        msg = "ModelPanel1D.onContextMenu: "
450                        msg += "bad menu item  %s" % sys.exc_value
451                        wx.PostEvent(self.parent, StatusEvent(status=msg))
452                        pass
453                plot_menu.AppendSeparator()
454           
455            if self.parent.ClassName.count('wxDialog') == 0: 
456                id = wx.NewId()
457                plot_menu.Append(id, '&Linear Fit', name)
458                wx.EVT_MENU(self, id, self.onFitting)
459                plot_menu.AppendSeparator()
460   
461                id = wx.NewId()
462                plot_menu.Append(id, "Remove", name)
463                wx.EVT_MENU(self, id, self._onRemove)
464                if not plot.is_data:
465                    id = wx.NewId()
466                    plot_menu.Append(id, '&Freeze', name)
467                    wx.EVT_MENU(self, id, self.onFreeze)
468                plot_menu.AppendSeparator()   
469                symbol_menu = wx.Menu()
470               
471                if plot.is_data:
472                    id = wx.NewId()
473                    self.hide_menu = plot_menu.Append(id, 
474                                                    "Hide Error Bar", name)
475       
476                    if plot.dy is not None and plot.dy != []:
477                        if plot.hide_error :
478                            self.hide_menu.SetText('Show Error Bar')
479                        else:
480                            self.hide_menu.SetText('Hide Error Bar')
481                    else:
482                        self.hide_menu.Enable(False)
483                    wx.EVT_MENU(self, id, self._ontoggle_hide_error)
484               
485                    plot_menu.AppendSeparator()
486
487                id = wx.NewId()
488                plot_menu.Append(id, '&Modify plot properties', name)
489                wx.EVT_MENU(self, id, self.createAppDialog)
490
491
492
493            id = wx.NewId()
494            #plot_menu.SetTitle(name)
495            self._slicerpop.AppendMenu(id, '&%s'% name, plot_menu)
496                # Option to hide
497                #TODO: implement functionality to hide a plottable (legend click)
498        if not self.graph.selected_plottable in self.plots: 
499            self._slicerpop.AppendSeparator()
500            loc_menu = wx.Menu()
501            for label in self._loc_labels:
502                id = wx.NewId()
503                loc_menu.Append(id, str(label), str(label))
504                wx.EVT_MENU(self, id, self.onChangeLegendLoc)
505           
506
507            # ILL mod start here
508
509            # id = wx.NewId()
510            # self._slicerpop.AppendMenu(id, '&Modify Legend Location', loc_menu)
511
512            # id = wx.NewId()
513            # self._slicerpop.Append(id, '&Toggle Legend On/Off', 'Toggle Legend On/Off')
514            # wx.EVT_MENU(self, id, self.onLegend)
515            # self._slicerpop.AppendSeparator()
516           
517            # id = wx.NewId()
518            # self._slicerpop.Append(id, '&Edit Y Axis Label')
519            # wx.EVT_MENU(self, id, self._on_yaxis_label)     
520            # id = wx.NewId()
521            # self._slicerpop.Append(id, '&Edit X Axis Label')
522            # wx.EVT_MENU(self, id, self._on_xaxis_label)
523   
524            # id = wx.NewId()
525            # self._slicerpop.Append(id, '&Toggle Grid On/Off', 'Toggle Grid On/Off')
526            # wx.EVT_MENU(self, id, self.onGridOnOff)
527            # self._slicerpop.AppendSeparator()
528
529            id = wx.NewId()
530            self._slicerpop.Append(id, '&Modify graph appearance','Modify graph appearance')
531            wx.EVT_MENU(self, id, self.modifyGraphAppearance)
532            self._slicerpop.AppendSeparator()
533
534           
535            if self.position != None:
536                id = wx.NewId()
537                self._slicerpop.Append(id, '&Add Text')
538                wx.EVT_MENU(self, id, self._on_addtext)
539                id = wx.NewId()
540                self._slicerpop.Append(id, '&Remove Text')
541                wx.EVT_MENU(self, id, self._on_removetext)
542                self._slicerpop.AppendSeparator()
543            id = wx.NewId()
544            self._slicerpop.Append(id, '&Change Scale')
545            wx.EVT_MENU(self, id, self._onProperties)
546            self._slicerpop.AppendSeparator()
547            id = wx.NewId()
548            self._slicerpop.Append(id, '&Reset Graph Range')
549            wx.EVT_MENU(self, id, self.onResetGraph) 
550           
551            if self.parent.ClassName.count('wxDialog') == 0:   
552                self._slicerpop.AppendSeparator()
553                id = wx.NewId()
554                self._slicerpop.Append(id, '&Window Title')
555                wx.EVT_MENU(self, id, self.onChangeCaption)
556        try:
557            pos_evt = event.GetPosition()
558            pos = self.ScreenToClient(pos_evt)
559        except:
560            pos_x, pos_y = self.toolbar.GetPositionTuple()
561            pos = (pos_x, pos_y + 5)
562        self.PopupMenu(self._slicerpop, pos)
563           
564    def onFreeze(self, event):
565        """
566        """
567        menu = event.GetEventObject()
568        id = event.GetId()
569        self.set_selected_from_menu(menu, id)
570        plot = self.plots[self.graph.selected_plottable]
571        self.parent.onfreeze([plot.id])
572       
573                       
574    def _onSave(self, evt):
575        """
576        Save a data set to a text file
577       
578        :param evt: Menu event
579       
580        """
581        menu = evt.GetEventObject()
582        id = evt.GetId()
583        self.set_selected_from_menu(menu, id)
584        data = self.plots[self.graph.selected_plottable]
585        default_name = data.label
586        if default_name.count('.') > 0:
587            default_name = default_name.split('.')[0]
588        default_name += "_out"
589        if self.parent != None:
590            self.parent.save_data1d(data, default_name)
591
592                       
593    def _onDataShow(self, evt):
594        """
595        Show the data set in text
596       
597        :param evt: Menu event
598       
599        """
600        menu = evt.GetEventObject()
601        id = evt.GetId()
602        self.set_selected_from_menu(menu, id)
603        data = self.plots[self.graph.selected_plottable]
604        default_name = data.label
605        if default_name.count('.') > 0:
606            default_name = default_name.split('.')[0]
607        #default_name += "_out"
608        if self.parent != None:
609            self.parent.show_data1d(data, default_name)
610           
611    def _add_more_tool(self):
612        """
613        Add refresh, add/hide button in the tool bar
614        """
615        if self.parent.__class__.__name__ != 'ViewerFrame':
616            return
617        self.toolbar.AddSeparator()
618        id_hide = wx.NewId()
619        hide = wx.Bitmap(GUIFRAME_ICON.HIDE_ID_PATH, wx.BITMAP_TYPE_PNG)
620        self.toolbar.AddSimpleTool(id_hide, hide, 'Hide', 'Hide')
621        self.toolbar.Realize()
622        wx.EVT_TOOL(self, id_hide,  self._on_hide)
623       
624    def _on_hide(self, event):
625        """
626        Hides the plot when button is pressed
627        """     
628        if self.parent is not None:
629            self.parent.hide_panel(self.uid)
630
631    def createAppDialog(self, event):
632        """
633        Create the custom dialog for fit appearance modification
634        """
635        menu = event.GetEventObject()
636        id = event.GetId()
637        self.set_selected_from_menu(menu,id)
638        self.appearance_selected_plot = self.plots[self.graph.selected_plottable]
639
640        # find current properties
641        curr_color = self.appearance_selected_plot.custom_color
642        curr_symbol = self.appearance_selected_plot.symbol
643        curr_size = self.appearance_selected_plot.markersize
644        curr_label = self.appearance_selected_plot.label
645
646        if curr_color == None:
647            curr_color = self._color_labels['Blue']
648            curr_symbol = 13
649
650        self.appD = appearanceDialog(self,'Modify plot properties')
651        self.appD.setDefaults(float(curr_size),int(curr_color),str(appearanceDialog.find_key(self.get_symbol_label(),int(curr_symbol))),curr_label)
652        self.appD.Bind(wx.EVT_CLOSE, self.on_AppDialog_close)   
653
654    def on_AppDialog_close(self,e):
655        if(self.appD.okay_clicked == True):
656            info = self.appD.getCurrentValues() # returns (size,color,symbol,datalabel)
657            self.appearance_selected_plot.custom_color = self._color_labels[info[1].encode('ascii','ignore')]
658
659            self.appearance_selected_plot.markersize = float(info[0])
660            self.appearance_selected_plot.symbol = self.get_symbol_label()[info[2]] # self._symbol_labels[info[2].encode('ascii','ignore')]
661            self.appearance_selected_plot.label = str(info[3])
662
663            pos = self.parent._window_menu.FindItem(self.window_caption)
664            helpString = 'Show/Hide Graph: '
665            for plot in  self.plots.itervalues():
666                helpString += (' ' + str(plot.label) +';')
667                self.parent._window_menu.SetHelpString(pos, helpString)
668                self._is_changed_legend_label = True
669               
670        self.appD.Destroy()
671        self._check_zoom_plot()
672
673
674    def modifyGraphAppearance(self,e):
675        self.graphApp = graphAppearance(self,'Modify graph appearance')
676
677       
678
679        self.graphApp.setDefaults(self.grid_on,self.legend_on,
680                                  self.xaxis_label,self.yaxis_label,
681                                  self.xaxis_unit,self.yaxis_unit,
682                                  self.xaxis_font,self.yaxis_font,
683                                  find_key(self.get_loc_label(),self.legendLoc),
684                                  self.xcolor,self.ycolor)
685        self.graphApp.Bind(wx.EVT_CLOSE, self.on_graphApp_close)
686   
687
688    def on_graphApp_close(self,e):
689        # gets values from graph appearance dialog and sends them off
690        # to modify the plot
691
692        self.onGridOnOff(self.graphApp.get_togglegrid())
693        self.onLegend(self.graphApp.get_togglelegend())
694        self.ChangeLegendLoc(self.graphApp.get_legend_loc())
695
696        self.xaxis_label = self.graphApp.get_xlab()
697        self.yaxis_label = self.graphApp.get_ylab()
698        self.xaxis_unit = self.graphApp.get_xunit()
699        self.yaxis_unit = self.graphApp.get_yunit()
700
701        self.xaxis(self.xaxis_label,self.xaxis_unit,
702                   self.graphApp.get_xfont(),self.graphApp.get_xcolor())
703        self.yaxis(self.yaxis_label,self.yaxis_unit,
704                   self.graphApp.get_yfont(),self.graphApp.get_ycolor())
705
706        self.graphApp.Destroy()
Note: See TracBrowser for help on using the repository browser.