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


Ignore:
Timestamp:
Nov 9, 2017 8:43:56 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:
53c771e
Parents:
fbfc488
git-author:
Piotr Rozyczko <rozyczko@…> (11/07/17 08:29:59)
git-committer:
Piotr Rozyczko <rozyczko@…> (11/09/17 08:43:56)
Message:

More Qt5 related fixes

File:
1 edited

Legend:

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

    rfbfc488 rd6b8a1d  
    584584    } 
    585585    # Query user for filename. 
    586     filename = QtWidgets.QFileDialog.getSaveFileName(**kwargs) 
     586    filename_tuple = QtWidgets.QFileDialog.getSaveFileName(**kwargs) 
     587    filename = filename_tuple[0] 
    587588 
    588589    # User cancelled. 
    589590    if not filename: 
    590591        return 
    591  
    592     filename = str(filename) 
    593592 
    594593    #Instantiate a loader 
     
    616615    } 
    617616    # Query user for filename. 
    618     filename = QtWidgets.QFileDialog.getSaveFileName(**kwargs) 
     617    filename_tuple = QtWidgets.QFileDialog.getSaveFileName(**kwargs) 
     618    filename = filename_tuple[0] 
    619619 
    620620    # User cancelled. 
    621621    if not filename: 
    622622        return 
    623     filename = str(filename) 
     623 
    624624    #Instantiate a loader 
    625625    loader = Loader() 
     
    825825    else: 
    826826        raise ValueError 
     827 
     828class DoubleValidator(QtGui.QDoubleValidator): 
     829    """ 
     830    Allow only dots as decimal separator 
     831    """ 
     832    def validate(self, input, pos): 
     833        """ 
     834        Return invalid for commas 
     835        """ 
     836        if (',' in input): 
     837            return (QtGui.QValidator.Invalid, input, pos) 
     838        return super(DoubleValidator, self).validate(input, pos) 
     839 
     840    def fixup(self, input): 
     841        """ 
     842        Correct (remove) potential preexisting content 
     843        """ 
     844        QtGui.QDoubleValidator.fixup(input) 
     845        input = input.replace(",", "") 
     846 
Note: See TracChangeset for help on using the changeset viewer.