Changeset 0aca693 in sasview for sansguiframe/src/sans/guiframe
- Timestamp:
- Apr 9, 2012 9:44:49 AM (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:
- 8b1d759
- Parents:
- cce182ae
- Location:
- sansguiframe/src/sans/guiframe
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
sansguiframe/src/sans/guiframe/data_panel.py
r9ea4577e r0aca693 435 435 dimension=dimension, id=wx.NewId()) 436 436 panel.ShowModal() 437 438 def on_data_info(self, event): 439 """ 440 Data Info panel 441 """ 442 data = self._get_data_selection(event) 443 if data.__class__.__name__ == "Data2D": 444 self.parent.show_data2d(data, data.name) 445 else: 446 self.parent.show_data1d(data, data.name) 437 447 438 448 def on_save_as(self, event): … … 465 475 ## Create context menu for page 466 476 self.data_menu = wx.Menu() 477 id = wx.NewId() 478 name = "Data Info" 479 msg = "Show Data Info" 480 self.data_menu.Append(id, name, msg) 481 wx.EVT_MENU(self, id, self.on_data_info) 482 467 483 id = wx.NewId() 468 484 name = "Save As" -
sansguiframe/src/sans/guiframe/gui_manager.py
r7954acd r0aca693 326 326 list_children = self.GetChildren() 327 327 for frame in list_children: 328 if hasattr(frame, "IsIconized"): 329 if not frame.IsIconized(): 330 try: 331 icon = self.GetIcon() 332 frame.SetIcon(icon) 333 except: 334 pass 328 self.put_icon(frame) 329 330 def put_icon(self, frame): 331 """ 332 Put icon on the tap of a panel 333 """ 334 if hasattr(frame, "IsIconized"): 335 if not frame.IsIconized(): 336 try: 337 icon = self.GetIcon() 338 frame.SetIcon(icon) 339 except: 340 pass 335 341 336 342 def on_set_batch_result(self, data_outputs, data_inputs=None, … … 2182 2188 2183 2189 dialog = PDFFrame(None, -1, "Tutorial", path) 2184 if hasattr(dialog, "IsIconized"): 2185 if not dialog.IsIconized(): 2186 try: 2187 icon = self.GetIcon() 2188 dialog.SetIcon(icon) 2189 except: 2190 pass 2190 # put icon 2191 self.put_icon(frame) 2191 2192 #self.SetTopWindow(dialog) 2192 2193 dialog.Show(True) … … 2565 2566 out.write("%g %g\n" % (data.x[i], 2566 2567 data.y[i])) 2567 out.close() 2568 out.close() 2569 2570 def show_data1d(self, data, name): 2571 """ 2572 Show data dialog 2573 """ 2574 text = data.__str__() 2575 text += 'Data Min Max:\n' 2576 text += 'X_min = %s: X_max = %s\n'% (min(data.x), max(data.x)) 2577 text += 'Y_min = %s: Y_max = %s\n'% (min(data.y), max(data.y)) 2578 if data.dy != None: 2579 text += 'dY_min = %s: dY_max = %s\n'% (min(data.dy), max(data.dy)) 2580 text += '\nData Points:\n' 2581 x_st = "X" 2582 for index in range(len(data.x)): 2583 if data.dy != None: 2584 dy_val = data.dy[index] 2585 else: 2586 dy_val = 0.0 2587 if data.dx != None: 2588 dx_val = data.dx[index] 2589 else: 2590 dx_val = 0.0 2591 if data.dxl != None: 2592 if index == 0: x_st = "Xl" 2593 dx_val = data.dxl[index] 2594 elif data.dxw != None: 2595 if index == 0: x_st = "Xw" 2596 dx_val = data.dxw[index] 2597 2598 if index == 0: 2599 text += "<index> \t<X> \t<Y> \t<dY> \t<d%s>\n"% x_st 2600 text += "%s \t%s \t%s \t%s \t%s\n" % (index, 2601 data.x[index], 2602 data.y[index], 2603 dy_val, 2604 dx_val) 2605 from pdfview import TextFrame 2606 frame = TextFrame(None, -1, "Data Info: %s"% data.name, text) 2607 # put icon 2608 self.put_icon(frame) 2609 frame.Show(True) 2568 2610 2569 2611 def save_data2d(self, data, fname): … … 2609 2651 pass 2610 2652 dlg.Destroy() 2611 2653 2654 def show_data2d(self, data, name): 2655 """ 2656 Show data dialog 2657 """ 2658 2659 wx.PostEvent(self, StatusEvent(status = "Gathering Data2D Info.", 2660 type = 'start' )) 2661 text = data.__str__() 2662 text += 'Data Min Max:\n' 2663 text += 'I_min = %s\n'% min(data.data) 2664 text += 'I_max = %s\n\n'% max(data.data) 2665 text += 'Data (First 2501) Points:\n' 2666 text += 'Data columns include err(I).\n' 2667 text += 'ASCII data starts here.\n' 2668 text += "<index> \t<Qx> \t<Qy> \t<I> \t<dI> \t<dQparal> \t<dQperp>\n" 2669 di_val = 0.0 2670 dx_val = 0.0 2671 dy_val = 0.0 2672 #mask_val = True 2673 len_data = len(data.qx_data) 2674 for index in xrange(0, len_data): 2675 x_val = data.qx_data[index] 2676 y_val = data.qy_data[index] 2677 i_val = data.data[index] 2678 if data.err_data != None: di_val = data.err_data[index] 2679 if data.dqx_data != None: dx_val = data.dqx_data[index] 2680 if data.dqy_data != None: dy_val = data.dqy_data[index] 2681 #if data.mask != None: mask_val = data.mask[index] 2682 2683 text += "%s \t%s \t%s \t%s \t%s \t%s \t%s\n" % (index, 2684 x_val, 2685 y_val, 2686 i_val, 2687 di_val, 2688 dx_val, 2689 dy_val) 2690 # Takes too long time for typical data2d: Break here 2691 if index >= 2500: 2692 text += ".............\n" 2693 break 2694 2695 from pdfview import TextFrame 2696 frame = TextFrame(None, -1, "Data Info: %s"% data.name, text) 2697 # put icon 2698 self.put_icon(frame) 2699 frame.Show(True) 2700 wx.PostEvent(self, StatusEvent(status = "Data2D Info Displayed", 2701 type = 'stop' )) 2702 2612 2703 def set_current_perspective(self, perspective): 2613 2704 """ -
sansguiframe/src/sans/guiframe/local_perspectives/plotting/Plotter1D.py
r4a9bce1 r0aca693 410 410 pass 411 411 plot_menu.AppendSeparator() 412 412 413 id = wx.NewId() 414 plot_menu.Append(id, "&DataInfo", name) 415 wx.EVT_MENU(self, id, self. _onDataShow) 413 416 id = wx.NewId() 414 417 plot_menu.Append(id, "&Save Points as a File", name) … … 657 660 self.parent.save_data1d(data, default_name) 658 661 662 663 def _onDataShow(self, evt): 664 """ 665 Show the data set in text 666 667 :param evt: Menu event 668 669 """ 670 menu = evt.GetEventObject() 671 id = evt.GetId() 672 self.set_selected_from_menu(menu, id) 673 data = self.plots[self.graph.selected_plottable] 674 default_name = data.label 675 if default_name.count('.') > 0: 676 default_name = default_name.split('.')[0] 677 #default_name += "_out" 678 if self.parent != None: 679 self.parent.show_data1d(data, default_name) 680 659 681 def _add_more_tool(self): 660 682 """ -
sansguiframe/src/sans/guiframe/local_perspectives/plotting/Plotter2D.py
r2a09236 r0aca693 316 316 # saving data 317 317 plot = self.data2D 318 id = wx.NewId() 319 name = plot.name 320 slicerpop.Append(id, "&Data Info" ) 321 wx.EVT_MENU(self, id, self._onDataShow) 322 318 323 id = wx.NewId() 319 324 name = plot.name … … 761 766 path = None 762 767 self.parent.save_data2d(self.data2D, default_name) 763 768 769 def _onDataShow(self, evt): 770 """ 771 Show the data set in text 772 773 :param evt: Menu event 774 775 """ 776 menu = evt.GetEventObject() 777 id = evt.GetId() 778 self.set_selected_from_menu(menu, id) 779 data = self.plots[self.graph.selected_plottable] 780 default_name = data.label 781 if default_name.count('.') > 0: 782 default_name = default_name.split('.')[0] 783 #default_name += "_out" 784 if self.parent != None: 785 self.parent.show_data2d(data, default_name) 786 -
sansguiframe/src/sans/guiframe/pdfview.py
r03a8b16 r0aca693 7 7 from wx.lib.pdfwin import PDFWindow 8 8 9 from wx.lib.scrolledpanel import ScrolledPanel 10 STYLE = wx.TE_MULTILINE|wx.TE_READONLY|wx.SUNKEN_BORDER|wx.HSCROLL 11 12 class TextPanel(ScrolledPanel): 13 """ 14 Panel that contains the text 15 """ 16 def __init__(self, parent, text=None): 17 """ 18 """ 19 ScrolledPanel.__init__(self, parent, id=-1) 20 self.SetupScrolling() 21 self.parent = parent 22 self.text = text 23 sizer = wx.BoxSizer(wx.VERTICAL) 24 self.textctl = wx.TextCtrl(self, -1, size=(-1, -1), style=STYLE) 25 self.textctl.SetValue(self.text) 26 sizer.Add(self.textctl, proportion=1, flag=wx.EXPAND) 27 self.SetSizer(sizer) 28 self.SetAutoLayout(True) 29 wx.EVT_CLOSE(self.parent, self.OnClose) 30 31 def OnClose(self, event): 32 """ 33 Close panel 34 """ 35 self.parent.Destroy() 36 37 class TextFrame(wx.Frame): 38 """ 39 Frame for PDF panel 40 """ 41 def __init__(self, parent, id, title, text): 42 """ 43 Init 44 45 :param parent: parent panel/container 46 :param path: full path of the pdf file 47 """ 48 # Initialize the Frame object 49 wx.Frame.__init__(self, parent, id, title, 50 wx.DefaultPosition, wx.Size(600, 830)) 51 # make an instance of the class 52 TextPanel(self, text) 53 self.SetFocus() 54 9 55 class PDFPanel(wx.Panel): 10 56 """
Note: See TracChangeset
for help on using the changeset viewer.