Changeset 2a1b92eb in sasview for src/sas/sasgui/perspectives/fitting
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/fitting/gpu_options.py
r25594ca r2a1b92eb 18 18 class CustomMessageBox(wx.Dialog): 19 19 def __init__(self, parent, msg, title): 20 20 21 wx.Dialog.__init__(self, parent, title=title) 21 text = wx.TextCtrl(self, style=wx.TE_READONLY|wx.BORDER_NONE) 22 23 panel = wx.Panel(self, -1) 24 static_box = wx.StaticBox(panel, -1, "OpenCL test completed!") 25 boxsizer = wx.BoxSizer(orient=wx.VERTICAL) 26 27 text = wx.TextCtrl(self, style=wx.TE_READONLY|wx.TE_MULTILINE 28 |wx.BORDER_NONE, size=(400,200)) 22 29 text.SetValue(msg) 23 30 text.SetBackgroundColour(self.GetBackgroundColour()) 31 32 boxsizer.Add(text, 0) 33 34 fit_hsizer = wx.StaticBoxSizer(static_box, orient=wx.VERTICAL) 35 fit_hsizer.Add(boxsizer, 0, wx.ALL, 5) 36 37 panel.SetSizer(fit_hsizer) 38 39 vbox = wx.BoxSizer(wx.VERTICAL) 40 vbox.Add(panel, 0, wx.ALL, 10) 41 42 ok_btn = wx.Button(self, wx.ID_OK) 43 44 btn_sizer = wx.BoxSizer(wx.HORIZONTAL) 45 btn_sizer.Add((10, 20), 1) # stretchable whitespace 46 btn_sizer.Add(ok_btn, 0) 47 48 vbox.Add(btn_sizer, 0, wx.EXPAND|wx.ALL, 10) 49 50 self.SetSizer(vbox) 51 vbox.Fit(self) 52 53 self.Centre() 24 54 self.ShowModal() 25 55 self.Destroy() … … 50 80 #Check if SAS_OPENCL is already set as enviromental variable 51 81 self.sas_opencl = os.environ.get("SAS_OPENCL","") 52 #self.sas_opencl = os.environ["SAS_OPENCL"] \ 53 # if "SAS_OPENCL" in os.environ else SAS_OPENCL_CUSTOM 82 print("SAS_OPENCL: ",self.sas_opencl) 54 83 55 84 for clopt in clinfo: … … 148 177 return clinfo 149 178 150 179 #TODO: Dont want to mess with writting to configuration file before end of 151 180 def _write_to_config_file(self): 152 181 from sas.sasgui.guiframe.customdir import SetupCustom … … 183 212 def on_check(self, event): 184 213 """ 185 Action triggered when b uttonis selected214 Action triggered when box is selected 186 215 :param event: 187 216 :return: … … 207 236 if "SAS_OPENCL" in os.environ: 208 237 del(os.environ["SAS_OPENCL"]) 209 try: 210 imp.find_module('sasmodels.kernelcl') 211 kernelcl_exist = True 212 except: 213 kernelcl_exist = False 214 if kernelcl_exist: 215 sasmodels.kernelcl.ENV = None 216 217 self._write_to_config_file() 238 sasmodels.kernelcl.ENV = None 218 239 #Need to reload sasmodels.core module to account SAS_OPENCL = "None" 219 240 reload(sasmodels.core) … … 224 245 Close window on accpetance 225 246 """ 226 import sasmodels227 247 for btn in self.buttons: 228 248 btn.SetValue(0) 229 249 230 250 self.sas_opencl=None 231 del(os.environ["SAS_OPENCL"])232 233 try:234 imp.find_module('sasmodels.kernelcl')235 kernelcl_exist = True236 except:237 kernelcl_exist = False238 if kernelcl_exist:239 sasmodels.kernelcl.ENV = None240 241 self._write_to_config_file()242 reload(sasmodels.core)243 event.Skip()244 251 245 252 def on_test(self, event): … … 279 286 280 287 msg_info = "OpenCL tests" 281 msg = "OpenCL test completed!\n" 282 msg += "Sasmodels version: " 283 msg += info['version']+"\n" 284 msg += "Platform used: " 285 msg += json.dumps(info['platform'])+"\n" 286 msg += "OpenCL driver: " 287 msg += json.dumps(info['opencl'])+"\n" 288 289 msg = "Results: " 288 290 if len(failures) > 0: 289 291 msg += 'Failing tests:\n' 290 292 msg += json.dumps(info['failing tests']) 291 293 else: 292 msg+="All tests passed\n" 294 msg+="All tests passed!\n" 295 296 msg +="\nDetails:\n" 297 msg += "Sasmodels version: " 298 msg += info['version']+"\n" 299 msg += "\nPlatform used: " 300 msg += json.dumps(info['platform'])+"\n" 301 msg += "\nOpenCL driver: " 302 msg += json.dumps(info['opencl'])+"\n" 293 303 294 304 CustomMessageBox(self.panel1, msg, msg_info)
Note: See TracChangeset
for help on using the changeset viewer.