Changeset 7d16278 in sasview for invariantview


Ignore:
Timestamp:
Apr 29, 2011 1:01:41 PM (13 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:
eaab2ad
Parents:
b113128
Message:

working on invariant panel size

File:
1 edited

Legend:

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

    red4e122 r7d16278  
    4141 
    4242if sys.platform.count("win32") > 0: 
    43     _STATICBOX_WIDTH = 450 
     43    _STATICBOX_WIDTH = 400 
    4444    PANEL_WIDTH = 500  
    4545    PANEL_HEIGHT = 700 
    4646    FONT_VARIANT = 0 
    4747else: 
    48     _STATICBOX_WIDTH = 480 
     48    _STATICBOX_WIDTH = 430 
    4949    PANEL_WIDTH = 530 
    5050    PANEL_HEIGHT = 700 
     
    359359        try: 
    360360            qstar_total, qstar_total_err = inv.get_qstar_with_error(extrapolation) 
    361              
    362361            self.invariant_total_tcl.SetValue(format_number(qstar_total)) 
    363362            self.invariant_total_err_tcl.SetValue(format_number(qstar_total_err)) 
    364363            self.inv_container.qstar_total = qstar_total 
    365364            self.inv_container.qstar_total_err = qstar_total_err 
    366           
    367365        except: 
    368366            self.inv_container.qstar_total = "Error" 
     
    12221220        outputs_box = wx.StaticBox(self, -1, "Outputs") 
    12231221        self.outputs_sizer = wx.StaticBoxSizer(outputs_box, wx.VERTICAL) 
    1224         self.outputs_sizer.SetMinSize((PANEL_WIDTH,-1)) 
     1222        self.outputs_sizer.SetMinSize((_STATICBOX_WIDTH,-1)) 
    12251223        #Sizer related to data 
    12261224        data_name_box = wx.StaticBox(self, -1, "I(q) Data Source") 
    12271225        self.data_name_boxsizer = wx.StaticBoxSizer(data_name_box, wx.VERTICAL) 
    1228         self.data_name_boxsizer.SetMinSize((PANEL_WIDTH,-1)) 
     1226        self.data_name_boxsizer.SetMinSize((_STATICBOX_WIDTH,-1)) 
    12291227        self.hint_msg_sizer = wx.BoxSizer(wx.HORIZONTAL) 
    12301228        self.data_name_sizer = wx.BoxSizer(wx.HORIZONTAL) 
    12311229        
    12321230        self.data_range_sizer = wx.BoxSizer(wx.HORIZONTAL) 
    1233         #Sizer related to background and scale 
    1234         self.bkg_scale_sizer = wx.BoxSizer(wx.HORIZONTAL)  
    1235         #Sizer related to contrast and porod constant 
    1236         self.contrast_porod_sizer = wx.BoxSizer(wx.HORIZONTAL)  
     1231        #Sizer related to inputs 
     1232        self.sizer_input =  wx.FlexGridSizer(2, 5, 0, 0) 
    12371233        #Sizer related to inputs 
    12381234        inputs_box = wx.StaticBox(self, -1, "Customized Inputs") 
    12391235        self.inputs_sizer = wx.StaticBoxSizer(inputs_box, wx.VERTICAL) 
     1236        self.inputs_sizer.SetMinSize((_STATICBOX_WIDTH,-1)) 
    12401237        #Sizer related to extrapolation 
    12411238        extrapolation_box = wx.StaticBox(self, -1, "Extrapolation") 
    12421239        self.extrapolation_sizer = wx.StaticBoxSizer(extrapolation_box, 
    12431240                                                        wx.VERTICAL) 
    1244         self.extrapolation_sizer.SetMinSize((PANEL_WIDTH,-1)) 
     1241        self.extrapolation_sizer.SetMinSize((_STATICBOX_WIDTH,-1)) 
    12451242        self.extrapolation_range_sizer = wx.BoxSizer(wx.HORIZONTAL) 
    12461243        self.extrapolation_low_high_sizer = wx.BoxSizer(wx.HORIZONTAL) 
     
    12481245        low_q_box = wx.StaticBox(self, -1, "Low Q") 
    12491246        self.low_extrapolation_sizer = wx.StaticBoxSizer(low_q_box, wx.VERTICAL) 
     1247       
    12501248        self.low_q_sizer = wx.GridBagSizer(5,5) 
    12511249        #Sizer related to extrapolation at low q range 
     
    12601258        #Sizer related to button 
    12611259        self.button_sizer = wx.BoxSizer(wx.HORIZONTAL) 
     1260        self.button_sizer.SetMinSize((_STATICBOX_WIDTH,-1)) 
    12621261        #Sizer related to save button 
    12631262        self.save_button_sizer = wx.BoxSizer(wx.HORIZONTAL) 
     
    12771276        self.hint_msg_sizer.Add(self.hint_msg_txt) 
    12781277        #Data name [string] 
    1279         data_name_txt = wx.StaticText(self, -1, 'Data : ')   
     1278        data_name_txt = wx.StaticText(self, -1, 'Data:')   
    12801279        
    1281         self.data_name_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH*5, 20), 
     1280        self.data_name_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH*4, 20), 
    12821281                                            style=0)  
    12831282        self.data_name_tcl.SetToolTipString("Data's name.") 
    1284         self.data_name_sizer.AddMany([(data_name_txt, 0, wx.LEFT|wx.RIGHT, 10), 
     1283        self.data_name_sizer.AddMany([(data_name_txt, 0, wx.LEFT|wx.RIGHT, 5), 
    12851284                                       (self.data_name_tcl, 0, wx.EXPAND)]) 
    12861285        #Data range [string] 
     
    12941293                                           style=0, name='data_max_tcl')  
    12951294        self.data_max_tcl.SetToolTipString("The maximum value of q range.") 
    1296         self.data_range_sizer.AddMany([(data_range_txt, 0, wx.RIGHT, 10), 
    1297                                        (data_min_txt, 0, wx.RIGHT, 10), 
    1298                                        (self.data_min_tcl, 0, wx.RIGHT, 10), 
    1299                                        (data_max_txt, 0, wx.RIGHT, 10), 
    1300                                        (self.data_max_tcl, 0, wx.RIGHT, 10)]) 
    1301         self.data_name_boxsizer.AddMany([(self.hint_msg_sizer, 0 , wx.ALL, 5), 
    1302                             (self.data_name_sizer, 0 , wx.ALL, 10), 
    1303                                      (self.data_range_sizer, 0 , wx.ALL, 10)]) 
     1295        self.data_range_sizer.AddMany([(data_range_txt, 0, wx.RIGHT, 5), 
     1296                                       (data_min_txt, 0, wx.RIGHT, 5), 
     1297                                       (self.data_min_tcl, 0, wx.RIGHT, 5), 
     1298                                       (data_max_txt, 0, wx.RIGHT, 5), 
     1299                                       (self.data_max_tcl, 0, wx.RIGHT, 5)]) 
     1300        self.data_name_boxsizer.AddMany([(self.hint_msg_sizer, 0 , wx.ALL, 2), 
     1301                            (self.data_name_sizer, 0 , wx.ALL, 5), 
     1302                                     (self.data_range_sizer, 0 , wx.ALL, 5)]) 
    13041303     
    1305     def _layout_bkg_scale(self): 
    1306         """ 
    1307         Draw widgets related to background and scale 
    1308         """ 
    1309         background_txt = wx.StaticText(self, -1, 'Background : ')   
    1310         self.background_tcl = InvTextCtrl(self, -1, size=(_BOX_WIDTH, 20), 
    1311                                           style=0, name='background_tcl')  
    1312         wx.EVT_TEXT(self, self.background_tcl.GetId(), self._on_text) 
    1313         background_hint_txt = "Background" 
    1314         self.background_tcl.SetToolTipString(background_hint_txt) 
    1315         background_unit_txt = wx.StaticText(self, -1, '[1/cm]')   
    1316         scale_txt = wx.StaticText(self, -1, 'Scale : ')   
    1317         self.scale_tcl = InvTextCtrl(self, -1, size=(_BOX_WIDTH, 20), style=0, 
    1318                                      name='scale_tcl') 
    1319         wx.EVT_TEXT(self, self.scale_tcl.GetId(), self._on_text) 
    1320         scale_hint_txt = "Scale" 
    1321         self.scale_tcl.SetToolTipString(scale_hint_txt) 
    1322         self.bkg_scale_sizer.AddMany([(background_txt, 0, wx.LEFT, 10), 
    1323                                        (self.background_tcl, 0, wx.LEFT, 5), 
    1324                                        (background_unit_txt, 0, wx.LEFT, 10), 
    1325                                        (scale_txt, 0, wx.LEFT, 70), 
    1326                                        (self.scale_tcl, 0, wx.LEFT, 40)]) 
    1327   
    1328     def _layout_contrast_porod(self): 
    1329         """ 
    1330         Draw widgets related to porod constant and contrast 
    1331         """ 
    1332         contrast_txt = wx.StaticText(self, -1, 'Contrast : ')   
    1333         self.contrast_tcl = InvTextCtrl(self, -1, size=(_BOX_WIDTH, 20), 
    1334                                         style=0,name='contrast_tcl') 
    1335         wx.EVT_TEXT(self, self.contrast_tcl.GetId(), self._on_text) 
    1336         contrast_hint_txt = "Contrast" 
    1337         self.contrast_tcl.SetToolTipString(contrast_hint_txt) 
    1338         contrast_unit_txt = wx.StaticText(self, -1, '[1/A^(2)]')   
    1339         porod_const_txt = wx.StaticText(self, -1, 'Porod Constant:')   
    1340         self.porod_constant_tcl = InvTextCtrl(self, -1,  
    1341                                               size=(_BOX_WIDTH, 20), style=0, 
    1342                                               name='porod_constant_tcl')  
    1343         wx.EVT_TEXT(self, self.porod_constant_tcl.GetId(), self._on_text) 
    1344         porod_const_hint_txt = "Porod Constant" 
    1345         self.porod_constant_tcl.SetToolTipString(porod_const_hint_txt) 
    1346         optional_txt = wx.StaticText(self, -1, '(Optional)')   
    1347         self.contrast_porod_sizer.AddMany([(contrast_txt, 0, wx.LEFT, 10), 
    1348                                            (self.contrast_tcl, 0, wx.LEFT, 20), 
    1349                                            (contrast_unit_txt, 0, wx.LEFT, 10), 
    1350                                            (porod_const_txt, 0, wx.LEFT, 50), 
    1351                                        (self.porod_constant_tcl, 0, wx.LEFT, 0), 
    1352                                        (optional_txt, 0, wx.LEFT, 10)]) 
    1353          
    13541304    def _enable_fit_power_law_low(self, event=None): 
    13551305        """ 
     
    14791429        self.low_q_sizer.Add(self.power_law_low,(iy, ix), (1, 2), 
    14801430                            wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
    1481         
    14821431        # Parameter controls for power law 
    14831432        ix = 1 
     
    14951444        self.low_q_sizer.Add(self.power_low_tcl, (iy, ix), (1, 1), 
    14961445                            wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
    1497         self.low_extrapolation_sizer.AddMany([(self.low_q_sizer, 0, 
    1498                                                 wx.BOTTOM|wx.RIGHT, 15)]) 
     1446        self.low_extrapolation_sizer.Add(self.low_q_sizer) 
    14991447         
    15001448    def _enable_fit_power_law_high(self, event=None): 
     
    15841532        self.high_q_sizer.Add(self.npts_high_tcl, (iy, ix), (1, 1), 
    15851533                            wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
    1586         iy += 2 
     1534        iy += 1 
    15871535        ix = 0 
    15881536        self.high_q_sizer.Add(self.power_law_high, (iy, ix),(1, 2), 
     
    16041552        self.high_q_sizer.Add(self.power_high_tcl, (iy, ix),  (1, 1), 
    16051553                            wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
    1606         self.high_extrapolation_sizer.AddMany([(self.high_q_sizer, 0,  
    1607                                                 wx.BOTTOM|wx.RIGHT, 10)]) 
     1554        self.high_extrapolation_sizer.Add(self.high_q_sizer, 0,  
     1555                                                wx.BOTTOM, 20) 
    16081556         
    16091557    def _layout_extrapolation(self): 
     
    16111559        Draw widgets related to extrapolation 
    16121560        """ 
    1613         extra_hint = "Extrapolation Maximum Q Range [1/A]: " 
     1561        extra_hint = "Extrapolation \nMaximum Q Range [1/A]:" 
    16141562        extra_hint_txt = wx.StaticText(self, -1, extra_hint) 
    16151563        #Extrapolation range [string] 
    1616         extrapolation_min_txt = wx.StaticText(self, -1, 'Min :')   
     1564        extrapolation_min_txt = wx.StaticText(self, -1, 'Min:')   
    16171565        self.extrapolation_min_tcl = OutputTextCtrl(self, -1,  
    16181566                                                size=(_BOX_WIDTH, 20), style=0, 
     
    16211569        hint_msg = "The minimum extrapolated q value." 
    16221570        self.extrapolation_min_tcl.SetToolTipString(hint_msg) 
    1623         extrapolation_max_txt = wx.StaticText(self, -1, 'Max :')  
     1571        extrapolation_max_txt = wx.StaticText(self, -1, 'Max:')  
    16241572        self.extrapolation_max_tcl = OutputTextCtrl(self, -1, 
    16251573                                                  size=(_BOX_WIDTH, 20), 
     
    16301578        self.extrapolation_max_tcl.SetToolTipString(hint_msg) 
    16311579        self.extrapolation_range_sizer.AddMany([(extra_hint_txt, 0,  
    1632                                                  wx.LEFT, 10), 
     1580                                                 wx.LEFT, 5), 
    16331581                                                (extrapolation_min_txt, 0, 
    1634                                                  wx.LEFT, 10), 
     1582                                                 wx.LEFT, 5), 
    16351583                                                (self.extrapolation_min_tcl, 
    1636                                                             0, wx.LEFT, 10), 
     1584                                                            0, wx.LEFT, 5), 
    16371585                                                (extrapolation_max_txt, 0, 
    1638                                                  wx.LEFT, 10), 
     1586                                                 wx.LEFT, 5), 
    16391587                                                (self.extrapolation_max_tcl, 
    1640                                                             0, wx.LEFT, 10), 
    1641                                                 ]) 
     1588                                                            0, wx.LEFT, 5)]) 
    16421589        self._layout_extrapolation_low() 
    16431590        self._layout_extrapolation_high() 
    16441591        self.extrapolation_low_high_sizer.AddMany([(self.low_extrapolation_sizer, 
    1645                                                      0, wx.ALL, 5), 
     1592                                0, wx.LEFT|wx.BOTTOM|wx.TOP, 5), 
    16461593                                                   (self.high_extrapolation_sizer, 
    1647                                                     0, wx.ALL, 5)]) 
    1648         self.extrapolation_sizer.AddMany([(self.extrapolation_range_sizer, 0, 
    1649                                             wx.RIGHT, 5), 
    1650                                         (self.extrapolation_low_high_sizer, 0, 
    1651                                            wx.ALL, 5)]) 
     1594                                        0, wx.LEFT|wx.BOTTOM|wx.TOP, 5)]) 
     1595        self.extrapolation_sizer.AddMany([(self.extrapolation_range_sizer), 
     1596                                        (self.extrapolation_low_high_sizer)]) 
    16521597         
    16531598    def _layout_volume_surface_sizer(self): 
     
    16581603        unit_surface = '' 
    16591604        uncertainty = "+/-"  
    1660         volume_txt = wx.StaticText(self, -1, 'Volume Fraction      ') 
     1605        volume_txt = wx.StaticText(self, -1, 'Volume Fraction') 
    16611606        self.volume_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH, -1), 
    16621607                                         name='volume_tcl') 
     
    17131658        self.volume_surface_sizer.Add(surface_units_txt, (iy, ix), (1, 1), 
    17141659                            wx.EXPAND|wx.ADJUST_MINSIZE, 10) 
     1660        static_line = wx.StaticLine(self, -1) 
     1661        iy += 1 
     1662        ix = 0 
    17151663         
    17161664    def _layout_invariant_sizer(self): 
     
    17551703        Draw widgets related to inputs 
    17561704        """ 
    1757         self._layout_bkg_scale() 
    1758         self._layout_contrast_porod() 
    1759         self.inputs_sizer.AddMany([(self.bkg_scale_sizer, 0, wx.ALL, 5), 
    1760                                     (self.contrast_porod_sizer, 0, wx.ALL, 5)]) 
    1761          
     1705        contrast_txt = wx.StaticText(self, -1, 'Contrast : ')   
     1706        self.contrast_tcl = InvTextCtrl(self, -1, size=(_BOX_WIDTH, 20), 
     1707                                        style=0,name='contrast_tcl') 
     1708        wx.EVT_TEXT(self, self.contrast_tcl.GetId(), self._on_text) 
     1709        contrast_hint_txt = "Contrast" 
     1710        self.contrast_tcl.SetToolTipString(contrast_hint_txt) 
     1711        contrast_unit_txt = wx.StaticText(self, -1, '[1/A^(2)]')   
     1712        porod_const_txt = wx.StaticText(self, -1, 'Porod Constant:\n(optional)\n')   
     1713        self.porod_constant_tcl = InvTextCtrl(self, -1,  
     1714                                              size=(_BOX_WIDTH, 20), style=0, 
     1715                                              name='porod_constant_tcl')  
     1716        wx.EVT_TEXT(self, self.porod_constant_tcl.GetId(), self._on_text) 
     1717        porod_const_hint_txt = "Porod Constant" 
     1718        self.porod_constant_tcl.SetToolTipString(porod_const_hint_txt) 
     1719         
     1720        background_txt = wx.StaticText(self, -1, 'Background : ')   
     1721        self.background_tcl = InvTextCtrl(self, -1, size=(_BOX_WIDTH, 20), 
     1722                                          style=0, name='background_tcl')  
     1723        wx.EVT_TEXT(self, self.background_tcl.GetId(), self._on_text) 
     1724        background_hint_txt = "Background" 
     1725        self.background_tcl.SetToolTipString(background_hint_txt) 
     1726        background_unit_txt = wx.StaticText(self, -1, '[1/cm]')   
     1727        scale_txt = wx.StaticText(self, -1, 'Scale : ')   
     1728        self.scale_tcl = InvTextCtrl(self, -1, size=(_BOX_WIDTH, 20), style=0, 
     1729                                     name='scale_tcl') 
     1730        wx.EVT_TEXT(self, self.scale_tcl.GetId(), self._on_text) 
     1731        scale_hint_txt = "Scale" 
     1732        self.scale_tcl.SetToolTipString(scale_hint_txt) 
     1733        self.sizer_input.AddMany([(background_txt, 0, wx.LEFT|wx.BOTTOM, 5), 
     1734                                  (self.background_tcl, 0, wx.LEFT|wx.BOTTOM, 5), 
     1735                                (background_unit_txt, 0, wx.LEFT|wx.BOTTOM, 5), 
     1736                                (scale_txt, 0, wx.LEFT|wx.BOTTOM, 5), 
     1737                                (self.scale_tcl, 0, wx.LEFT|wx.BOTTOM|wx.RIGHT, 5), 
     1738                                (contrast_txt, 0, wx.LEFT|wx.BOTTOM, 5), 
     1739                                (self.contrast_tcl, 0, wx.LEFT|wx.BOTTOM, 5), 
     1740                                (contrast_unit_txt, 0, wx.LEFT|wx.BOTTOM, 5), 
     1741                                (porod_const_txt, 0, wx.LEFT|wx.BOTTOM, 5), 
     1742                        (self.porod_constant_tcl, 0, wx.LEFT|wx.BOTTOM|wx.RIGHT, 5)]) 
     1743        self.inputs_sizer.Add(self.sizer_input) 
     1744        
    17621745    def _layout_outputs_sizer(self): 
    17631746        """ 
     
    17671750        self._layout_invariant_sizer() 
    17681751        static_line = wx.StaticLine(self, -1) 
    1769         self.outputs_sizer.AddMany([(self.volume_surface_sizer, 0, wx.ALL, 10), 
     1752        self.outputs_sizer.AddMany([(self.volume_surface_sizer, 
     1753                                      0, wx.TOP|wx.BOTTOM, 10), 
    17701754                                    (static_line, 0, wx.EXPAND, 0), 
    1771                                     (self.invariant_sizer, 0, wx.ALL, 10)]) 
     1755                         (self.invariant_sizer, 0, wx.TOP|wx.BOTTOM, 10)]) 
    17721756    def _layout_button(self):   
    17731757        """ 
     
    17881772        details = "Details on Invariant Total Calculations" 
    17891773        details_txt = wx.StaticText(self, -1, details) 
    1790         self.button_sizer.AddMany([((50,10), 0 , wx.LEFT,0), 
    1791                                    (details_txt, 0 ,  
     1774        self.button_sizer.AddMany([(details_txt, 0 ,  
    17921775                                    wx.RIGHT|wx.BOTTOM|wx.TOP, 10), 
    17931776                                   (self.button_details, 0 , wx.ALL, 10), 
     
    18071790                                  (self.outputs_sizer, 0, 
    18081791                                  wx.LEFT|wx.RIGHT|wx.BOTTOM, 10), 
    1809                                   (self.button_sizer,0, 
    1810                                   wx.LEFT|wx.RIGHT|wx.BOTTOM, 10), 
     1792                                  (self.button_sizer, 0, wx.LEFT|wx.RIGHT, 15), 
    18111793                                 (self.inputs_sizer, 0, 
    18121794                                  wx.LEFT|wx.RIGHT|wx.BOTTOM, 10), 
Note: See TracChangeset for help on using the changeset viewer.