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


Ignore:
Timestamp:
Nov 9, 2017 8:43:55 AM (6 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:
d6b8a1d
Parents:
7969b9c
git-author:
Piotr Rozyczko <rozyczko@…> (11/03/17 10:58:39)
git-committer:
Piotr Rozyczko <rozyczko@…> (11/09/17 08:43:55)
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

    r4992ff2 rfbfc488  
    6161        QtGui.QStandardItemModel.__init__(self,parent) 
    6262 
    63     def headerData(self, section, orientation, role): 
     63    def headerData(self, section, orientation, role=QtCore.Qt.DisplayRole): 
    6464        """ 
    6565        Displays tooltip for each column's header 
     
    592592        elif model_column in [self.lstPoly.itemDelegate().poly_min, self.lstPoly.itemDelegate().poly_max]: 
    593593            try: 
    594                 value = float(item.text()) 
     594                value = GuiUtils.toDouble(item.text()) 
    595595            except ValueError: 
    596596                # Can't be converted properly, bring back the old value and exit 
     
    607607        else: 
    608608            try: 
    609                 value = float(item.text()) 
     609                value = GuiUtils.toDouble(item.text()) 
    610610            except ValueError: 
    611611                # Can't be converted properly, bring back the old value and exit 
     
    624624        model_row = item.row() 
    625625        name_index = self._magnet_model.index(model_row, 0) 
    626         parameter_name = str(self._magnet_model.data(name_index).toPyObject()) 
     626        parameter_name = str(self._magnet_model.data(name_index)) 
    627627 
    628628        if model_column == 0: 
     
    640640        # Extract changed value. 
    641641        try: 
    642             value = float(item.text()) 
     642            value = GuiUtils.toDouble(item.text()) 
    643643        except ValueError: 
    644644            # Unparsable field 
    645645            return 
    646646 
    647         property_index = self._magnet_model.headerData(0, 1, model_column).toInt()[0]-1 # Value, min, max, etc. 
     647        property_index = self._magnet_model.headerData(1, model_column)-1 # Value, min, max, etc. 
    648648 
    649649        # Update the parameter value - note: this supports +/-inf as well 
     
    13041304        # Extract changed value. 
    13051305        try: 
    1306             value = float(item.text()) 
     1306            value = GuiUtils.toDouble(item.text()) 
    13071307        except ValueError: 
    13081308            # Unparsable field 
    13091309            return 
    1310         parameter_name = str(self._model_model.data(name_index)) #.toPyObject()) # sld, background etc. 
     1310 
     1311        parameter_name = str(self._model_model.data(name_index)) # sld, background etc. 
    13111312 
    13121313        # Update the parameter value - note: this supports +/-inf as well 
     
    16871688        datafile = QtWidgets.QFileDialog.getOpenFileName( 
    16881689            self, "Choose a weight file", "", "All files (*.*)", None, 
    1689             QtWidgets.QFileDialog.DontUseNativeDialog) 
    1690  
    1691         if datafile is None or str(datafile)=='': 
     1690            QtWidgets.QFileDialog.DontUseNativeDialog)[0] 
     1691 
     1692        if not datafile: 
    16921693            logging.info("No weight data chosen.") 
    16931694            raise IOError 
  • src/sas/qtgui/Perspectives/Fitting/ViewDelegate.py

    r7969b9c rfbfc488  
    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.