Changeset f8be87d in sasview for sansguiframe/src/sans/guiframe
- Timestamp:
- Jun 25, 2012 4:25:46 AM (12 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:
- 0a9686d
- Parents:
- 30bc3045
- Location:
- sansguiframe/src/sans/guiframe/local_perspectives/plotting
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sansguiframe/src/sans/guiframe/local_perspectives/plotting/Plotter1D.py
r940aca7 rf8be87d 36 36 from sans.guiframe.gui_style import GUIFRAME_ICON 37 37 from binder import BindArtist 38 from appearanceDialog import appearanceDialog 38 39 39 40 DEFAULT_QMAX = 0.05 … … 459 460 plot_menu.AppendSeparator() 460 461 symbol_menu = wx.Menu() 461 for label in self._symbol_labels:462 id = wx.NewId()463 symbol_menu.Append(id, str(label), name)464 wx.EVT_MENU(self, id, self.onChangeSymbol)465 id = wx.NewId()466 plot_menu.AppendMenu(id,'&Modify Symbol', symbol_menu, name)467 468 color_menu = wx.Menu()469 for label in self._color_labels:470 id = wx.NewId()471 color_menu.Append(id, str(label), name)472 wx.EVT_MENU(self, id, self.onChangeColor)473 id = wx.NewId()474 plot_menu.AppendMenu(id, '&Modify Symbol Color',475 color_menu, name)476 477 size_menu = wx.Menu()478 for i in range(10):479 id = wx.NewId()480 size_menu.Append(id, str(i), name)481 wx.EVT_MENU(self, id, self.onChangeSize)482 id = wx.NewId()483 size_menu.Append(id, '&Custom', name)484 wx.EVT_MENU(self, id, self.onChangeSize)485 id = wx.NewId()486 plot_menu.AppendMenu(id, '&Modify Symbol Size',487 size_menu, name)488 462 489 463 if plot.is_data: 464 id = wx.NewId() 490 465 self.hide_menu = plot_menu.Append(id, 491 466 "Hide Error Bar", name) … … 500 475 wx.EVT_MENU(self, id, self._ontoggle_hide_error) 501 476 502 plot_menu.AppendSeparator() 477 plot_menu.AppendSeparator() 478 503 479 id = wx.NewId() 504 plot_menu.Append(id, '&Edit Legend Label', name) 505 wx.EVT_MENU(self, id, self.onEditLabels) 480 plot_menu.Append(id, '&Modify graph properties', name) 481 wx.EVT_MENU(self, id, self.createAppDialog) 482 483 484 506 485 id = wx.NewId() 507 486 #plot_menu.SetTitle(name) … … 574 553 self.parent.onfreeze([plot.id]) 575 554 576 def onEditLabels(self, event):577 """578 Edit legend label579 """580 menu = event.GetEventObject()581 id = event.GetId()582 self.set_selected_from_menu(menu, id)583 selected_plot = self.plots[self.graph.selected_plottable]584 label = selected_plot.label585 dial = LabelDialog(None, -1, 'Change Legend Label', label)586 if dial.ShowModal() == wx.ID_OK:587 newLabel = dial.getText()588 selected_plot.label = newLabel589 # Updata Graph menu help string590 pos = self.parent._window_menu.FindItem(self.window_caption)591 helpString = 'Show/Hide Graph: '592 for plot in self.plots.itervalues():593 helpString += (' ' + str(plot.label) +';')594 self.parent._window_menu.SetHelpString(pos, helpString)595 self._is_changed_legend_label = True596 #break597 dial.Destroy()598 599 ## render the graph600 try:601 self._onEVT_FUNC_PROPERTY()602 except:603 msg=" Encountered singular points..."604 wx.PostEvent(self.parent, StatusEvent(status=\605 "Plotting Erorr: %s"% msg, info="error"))606 607 def onChangeColor(self, event):608 """609 Changes the color of the graph when selected610 """611 menu = event.GetEventObject()612 id = event.GetId()613 self.set_selected_from_menu(menu, id)614 label = menu.GetLabel(id)615 selected_plot = self.plots[self.graph.selected_plottable]616 selected_plot.custom_color = self._color_labels[label]617 ## Set the view scale for all plots618 self._check_zoom_plot()619 #self._onEVT_FUNC_PROPERTY()620 #wx.PostEvent(self.parent,621 # NewColorEvent(color=selected_plot.custom_color,622 # id=selected_plot.id))623 624 def onChangeSize(self, event):625 """626 On Change size menu627 """628 menu = event.GetEventObject()629 id = event.GetId()630 self.set_selected_from_menu(menu, id)631 label = menu.GetLabel(id)632 selected_plot = self.plots[self.graph.selected_plottable]633 634 if label == "&Custom":635 sizedial = SizeDialog(None, -1, 'Change Marker Size')636 if sizedial.ShowModal() == wx.ID_OK:637 try:638 label = sizedial.getText()639 640 except:641 msg = 'Symbol Size: Got an invalid Value.'642 wx.PostEvent( self.parent,643 StatusEvent(status= msg, info='error'))644 sizedial.Destroy()645 try:646 selected_plot.markersize = int(label)647 self._check_zoom_plot()648 except:649 msg = 'Symbol Size: Got an invalid Value.'650 wx.PostEvent( self.parent,651 StatusEvent(status= msg, info='error'))652 653 654 def onChangeSymbol(self, event):655 """656 """657 menu = event.GetEventObject()658 id = event.GetId()659 self.set_selected_from_menu(menu, id)660 label = menu.GetLabel(id)661 selected_plot = self.plots[self.graph.selected_plottable]662 selected_plot.symbol = self._symbol_labels[label]663 ## Set the view scale for all plots664 self._check_zoom_plot()665 #self._onEVT_FUNC_PROPERTY()666 ## render the graph667 #self.graph.render(self)668 #self.subplot.figure.canvas.draw_idle()669 555 670 556 def _onSave(self, evt): … … 724 610 if self.parent is not None: 725 611 self.parent.hide_panel(self.uid) 726 727 612 613 def createAppDialog(self, event): 614 """ 615 Create the custom dialog for fit appearance modification 616 """ 617 menu = event.GetEventObject() 618 id = event.GetId() 619 self.set_selected_from_menu(menu,id) 620 self.appearance_selected_plot = self.plots[self.graph.selected_plottable] 621 622 # find current properties 623 curr_color = self.appearance_selected_plot.custom_color 624 curr_symbol = self.appearance_selected_plot.symbol 625 curr_size = self.appearance_selected_plot.markersize 626 curr_label = self.appearance_selected_plot.label 627 628 if curr_color == None: 629 curr_color = self._color_labels['Blue'] 630 curr_symbol = 13 631 632 self.appD = appearanceDialog(self,'Modify graph properties') 633 self.appD.setDefaults(float(curr_size),int(curr_color),str(appearanceDialog.find_key(self.get_symbol_label(),int(curr_symbol))),curr_label) 634 self.appD.Bind(wx.EVT_CLOSE, self.on_AppDialog_close) 635 636 def on_AppDialog_close(self,e): 637 if(self.appD.okay_clicked == True): 638 info = self.appD.getCurrentValues() # returns (size,color,symbol,datalabel) 639 self.appearance_selected_plot.custom_color = self._color_labels[info[1].encode('ascii','ignore')] 640 641 self.appearance_selected_plot.markersize = float(info[0]) 642 self.appearance_selected_plot.symbol = self.get_symbol_label()[info[2]] # self._symbol_labels[info[2].encode('ascii','ignore')] 643 self.appearance_selected_plot.label = str(info[3]) 644 645 pos = self.parent._window_menu.FindItem(self.window_caption) 646 helpString = 'Show/Hide Graph: ' 647 for plot in self.plots.itervalues(): 648 helpString += (' ' + str(plot.label) +';') 649 self.parent._window_menu.SetHelpString(pos, helpString) 650 self._is_changed_legend_label = True 651 652 self.appD.Destroy() 653 self._check_zoom_plot()
Note: See TracChangeset
for help on using the changeset viewer.