Changeset 2636188 in sasview for sansguiframe/src
- Timestamp:
- Aug 11, 2011 10:24:35 AM (13 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:
- ac5c7d4
- Parents:
- 3d2d54a6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sansguiframe/src/sans/guiframe/local_perspectives/plotting/Plotter1D.py
r8c347a6 r2636188 25 25 from sans.guiframe.events import StatusEvent 26 26 from sans.guiframe.events import NewPlotEvent 27 from sans.guiframe.events import NewColorEvent 27 28 from sans.guiframe.events import SlicerEvent 28 29 from sans.guiframe.events import PanelOnFocusEvent … … 38 39 BIN_WIDTH = 1 39 40 41 class SizeDialog(wx.Dialog): 42 def __init__(self, parent, id, title): 43 wx.Dialog.__init__(self, parent, id, title, size=(300, 175)) 44 45 #panel = wx.Panel(self, -1) 46 47 mainbox = wx.BoxSizer(wx.VERTICAL) 48 vbox = wx.BoxSizer(wx.VERTICAL) 49 textbox = wx.BoxSizer(wx.HORIZONTAL) 50 51 text1 = "Enter in a custom size (float values > 0 accepted)" 52 msg = wx.StaticText(self, -1, text1,(30,15), style=wx.ALIGN_CENTRE) 53 msg.SetLabel(text1) 54 self.myTxtCtrl = wx.TextCtrl(self, -1, '', (100, 50)) 55 56 textbox.Add(self.myTxtCtrl, flag=wx.LEFT|wx.RIGHT|wx.ADJUST_MINSIZE, 57 border=10, proportion=2) 58 vbox.Add(msg, flag=wx.ALL, border=10, proportion=1) 59 vbox.Add(textbox, flag=wx.EXPAND|wx.TOP|wx.BOTTOM|wx.ADJUST_MINSIZE, 60 border=10) 61 62 hbox = wx.BoxSizer(wx.HORIZONTAL) 63 okButton = wx.Button(self,wx.ID_OK, 'OK', size=(70, 30)) 64 closeButton = wx.Button(self,wx.ID_CANCEL, 'Close', size=(70, 30)) 65 hbox.Add(okButton, wx.LEFT|wx.RIGHT|wx.ADJUST_MINSIZE, 66 border=10) 67 hbox.Add(closeButton, wx.LEFT|wx.RIGHT|wx.ADJUST_MINSIZE, 68 border=10) 69 70 mainbox.Add(vbox, flag=wx.ALL, border=10) 71 mainbox.Add(hbox, flag=wx.EXPAND|wx.TOP|wx.BOTTOM|wx.ADJUST_MINSIZE, 72 border=10) 73 self.SetSizer(mainbox) 74 75 def getText(self): 76 return self.myTxtCtrl.GetValue() 40 77 41 78 class ModelPanel1D(PlotPanel, PanelBase): … … 68 105 self._menu_add_ids = [] 69 106 self._symbol_labels = self.get_symbol_label() 107 self._color_labels = self.get_color_label() 108 self.currColorIndex = "" 70 109 71 110 self.hide_menu = None … … 121 160 i += 1 122 161 _labels['Line'] = i 162 return _labels 163 164 def get_color_label(self): 165 """ 166 Associates label to a specific color 167 """ 168 _labels = {} 169 i = 0 170 _labels['Blue'] = i 171 i += 1 172 _labels['Green'] = i 173 i += 1 174 _labels['Red'] = i 175 i += 1 176 _labels['Cyan'] = i 177 i += 1 178 _labels['Magenta'] = i 179 i += 1 180 _labels['Yellow'] = i 123 181 return _labels 124 182 … … 333 391 self._slicerpop.Append(id, '&Freeze', 'Freeze') 334 392 wx.EVT_MENU(self, id, self.onFreeze) 393 335 394 symbol_menu = wx.Menu() 336 395 for label in self._symbol_labels: … … 340 399 id = wx.NewId() 341 400 self._slicerpop.AppendMenu(id,'&Modify Symbol', symbol_menu) 401 402 color_menu = wx.Menu() 403 for label in self._color_labels: 404 id = wx.NewId() 405 color_menu.Append(id, str(label), str(label)) 406 wx.EVT_MENU(self, id, self.onChangeColor) 407 id = wx.NewId() 408 self._slicerpop.AppendMenu(id, '&Modify Symbol Color', color_menu) 409 410 411 size_menu = wx.Menu() 412 for i in range(10): 413 id = wx.NewId() 414 size_menu.Append(id, str(i), str(i)) 415 wx.EVT_MENU(self, id, self.onChangeSize) 416 id = wx.NewId() 417 size_menu.Append(id, '&Custom', 'Custom') 418 wx.EVT_MENU(self, id, self.onChangeSize) 419 id = wx.NewId() 420 self._slicerpop.AppendMenu(id, '&Modify Symbol Size', size_menu) 421 342 422 self._slicerpop.AppendSeparator() 343 423 … … 374 454 plot = self.plots[self.graph.selected_plottable] 375 455 self.parent.onfreeze([plot.id]) 376 456 457 def onChangeColor(self, event): 458 """ 459 Changes the color of the graph when selected 460 """ 461 menu = event.GetEventObject() 462 id = event.GetId() 463 label = menu.GetLabel(id) 464 selected_plot = self.plots[self.graph.selected_plottable] 465 selected_plot.custom_color = self._color_labels[label] 466 ## Set the view scale for all plots 467 self._onEVT_FUNC_PROPERTY() 468 ## render the graph 469 #self.graph.render(self) 470 #self.subplot.figure.canvas.draw_idle() 471 print "PARENT: ", self.parent 472 wx.PostEvent(self.parent, 473 NewColorEvent(color=selected_plot.custom_color, 474 id=selected_plot.id)) 475 476 def onChangeSize(self, event): 477 478 menu = event.GetEventObject() 479 id = event.GetId() 480 label = menu.GetLabel(id) 481 selected_plot = self.plots[self.graph.selected_plottable] 482 483 if label == "&Custom": 484 sizedial = SizeDialog(None, -1, 'Change Marker Size') 485 if sizedial.ShowModal() == wx.ID_OK: 486 label = sizedial.getText() 487 sizedial.Destroy() 488 489 selected_plot.marker_size = int(label) 490 self._onEVT_FUNC_PROPERTY() 491 ## Set the view scale for all plots 492 493 ## render the graph 494 #self.graph.render(self) 495 #self.subplot.figure.canvas.draw_idle() 496 497 377 498 def onChangeSymbol(self, event): 378 499 """ … … 388 509 #self.graph.render(self) 389 510 #self.subplot.figure.canvas.draw_idle() 511 512 390 513 391 514 def _onsaveTXT(self, path):
Note: See TracChangeset
for help on using the changeset viewer.