Changeset 6280464 in sasview for src/sas/qtgui/Perspectives/Fitting


Ignore:
Timestamp:
Nov 3, 2017 10:58:39 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:
412e069e
Parents:
304d082
Message:

More Qt5 related fixes.

Location:
src/sas/qtgui/Perspectives/Fitting
Files:
2 edited

Legend:

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

    r0849aec r6280464  
    6060        QtGui.QStandardItemModel.__init__(self,parent) 
    6161 
    62     def headerData(self, section, orientation, role): 
     62    def headerData(self, section, orientation, role=QtCore.Qt.DisplayRole): 
    6363        """ 
    6464        Displays tooltip for each column's header 
     
    586586        elif model_column in [self.lstPoly.itemDelegate().poly_min, self.lstPoly.itemDelegate().poly_max]: 
    587587            try: 
    588                 value = float(item.text()) 
     588                value = GuiUtils.toDouble(item.text()) 
    589589            except ValueError: 
    590590                # Can't be converted properly, bring back the old value and exit 
     
    601601        else: 
    602602            try: 
    603                 value = float(item.text()) 
     603                value = GuiUtils.toDouble(item.text()) 
    604604            except ValueError: 
    605605                # Can't be converted properly, bring back the old value and exit 
     
    618618        model_row = item.row() 
    619619        name_index = self._magnet_model.index(model_row, 0) 
    620         parameter_name = str(self._magnet_model.data(name_index).toPyObject()) 
     620        parameter_name = str(self._magnet_model.data(name_index)) 
    621621 
    622622        if model_column == 0: 
     
    634634        # Extract changed value. 
    635635        try: 
    636             value = float(item.text()) 
     636            value = GuiUtils.toDouble(item.text()) 
    637637        except ValueError: 
    638638            # Unparsable field 
    639639            return 
    640640 
    641         property_index = self._magnet_model.headerData(1, model_column).toInt()[0]-1 # Value, min, max, etc. 
     641        property_index = self._magnet_model.headerData(1, model_column)-1 # Value, min, max, etc. 
    642642 
    643643        # Update the parameter value - note: this supports +/-inf as well 
     
    12951295        # Extract changed value. 
    12961296        try: 
    1297             value = float(item.text()) 
     1297            value = GuiUtils.toDouble(item.text()) 
    12981298        except ValueError: 
    12991299            # Unparsable field 
    13001300            return 
    1301         parameter_name = str(self._model_model.data(name_index)) #.toPyObject()) # sld, background etc. 
     1301 
     1302        parameter_name = str(self._model_model.data(name_index)) # sld, background etc. 
    13021303 
    13031304        # Update the parameter value - note: this supports +/-inf as well 
     
    16781679        datafile = QtWidgets.QFileDialog.getOpenFileName( 
    16791680            self, "Choose a weight file", "", "All files (*.*)", None, 
    1680             QtWidgets.QFileDialog.DontUseNativeDialog) 
    1681  
    1682         if datafile is None or str(datafile)=='': 
     1681            QtWidgets.QFileDialog.DontUseNativeDialog)[0] 
     1682 
     1683        if not datafile: 
    16831684            logging.info("No weight data chosen.") 
    16841685            raise IOError 
  • src/sas/qtgui/Perspectives/Fitting/ViewDelegate.py

    r304d082 r6280464  
    44 
    55import sas.qtgui.Utilities.GuiUtils as GuiUtils 
     6 
     7class CommaLessValidator(QtGui.QDoubleValidator): 
     8    """ 
     9    Custom double validator which doesn't allow for commas to be used as decimal point 
     10    """ 
     11    pass 
    612 
    713class ModelViewDelegate(QtWidgets.QStyledItemDelegate): 
     
    4450        if index.column() in self.fancyColumns(): 
    4551            # Units - present in nice HTML 
    46             #options = QtWidgets.QStyleOptionViewItemV4(option) 
    4752            options = QtWidgets.QStyleOptionViewItem(option) 
    4853            self.initStyleOption(options,index) 
     
    236241    def createEditor(self, widget, option, index): 
    237242        # Remember the current choice 
    238         current_text = index.data().toString() 
     243        current_text = index.data() 
    239244        if not index.isValid(): 
    240245            return 0 
Note: See TracChangeset for help on using the changeset viewer.