Changeset 53cf669 in sasview
- Timestamp:
- Sep 4, 2011 6:12:25 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:
- e85e2bc
- Parents:
- 37c36d9
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
fittingview/src/sans/perspectives/fitting/fitting.py
r59de3e43 r53cf669 1313 1313 new_plot.title = "Model2D for " + data.name 1314 1314 new_plot.is_data = False 1315 new_plot.name = model.name + " ["+ str(model.__class__.__name__)+ "]" 1315 new_plot.name = model.name + " [" + \ 1316 str(model.__class__.__name__) + "-2D]" 1316 1317 theory_data = deepcopy(new_plot) 1317 1318 theory_data.name = "Unknown" -
sansguiframe/src/sans/guiframe/gui_manager.py
r37c36d9 r53cf669 234 234 # List of plot panels 235 235 self.plot_panels = {} 236 # default Graph number fot the plotpanel caption 237 self.graph_num = 0 236 238 237 239 # Default locations … … 808 810 count += 1 809 811 windowname = p.window_name 810 caption =p.window_caption812 windowcaption = 'Graph'#p.window_caption 811 813 if count > 0: 812 814 windowname += str(count+1) 813 caption += (' '+str(count))815 #caption += (' '+str(count)) 814 816 p.window_name = windowname 817 818 # Append nummber 819 captions = self._get_plotpanel_captions() 820 while (1): 821 self.graph_num += 1 822 caption = windowcaption + '%s'% str(self.graph_num) 823 if caption not in captions: 824 break 825 815 826 p.window_caption = caption 816 827 … … 861 872 self._data_panel.cb_plotpanel.Append(str(caption), p) 862 873 return ID 863 874 875 def _get_plotpanel_captions(self): 876 """ 877 Get all the plotpanel cations 878 879 : return: list of captions 880 """ 881 captions = [] 882 for Id in self.plot_panels.keys(): 883 captions.append(self.plot_panels[Id].window_caption) 884 885 return captions 886 864 887 def _setup_menus(self): 865 888 """ … … 2361 2384 # wx.aui.AuiPaneInfo 2362 2385 pane_info = self.get_paneinfo(name) 2363 # New Caption2364 pane_info.Caption(new_caption)2365 2386 # update the data_panel.cb_plotpanel 2366 2387 if 'data_panel' in self.panels.keys(): … … 2368 2389 data_panel = self.panels["data_panel"] 2369 2390 if data_panel.cb_plotpanel is not None: 2391 # Check if any panel has the same caption 2392 has_newstring = data_panel.cb_plotpanel.FindString\ 2393 (str(new_caption)) 2394 caption = new_caption 2395 if has_newstring != wx.NOT_FOUND: 2396 captions = self._get_plotpanel_captions() 2397 # Append nummber 2398 inc = 1 2399 while (1): 2400 caption = new_caption + '_%s'% str(inc) 2401 if caption not in captions: 2402 break 2403 inc += 1 2404 # notify to users 2405 msg = "Found Same Title: Added '_%s'"% str(inc) 2406 wx.PostEvent(self, StatusEvent(status=msg)) 2407 # update data_panel cb 2370 2408 pos = data_panel.cb_plotpanel.FindString(str(old_caption)) 2371 2409 if pos != wx.NOT_FOUND: 2372 data_panel.cb_plotpanel.SetString(pos, new_caption)2373 data_panel.cb_plotpanel.SetStringSelection( new_caption)2410 data_panel.cb_plotpanel.SetString(pos, caption) 2411 data_panel.cb_plotpanel.SetStringSelection(caption) 2374 2412 # update window Show menu 2375 2413 if self._window_menu != None: … … 2377 2415 pos = self._window_menu.FindItem(old_caption) 2378 2416 if self._window_menu.GetLabel(pos) == str(old_caption): 2379 self._window_menu.SetLabel(pos, new_caption)2417 self._window_menu.SetLabel(pos, caption) 2380 2418 break 2419 # New Caption 2420 pane_info.Caption(caption) 2381 2421 # update aui manager 2382 2422 self._mgr.Update() 2423 return caption 2383 2424 2384 2425 def get_paneinfo(self, name): … … 2580 2621 self.panel_on_focus = panel 2581 2622 self.set_panel_on_focus(None) 2582 2623 2583 2624 def set_plot_unfocus(self): 2584 2625 """ -
sansguiframe/src/sans/guiframe/local_perspectives/plotting/Plotter1D.py
r37c36d9 r53cf669 247 247 self.subplot.set_xlim((xlo, xhi)) 248 248 self.subplot.set_ylim((ylo, yhi)) 249 # Update Graph menu and help string 250 pos = self.parent._window_menu.FindItem(self.window_caption) 251 helpString = 'Show/Hide Graph: ' 252 for plot in self.plots.itervalues(): 253 helpString += (' ' + plot.label +';') 254 self.parent._window_menu.SetHelpString(pos, helpString) 249 255 else: 250 256 self.plots[data.id] = data … … 270 276 Display the position of the mouse on the statusbar 271 277 """ 272 PlotPanel.onLeftDown(self, event) 273 ax = event.inaxes 274 if ax != None: 275 # data coordinate position 276 pos_x = "%8.3g"% event.xdata 277 pos_y = "%8.3g"% event.ydata 278 position = "x: %s y: %s" % (pos_x, pos_y) 279 wx.PostEvent(self.parent, StatusEvent(status=position)) 278 PlotPanel.onLeftDown(self, event) 280 279 # unfocus all 281 280 self.parent.set_plot_unfocus() … … 458 457 self._slicerpop.AppendSeparator() 459 458 id = wx.NewId() 460 self._slicerpop.Append(id, '&Reset Range')459 self._slicerpop.Append(id, '&Reset Axis Ranges') 461 460 wx.EVT_MENU(self, id, self.onResetGraph) 462 461 try: … … 490 489 newLabel = dial.getText() 491 490 selected_plot.label = newLabel 491 # Updata Graph menu help string 492 pos = self.parent._window_menu.FindItem(self.window_caption) 493 helpString = 'Show/Hide Graph: ' 494 for plot in self.plots.itervalues(): 495 helpString += (' ' + plot.label +';') 496 self.parent._window_menu.SetHelpString(pos, helpString) 497 #break 492 498 dial.Destroy() 499 493 500 ## render the graph 494 501 self._onEVT_FUNC_PROPERTY() -
sansguiframe/src/sans/guiframe/local_perspectives/plotting/Plotter2D.py
r37c36d9 r53cf669 143 143 """ 144 144 # Check that the LEFT button was pressed 145 if event.button == 1: 146 self.leftdown = True 147 ax = event.inaxes 148 if ax != None: 149 self.xInit, self.yInit = event.xdata, event.ydata 145 PlotPanel.onLeftDown(self, event) 146 150 147 self.plottable_selected(self.data2D.id) 151 152 148 self._manager.set_panel_on_focus(self) 153 149 wx.PostEvent(self.parent, PanelOnFocusEvent(panel=self)) … … 251 247 self.toolbar.update() 252 248 self._is_zoomed = False 253 249 250 # Update Graph menu and help string 251 pos = self.parent._window_menu.FindItem(self.window_caption) 252 helpString = 'Show/Hide Graph: ' 253 helpString += (' ' + data.label +';') 254 self.parent._window_menu.SetHelpString(pos, helpString) 255 254 256 def _set_axis_labels(self): 255 257 """ … … 383 385 slicerpop.Append(id, '&Toggle Linear/Log Scale') 384 386 wx.EVT_MENU(self, id, self._onToggleScale) 387 388 389 slicerpop.AppendSeparator() 390 id = wx.NewId() 391 slicerpop.Append(id, '&Window Title') 392 wx.EVT_MENU(self, id, self.onChangeCaption) 393 385 394 try: 386 395 pos_evt = event.GetPosition() … … 391 400 self.PopupMenu(slicerpop, pos) 392 401 393 slicerpop.AppendSeparator()394 id = wx.NewId()395 slicerpop.Append(id, '&Window Title')396 wx.EVT_MENU(self, id, self.onChangeCaption)397 398 self.PopupMenu(self._slicerpop, pos)399 402 400 403 def onEditLabels(self, event): … … 416 419 colour = dial.getColor() 417 420 if len(newlabel) > 0: 421 # update Label 418 422 selected_plot.label = newlabel 423 self.graph.title(newlabel) 419 424 self.title_label = selected_plot.label 420 425 self.title_font = font … … 433 438 raise 434 439 dial.Destroy() 440 441 # Update Graph menu and help string 442 if self.title_label != None: 443 pos = self.parent._window_menu.FindItem(self.window_caption) 444 helpString = 'Show/Hide Graph: ' 445 helpString += (' ' + self.title_label +';') 446 self.parent._window_menu.SetHelpString(pos, helpString) 435 447 436 448 -
sansguiframe/src/sans/guiframe/local_perspectives/plotting/plotting.py
r846c724 r53cf669 158 158 if pos != -1: 159 159 self.menu.Delete(DEFAULT_MENU_ITEM_ID) 160 161 self.menu.AppendCheckItem(event_id, new_panel.window_caption,162 "Show %s plot panel" % new_panel.window_caption)163 self.menu.Check(event_id, IS_WIN)164 wx.EVT_MENU(self.parent, event_id, self._on_check_menu)165 166 wx.EVT_SHOW(new_panel, self._on_close_panel)167 168 160 # Set UID to allow us to reference the panel later 169 161 new_panel.uid = event_id … … 172 164 self.plot_panels[new_panel.group_id] = new_panel 173 165 166 # Set Graph menu and help string 167 helpString = 'Show/Hide Graph: ' 168 for plot in new_panel.plots.itervalues(): 169 helpString += (' ' + plot.label + ';') 170 self.menu.AppendCheckItem(event_id, new_panel.window_caption, 171 helpString) 172 self.menu.Check(event_id, IS_WIN) 173 wx.EVT_MENU(self.parent, event_id, self._on_check_menu) 174 175 wx.EVT_SHOW(new_panel, self._on_close_panel) 176 174 177 175 178 def create_1d_panel(self, data, group_id): … … 282 285 title = None 283 286 if hasattr(event, 'title'): 284 title = event.title287 title = 'Graph'#event.title 285 288 286 289 data = event.plot
Note: See TracChangeset
for help on using the changeset viewer.