Ignore:
Timestamp:
Mar 29, 2019 6:52:16 AM (5 years ago)
Author:
ibressler
Branches:
ESS_GUI_bumps_abstraction
Children:
f86343bd
Parents:
fec5842
Message:

FittingOptions?: now with tooltips again

  • extracted from generated FittingOptions? UI file
  • moved to bumps related interface code
    • could be provided by bumps directly instead
    • alternatively, extract the tooltips from the documentation programatically, perhaps?
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/Perspectives/Fitting/FittingOptions.py

    rfec5842 rccfe03b  
    2727    _longName = None 
    2828    _type = None 
     29    _description = None # an optional description for the user, will be shown as UI tooltip 
    2930    _defaultValue = None 
    3031    value = None 
    3132 
    32     def __init__(self, shortName, longName, dtype, defaultValue): 
     33    def __init__(self, shortName, longName, dtype, defaultValue, description = None): 
    3334        self._shortName = shortName 
    3435        self._longName = longName 
    3536        self._type = dtype 
     37        self._description = description 
    3638        self._defaultValue = defaultValue 
    3739        self.value = defaultValue 
     
    4850    def type(self): 
    4951        return self._type 
     52 
     53    @property 
     54    def description(self): 
     55        return self._description 
    5056 
    5157    @property 
     
    136142    def __str__(self): 
    137143        return "\n".join(["{}: {}".format(key, fm) for key, fm in self._methods.items()]) 
     144 
     145from sas.sascalc.fit.BumpsFitting import toolTips as bumpsToolTips 
    138146 
    139147class FittingMethodBumps(FittingMethod): 
     
    162170                longName, dtype = bumps.options.FIT_FIELDS[shortName] 
    163171                dtype = self._convertParamType(dtype) 
    164                 param = FittingMethodParameter(shortName, longName, dtype, defValue) 
     172                key = shortName+"_"+f.id 
     173                descr = bumpsToolTips.get(key, None) 
     174                param = FittingMethodParameter(shortName, longName, dtype, defValue, 
     175                                               description=descr) 
    165176                params.append(param) 
    166177            self.add(FittingMethodBumps(f.id, f.name, params)) 
     
    308319        for param in fm.params.values(): 
    309320            row = layout.rowCount()+1 
    310             layout.addWidget(self._makeLabel(param.longName), row, 0) 
     321            label = self._makeLabel(param.longName) 
     322            layout.addWidget(label, row, 0) 
    311323            widget = self._inputWidgetFromType(param.type, self) 
    312324            if widget is None: 
    313325                continue 
     326            if param.description is not None: 
     327                widget.setToolTip(param.description) 
     328                label.setToolTip(param.description) 
     329            layout.addWidget(widget, row, 1) 
    314330            widgetName = param.shortName+'_'+fm.shortName 
    315             layout.addWidget(widget, row, 1) 
    316331            setattr(self, widgetName, widget) 
    317332        layout.addItem(QtWidgets.QSpacerItem(0, 0, vPolicy=QtWidgets.QSizePolicy.Expanding)) 
Note: See TracChangeset for help on using the changeset viewer.