Changeset 570a58f9 in sasview for src/sas/qtgui/GuiUtils.py


Ignore:
Timestamp:
Jan 6, 2017 3:40:05 AM (7 years ago)
Author:
Piotr Rozyczko <rozyczko@…>
Branches:
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
Children:
fed94a2
Parents:
aadf0af1
git-author:
Piotr Rozyczko <rozyczko@…> (01/06/17 03:31:10)
git-committer:
Piotr Rozyczko <rozyczko@…> (01/06/17 03:40:05)
Message:

Linear fits for 1D charts

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/GuiUtils.py

    raadf0af1 r570a58f9  
    693693    """ 
    694694    return item.child(0).data().toPyObject() 
     695 
     696def formatNumber(value, high=False): 
     697    """ 
     698    Return a float in a standardized, human-readable formatted string. 
     699    This is used to output readable (e.g. x.xxxe-y) values to the panel. 
     700    """ 
     701    try: 
     702        value = float(value) 
     703    except: 
     704        output = "NaN" 
     705        return output.lstrip().rstrip() 
     706 
     707    if high: 
     708        output = "%-6.4g" % value 
     709 
     710    else: 
     711        output = "%-5.3g" % value 
     712    return output.lstrip().rstrip() 
Note: See TracChangeset for help on using the changeset viewer.