Changeset 49a470d in sasview for sansguiframe/src/sans
- Timestamp:
- Aug 31, 2011 1:29:29 PM (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:
- c17760d
- Parents:
- fe48fcc
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sansguiframe/src/sans/guiframe/local_perspectives/plotting/Plotter2D.py
rfe48fcc r49a470d 20 20 from danse.common.plottools.PlotPanel import PlotPanel 21 21 from danse.common.plottools.plottables import Graph 22 from danse.common.plottools. LabelDialog import LabelDialog22 from danse.common.plottools.TextDialog import TextDialog 23 23 from sans.guiframe.events import EVT_NEW_PLOT 24 24 from sans.guiframe.events import EVT_SLICER_PARS … … 32 32 from danse.common.plottools.toolbar import NavigationToolBar 33 33 from sans.guiframe.dataFitting import Data1D 34 from matplotlib.font_manager import FontProperties 34 35 (InternalEvent, EVT_INTERNAL) = wx.lib.newevent.NewEvent() 35 36 … … 116 117 ## panel that contains result from slicer motion (ex: Boxsum info) 117 118 self.panel_slicer = None 119 self.title_label = None 120 self.title_font = None 121 self.title_color = 'black' 118 122 ## Graph 119 123 self.graph = Graph() … … 172 176 yhi = None 173 177 ## Update self.data2d with the current plot 174 self.data2D = data178 175 179 if data.id in self.plots.keys(): 176 180 #replace … … 191 195 192 196 #data2D: put 'Pixel (Number)' for axis title and unit in case of having no detector info and none in _units 193 if len( self.data2D.detector) < 1:197 if len(data.detector) < 1: 194 198 if len(data._xunit) < 1 and len(data._yunit) < 1: 195 199 data._xaxis = '\\rm{x}' … … 199 203 self.graph.xaxis(data._xaxis, data._xunit) 200 204 self.graph.yaxis(data._yaxis, data._yunit) 205 data.label = self.title_label 206 201 207 if data.label == None: 202 208 data.label = data.name 203 self.graph.title(data.label) 204 self.graph.render(self) 205 self.draw_plot() 206 #self.subplot.figure.canvas.draw_idle() 209 210 if not self.title_font: 211 self.graph.title(data.label) 212 self.graph.render(self) 213 self.draw_plot() 214 215 else: 216 self.graph.render(self) 217 self.draw_plot() 218 self.subplot.set_title(label=data.label, 219 fontproperties=self.title_font, 220 color=self.title_color) 221 self.subplot.figure.canvas.draw_idle() 222 223 self.data2D = data 207 224 ## store default value of zmin and zmax 208 225 self.default_zmin_ctl = self.zmin_2D … … 325 342 selected_plot = self.plots[self.graph.selected_plottable] 326 343 label = selected_plot.label 327 dial = LabelDialog(None, -1, 'Change Label', label)344 dial = TextDialog(None, -1, 'Change Label', label) 328 345 if dial.ShowModal() == wx.ID_OK: 329 newLabel = dial.getText() 330 selected_plot.label = newLabel 346 try: 347 FONT = FontProperties() 348 newlabel = dial.getText() 349 font = FONT.copy() 350 font.set_size(dial.getSize()) 351 font.set_family(dial.getFamily()) 352 font.set_style(dial.getStyle()) 353 font.set_weight(dial.getWeight()) 354 colour = dial.getColor() 355 if len(newlabel) > 0: 356 selected_plot.label = newlabel 357 self.title_label = selected_plot.label 358 self.title_font = font 359 self.title_color = colour 360 ## render the graph 361 self.subplot.set_title(label=self.title_label, 362 fontproperties=self.title_font, 363 color=self.title_color) 364 self.subplot.figure.canvas.draw_idle() 365 except: 366 if self.parent != None: 367 from sans.guiframe.events import StatusEvent 368 msg= "Add Text: Error. Check your property values..." 369 wx.PostEvent(self.parent, StatusEvent(status = msg )) 370 else: 371 raise 331 372 dial.Destroy() 332 ## render the graph 333 self.subplot.set_title(selected_plot.label) 334 self.subplot.figure.canvas.draw_idle() 373 335 374 336 375 def _onEditDetector(self, event):
Note: See TracChangeset
for help on using the changeset viewer.