Ignore:
Timestamp:
Oct 24, 2017 12:31:38 PM (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:
83710be
Parents:
a6cd8d1
Message:

SAS_OPENCL updates properly.

File:
1 edited

Legend:

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

    ra6cd8d1 r1df1025  
    2828 
    2929    clicked = False 
    30     checkBoxes = None 
    3130    sas_open_cl = None 
    3231 
     
    4645        i = 0 
    4746        self.sas_open_cl = os.environ.get("SAS_OPENCL", "") 
    48         self.checkBoxes = [] 
    4947        for title, descr in cl_tuple: 
    5048            checkBox = QtGui.QCheckBox(self.openCLCheckBoxGroup) 
     
    5553                checkBox.click() 
    5654                self.clicked = True 
    57             self.checkBoxes.append(checkBox) 
    5855            # Expand group and shift items down as more are added 
    5956            self.openCLCheckBoxGroup.resize(391, 60 + i) 
     
    7168        self.testButton.clicked.connect(lambda: self.testButtonClicked()) 
    7269        self.helpButton.clicked.connect(lambda: self.helpButtonClicked()) 
    73         self.openCLCheckBoxGroup.clicked.connect(lambda: self.checked()) 
     70        for item in self.openCLCheckBoxGroup.findChildren(QtGui.QCheckBox): 
     71            item.clicked.connect(lambda: self.checked()) 
    7472 
    7573    def checked(self): 
     
    7775        Action triggered when box is selected 
    7876        """ 
    79         selected_box = None 
    80         for box in self.checkBoxes: 
    81             if box.isChecked() and box.getText() != self.sas_open_cl: 
    82                 selected_box = box 
     77        checked = None 
     78        for box in self.openCLCheckBoxGroup.findChildren(QtGui.QCheckBox): 
     79            if box.isChecked() and (str(box.text()) == self.sas_open_cl or ( 
     80                            str(box.text()) == "No OpenCL" and self.sas_open_cl == "")): 
     81                box.setChecked(False) 
     82            elif not box.isChecked(): 
     83                pass 
    8384            else: 
    84                 box.setChecked(False) 
    85         if selected_box.getText(): 
    86             self.sas_open_cl = self.option_button[selected_box.title] 
     85                checked = box 
     86        if hasattr(checked, "text"): 
     87            self.sas_open_cl = str(checked.text()) 
    8788        else: 
    8889            self.sas_open_cl = None 
     
    105106        """ 
    106107        self.close() 
    107         self.parent.gpu_options_widget = GPUOptions(self) 
    108108        self.open() 
    109109 
     
    130130        Overwrite QDialog close method to allow for custom widget close 
    131131        """ 
     132        self.parent.gpu_options_widget = reload(GPUOptions(self)) 
    132133        self.reject() 
    133134 
Note: See TracChangeset for help on using the changeset viewer.