Changeset 8f59e95 in sasview
- Timestamp:
- Jul 4, 2012 4:56:50 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:
- 8a687cfd
- Parents:
- d560a37
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
plottools/src/danse/common/plottools/PlotPanel.py
r9bab141 r8f59e95 948 948 self.onContextMenu(event) 949 949 950 def onLegend(self, event): 950 # modified kieranrcampbell ILL june2012 951 def onLegend(self,legOnOff): 951 952 """ 952 953 Toggles whether legend is visible/not visible 953 954 """ 954 955 955 if self.legend_on:956 if not legOnOff: 956 957 for ax in self.axes: 957 958 self.remove_legend(ax) … … 971 972 972 973 self.subplot.figure.canvas.draw_idle() 973 self.legend_on = not self.legend_on974 self.legend_on = legOnOff 974 975 976 977 # to do - remove this function when done 978 975 979 def onChangeLegendLoc(self, event): 976 980 """ … … 997 1001 self.subplot.figure.canvas.draw_idle() 998 1002 1003 1004 def ChangeLegendLoc(self, label): 1005 """ 1006 Changes legend loc based on user input 1007 """ 1008 1009 self.legendLoc = label 1010 self.legend_pos_loc = None 1011 # sort them by labels 1012 handles, labels = self.subplot.get_legend_handles_labels() 1013 hl = sorted(zip(handles, labels), 1014 key=operator.itemgetter(1)) 1015 handles2, labels2 = zip(*hl) 1016 self.line_collections_list = handles2 1017 self.legend = self.subplot.legend(handles2, labels2, 1018 prop=FontProperties(size=10), numpoints=1, 1019 handletextsep=.05, loc=self.legendLoc) 1020 if self.legend != None: 1021 self.legend.set_picker(self.legend_picker) 1022 self.legend.set_axes(self.subplot) 1023 self.subplot.figure.canvas.draw_idle() 1024 1025 1026 1027 999 1028 def remove_legend(self, ax=None): 1000 1029 """ … … 1048 1077 #based on this and plot it at user designated coordinates 1049 1078 1050 def onGridOnOff(self, event):1079 def onGridOnOff(self,gridon_off): 1051 1080 """ 1052 1081 Allows ON/OFF Grid 1053 1082 """ 1054 if self.grid_on: 1055 self.grid_on = False 1056 else: 1057 self.grid_on = True 1083 self.grid_on = gridon_off 1084 1058 1085 self.subplot.figure.canvas.draw_idle() 1059 1086 … … 1266 1293 1267 1294 """ 1295 1296 self.xcolor = color 1268 1297 if units != "": 1269 1298 label = label + " (" + units + ")" … … 1284 1313 def yaxis(self, label, units, font=None, color='black', t_font=None): 1285 1314 """yaxis label and units.""" 1315 self.ycolor = color 1316 1286 1317 if units != "": 1287 1318 label = label + " (" + units + ")" -
sansguiframe/src/sans/guiframe/local_perspectives/plotting/Plotter1D.py
rf8be87d r8f59e95 37 37 from binder import BindArtist 38 38 from appearanceDialog import appearanceDialog 39 from graphAppearance import graphAppearance 39 40 40 41 DEFAULT_QMAX = 0.05 … … 43 44 BIN_WIDTH = 1 44 45 IS_MAC = (sys.platform == 'darwin') 46 47 48 def 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 45 53 46 54 class ModelPanel1D(PlotPanel, PanelBase): … … 478 486 479 487 id = wx.NewId() 480 plot_menu.Append(id, '&Modify graphproperties', name)488 plot_menu.Append(id, '&Modify plot properties', name) 481 489 wx.EVT_MENU(self, id, self.createAppDialog) 482 490 … … 495 503 loc_menu.Append(id, str(label), str(label)) 496 504 wx.EVT_MENU(self, id, self.onChangeLegendLoc) 497 id = wx.NewId() 498 self._slicerpop.AppendMenu(id, '&Modify Legend Location', loc_menu) 499 500 id = wx.NewId() 501 self._slicerpop.Append(id, '&Toggle Legend On/Off', 'Toggle Legend On/Off') 502 wx.EVT_MENU(self, id, self.onLegend) 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) 503 532 self._slicerpop.AppendSeparator() 504 505 id = wx.NewId() 506 self._slicerpop.Append(id, '&Edit Y Axis Label') 507 wx.EVT_MENU(self, id, self._on_yaxis_label) 508 id = wx.NewId() 509 self._slicerpop.Append(id, '&Edit X Axis Label') 510 wx.EVT_MENU(self, id, self._on_xaxis_label) 511 512 id = wx.NewId() 513 self._slicerpop.Append(id, '&Toggle Grid On/Off', 'Toggle Grid On/Off') 514 wx.EVT_MENU(self, id, self.onGridOnOff) 515 self._slicerpop.AppendSeparator() 533 516 534 517 535 if self.position != None: … … 630 648 curr_symbol = 13 631 649 632 self.appD = appearanceDialog(self,'Modify graphproperties')650 self.appD = appearanceDialog(self,'Modify plot properties') 633 651 self.appD.setDefaults(float(curr_size),int(curr_color),str(appearanceDialog.find_key(self.get_symbol_label(),int(curr_symbol))),curr_label) 634 652 self.appD.Bind(wx.EVT_CLOSE, self.on_AppDialog_close) … … 652 670 self.appD.Destroy() 653 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 # returns toggleGrid? toggleLegend? xlab, ylab, xunit, yunit, xfont, yfont, xcolor, ycolor, legendloc 690 691 #to do - make this passback mechanism much nicer 692 data = self.graphApp.getAppInfo() 693 self.onGridOnOff(data[0]) 694 self.onLegend(data[1]) 695 self.ChangeLegendLoc(data[10]) 696 697 self.xaxis_label = data[2] 698 self.yaxis_label = data[3] 699 self.xaxis_unit = data[4] 700 self.yaxis_unit = data[5] 701 702 self.xaxis(data[2],data[4],data[6],data[8]) 703 self.yaxis(data[3],data[5],data[7],data[9]) 704 705 xfont = data[6] 706 yfont = data[7] 707 708 # and a little sanity checking along the way 709 710 self.graphApp.Destroy()
Note: See TracChangeset
for help on using the changeset viewer.