Changeset a54e4be in sasview
- Timestamp:
- Nov 23, 2010 11:31:25 AM (14 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 4a7ad5f
- Parents:
- 32c0841
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
guiframe/local_perspectives/plotting/profile_dialog.py
r519c693 ra54e4be 1 2 3 1 4 import wx 2 5 import sys 3 4 6 from copy import deepcopy 5 7 from danse.common.plottools.plottables import Graph 8 from Plotter1D import ModelPanel1D as PlotPanel 6 9 from sans.guiframe.dataFitting import Theory1D 7 10 import pylab 8 11 9 DEFAULT_CMAP= pylab.cm.jet 10 12 DEFAULT_CMAP = pylab.cm.jet 11 13 _BOX_WIDTH = 76 12 14 _STATICBOX_WIDTH = 400 … … 23 25 FONT_VARIANT = 1 24 26 25 26 27 27 28 class SLDPanel(wx.Dialog): 28 29 """ … … 35 36 ## Flag to tell the AUI manager to put this panel in the center pane 36 37 CENTER_PANE = True 37 def __init__(self, parent=None, base=None,data =None,axes =['Radius'],38 id =-1, *args, **kwds):39 kwds["style"] = 40 kwds["size"] = wx.Size(_STATICBOX_WIDTH, PANEL_SIZE)41 wx.Dialog.__init__(self, parent, id = id,*args, **kwds)38 def __init__(self, parent=None, base=None, data=None, axes =['Radius'], 39 id=-1, *args, **kwds): 40 kwds["style"] = wx.DEFAULT_DIALOG_STYLE 41 kwds["size"] = wx.Size(_STATICBOX_WIDTH, PANEL_SIZE) 42 wx.Dialog.__init__(self, parent, id=id, *args, **kwds) 42 43 43 44 if data != None: 44 45 45 #Font size 46 kwds = []46 kwds = [] 47 47 self.SetWindowVariant(variant=FONT_VARIANT) 48 49 48 self.SetTitle("Scattering Length Density Profile") 50 49 self.parent = base 51 50 self.data = data 52 51 self.str = self.data.__str__() 53 54 52 ## when 2 data have the same id override the 1 st plotted 55 53 self.name = self.data.name 56 57 54 # Panel for plot 58 self.plotpanel 59 style =wx.TRANSPARENT_WINDOW)55 self.plotpanel = SLDplotpanel(self, axes, -1, 56 style=wx.TRANSPARENT_WINDOW) 60 57 self.cmap = DEFAULT_CMAP 61 58 ## Create Artist and bind it … … 66 63 data_plot = deepcopy(self.data) 67 64 data_plot.dy = self._set_dy_data() 68 self.newplot =Theory1D(data_plot.x,data_plot.y,data_plot.dy)65 self.newplot = Theory1D(data_plot.x, data_plot.y, data_plot.dy) 69 66 self.newplot.name = 'SLD' 70 67 self.plotpanel.add_image(self.newplot) 71 72 68 self.Centre() 73 69 self.Layout() 74 70 75 76 71 def _set_dy_data(self): 77 72 """ … … 81 76 """ 82 77 # set dy as zero 83 dy = [ 78 dy = [0 for y in self.data.y] 84 79 return dy 85 80 … … 90 85 # panel sizer 91 86 sizer = wx.BoxSizer(wx.VERTICAL) 92 sizer.Add(self.plotpanel, -1, wx.LEFT|wx.RIGHT,5)93 sizer.Add((0, 10))87 sizer.Add(self.plotpanel, -1, wx.LEFT|wx.RIGHT, 5) 88 sizer.Add((0, 10)) 94 89 #-----Button------------1 95 90 id = wx.NewId() … … 97 92 button_reset.SetToolTipString("Close...") 98 93 button_reset.Bind(wx.EVT_BUTTON, self._close, 99 id =button_reset.GetId())94 id=button_reset.GetId()) 100 95 sizer.Add(button_reset, 0, wx.LEFT, _STATICBOX_WIDTH - 80) 101 sizer.Add((0,10)) 102 96 sizer.Add((0, 10)) 103 97 self.SetSizerAndFit(sizer) 104 105 98 self.Centre() 106 99 self.Show(True) … … 111 104 Close the dialog 112 105 """ 113 114 106 self.Close(True) 115 107 116 def _draw_model(self, event):108 def _draw_model(self, event): 117 109 """ 118 110 on_close, update the model2d plot … … 131 123 return [] 132 124 133 from Plotter1D import ModelPanel1D as PlotPanel 125 134 126 class SLDplotpanel(PlotPanel): 135 127 """ 136 128 Panel 137 129 """ 138 def __init__(self, parent, axes = [], id = -1, color = None, dpi =None,130 def __init__(self, parent, axes=[], id=-1, color=None, dpi=None, 139 131 **kwargs): 140 132 """ 141 133 """ 142 PlotPanel.__init__(self, parent, id=id, xtransform = 'x', ytransform ='y',143 color = color, dpi =dpi,144 size =(_STATICBOX_WIDTH, PANEL_SIZE-100), **kwargs)134 PlotPanel.__init__(self, parent, id=id, xtransform='x', ytransform='y', 135 color=color, dpi=dpi, 136 size=(_STATICBOX_WIDTH, PANEL_SIZE-100), **kwargs) 145 137 146 138 # Keep track of the parent Frame … … 167 159 self.graph.xaxis('\\rm{%s} '% x1_label, 'A') 168 160 self.graph.yaxis('\\rm{SLD} ', 'A^{-2}') 169 170 161 #draw 171 162 self.graph.render(self) … … 201 192 # Initialize the Frame object 202 193 wx.Frame.__init__(self, parent, id, title, wx.DefaultPosition, 203 wx.Size(_STATICBOX_WIDTH,PANEL_SIZE)) 204 194 wx.Size(_STATICBOX_WIDTH, PANEL_SIZE)) 205 195 # Panel for 1D plot 206 self.plotpanel = SLDplotpanel(self, -1, style =wx.RAISED_BORDER)196 self.plotpanel = SLDplotpanel(self, -1, style=wx.RAISED_BORDER) 207 197 208 198 class ViewApp(wx.App):
Note: See TracChangeset
for help on using the changeset viewer.