Changeset ad6b4e2 in sasview for src/sas/qtgui/Utilities


Ignore:
Timestamp:
May 12, 2017 6:18:48 AM (8 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:
6011788
Parents:
d60da0c
Message:

Custom delegate for fancy display of units

File:
1 edited

Legend:

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

    rf7f5796 rad6b4e2  
    773773        output = "%-5.3g" % value 
    774774    return output.lstrip().rstrip() 
     775 
     776def convertUnitToHTML(unit): 
     777    """ 
     778    Convert ASCII unit display into well rendering HTML 
     779    """ 
     780    if unit == "1/A": 
     781        return "&#x212B;<sup>-1</sup>" 
     782    elif unit == "1/cm": 
     783        return "cm<sup>-1</sup>" 
     784    elif unit == "Ang": 
     785        return "&#x212B;" 
     786    elif unit == "1e-6/Ang^2": 
     787        return "10<sup>-6</sup>/&#x212B;<sup>2</sup>" 
     788    elif unit == "inf": 
     789        return "&#x221e;" 
     790    elif unit == "-inf": 
     791        return "-&#x221e;" 
     792    else: 
     793        return unit 
Note: See TracChangeset for help on using the changeset viewer.