Ignore:
Timestamp:
Nov 10, 2017 5:24:52 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:
f1f3e6a
Parents:
1ba88515
Message:

Updated GPUOptions for py3/qt5

File:
1 edited

Legend:

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

    rf629e62f r1543f0c  
    77 
    88import sas.qtgui.Utilities.GuiUtils as GuiUtils 
    9 from PyQt4 import QtGui, QtCore, QtWebKit 
     9from PyQt5 import QtGui, QtCore, QtWebKit, QtWidgets 
    1010from sas.qtgui.Perspectives.Fitting.UI.GPUOptionsUI import Ui_GPUOptions 
    1111from sas.qtgui.Perspectives.Fitting.UI.GPUTestResultsUI import Ui_GPUTestResults 
     
    1818 
    1919try: 
    20     _encoding = QtGui.QApplication.UnicodeUTF8 
     20    _encoding = QtWidgets.QApplication.UnicodeUTF8 
    2121    def _translate(context, text, disambig): 
    22         return QtGui.QApplication.translate(context, text, disambig, _encoding) 
     22        return QtWidgets.QApplication.translate(context, text, disambig, _encoding) 
    2323except AttributeError: 
    2424    def _translate(context, text, disambig): 
    25         return QtGui.QApplication.translate(context, text, disambig) 
    26  
    27  
    28 class GPUOptions(QtGui.QDialog, Ui_GPUOptions): 
     25        return QtWidgets.QApplication.translate(context, text, disambig) 
     26 
     27 
     28class GPUOptions(QtWidgets.QDialog, Ui_GPUOptions): 
    2929    """ 
    3030    OpenCL Dialog to select the desired OpenCL driver 
     
    3939        self.setupUi(self) 
    4040        self.addOpenCLOptions() 
    41         self.setFixedSize(self.size()) 
    4241        self.createLinks() 
    4342 
     
    5150        for title, descr in cl_tuple: 
    5251            # Create an item for each openCL option 
    53             check_box = QtGui.QCheckBox() 
     52            check_box = QtWidgets.QCheckBox() 
    5453            check_box.setObjectName(_fromUtf8(descr)) 
    5554            check_box.setText(_translate("GPUOptions", descr, None)) 
     
    5958                check_box.click() 
    6059                self.clicked = True 
    61         self.openCLCheckBoxGroup.setMinimumWidth( 
    62             self.optionsLayout.sizeHint().width()) 
    63         self.setMinimumWidth(self.verticalLayout.sizeHint().width()) 
     60        self.openCLCheckBoxGroup.setMinimumWidth(self.optionsLayout.sizeHint().width()+10) 
    6461 
    6562    def createLinks(self): 
     
    6966        self.testButton.clicked.connect(self.testButtonClicked) 
    7067        self.helpButton.clicked.connect(self.helpButtonClicked) 
    71         for item in self.openCLCheckBoxGroup.findChildren(QtGui.QCheckBox): 
     68        for item in self.openCLCheckBoxGroup.findChildren(QtWidgets.QCheckBox): 
    7269            item.clicked.connect(self.checked) 
    7370 
     
    7774        """ 
    7875        checked = None 
    79         for box in self.openCLCheckBoxGroup.findChildren(QtGui.QCheckBox): 
     76        for box in self.openCLCheckBoxGroup.findChildren(QtWidgets.QCheckBox): 
    8077            if box.isChecked() and (str(box.text()) == self.sas_open_cl or ( 
    8178                    str(box.text()) == "No OpenCL" and self.sas_open_cl == "")): 
     
    103100        if 'sasmodels.kernelcl' in sys.modules: 
    104101            sasmodels.kernelcl.ENV = None 
     102        from importlib import reload # assumed Python > 3.3 
    105103        reload(sasmodels.core) 
    106104        return no_opencl_msg 
     
    199197 
    200198 
    201 class GPUTestResults(QtGui.QDialog, Ui_GPUTestResults): 
     199class GPUTestResults(QtWidgets.QDialog, Ui_GPUTestResults): 
    202200    """ 
    203201    OpenCL Dialog to modify the OpenCL options 
     
    207205        self.setupUi(self) 
    208206        self.resultsText.setText(_translate("GPUTestResults", msg, None)) 
    209         self.setFixedSize(self.size()) 
     207        #self.setFixedSize(self.size()) 
    210208        self.open() 
    211209 
Note: See TracChangeset for help on using the changeset viewer.