Changeset 8f02f7f in sasview


Ignore:
Timestamp:
Dec 5, 2016 12:57:20 AM (7 years ago)
Author:
wojciech
Children:
71ac835
Parents:
075c460
Message:

Code clean-up after review by PR

Location:
src/sas/sasgui/perspectives/fitting
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/perspectives/fitting/fitting.py

    r6b59bb3 r8f02f7f  
    4545from sas.sasgui.guiframe.gui_manager import MDIFrame 
    4646from sas.sasgui.guiframe.documentation_window import DocumentationWindow 
     47from sas.sasgui.perspectives.fitting.gpu_options import GpuOptions 
    4748 
    4849from . import models 
     
    810811        Make the Fit Results panel visible. 
    811812        """ 
    812         import sas.sasgui.perspectives.fitting.gpu_options as GpuOptions 
    813         dialog = GpuOptions.GpuOptions(None, -1, "") 
     813        dialog = GpuOptions(None, wx.ID_ANY, "") 
    814814        dialog.Show() 
    815815 
  • src/sas/sasgui/perspectives/fitting/gpu_options.py

    r075c460 r8f02f7f  
    11''' 
     2Module provides dialog for setting SAS_OPENCL variable, which defines 
     3device choice for OpenCL calculation 
     4 
    25Created on Nov 29, 2016 
    36 
     
    710import os 
    811import warnings 
    9  
    1012import wx 
    11 import wx.richtext 
    12 import wx.lib.hyperlink 
    1313 
    1414from sas.sasgui.guiframe.documentation_window import DocumentationWindow 
     
    1616class GpuOptions(wx.Dialog): 
    1717    """ 
    18     "Acknowledgement" Dialog Box 
     18    "OpenCL options" Dialog Box 
    1919 
    20     Shows the current method for acknowledging SasView in 
    21     scholarly publications. 
     20    Provides dialog for setting SAS_OPENCL variable, which defines 
     21    device choice for OpenCL calculation 
    2222 
    2323    """ 
     
    4242            else: 
    4343                self.option_button[clopt] = "None" 
    44             self.Bind(wx.EVT_CHECKBOX, self.on_radio, id=button.GetId()) 
     44            self.Bind(wx.EVT_CHECKBOX, self.on_check, id=button.GetId()) 
    4545            self.buttons.append(button) 
    4646            boxsizer.Add(button, 0, 0) 
     
    6161        help_btn.SetToolTipString("Help on the GPU options") 
    6262 
    63         self.Bind(wx.EVT_BUTTON, self.on_accept, accept_btn) 
     63        self.Bind(wx.EVT_BUTTON, self.on_OK, accept_btn) 
    6464        self.Bind(wx.EVT_BUTTON, self.on_help, help_btn) 
    65         self.Bind(wx.EVT_CLOSE, self.on_close) 
    6665 
    6766        btn_sizer = wx.BoxSizer(wx.HORIZONTAL) 
     
    9392        return clinfo 
    9493 
    95     def on_radio_default(self, event): 
    96         event.GetEventObject().SetValue(not event.GetEventObject().GetValue()) 
    97  
    98     def on_radio(self, event): 
     94    def on_check(self, event): 
    9995        """ 
    10096        Action triggered when button is selected 
     
    10298        :return: 
    10399        """ 
    104         import sasmodels 
    105100        selected_button = event.GetEventObject() 
    106101        for btn in self.buttons: 
     
    108103                btn.SetValue(0) 
    109104        os.environ["SAS_OPENCL"] = self.option_button[selected_button.Name] 
     105 
     106    def on_OK(self, event): 
     107        """ 
     108        Close window on accpetance 
     109        """ 
     110        import sasmodels 
    110111        sasmodels.kernelcl.ENV = None 
    111112        #Need to reload sasmodels.core module to account SAS_OPENCL = "None" 
    112113        reload(sasmodels.core) 
    113  
    114     def on_accept(self, event): 
    115         """ 
    116         Close window on accpetance 
    117         """ 
    118114        event.Skip() 
    119115 
     
    126122        DocumentationWindow(self, -1, 
    127123                            TreeLocation, anchor, "OpenCL Options Help") 
    128  
    129     def on_close(self, event): 
    130         """ 
    131         Close window 
    132         """ 
    133         event.Skip() 
Note: See TracChangeset for help on using the changeset viewer.