Changeset 5251ec6 in sasview for src/sas/sasgui/guiframe/local_perspectives/plotting/plotting.py
- Timestamp:
- Oct 11, 2018 2:20:56 PM (6 years ago)
- Branches:
- master, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1249
- Children:
- 98b9f32
- Parents:
- 67ed543
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/guiframe/local_perspectives/plotting/plotting.py
r2d9526d r5251ec6 12 12 ################################################################################ 13 13 14 import wx15 14 import sys 16 15 from copy import deepcopy 16 17 import wx 18 17 19 from sas.sasgui.guiframe.events import EVT_NEW_PLOT 18 20 from sas.sasgui.guiframe.events import EVT_PLOT_QRANGE … … 23 25 from sas.sasgui.guiframe.dataFitting import Data2D 24 26 from sas.sasgui.guiframe.gui_manager import MDIFrame 27 25 28 DEFAULT_MENU_ITEM_LABEL = "No graph available" 26 29 DEFAULT_MENU_ITEM_ID = wx.NewId() … … 91 94 if event is None: 92 95 return 93 if event.id in self.plot_panels .keys():96 if event.id in self.plot_panels: 94 97 panel = self.plot_panels[event.id] 95 elif event.group_id in self.plot_panels .keys():98 elif event.group_id in self.plot_panels: 96 99 panel = self.plot_panels[event.group_id] 97 100 else: … … 102 105 if event is None: 103 106 return 104 if event.id in self.plot_panels .keys():107 if event.id in self.plot_panels: 105 108 panel = self.plot_panels[event.id] 106 elif event.group_id in self.plot_panels .keys():109 elif event.group_id in self.plot_panels: 107 110 panel = self.plot_panels[event.group_id] 108 111 else: … … 123 126 """ 124 127 125 if group_id in self.plot_panels .keys():128 if group_id in self.plot_panels: 126 129 panel = self.plot_panels[group_id] 127 130 panel.remove_data_by_id(id=id) … … 134 137 Clear and Hide all plot panels, and remove them from menu 135 138 """ 136 for group_id in self.plot_panels .keys():139 for group_id in self.plot_panels: 137 140 self.clear_panel_by_id(group_id) 138 141 self.plot_panels = {} … … 142 145 clear the graph 143 146 """ 144 if group_id in self.plot_panels .keys():147 if group_id in self.plot_panels: 145 148 panel = self.plot_panels[group_id] 146 149 for plottable in panel.graph.plottables.keys(): … … 184 187 # Create a new plot panel if none was available 185 188 if issubclass(data.__class__, Data1D): 186 from Plotter1D import ModelPanel1D189 from .Plotter1D import ModelPanel1D 187 190 ## get the data representation label of the data to plot 188 191 ## when even the user select "change scale" … … 200 203 201 204 msg = "1D Panel of group ID %s could not be created" % str(group_id) 202 raise ValueError , msg205 raise ValueError(msg) 203 206 204 207 def create_2d_panel(self, data, group_id): … … 207 210 if issubclass(data.__class__, Data2D): 208 211 ##Create a new plotpanel for 2D data 209 from Plotter2D import ModelPanel2D212 from .Plotter2D import ModelPanel2D 210 213 scale = data.scale 211 214 win = MDIFrame(self.parent, None, 'None', (200, 150)) … … 218 221 return new_panel 219 222 msg = "2D Panel of group ID %s could not be created" % str(group_id) 220 raise ValueError , msg223 raise ValueError(msg) 221 224 222 225 def update_panel(self, data, panel): … … 238 241 msg += " to panel %s\n" % str(panel.window_caption) 239 242 msg += "Please edit %s's units, labels" % str(data.name) 240 raise ValueError , msg243 raise ValueError(msg) 241 244 else: 242 245 if panel.group_id not in data.list_group_id: … … 247 250 """ 248 251 """ 249 if group_id in self.plot_panels .keys():252 if group_id in self.plot_panels: 250 253 panel = self.plot_panels[group_id] 251 254 uid = panel.uid … … 254 257 caption=panel.window_caption)) 255 258 del self.plot_panels[group_id] 256 if uid in self.parent.plot_panels .keys():259 if uid in self.parent.plot_panels: 257 260 del self.parent.plot_panels[uid] 258 261 panel.frame.Destroy() … … 280 283 for data in event.plots: 281 284 for panel in self.plot_panels.values(): 282 if data.id in panel.plots .keys():285 if data.id in panel.plots: 283 286 plot_exists = True 284 287 # Pass each panel it's own copy of the data … … 310 313 data = event.plot 311 314 group_id = data.group_id 312 if group_id in self.plot_panels .keys():315 if group_id in self.plot_panels: 313 316 if action_check: 314 317 # Check if the plot already exist. if it does, do nothing. 315 if data.id in self.plot_panels[group_id].plots .keys():318 if data.id in self.plot_panels[group_id].plots: 316 319 return 317 320 #update a panel graph … … 327 330 for p_group_id in self.plot_panels.keys(): 328 331 p_plot = self.plot_panels[p_group_id] 329 if data.id in p_plot.plots .keys():332 if data.id in p_plot.plots: 330 333 p_plot.plots[data.id] = data 331 334 self.plot_panels[group_id] = p_plot
Note: See TracChangeset
for help on using the changeset viewer.