Ignore:
Timestamp:
Oct 25, 2017 7:58:46 AM (7 years ago)
Author:
krzywon
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:
c31d41e7
Parents:
37be27f
Message:

Address issues outlined in SVCC-79.

File:
1 edited

Legend:

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

    r37be27f r9863343  
    66import platform 
    77 
     8import sas.qtgui.Utilities.GuiUtils as GuiUtils 
    89from PyQt4 import QtGui, QtCore, QtWebKit 
    910from sas.qtgui.Perspectives.Fitting.UI.GPUOptionsUI import Ui_GPUOptions 
     
    3839        self.setupUi(self) 
    3940        self.addOpenCLOptions() 
     41        self.setFixedSize(self.size()) 
    4042        self.createLinks() 
    4143 
     
    6163            # Expand group and shift items down as more are added 
    6264            self.openCLCheckBoxGroup.resize(391, 60 + i) 
    63             self.label.setGeometry(QtCore.QRect(20, 90 + i, 391, 37)) 
     65            self.warningMessage.setGeometry(QtCore.QRect(20, 90 + i, 391, 37)) 
    6466            self.okButton.setGeometry(QtCore.QRect(20, 127 + i, 93, 28)) 
    6567            self.resetButton.setGeometry(QtCore.QRect(120, 127 + i, 93, 28)) 
     
    7375        Link user interactions to function calls 
    7476        """ 
    75         self.testButton.clicked.connect(lambda: self.testButtonClicked()) 
    76         self.helpButton.clicked.connect(lambda: self.helpButtonClicked()) 
     77        self.testButton.clicked.connect(self.testButtonClicked) 
     78        self.helpButton.clicked.connect(self.helpButtonClicked) 
    7779        for item in self.openCLCheckBoxGroup.findChildren(QtGui.QCheckBox): 
    78             item.clicked.connect(lambda: self.checked()) 
     80            item.clicked.connect(self.checked) 
    7981 
    8082    def checked(self): 
     
    151153        } 
    152154 
    153         msg_info = 'OpenCL tests results' 
    154  
    155155        msg = str(tests_completed) + ' tests completed.\n' 
    156156        if len(failures) > 0: 
     
    172172            msg += "\nOpenCL driver: " 
    173173            msg += json.dumps(info['opencl']) + "\n" 
    174         GPUTestResults(self, msg, msg_info) 
     174        GPUTestResults(self, msg) 
    175175 
    176176    def helpButtonClicked(self): 
     
    178178        Open the help menu when the help button is clicked 
    179179        """ 
    180         tree_location = "user/sasgui/perspectives/fitting/gpu_setup.html" 
    181         anchor = "#device-selection" 
     180        help_location = GuiUtils.HELP_DIRECTORY_LOCATION 
     181        help_location += "/user/sasgui/perspectives/fitting/gpu_setup.html" 
     182        help_location += "#device-selection" 
    182183        self.helpView = QtWebKit.QWebView() 
    183         help_location = tree_location + anchor 
    184184        self.helpView.load(QtCore.QUrl(help_location)) 
    185185        self.helpView.show() 
     
    211211    OpenCL Dialog to modify the OpenCL options 
    212212    """ 
    213     def __init__(self, parent, msg, title): 
     213    def __init__(self, parent, msg): 
    214214        super(GPUTestResults, self).__init__(parent) 
    215215        self.setupUi(self) 
    216216        self.resultsText.setText(_translate("GPUTestResults", msg, None)) 
     217        self.setFixedSize(self.size()) 
    217218        self.open() 
    218219 
     
    223224    """ 
    224225    clinfo = [] 
    225     platforms = [] 
     226    cl_platforms = [] 
    226227    try: 
    227228        import pyopencl as cl 
    228         platforms = cl.get_platforms() 
     229        cl_platforms = cl.get_platforms() 
    229230    except ImportError: 
    230231        print("pyopencl import failed. Using only CPU computations") 
    231232 
    232233    p_index = 0 
    233     for platform in platforms: 
     234    for cl_platform in cl_platforms: 
    234235        d_index = 0 
    235         devices = platform.get_devices() 
    236         for device in devices: 
    237             if len(devices) > 1 and len(platforms) > 1: 
     236        cl_platforms = cl_platform.get_devices() 
     237        for cl_platform in cl_platforms: 
     238            if len(cl_platforms) > 1 and len(cl_platforms) > 1: 
    238239                combined_index = ":".join([str(p_index), str(d_index)]) 
    239             elif len(platforms) > 1: 
     240            elif len(cl_platforms) > 1: 
    240241                combined_index = str(p_index) 
    241242            else: 
    242243                combined_index = str(d_index) 
    243             clinfo.append((combined_index, ":".join([platform.name, 
    244                                                      device.name]))) 
     244            clinfo.append((combined_index, ":".join([cl_platform.name, 
     245                                                     cl_platform.name]))) 
    245246            d_index += 1 
    246247        p_index += 1 
Note: See TracChangeset for help on using the changeset viewer.