Changeset bf66f67 in sasview for sansview/perspectives


Ignore:
Timestamp:
Aug 4, 2010 1:52:43 PM (14 years ago)
Author:
Gervaise Alina <gervyh@…>
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:
210ff4f
Parents:
9e2cfee
Message:

reverse to version 3161

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sansview/perspectives/fitting/hint_fitpage.py

    r4f81342 rbf66f67  
     1import wx 
    12 
    2 import os  
    3 import wx 
    4 from wx.lib.scrolledpanel import ScrolledPanel 
    5 from sans.guicomm.events import NewPlotEvent 
    63 
    7 class HintFitPage(ScrolledPanel): 
     4class HintFitPage(wx.ScrolledWindow): 
    85    """ 
    9     This class provide general structure of  fitpanel page 
     6        This class provide general structure of  fitpanel page 
    107    """ 
    118     ## Internal name for the AUI manager 
    12     window_name = "Loaded Data" 
     9    window_name = "Hint Page" 
    1310    ## Title to appear on top of the window 
    14     window_caption = "Loaded Data" 
     11    window_caption = "Hint page " 
    1512     
    1613    def __init__(self, parent): 
    17         """ 
    18         """ 
    19         ScrolledPanel.__init__(self, parent, 
    20                  style=wx.FULL_REPAINT_ON_RESIZE) 
    21         self.SetupScrolling() 
    22         self.parent = parent 
    23         self.manager = None 
     14        wx.ScrolledWindow.__init__(self, parent, 
     15                 style= wx.FULL_REPAINT_ON_RESIZE ) 
     16         
    2417        msg = "right click on the data when it is highlighted " 
    2518        msg += "the select option to fit for futher options" 
    2619        self.do_layout() 
    2720         
    28     def set_manager(self, manager): 
    29         """ 
    30         """ 
    31         self.manager = manager 
    32          
    33     def set_data(self, list=[], state=None): 
    34         """ 
    35         """ 
    36         if not list: 
    37             return  
    38         for data, path in list: 
    39             if data.name not in self.data_cbbox.GetItems(): 
    40                 self.data_cbbox.Insert(item=data.name, pos=0, 
    41                                     clientData=(data, path)) 
    42       
    43         if self.data_cbbox.GetCount() ==1: 
    44             self.data_cbbox.SetSelection(0) 
    45             self.data_cbbox.Enable() 
    46             self.on_select_data(event=None) 
    47          
    4821    def do_layout(self): 
    4922        """ 
    50         Draw the page  
     23            Draw the page  
    5124        """ 
    52         self.vbox = wx.BoxSizer(wx.VERTICAL) 
    53         sizer1 = wx.BoxSizer(wx.HORIZONTAL) 
    54         sizer2 = wx.GridBagSizer(0,0) 
    55         box_description = wx.StaticBox(self, -1, "Hint") 
    56         boxsizer = wx.StaticBoxSizer(box_description, wx.HORIZONTAL) 
    57         boxsizer.SetMinSize((450,100)) 
     25        name="Hint" 
     26        box_description= wx.StaticBox(self, -1,name) 
     27        boxsizer = wx.StaticBoxSizer(box_description, wx.VERTICAL) 
    5828        msg  = "    How to link data to the control panel: \n \n" 
    5929        msg += "    First load data file from 'File' menu. \n" 
     
    6131        msg += "    Finally, select 'Select data for fitting' in the pop-up menu. \n" 
    6232        self.hint_txt = wx.StaticText(self, -1, msg, style=wx.ALIGN_LEFT) 
    63         self.data_txt = wx.StaticText(self, -1,"Loaded Data: ") 
    64         self.data_cbbox = wx.ComboBox(self, -1, size=(260,20)) 
    65         self.data_cbbox.Disable() 
    66         wx.EVT_COMBOBOX(self.data_cbbox ,-1, self.on_select_data)  
    67          
    68         sizer1.Add(self.hint_txt) 
    69         ix = 0  
    70         iy = 0 
    71        
    72         sizer2.Add(self.data_txt, (iy, ix), (1,1), 
    73                     wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
    74         ix += 1 
    75         sizer2.Add( self.data_cbbox, (iy, ix), (1,1), 
    76                     wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
    77         boxsizer.Add(sizer1) 
    78         
    79         self.vbox.Add(boxsizer,0, wx.ALL, 10) 
    80         self.vbox.Add(sizer2) 
     33        boxsizer.Add(self.hint_txt, wx.ALL|wx.EXPAND, 20) 
     34        self.vbox = wx.BoxSizer(wx.VERTICAL) 
     35        self.vbox.Add(boxsizer ) 
     36        self.vbox.Layout() 
     37        self.vbox.Fit(self)  
    8138        self.SetSizer(self.vbox) 
    82         
    83     def on_select_data(self, event=None): 
    84         """ 
    85         """ 
    86         n = self.data_cbbox.GetCurrentSelection() 
    87         data, path = self.data_cbbox.GetClientData(n) 
    88         if data.__class__.__name__ in ["Data1D", "Theory1D"]: 
    89             data = self.manager.create_fittable_data1D(data=data) 
    90         else: 
    91             data = self.manager.create_fittable_data2D(data=data) 
    92         self.parent.manager.add_fit_page(data=data) 
    93         if data !=None: 
    94             if hasattr(data,"title"): 
    95                 title = str(data.title.lstrip().rstrip()) 
    96                 if title == "": 
    97                     title = str(data.name) 
    98             else: 
    99                 title = str(data.name) 
    100             wx.PostEvent(self.parent.parent, NewPlotEvent(plot=data, title=title)) 
     39        self.SetScrollbars(20,20,25,65) 
     40        self.Layout() 
    10141         
    10242    def createMemento(self): 
    103         """ 
    104         """ 
    10543        return  
     44         
     45class HelpWindow(wx.Frame): 
     46    def __init__(self, parent, id, title): 
     47        wx.Frame.__init__(self, parent, id, title, size=(570, 400)) 
     48        
     49        self.page = HintFitPage(self)  
     50        self.Centre() 
     51        self.Show(True) 
    10652  
     53if __name__=="__main__": 
     54    app = wx.App() 
     55    HelpWindow(None, -1, 'HelpWindow') 
     56    app.MainLoop() 
     57                 
Note: See TracChangeset for help on using the changeset viewer.