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


Ignore:
Timestamp:
Nov 9, 2017 6: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 08:58:39)
git-committer:
Piotr Rozyczko <rozyczko@…> (11/09/17 06:43:55)
Message:

More Qt5 related fixes.

Location:
src/sas/qtgui/Utilities
Files:
2 edited

Legend:

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

    r4992ff2 rfbfc488  
    249249        plot_item = item.child(index) 
    250250        if plot_item.isCheckable(): 
    251             plot_data = plot_item.child(0).data() #.toPyObject() 
     251            plot_data = plot_item.child(0).data() 
    252252            if plot_data.id is not None and plot_data.id == py_update_data.id: 
    253253                # replace data section in item 
     
    270270    Adds 'update_data' to that row. 
    271271    """ 
    272     #assert isinstance(update_data, QtCore.QVariant) 
    273     #py_update_data = update_data.toPyObject() 
    274272    py_update_data = update_data 
    275273 
     
    339337        if str(item.text()) == filename: 
    340338            # TODO: assure item type is correct (either data1/2D or Plotter) 
    341             plot_data.append(item.child(0).data()) #.toPyObject()) 
     339            plot_data.append(item.child(0).data()) 
    342340            # Going 1 level deeper only 
    343341            for index_2 in range(item.rowCount()): 
     
    345343                if item_2 and item_2.isCheckable(): 
    346344                    # TODO: assure item type is correct (either data1/2D or Plotter) 
    347                     plot_data.append(item_2.child(0).data()) #.toPyObject()) 
     345                    plot_data.append(item_2.child(0).data()) 
    348346 
    349347    return plot_data 
     
    361359        if item.isCheckable() and item.checkState() == QtCore.Qt.Checked: 
    362360            # TODO: assure item type is correct (either data1/2D or Plotter) 
    363             plot_data.append((item, item.child(0).data())) #.toPyObject())) 
     361            plot_data.append((item, item.child(0).data())) 
    364362        # Going 1 level deeper only 
    365363        for index_2 in range(item.rowCount()): 
     
    367365            if item_2 and item_2.isCheckable() and item_2.checkState() == QtCore.Qt.Checked: 
    368366                # TODO: assure item type is correct (either data1/2D or Plotter) 
    369                 plot_data.append((item_2, item_2.child(0).data())) #.toPyObject())) 
     367                plot_data.append((item_2, item_2.child(0).data())) 
    370368 
    371369    return plot_data 
     
    635633   
    636634    def validate(self, input, pos): 
    637         try: 
    638             Formula(str(input)) 
    639             self._setStyleSheet("") 
    640             return QtGui.QValidator.Acceptable, pos 
    641  
    642         except Exception as e: 
    643             self._setStyleSheet("background-color:pink;") 
    644             return QtGui.QValidator.Intermediate, pos 
     635 
     636        self._setStyleSheet("") 
     637        return QtGui.QValidator.Acceptable, pos 
     638 
     639        #try: 
     640        #    Formula(str(input)) 
     641        #    self._setStyleSheet("") 
     642        #    return QtGui.QValidator.Acceptable, pos 
     643 
     644        #except Exception as e: 
     645        #    self._setStyleSheet("background-color:pink;") 
     646        #    return QtGui.QValidator.Intermediate, pos 
    645647 
    646648    def _setStyleSheet(self, value): 
     
    756758    The assumption - data stored in SasView standard, in child 0 
    757759    """ 
    758     return item.child(0).data() #.toPyObject() 
     760    return item.child(0).data() 
    759761 
    760762def formatNumber(value, high=False): 
     
    806808    else: 
    807809        return name 
     810 
     811def toDouble(value_string): 
     812    """ 
     813    toFloat conversion which cares deeply about user's locale 
     814    """ 
     815    # Holy shit this escalated quickly in Qt5. 
     816    # No more float() cast on general locales. 
     817    value = QtCore.QLocale().toFloat(value_string) 
     818    if value[1]: 
     819        return value[0] 
     820 
     821    # Try generic locale 
     822    value = QtCore.QLocale(QtCore.QLocale('en_US')).toFloat(value_string) 
     823    if value[1]: 
     824        return value[0] 
     825    else: 
     826        raise ValueError 
  • src/sas/qtgui/Utilities/IPythonWidget.py

    r4992ff2 rfbfc488  
    33from PyQt5 import QtWidgets 
    44 
    5 ##from PyQt4 import QtSvg 
     5from PyQt5 import QtSvg 
    66 
    77def new_load_qt(api_options): 
     
    1818# Do some monkey patching to satisfy pyinstaller complaining 
    1919# about pyside/pyqt confusion 
    20 qt_loaders.load_qt = new_load_qt 
    21 qtconsole_qt_loaders.load_qt = qtconsole_new_load_qt 
     20#qt_loaders.load_qt = new_load_qt 
     21#qtconsole_qt_loaders.load_qt = qtconsole_new_load_qt 
    2222 
    2323from qtconsole.rich_jupyter_widget import RichJupyterWidget 
Note: See TracChangeset for help on using the changeset viewer.