Changeset 518d35d in sasview for invariantview/perspectives


Ignore:
Timestamp:
Mar 24, 2010 4:40: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:
d3fac18
Parents:
00e8df8
Message:

change panel according to inputs or wed meeting

Location:
invariantview/perspectives/invariant
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • invariantview/perspectives/invariant/invariant.py

    r2661d8b r518d35d  
    104104        
    105105        for item in self.graph.plottables: 
    106             if issubclass(item.__class__,LoaderData1D): 
    107         
    108                 if item.name !="$I_{obs}(q)$" and item.name !="$P_{fit}(r)$": 
    109                     if hasattr(item, "group_id"): 
    110                         return [[invariant_option,  
    111                                     invariant_hint, self._compute_invariant]] 
     106            if item.name == graph.selected_plottable : 
     107                if issubclass(item.__class__,LoaderData1D): 
     108            
     109                    if item.name !="$I_{obs}(q)$" and item.name !="$P_{fit}(r)$": 
     110                        if hasattr(item, "group_id"): 
     111                            return [[invariant_option,  
     112                                        invariant_hint, self._compute_invariant]] 
    112113        return []    
    113114 
  • invariantview/perspectives/invariant/invariant_details.py

    r9ce7641c r518d35d  
    55import numpy 
    66from sans.guiframe.utils import format_number, check_float 
     7from invariant_widgets import OutputTextCtrl 
    78# Dimensions related to chart 
    89RECTANGLE_WIDTH  = 400.0   
     
    9394      
    9495        invariant_txt = wx.StaticText(self, -1, 'Invariant') 
    95         self.invariant_tcl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,-1)) 
    96         self.invariant_tcl.SetEditable(False) 
     96        self.invariant_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH,-1)) 
    9797        self.invariant_tcl.SetToolTipString("Invariant in the data set's Q range.") 
    98         self.invariant_err_tcl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,-1)) 
    99         self.invariant_err_tcl.SetEditable(False) 
     98        self.invariant_err_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH,-1)) 
    10099        self.invariant_err_tcl.SetToolTipString("Uncertainty on the invariant.") 
    101100        invariant_units_txt = wx.StaticText(self, -1, unit_invariant) 
    102101        
    103102        invariant_low_txt = wx.StaticText(self, -1, 'Invariant in low-Q region') 
    104         self.invariant_low_tcl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,-1)) 
    105         self.invariant_low_tcl.SetEditable(False) 
     103        self.invariant_low_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH,-1)) 
    106104        self.invariant_low_tcl.SetToolTipString("Invariant computed with the extrapolated low-Q data.") 
    107         self.invariant_low_err_tcl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,-1)) 
    108         self.invariant_low_err_tcl.SetEditable(False) 
     105        self.invariant_low_err_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH,-1)) 
    109106        self.invariant_low_err_tcl.SetToolTipString("Uncertainty on the invariant.") 
    110107        invariant_low_units_txt = wx.StaticText(self, -1,  unit_invariant) 
    111108         
    112109        invariant_high_txt = wx.StaticText(self, -1, 'Invariant in high-Q region') 
    113         self.invariant_high_tcl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,-1)) 
    114         self.invariant_high_tcl.SetEditable(False) 
     110        self.invariant_high_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH,-1)) 
    115111        self.invariant_high_tcl.SetToolTipString("Invariant computed with the extrapolated high-Q data") 
    116         self.invariant_high_err_tcl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,-1)) 
    117         self.invariant_high_err_tcl.SetEditable(False) 
     112        self.invariant_high_err_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH,-1)) 
    118113        self.invariant_high_err_tcl.SetToolTipString("Uncertainty on the invariant.") 
    119114        invariant_high_units_txt = wx.StaticText(self, -1,  unit_invariant) 
  • invariantview/perspectives/invariant/invariant_panel.py

    rf43827cc r518d35d  
    1111from sans.guicomm.events import NewPlotEvent, StatusEvent 
    1212from invariant_details import InvariantDetailsWindow 
     13from invariant_widgets import OutputTextCtrl, InvTextCtrl 
    1314# The minimum q-value to be used when extrapolating 
    1415Q_MINIMUM  = 1e-5 
     
    201202            qstar_total, qstar_total_err = inv.get_qstar_with_error(extrapolation) 
    202203            self.invariant_total_tcl.SetValue(format_number(qstar_total)) 
    203             self.invariant_total_err_tcl.SetValue(format_number(qstar_total)) 
     204            self.invariant_total_err_tcl.SetValue(format_number(qstar_total_err)) 
    204205            self.inv_container.qstar_total = qstar_total 
    205206            self.inv_container.qstar_total_err = qstar_total_err 
    206             check_float(self.invariant_total_tcl) 
    207             check_float(self.invariant_total_err_tcl) 
     207          
    208208        except: 
    209209            msg= "Error occurred computing invariant using extrapolation: %s"%sys.exc_value 
     
    220220                extrapolated_data = inv.get_extra_data_low(npts_in=npts_low)  
    221221                power_low = inv.get_extrapolation_power(range='low')   
    222                 self.power_low_tcl.SetValue(str(power_low)) 
     222                if self.power_law_low.GetValue(): 
     223                    self.power_low_tcl.SetValue(str(power_low)) 
    223224                self._manager.plot_theory(data=extrapolated_data, 
    224225                                           name="Low-Q extrapolation") 
     
    237238                self.inv_container.qstar_high = qstar_high 
    238239                self.inv_container.qstar_high_err = qstar_high_err 
    239                 power_high = inv.get_extrapolation_power(range='high')   
     240                power_high = inv.get_extrapolation_power(range='high')  
    240241                self.power_high_tcl.SetValue(str(power_high)) 
    241242                high_out_data = inv.get_extra_data_high(q_end=Q_MAXIMUM_PLOT) 
     
    263264            function_low = "guinier" 
    264265        # get the function 
    265         power_low = None 
     266        power_low = None #2.0/3.0 
    266267        if self.power_law_low.GetValue(): 
    267268            function_low = "power_law" 
    268             if self.fit_low_cbox.GetValue(): 
     269            if self.fit_enable_low.GetValue(): 
    269270                #set value of power_low to none to allow fitting 
    270271                power_low = None 
     
    278279                        msg = "Expect float for power at low q , got %s"%(power_low) 
    279280                        raise ValueError, msg 
    280                            
     281        
    281282        #Get the number of points to extrapolated 
    282283        npts_low = self.npts_low_tcl.GetValue().lstrip().rstrip()    
     
    300301        if self.power_law_high.GetValue(): 
    301302            function_high = "power_law" 
    302             if self.fit_high_cbox.GetValue(): 
     303            if self.fit_enable_high.GetValue(): 
    303304                #set value of power_high to none to allow fitting 
    304305                power_high = None 
     
    359360            inv, npts_high = self.set_extrapolation_high(inv=inv, high_q=high_q) 
    360361        except: 
    361             msg= "Error occurred computing invariant: %s"%sys.exc_value 
    362             wx.PostEvent(self.parent, StatusEvent(status= msg, type="stop")) 
     362            raise 
     363            #msg= "Error occurred computing invariant: %s"%sys.exc_value 
     364            #wx.PostEvent(self.parent, StatusEvent(status= msg, type="stop")) 
    363365            return 
    364366        #check the type of extrapolation 
     
    469471        data_name_txt = wx.StaticText(self, -1, 'Data : ')   
    470472        
    471         self.data_name_tcl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH*5, 20), style=0)  
     473        self.data_name_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH*5, 20), style=0)  
    472474        self.data_name_tcl.SetToolTipString("Data's name.") 
    473475        self.data_name_sizer.AddMany([(data_name_txt, 0, wx.LEFT|wx.RIGHT, 10), 
     
    476478        data_range_txt = wx.StaticText(self, -1, 'Total Q Range (1/A): ')  
    477479        data_min_txt = wx.StaticText(self, -1, 'Min : ')   
    478         self.data_min_tcl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH, 20), style=0) 
     480        self.data_min_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH, 20), style=0) 
    479481        self.data_min_tcl.SetToolTipString("The minimum value of q range.") 
    480         self.data_min_tcl.SetEditable(False)  
    481482        data_max_txt = wx.StaticText(self, -1, 'Max : ')  
    482         self.data_max_tcl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH, 20), style=0)  
     483        self.data_max_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH, 20), style=0)  
    483484        self.data_max_tcl.SetToolTipString("The maximum value of q range.") 
    484         self.data_max_tcl.SetEditable(False)  
    485485        self.data_range_sizer.AddMany([(data_range_txt, 0, wx.RIGHT, 10), 
    486486                                       (data_min_txt, 0, wx.RIGHT, 10), 
     
    497497        """ 
    498498        background_txt = wx.StaticText(self, -1, 'Background : ')   
    499         self.background_tcl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH, 20), style=0)  
     499        self.background_tcl = InvTextCtrl(self, -1, size=(_BOX_WIDTH, 20), style=0)  
    500500        self.background_tcl.SetValue(str(BACKGROUND)) 
     501        background_hint_txt = "background" 
     502        self.background_tcl.SetToolTipString(background_hint_txt) 
     503        background_unit_txt = wx.StaticText(self, -1, '[1/cm]')   
    501504        self.background_sizer.AddMany([(background_txt, 0, wx.LEFT|wx.RIGHT, 10), 
    502                                        (self.background_tcl)]) 
     505                                       (self.background_tcl, 0, wx.RIGHT, 10), 
     506                                       (background_unit_txt)]) 
    503507    def _layout_scale(self): 
    504508        """ 
     
    506510        """ 
    507511        scale_txt = wx.StaticText(self, -1, 'Scale : ')   
    508         self.scale_tcl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH, 20), style=0) 
     512        self.scale_tcl = InvTextCtrl(self, -1, size=(_BOX_WIDTH, 20), style=0) 
     513        scale_hint_txt = "Scale" 
     514        self.scale_tcl.SetToolTipString(scale_hint_txt) 
    509515        self.scale_tcl.SetValue(str(SCALE))  
    510516        self.scale_sizer.AddMany([(scale_txt, 0, wx.LEFT|wx.RIGHT, 10), 
     
    516522        """ 
    517523        contrast_txt = wx.StaticText(self, -1, 'Contrast : ')   
    518         self.contrast_tcl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH, 20), style=0) 
     524        self.contrast_tcl = InvTextCtrl(self, -1, size=(_BOX_WIDTH, 20), style=0) 
    519525        self.contrast_tcl.SetValue(str(CONTRAST))  
     526        contrast_hint_txt = "Contrast" 
     527        self.contrast_tcl.SetToolTipString(contrast_hint_txt) 
     528        contrast_unit_txt = wx.StaticText(self, -1, '[1/A^(2)]')   
    520529        self.contrast_sizer.AddMany([(contrast_txt, 0, wx.LEFT|wx.RIGHT, 10), 
    521                                        (self.contrast_tcl, 0, wx.LEFT, 15)]) 
     530                                       (self.contrast_tcl, 0, wx.LEFT, 15), 
     531                                       (contrast_unit_txt, 0, wx.LEFT, 10)]) 
    522532     
    523533    def _layout_porod_constant(self): 
     
    526536        """ 
    527537        porod_const_txt = wx.StaticText(self, -1, 'Porod Constant:')   
    528         self.porod_constant_tcl = wx.TextCtrl(self, -1,  
     538        self.porod_constant_tcl = InvTextCtrl(self, -1,  
    529539                                              size=(_BOX_WIDTH, 20), style=0)  
     540        porod_const_hint_txt = "Porod Constant" 
     541        self.porod_constant_tcl.SetToolTipString(porod_const_hint_txt) 
    530542        optional_txt = wx.StaticText(self, -1, '(Optional)')   
    531543        self.porod_constant_sizer.AddMany([(porod_const_txt, 0, wx.LEFT, 10), 
     
    533545                                       (optional_txt, 0, wx.LEFT, 10)]) 
    534546         
     547    def _enable_fit_power_law_low(self, event=None): 
     548        """ 
     549            Enable and disable the power value editing 
     550        """ 
     551        if self.fix_enable_low.IsEnabled(): 
     552            if self.fix_enable_low.GetValue(): 
     553                self.power_low_tcl.Enable() 
     554            else: 
     555                self.power_low_tcl.Disable() 
     556             
     557    def _enable_low_q_section(self, event=None): 
     558        """ 
     559            Disable or enable some button if the user enable low q extrapolation 
     560        """ 
     561        if self.enable_low_cbox.GetValue(): 
     562            self.npts_low_tcl.Enable() 
     563            self.fix_enable_low.Enable() 
     564            self.fit_enable_low.Enable() 
     565            self.guinier.Enable() 
     566            self.power_law_low.Enable() 
     567 
     568        else: 
     569            self.npts_low_tcl.Disable() 
     570            self.fix_enable_low.Disable() 
     571            self.fit_enable_low.Disable() 
     572            self.guinier.Disable() 
     573            self.power_law_low.Disable() 
     574        self._enable_power_law_low() 
     575        self._enable_fit_power_law_low() 
     576     
     577    def _enable_power_law_low(self, event=None): 
     578        """ 
     579            Enable editing power law section at low q range 
     580        """ 
     581        if self.guinier.GetValue(): 
     582            self.fix_enable_low.Disable() 
     583            self.fit_enable_low.Disable() 
     584            self.power_low_tcl.Disable() 
     585        else: 
     586            self.fix_enable_low.Enable() 
     587            self.fit_enable_low.Enable() 
     588            self.power_low_tcl.Enable() 
     589        self._enable_fit_power_law_low() 
     590             
    535591    def _layout_extrapolation_low(self): 
    536592        """ 
     
    540596        self.enable_low_cbox.SetForegroundColour('red') 
    541597        self.enable_low_cbox.SetValue(False) 
    542         self.fit_low_cbox = wx.CheckBox(self, -1, "Check to Fit Power") 
    543         self.fit_low_cbox.SetValue(False) 
     598        wx.EVT_CHECKBOX(self, self.enable_low_cbox.GetId(), 
     599                                         self._enable_low_q_section) 
     600        self.fix_enable_low = wx.RadioButton(self, -1, 'Fix', 
     601                                         (10, 10),style=wx.RB_GROUP) 
     602        self.fix_enable_low.SetValue(True) 
     603        self.fit_enable_low = wx.RadioButton(self, -1, 'Fit', (10, 10)) 
     604        self.Bind(wx.EVT_RADIOBUTTON, self._enable_fit_power_law_low, 
     605                                     id=self.fix_enable_low.GetId()) 
     606        self.Bind(wx.EVT_RADIOBUTTON, self._enable_fit_power_law_low,  
     607                                        id=self.fit_enable_low.GetId()) 
    544608        self.guinier = wx.RadioButton(self, -1, 'Guinier', 
    545609                                         (10, 10),style=wx.RB_GROUP) 
    546610        self.guinier.SetValue(True) 
    547611        self.power_law_low = wx.RadioButton(self, -1, 'Power Law', (10, 10)) 
     612        self.Bind(wx.EVT_RADIOBUTTON, self._enable_power_law_low, 
     613                                     id=self.guinier.GetId()) 
     614        self.Bind(wx.EVT_RADIOBUTTON, self._enable_power_law_low,  
     615                                        id=self.power_law_low.GetId()) 
     616         
    548617        npts_low_txt = wx.StaticText(self, -1, 'Npts') 
    549         self.npts_low_tcl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH, -1)) 
     618        self.npts_low_tcl = InvTextCtrl(self, -1, size=(_BOX_WIDTH*2/3, -1)) 
    550619        self.npts_low_tcl.SetValue(str(NPTS)) 
    551620        msg_hint = "Number of Q points to consider" 
     
    553622        self.npts_low_tcl.SetToolTipString(msg_hint) 
    554623        power_txt = wx.StaticText(self, -1, 'Power') 
    555         self.power_low_tcl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH, -1)) 
     624        self.power_low_tcl = InvTextCtrl(self, -1, size=(_BOX_WIDTH*2/3, -1)) 
    556625        self.power_low_tcl.SetValue(str(self.power_law_exponant)) 
     626        self.power_low_tcl.Disable() 
    557627        power_hint_txt = "Exponent to apply to the Power_law function." 
    558628        self.power_low_tcl.SetToolTipString(power_hint_txt) 
    559629        iy = 0 
     630        ix = 0 
     631        self.low_q_sizer.Add(self.enable_low_cbox,(iy, ix),(1,5), 
     632                            wx.TOP|wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
     633        iy += 1 
     634        ix = 0 
     635        self.low_q_sizer.Add(npts_low_txt,(iy, ix),(1,1), 
     636                            wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
     637        ix += 1 
     638        self.low_q_sizer.Add(self.npts_low_tcl, (iy, ix), (1,1), 
     639                            wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
     640        iy += 1 
    560641        ix = 0 
    561642        self.low_q_sizer.Add(self.guinier,(iy, ix),(1,2), 
     
    565646        self.low_q_sizer.Add(self.power_law_low,(iy, ix),(1,2), 
    566647                            wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
     648        
    567649        # Parameter controls for power law 
    568650        ix = 1 
    569651        iy += 1 
    570         self.low_q_sizer.Add(self.fit_low_cbox,(iy, ix),(1,3), 
    571                             wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
     652        self.low_q_sizer.Add(self.fix_enable_low,(iy, ix),(1,1), 
     653                            wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
     654        ix += 1 
     655        self.low_q_sizer.Add(self.fit_enable_low,(iy, ix),(1,1), 
     656                           wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
    572657        ix = 1 
    573658        iy += 1 
    574659        self.low_q_sizer.Add(power_txt,(iy, ix),(1,1), 
    575                             wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
     660                            wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
    576661        ix += 1 
    577662        self.low_q_sizer.Add(self.power_low_tcl, (iy, ix), (1,1), 
    578663                            wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
    579         iy += 1 
    580         ix = 1 
    581         self.low_q_sizer.Add(npts_low_txt,(iy, ix),(1,1), 
    582                             wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
    583         ix += 1 
    584         self.low_q_sizer.Add(self.npts_low_tcl, (iy, ix), (1,1), 
    585                             wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
    586         iy += 1 
    587         ix = 0 
    588         self.low_q_sizer.Add(self.enable_low_cbox,(iy, ix),(1,5), 
    589                             wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
     664        #Change the state of txtcrtl to enable/disable 
     665        self._enable_low_q_section() 
    590666        self.low_extrapolation_sizer.AddMany([(self.low_q_sizer, 0, 
    591667                                                wx.BOTTOM|wx.RIGHT, 10)]) 
    592          
    593             
     668    def _enable_fit_power_law_high(self, event=None): 
     669        """ 
     670            Enable and disable the power value editing 
     671        """ 
     672        if self.fix_enable_high.IsEnabled(): 
     673            if self.fix_enable_high.GetValue(): 
     674                self.power_high_tcl.Enable() 
     675            else: 
     676                self.power_high_tcl.Disable() 
     677         
     678    def _enable_high_q_section(self, event=None): 
     679        """ 
     680            Disable or enable some button if the user enable high q extrapolation 
     681        """ 
     682        if self.enable_high_cbox.GetValue(): 
     683            self.npts_high_tcl.Enable() 
     684            self.power_law_high.Enable() 
     685            self.power_high_tcl.Enable() 
     686            self.fix_enable_high.Enable() 
     687            self.fit_enable_high.Enable() 
     688        else: 
     689            self.npts_high_tcl.Disable() 
     690            self.power_law_high.Disable() 
     691            self.power_high_tcl.Disable() 
     692            self.fix_enable_high.Disable() 
     693            self.fit_enable_high.Disable() 
     694        self._enable_fit_power_law_high() 
     695   
    594696    def _layout_extrapolation_high(self): 
    595697        """ 
     
    599701        self.enable_high_cbox.SetForegroundColour('red') 
    600702        self.enable_high_cbox.SetValue(False) 
    601         self.fit_high_cbox = wx.CheckBox(self, -1, "Check to Fit Power") 
    602         self.fit_high_cbox.SetValue(False) 
     703        wx.EVT_CHECKBOX(self, self.enable_high_cbox.GetId(), 
     704                                         self._enable_high_q_section) 
     705       
     706        self.fix_enable_high = wx.RadioButton(self, -1, 'Fix', 
     707                                         (10, 10),style=wx.RB_GROUP) 
     708        self.fix_enable_high.SetValue(True) 
     709        self.fit_enable_high = wx.RadioButton(self, -1, 'Fit', (10, 10)) 
     710        self.Bind(wx.EVT_RADIOBUTTON, self._enable_fit_power_law_high, 
     711                                     id=self.fix_enable_high.GetId()) 
     712        self.Bind(wx.EVT_RADIOBUTTON, self._enable_fit_power_law_high,  
     713                                        id=self.fit_enable_high.GetId()) 
     714         
    603715        self.power_law_high = wx.RadioButton(self, -1, 'Power Law', 
    604716                                              (10, 10), style=wx.RB_GROUP) 
     
    607719        self.power_law_high.SetValue(True) 
    608720        npts_high_txt = wx.StaticText(self, -1, 'Npts') 
    609         self.npts_high_tcl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH, -1)) 
     721        self.npts_high_tcl = InvTextCtrl(self, -1, size=(_BOX_WIDTH*2/3, -1)) 
    610722        msg_hint = "Number of Q points to consider" 
    611723        msg_hint += "while extrapolating the high-Q region" 
     
    613725        self.npts_high_tcl.SetValue(str(NPTS)) 
    614726        power_txt = wx.StaticText(self, -1, 'Power') 
    615         self.power_high_tcl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH, -1)) 
     727        self.power_high_tcl = InvTextCtrl(self, -1, size=(_BOX_WIDTH*2/3, -1)) 
    616728        self.power_high_tcl.SetValue(str(self.power_law_exponant)) 
    617729        power_hint_txt = "Exponent to apply to the Power_law function." 
    618730        self.power_high_tcl.SetToolTipString(power_hint_txt) 
    619         iy = 1 
     731        iy = 0 
     732        ix = 0 
     733        self.high_q_sizer.Add(self.enable_high_cbox,(iy, ix),(1,5), 
     734                            wx.TOP|wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
     735        iy += 1 
     736        ix = 0 
     737        self.high_q_sizer.Add(npts_high_txt,(iy, ix),(1,1), 
     738                            wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
     739        ix += 1 
     740        self.high_q_sizer.Add(self.npts_high_tcl, (iy, ix), (1,1), 
     741                            wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
     742        iy += 2 
    620743        ix = 0 
    621744        self.high_q_sizer.Add(self.power_law_high,(iy, ix),(1,2), 
    622745                            wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
     746        
     747        # Parameter controls for power law 
    623748        ix = 1 
    624749        iy += 1 
    625         self.high_q_sizer.Add(self.fit_high_cbox,(iy, ix),(1,3), 
    626                             wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
     750        self.high_q_sizer.Add(self.fix_enable_high,(iy, ix),(1,1), 
     751                            wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
     752        ix += 1 
     753        self.high_q_sizer.Add(self.fit_enable_high,(iy, ix),(1,1), 
     754                           wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
    627755        ix = 1 
    628756        iy += 1 
     
    632760        self.high_q_sizer.Add(self.power_high_tcl, (iy, ix), (1,1), 
    633761                            wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
    634         iy += 1 
    635         ix = 1 
    636         self.high_q_sizer.Add(npts_high_txt,(iy, ix),(1,1), 
    637                             wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
    638         ix += 1 
    639         self.high_q_sizer.Add(self.npts_high_tcl, (iy, ix), (1,1), 
    640                             wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
    641         iy += 1 
    642         ix = 0 
    643         self.high_q_sizer.Add(self.enable_high_cbox,(iy, ix),(1,5), 
    644                             wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
     762        #Change the state of txtcrtl to enable/disable 
     763        self._enable_high_q_section() 
    645764        self.high_extrapolation_sizer.AddMany([(self.high_q_sizer, 0, wx.RIGHT, 10)]) 
    646765         
     
    649768            Draw widgets related to extrapolation 
    650769        """ 
    651         extra_hint = "Extrapolation Maximum Range: " 
     770        extra_hint = "Extrapolation Maximum Q Range [1/A]: " 
    652771        extra_hint_txt = wx.StaticText(self, -1, extra_hint) 
    653772        #Extrapolation range [string] 
    654773        extrapolation_min_txt = wx.StaticText(self, -1, 'Min : ')   
    655         self.extrapolation_min_tcl = wx.TextCtrl(self, -1,  
     774        self.extrapolation_min_tcl = OutputTextCtrl(self, -1,  
    656775                                                size=(_BOX_WIDTH, 20), style=0) 
    657776        self.extrapolation_min_tcl.SetValue(str(Q_MINIMUM)) 
    658777        self.extrapolation_min_tcl.SetToolTipString("The minimum extrapolated q value.") 
    659         self.extrapolation_min_tcl.SetEditable(False)  
    660778        extrapolation_max_txt = wx.StaticText(self, -1, 'Max : ')  
    661         self.extrapolation_max_tcl = wx.TextCtrl(self, -1, 
     779        self.extrapolation_max_tcl = OutputTextCtrl(self, -1, 
    662780                                                  size=(_BOX_WIDTH, 20), style=0)  
    663781        self.extrapolation_max_tcl.SetValue(str(Q_MAXIMUM)) 
    664782        self.extrapolation_max_tcl.SetToolTipString("The maximum extrapolated q value.") 
    665         self.extrapolation_max_tcl.SetEditable(False)  
    666783        self.extrapolation_range_sizer.AddMany([(extra_hint_txt, 0, wx.LEFT, 10), 
    667784                                                (extrapolation_min_txt, 0, wx.LEFT, 10), 
     
    697814        uncertainty = "+/-"  
    698815        volume_txt = wx.StaticText(self, -1, 'Volume Fraction') 
    699         self.volume_tcl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,-1)) 
    700         self.volume_tcl.SetEditable(False) 
     816        self.volume_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH,-1)) 
    701817        self.volume_tcl.SetToolTipString("Volume fraction.") 
    702         self.volume_err_tcl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,-1)) 
    703         self.volume_err_tcl.SetEditable(False) 
     818        self.volume_err_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH,-1)) 
    704819        self.volume_err_tcl.SetToolTipString("Uncertainty on the volume fraction.") 
    705820        volume_units_txt = wx.StaticText(self, -1, unit_volume) 
    706821         
    707822        surface_txt = wx.StaticText(self, -1, 'Specific surface') 
    708         self.surface_tcl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,-1)) 
    709         self.surface_tcl.SetEditable(False) 
     823        self.surface_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH,-1)) 
    710824        self.surface_tcl.SetToolTipString("Specific surface value.") 
    711         self.surface_err_tcl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,-1)) 
    712         self.surface_err_tcl.SetEditable(False) 
     825        self.surface_err_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH,-1)) 
    713826        self.surface_err_tcl.SetToolTipString("Uncertainty on the specific surface.") 
    714827        surface_units_txt = wx.StaticText(self, -1, unit_surface) 
     
    753866        unit_invariant = '[1/cm][1/A]' 
    754867        invariant_total_txt = wx.StaticText(self, -1, 'Invariant Total') 
    755         self.invariant_total_tcl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,-1)) 
    756         self.invariant_total_tcl.SetEditable(False) 
     868        self.invariant_total_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH,-1)) 
    757869        msg_hint = "Total invariant, including extrapolated regions." 
    758870        self.invariant_total_tcl.SetToolTipString(msg_hint) 
    759         self.invariant_total_err_tcl = wx.TextCtrl(self, -1, size=(_BOX_WIDTH,-1)) 
    760         self.invariant_total_err_tcl.SetEditable(False) 
     871        self.invariant_total_err_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH,-1)) 
    761872        self.invariant_total_err_tcl.SetToolTipString("Uncertainty on invariant.") 
    762873        invariant_total_units_txt = wx.StaticText(self, -1, unit_invariant) 
Note: See TracChangeset for help on using the changeset viewer.