Changeset b91c736 in sasview
- Timestamp:
- Mar 19, 2010 1:09:45 PM (15 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:
- 837a043
- Parents:
- d2f1595
- Location:
- guiframe
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
guiframe/data_loader.py
r196608d rb91c736 22 22 return path 23 23 24 def append_data_to_existing_panel(panel_name, data_name): 25 """ 26 Pop up an error message. 27 28 @param panel_name: the name of the current panel 29 @param data_name: the name of the current data 30 """ 31 message = " Do you want to append %s data\n in "%(str(data_name)) 32 message += " %s panel?\n\n"%(str(panel_name)) 33 dial = wx.MessageDialog(None, message, 'Question', 34 wx.YES_NO|wx.NO_DEFAULT|wx.ICON_QUESTION) 35 if dial.ShowModal() == wx.ID_YES: 36 return True 37 else: 38 return False 39 24 40 25 41 def load_ascii_1D(path): … … 142 158 ## when 2 data have the same id override the 1 st plotted 143 159 new_plot.id = name 144 145 160 ##group_id specify on which panel to plot this data 146 161 new_plot.group_id = name 147 162 new_plot.is_data = True 148 163 ##post data to plot 164 title = output.filename 149 165 if hasattr(new_plot,"title"): 150 title = str(new_plot.title )166 title = str(new_plot.title.lstrip().rstrip()) 151 167 if title == "": 152 168 title = str(name) 153 169 else: 154 170 title = str(name) 155 wx.PostEvent(parent, NewPlotEvent(plot=new_plot, title=title )) 171 if hasattr(parent, "panel_on_focus") and not(parent.panel_on_focus is None): 172 existing_panel = parent.panel_on_focus 173 panel_name = existing_panel.window_caption 174 data_name = new_plot.name 175 if existing_panel.__class__.__name__ == "ModelPanel1D"\ 176 and existing_panel.group_id is not None: 177 if append_data_to_existing_panel(panel_name, data_name): 178 #add this plot the an existing panel 179 new_plot.group_id = existing_panel.group_id 180 wx.PostEvent(parent, NewPlotEvent(plot=new_plot, title=title)) 156 181 157 182 ## the output of the loader is a list , some xml files contain more than one data … … 190 215 new_plot.name = name 191 216 new_plot.interactive = True 192 193 217 new_plot.group_id = name 194 218 new_plot.id = name 195 196 new_plot.is_data =True219 new_plot.is_data = True 220 197 221 if hasattr(item,"title"): 198 title = item.title 222 title = item.title.lstrip().rstrip() 199 223 if title == "": 200 224 title = str(name) 201 225 else: 202 226 title = name 227 if hasattr(parent, "panel_on_focus") and not(parent.panel_on_focus is None): 228 existing_panel = parent.panel_on_focus 229 panel_name = existing_panel.window_caption 230 data_name = new_plot.name 231 if existing_panel.__class__.__name__ == "ModelPanel1D"\ 232 and existing_panel.group_id is not None: 233 if append_data_to_existing_panel(panel_name, data_name): 234 #add this plot the an existing panel 235 new_plot.group_id = existing_panel.group_id 203 236 wx.PostEvent(parent, NewPlotEvent(plot=new_plot, title=str(title))) 204 237 i+=1 -
guiframe/gui_manager.py
raf20f6b rb91c736 40 40 from sans.guicomm.events import EVT_STATUS 41 41 from sans.guicomm.events import EVT_NEW_PLOT,EVT_SLICER_PARS_UPDATE 42 42 from sans.guicomm.events import EVT_ADD_MANY_DATA 43 43 import warnings 44 44 warnings.simplefilter("ignore") … … 220 220 # Welcome panel 221 221 self.defaultPanel = None 222 222 #panel on focus 223 self.panel_on_focus = None 223 224 # Check for update 224 225 #self._check_update(None) … … 238 239 # Register to status events 239 240 self.Bind(EVT_STATUS, self._on_status_event) 240 241 #Register add extra data on the same panel event on load 242 self.Bind(EVT_ADD_MANY_DATA, self.set_panel_on_focus) 243 244 def set_panel_on_focus(self, event): 245 """ 246 Store reference to the last panel on focus 247 """ 248 self.panel_on_focus = event.panel 241 249 242 250 def build_gui(self): -
guiframe/local_perspectives/plotting/Plotter1D.py
r21d99c2 rb91c736 24 24 from sans.guicomm.events import EVT_NEW_PLOT 25 25 from sans.guicomm.events import StatusEvent ,NewPlotEvent,SlicerEvent,ErrorDataEvent 26 from sans.guicomm.events import RemoveDataEvent 26 from sans.guicomm.events import RemoveDataEvent, AddManyDataEvent 27 27 from sans.guiframe.utils import PanelMenu 28 28 from sans.guiframe.dataFitting import Data1D … … 79 79 self.graph.yaxis("\\rm{Intensity} ","cm^{-1}") 80 80 self.graph.render(self) 81 82 81 82 def on_kill_focus(self, event): 83 """ 84 reset the panel color and post even just after the panel has been on 85 focus to make sure the group_id is filled after _onEVT_1DREPLOT 86 is called 87 """ 88 self.SetColor(None) 89 self.draw() 90 #post nd event to notify guiframe that this panel is on focus 91 wx.PostEvent(self.parent, AddManyDataEvent(panel=self)) 92 83 93 def _reset(self): 84 94 """ … … 88 98 self.plots = {} 89 99 self.action_ids = {} 90 91 100 92 101 def _onEVT_1DREPLOT(self, event): … … 157 166 else: 158 167 self._on_add_errors( evt=None) 159 return160 168 161 169 def onLeftDown(self,event): … … 169 177 position = "x: %8.3g y: %8.3g" % (event.xdata, event.ydata) 170 178 wx.PostEvent(self.parent, StatusEvent(status=position)) 171 172 179 173 180 def _onRemove(self, event): 174 181 """
Note: See TracChangeset
for help on using the changeset viewer.