Changeset 18eba35 in sasview for guiframe/local_perspectives/plotting/Plotter1D.py
- Timestamp:
- Feb 24, 2009 11:46:12 AM (16 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:
- cce33b3
- Parents:
- 2a8fac1
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
guiframe/local_perspectives/plotting/Plotter1D.py
rdd66fbd r18eba35 16 16 import danse.common.plottools 17 17 from danse.common.plottools.PlotPanel import PlotPanel 18 from danse.common.plottools.plottables import Graph,Data1D,Theory1D 18 from danse.common.plottools.plottables import Graph,Data1D,Theory1D,Data1D 19 19 from sans.guicomm.events import EVT_NEW_PLOT 20 from sans.guicomm.events import StatusEvent ,NewPlotEvent,SlicerEvent 20 from sans.guicomm.events import StatusEvent ,NewPlotEvent,SlicerEvent,ErrorDataEvent 21 21 from sans.guiframe.utils import PanelMenu 22 22 … … 58 58 ## save errors dy for each data plotted 59 59 self.err_dy={} 60 self.errors_hide=0 60 61 61 62 ## Unique ID (from gui_manager) … … 184 185 id = wx.NewId() 185 186 slicerpop.Append(id,'&Print image', 'Print image ') 186 wx.EVT_MENU(self, id, self.onPrint) 187 wx.EVT_MENU(self, id, self.onPrint) 188 189 id = wx.NewId() 190 slicerpop.Append(id,'&Print Preview', 'image preview for print') 191 wx.EVT_MENU(self, id, self.onPrinterPreview) 187 192 188 193 slicerpop.AppendSeparator() … … 220 225 221 226 if self.graph.selected_plottable in self.plots: 222 if self.plots[self.graph.selected_plottable].__class__.__name__=="Theory1D": 227 if self.plots[self.graph.selected_plottable].name in self.err_dy.iterkeys()\ 228 and self.errors_hide==1: 229 230 #if self.plots[self.graph.selected_plottable].__class__.__name__=="Theory1D": 223 231 id = wx.NewId() 224 slicerpop.Append(id, '& Adderrors to data')232 slicerpop.Append(id, '&Show errors to data') 225 233 #print "panel scale before ",self.xLabel, self.yLabel 226 234 #print "cyllinder before adding error", self.plots[self.graph.selected_plottable].x 227 235 wx.EVT_MENU(self, id, self._on_add_errors) 228 """ 229 elif self.plots[self.graph.selected_plottable].__class__.__name__=="Data1D": 236 237 238 elif self.plots[self.graph.selected_plottable].__class__.__name__=="Data1D"\ 239 and self.errors_hide==0: 230 240 id = wx.NewId() 231 slicerpop.Append(id, '& Remove errors From data')241 slicerpop.Append(id, '&Hide Error bars') 232 242 #print "panel scale before ",self.xLabel, self.yLabel 233 243 #print "cyllinder before adding error", self.plots[self.graph.selected_plottable].x 234 244 wx.EVT_MENU(self, id, self._on_remove_errors) 235 """ 245 246 236 247 else: 237 248 id = wx.NewId() … … 262 273 pos = self.ScreenToClient(pos) 263 274 self.PopupMenu(slicerpop, pos) 275 276 264 277 def _on_remove_errors(self, evt): 265 278 if not self.graph.selected_plottable == None: … … 267 280 dy = self.plots[self.graph.selected_plottable].dy 268 281 self.err_dy[name]= dy 269 new_plot = Theory1D(self.plots[self.graph.selected_plottable].x, 282 import numpy 283 dy= numpy.zeros(len(self.plots[self.graph.selected_plottable].y)) 284 new_plot = Data1D(self.plots[self.graph.selected_plottable].x, 270 285 self.plots[self.graph.selected_plottable].y, 271 dy= None)286 dy=dy) 272 287 new_plot.interactive = True 288 self.errors_hide=1 273 289 new_plot.name = self.plots[self.graph.selected_plottable].name 274 290 if hasattr(self.plots[self.graph.selected_plottable], "group_id"): … … 283 299 new_plot.yaxis(label, unit) 284 300 #print "panel scale ",self.xLabel, self.yLabel 285 print "color",self.graph.plottables[self.plots[self.graph.selected_plottable]]301 #print "color",self.graph.plottables[self.plots[self.graph.selected_plottable]] 286 302 color=self.graph.plottables[self.plots[self.graph.selected_plottable]] 287 self.graph.delete _plottable(self.plots[self.graph.selected_plottable])303 self.graph.delete(self.plots[self.graph.selected_plottable]) 288 304 289 305 self.graph.add(new_plot,color) … … 295 311 self.graph.render(self) 296 312 self.subplot.figure.canvas.draw_idle() 313 314 event = ErrorDataEvent(err_dy=self.err_dy) 315 wx.PostEvent(self.parent, event) 297 316 298 317 def _on_add_errors(self, evt): … … 321 340 dy=dy) 322 341 new_plot.interactive = True 342 self.errors_hide=0 323 343 new_plot.name = self.plots[self.graph.selected_plottable].name 324 344 if hasattr(self.plots[self.graph.selected_plottable], "group_id"): … … 334 354 new_plot.yaxis(label, unit) 335 355 #print "panel scale ",self.xLabel, self.yLabel 336 #color=self.graph.plottables[self.plots[self.graph.selected_plottable]]337 self.graph.delete _plottable(self.plots[self.graph.selected_plottable])338 #self.graph.add_plottable(new_plot, color)339 self.graph.add(new_plot)356 color=self.graph.plottables[self.plots[self.graph.selected_plottable]] 357 self.graph.delete(self.plots[self.graph.selected_plottable]) 358 self.graph.add(new_plot, color) 359 340 360 # transforming the view of the new data into the same of the previous data 341 361 self._onEVT_FUNC_PROPERTY()
Note: See TracChangeset
for help on using the changeset viewer.