Changeset 7d16278 in sasview
- Timestamp:
- Apr 29, 2011 1:01:41 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:
- eaab2ad
- Parents:
- b113128
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
invariantview/perspectives/invariant/invariant_panel.py
red4e122 r7d16278 41 41 42 42 if sys.platform.count("win32") > 0: 43 _STATICBOX_WIDTH = 4 5043 _STATICBOX_WIDTH = 400 44 44 PANEL_WIDTH = 500 45 45 PANEL_HEIGHT = 700 46 46 FONT_VARIANT = 0 47 47 else: 48 _STATICBOX_WIDTH = 4 8048 _STATICBOX_WIDTH = 430 49 49 PANEL_WIDTH = 530 50 50 PANEL_HEIGHT = 700 … … 359 359 try: 360 360 qstar_total, qstar_total_err = inv.get_qstar_with_error(extrapolation) 361 362 361 self.invariant_total_tcl.SetValue(format_number(qstar_total)) 363 362 self.invariant_total_err_tcl.SetValue(format_number(qstar_total_err)) 364 363 self.inv_container.qstar_total = qstar_total 365 364 self.inv_container.qstar_total_err = qstar_total_err 366 367 365 except: 368 366 self.inv_container.qstar_total = "Error" … … 1222 1220 outputs_box = wx.StaticBox(self, -1, "Outputs") 1223 1221 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)) 1225 1223 #Sizer related to data 1226 1224 data_name_box = wx.StaticBox(self, -1, "I(q) Data Source") 1227 1225 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)) 1229 1227 self.hint_msg_sizer = wx.BoxSizer(wx.HORIZONTAL) 1230 1228 self.data_name_sizer = wx.BoxSizer(wx.HORIZONTAL) 1231 1229 1232 1230 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) 1237 1233 #Sizer related to inputs 1238 1234 inputs_box = wx.StaticBox(self, -1, "Customized Inputs") 1239 1235 self.inputs_sizer = wx.StaticBoxSizer(inputs_box, wx.VERTICAL) 1236 self.inputs_sizer.SetMinSize((_STATICBOX_WIDTH,-1)) 1240 1237 #Sizer related to extrapolation 1241 1238 extrapolation_box = wx.StaticBox(self, -1, "Extrapolation") 1242 1239 self.extrapolation_sizer = wx.StaticBoxSizer(extrapolation_box, 1243 1240 wx.VERTICAL) 1244 self.extrapolation_sizer.SetMinSize(( PANEL_WIDTH,-1))1241 self.extrapolation_sizer.SetMinSize((_STATICBOX_WIDTH,-1)) 1245 1242 self.extrapolation_range_sizer = wx.BoxSizer(wx.HORIZONTAL) 1246 1243 self.extrapolation_low_high_sizer = wx.BoxSizer(wx.HORIZONTAL) … … 1248 1245 low_q_box = wx.StaticBox(self, -1, "Low Q") 1249 1246 self.low_extrapolation_sizer = wx.StaticBoxSizer(low_q_box, wx.VERTICAL) 1247 1250 1248 self.low_q_sizer = wx.GridBagSizer(5,5) 1251 1249 #Sizer related to extrapolation at low q range … … 1260 1258 #Sizer related to button 1261 1259 self.button_sizer = wx.BoxSizer(wx.HORIZONTAL) 1260 self.button_sizer.SetMinSize((_STATICBOX_WIDTH,-1)) 1262 1261 #Sizer related to save button 1263 1262 self.save_button_sizer = wx.BoxSizer(wx.HORIZONTAL) … … 1277 1276 self.hint_msg_sizer.Add(self.hint_msg_txt) 1278 1277 #Data name [string] 1279 data_name_txt = wx.StaticText(self, -1, 'Data :')1278 data_name_txt = wx.StaticText(self, -1, 'Data:') 1280 1279 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), 1282 1281 style=0) 1283 1282 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), 1285 1284 (self.data_name_tcl, 0, wx.EXPAND)]) 1286 1285 #Data range [string] … … 1294 1293 style=0, name='data_max_tcl') 1295 1294 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)]) 1304 1303 1305 def _layout_bkg_scale(self):1306 """1307 Draw widgets related to background and scale1308 """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 contrast1331 """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 1354 1304 def _enable_fit_power_law_low(self, event=None): 1355 1305 """ … … 1479 1429 self.low_q_sizer.Add(self.power_law_low,(iy, ix), (1, 2), 1480 1430 wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 1481 1482 1431 # Parameter controls for power law 1483 1432 ix = 1 … … 1495 1444 self.low_q_sizer.Add(self.power_low_tcl, (iy, ix), (1, 1), 1496 1445 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) 1499 1447 1500 1448 def _enable_fit_power_law_high(self, event=None): … … 1584 1532 self.high_q_sizer.Add(self.npts_high_tcl, (iy, ix), (1, 1), 1585 1533 wx.EXPAND|wx.ADJUST_MINSIZE, 0) 1586 iy += 21534 iy += 1 1587 1535 ix = 0 1588 1536 self.high_q_sizer.Add(self.power_law_high, (iy, ix),(1, 2), … … 1604 1552 self.high_q_sizer.Add(self.power_high_tcl, (iy, ix), (1, 1), 1605 1553 wx.EXPAND|wx.ADJUST_MINSIZE, 0) 1606 self.high_extrapolation_sizer.Add Many([(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) 1608 1556 1609 1557 def _layout_extrapolation(self): … … 1611 1559 Draw widgets related to extrapolation 1612 1560 """ 1613 extra_hint = "Extrapolation Maximum Q Range [1/A]:"1561 extra_hint = "Extrapolation \nMaximum Q Range [1/A]:" 1614 1562 extra_hint_txt = wx.StaticText(self, -1, extra_hint) 1615 1563 #Extrapolation range [string] 1616 extrapolation_min_txt = wx.StaticText(self, -1, 'Min 1564 extrapolation_min_txt = wx.StaticText(self, -1, 'Min:') 1617 1565 self.extrapolation_min_tcl = OutputTextCtrl(self, -1, 1618 1566 size=(_BOX_WIDTH, 20), style=0, … … 1621 1569 hint_msg = "The minimum extrapolated q value." 1622 1570 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:') 1624 1572 self.extrapolation_max_tcl = OutputTextCtrl(self, -1, 1625 1573 size=(_BOX_WIDTH, 20), … … 1630 1578 self.extrapolation_max_tcl.SetToolTipString(hint_msg) 1631 1579 self.extrapolation_range_sizer.AddMany([(extra_hint_txt, 0, 1632 wx.LEFT, 10),1580 wx.LEFT, 5), 1633 1581 (extrapolation_min_txt, 0, 1634 wx.LEFT, 10),1582 wx.LEFT, 5), 1635 1583 (self.extrapolation_min_tcl, 1636 0, wx.LEFT, 10),1584 0, wx.LEFT, 5), 1637 1585 (extrapolation_max_txt, 0, 1638 wx.LEFT, 10),1586 wx.LEFT, 5), 1639 1587 (self.extrapolation_max_tcl, 1640 0, wx.LEFT, 10), 1641 ]) 1588 0, wx.LEFT, 5)]) 1642 1589 self._layout_extrapolation_low() 1643 1590 self._layout_extrapolation_high() 1644 1591 self.extrapolation_low_high_sizer.AddMany([(self.low_extrapolation_sizer, 1645 0, wx.ALL, 5),1592 0, wx.LEFT|wx.BOTTOM|wx.TOP, 5), 1646 1593 (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)]) 1652 1597 1653 1598 def _layout_volume_surface_sizer(self): … … 1658 1603 unit_surface = '' 1659 1604 uncertainty = "+/-" 1660 volume_txt = wx.StaticText(self, -1, 'Volume Fraction 1605 volume_txt = wx.StaticText(self, -1, 'Volume Fraction') 1661 1606 self.volume_tcl = OutputTextCtrl(self, -1, size=(_BOX_WIDTH, -1), 1662 1607 name='volume_tcl') … … 1713 1658 self.volume_surface_sizer.Add(surface_units_txt, (iy, ix), (1, 1), 1714 1659 wx.EXPAND|wx.ADJUST_MINSIZE, 10) 1660 static_line = wx.StaticLine(self, -1) 1661 iy += 1 1662 ix = 0 1715 1663 1716 1664 def _layout_invariant_sizer(self): … … 1755 1703 Draw widgets related to inputs 1756 1704 """ 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 1762 1745 def _layout_outputs_sizer(self): 1763 1746 """ … … 1767 1750 self._layout_invariant_sizer() 1768 1751 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), 1770 1754 (static_line, 0, wx.EXPAND, 0), 1771 (self.invariant_sizer, 0, wx.ALL, 10)])1755 (self.invariant_sizer, 0, wx.TOP|wx.BOTTOM, 10)]) 1772 1756 def _layout_button(self): 1773 1757 """ … … 1788 1772 details = "Details on Invariant Total Calculations" 1789 1773 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 , 1792 1775 wx.RIGHT|wx.BOTTOM|wx.TOP, 10), 1793 1776 (self.button_details, 0 , wx.ALL, 10), … … 1807 1790 (self.outputs_sizer, 0, 1808 1791 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), 1811 1793 (self.inputs_sizer, 0, 1812 1794 wx.LEFT|wx.RIGHT|wx.BOTTOM, 10),
Note: See TracChangeset
for help on using the changeset viewer.