Changeset 72a6bf8 in sasview for sansview/perspectives/fitting/hint_fitpage.py
- Timestamp:
- Jul 26, 2010 5:39:54 PM (14 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:
- cef847c
- Parents:
- 343fdb6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sansview/perspectives/fitting/hint_fitpage.py
r5062bbf r72a6bf8 1 1 2 import os 2 3 import wx 4 from wx.lib.scrolledpanel import ScrolledPanel 5 from sans.guicomm.events import NewPlotEvent 3 6 4 5 class HintFitPage(wx.ScrolledWindow): 7 class HintFitPage(ScrolledPanel): 6 8 """ 7 9 This class provide general structure of fitpanel page … … 15 17 """ 16 18 """ 17 wx.ScrolledWindow.__init__(self, parent, 18 style= wx.FULL_REPAINT_ON_RESIZE ) 19 19 ScrolledPanel.__init__(self, parent, 20 style=wx.FULL_REPAINT_ON_RESIZE) 21 self.SetupScrolling() 22 self.parent = parent 20 23 msg = "right click on the data when it is highlighted " 21 24 msg += "the select option to fit for futher options" 22 25 self.do_layout() 26 27 28 def set_data(self, list=[], state=None): 29 """ 30 """ 31 if not list: 32 return 33 for data, path in list: 34 if data.name not in self.data_cbbox.GetItems(): 35 self.data_cbbox.Insert(item=data.name, pos=0, 36 clientData=(data, path)) 37 if self.data_cbbox.GetCount() >0: 38 self.data_cbbox.SetSelection(0) 39 self.data_cbbox.Enable() 40 self.on_select_data(event=None) 23 41 24 42 def do_layout(self): … … 26 44 Draw the page 27 45 """ 28 name="Hint" 29 box_description= wx.StaticBox(self, -1,name) 30 boxsizer = wx.StaticBoxSizer(box_description, wx.VERTICAL) 46 self.vbox = wx.BoxSizer(wx.VERTICAL) 47 sizer1 = wx.BoxSizer(wx.HORIZONTAL) 48 sizer2 = wx.GridBagSizer(0,0) 49 box_description = wx.StaticBox(self, -1, "Hint") 50 boxsizer = wx.StaticBoxSizer(box_description, wx.HORIZONTAL) 51 boxsizer.SetMinSize((450,100)) 31 52 msg = " How to link data to the control panel: \n \n" 32 53 msg += " First load data file from 'File' menu. \n" … … 34 55 msg += " Finally, select 'Select data for fitting' in the pop-up menu. \n" 35 56 self.hint_txt = wx.StaticText(self, -1, msg, style=wx.ALIGN_LEFT) 36 boxsizer.Add(self.hint_txt, wx.ALL|wx.EXPAND, 20) 37 self.vbox = wx.BoxSizer(wx.VERTICAL) 38 self.vbox.Add(boxsizer ) 39 self.vbox.Layout() 40 self.vbox.Fit(self) 57 self.data_txt = wx.StaticText(self, -1,"Loaded Data: ") 58 self.data_cbbox = wx.ComboBox(self, -1, size=(260,20)) 59 self.data_cbbox.Disable() 60 wx.EVT_COMBOBOX(self.data_cbbox ,-1, self.on_select_data) 61 62 sizer1.Add(self.hint_txt) 63 ix = 0 64 iy = 0 65 66 sizer2.Add(self.data_txt, (iy, ix), (1,1), 67 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 68 ix += 1 69 sizer2.Add( self.data_cbbox, (iy, ix), (1,1), 70 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 71 boxsizer.Add(sizer1) 72 73 self.vbox.Add(boxsizer,0, wx.ALL, 10) 74 self.vbox.Add(sizer2) 41 75 self.SetSizer(self.vbox) 42 self.SetScrollbars(20,20,25,65) 43 self.Layout() 76 77 def on_select_data(self, event=None): 78 """ 79 """ 80 n = self.data_cbbox.GetCurrentSelection() 81 data, path = self.data_cbbox.GetClientData(n) 82 self.parent.manager.add_fit_page(data=data) 83 title = os.path.basename(path) 84 44 85 45 86 def createMemento(self): … … 47 88 """ 48 89 return 49 """ 50 Example: :: 51 52 class HelpWindow(wx.Frame): 53 def __init__(self, parent, id, title): 54 wx.Frame.__init__(self, parent, id, title, size=(570, 400)) 55 56 self.page = HintFitPage(self) 57 self.Centre() 58 self.Show(True) 59 60 if __name__=="__main__": 61 app = wx.App() 62 HelpWindow(None, -1, 'HelpWindow') 63 app.MainLoop() 64 """ 90
Note: See TracChangeset
for help on using the changeset viewer.