Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/fitting/gpu_options.py
r9a26428 rc2cb772 53 53 clinfo = None 54 54 55 #####################################56 55 self.panel1 = wx.Panel(self, -1) 57 56 static_box1 = wx.StaticBox(self.panel1, -1, "OpenCL Options") 58 57 59 #contextes = ("Intel(R) Iris(TM) Graphics 6100",60 # "Intel(R) Core(TM) i7-5557U CPU @ 3.10GHz",61 # "No OpenCL")62 58 rows = len(clinfo) 63 59 64 60 flexsizer = wx.FlexGridSizer(rows, 1, hgap=20, vgap=10) 65 self. fitter_button = {}66 for fitter in clinfo:61 self.option_button = {} 62 for index, fitter in enumerate(clinfo): 67 63 button = wx.RadioButton(self.panel1, -1, 68 64 label=fitter, name=fitter) 69 self.fitter_button[fitter] = button 70 #self.Bind(wx.EVT_RADIOBUTTON, self.OnRadio, id=button.GetId()) 65 if fitter != "No OpenCL": 66 self.option_button[fitter] = str(index) 67 else: 68 self.option_button[fitter] = "None" 69 self.Bind(wx.EVT_RADIOBUTTON, self.OnRadio, id=button.GetId()) 71 70 flexsizer.Add(button, 0, 0) 72 71 … … 78 77 self.vbox = wx.BoxSizer(wx.VERTICAL) 79 78 self.vbox.Add(self.panel1, 0, wx.ALL, 10) 80 ########################################### 81 #self.preamble = wx.StaticText(self, -1, config._acknowledgement_preamble) 82 #items = [config._acknowledgement_preamble_bullet1, 83 # config._acknowledgement_preamble_bullet2, 84 # config._acknowledgement_preamble_bullet3, 85 # config._acknowledgement_preamble_bullet4] 86 #self.list1 = wx.StaticText(self, -1, "\t(1) " + items[0]) 87 #self.list2 = wx.StaticText(self, -1, "\t(2) " + items[1]) 88 #self.list3 = wx.StaticText(self, -1, "\t(3) " + items[2]) 89 #self.list4 = wx.StaticText(self, -1, "\t(4) " + items[3]) 90 #self.static_line = wx.StaticLine(self, 0) 91 self.__set_properties() 92 self.__do_layout() 79 80 accept_btn = wx.Button(self, wx.ID_OK) 81 accept_btn.SetToolTipString("Accept new options for GPU") 82 83 help_btn = wx.Button(self, wx.ID_HELP, 'Help') 84 #help_btn = wx.Button(self, wx.ID_ANY, 'Help') 85 help_btn.SetToolTipString("Help on the GPU options") 86 87 self.Bind(wx.EVT_BUTTON, self.OnAccept, accept_btn) 88 #self.Bind(wx.EVT_BUTTON, self.OnCancel, cancel_btn) 89 if help is not None: 90 self.Bind(wx.EVT_BUTTON, self.OnHelp, help_btn) 91 92 self.Bind(wx.EVT_CLOSE, self.OnClose) 93 94 # Create the button sizer that will put the buttons in a row, right 95 # justified, and with a fixed amount of space between them. This 96 # emulates the Windows convention for placing a set of buttons at the 97 # bottom right of the window. 98 btn_sizer = wx.BoxSizer(wx.HORIZONTAL) 99 btn_sizer.Add((10,20), 1) # stretchable whitespace 100 btn_sizer.Add(accept_btn, 0) 101 #btn_sizer.Add((10,20), 0) # non-stretchable whitespace 102 #btn_sizer.Add(cancel_btn, 0) 103 #btn_sizer.Add((10,20), 0) # non-stretchable whitespace 104 btn_sizer.Add((10,20), 0) # non-stretchable whitespace 105 btn_sizer.Add(help_btn, 0) 106 107 # Add the button sizer to the main sizer. 108 self.vbox.Add(btn_sizer, 0, wx.EXPAND|wx.ALL, 10) 109 110 # Finalize the sizer and establish the dimensions of the dialog box. 111 # The minimum width is explicitly set because the sizer is not able to 112 # take into consideration the width of the enclosing frame's title. 113 self.SetSizer(self.vbox) 114 #self.vbox.SetMinSize((size[0], -1)) 115 self.vbox.Fit(self) 116 117 self.Centre() 118 #self.__set_properties() 119 #self.__do_layout() 93 120 94 121 def __set_properties(self): … … 96 123 :TODO - add method documentation 97 124 """ 98 # begin wxGlade: DialogAbout.__set_properties99 #self.preamble.SetFont(wx.Font(11, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))100 #self.preamble.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))101 125 self.SetTitle("Fitting on GPU Options") 102 #Increased size of box from (525, 225), SMK, 04/10/16103 126 self.SetSize((400, 150)) 104 127 # end wxGlade … … 108 131 :TODO - add method documentation 109 132 """ 110 # begin wxGlade: DialogAbout.__do_layout111 133 sizer_main = wx.BoxSizer(wx.VERTICAL) 112 #sizer_titles = wx.BoxSizer(wx.VERTICAL) 113 #sizer_titles.Add(self.preamble, 0, wx.ALL|wx.EXPAND, 5) 114 #sizer_titles.Add(self.list1, 0, wx.ALL|wx.EXPAND, 5) 115 #sizer_titles.Add(self.list2, 0, wx.ALL|wx.EXPAND, 5) 116 #sizer_titles.Add(self.list3, 0, wx.ALL|wx.EXPAND, 5) 117 #sizer_titles.Add(self.list4, 0, wx.ALL|wx.EXPAND, 5) 118 #sizer_titles.Add(self.static_line, 0, wx.ALL|wx.EXPAND, 0) 119 #sizer_titles.Add(self.ack, 0, wx.ALL|wx.EXPAND, 5) 120 #sizer_main.Add(sizer_titles, -1, wx.ALL|wx.EXPAND, 5) 134 121 135 self.SetAutoLayout(True) 122 136 self.SetSizer(sizer_main) … … 125 139 # end wxGlade 126 140 141 def OnRadio(self, event): 142 import sasmodels 143 button = event.GetEventObject() 144 print(self.option_button[button.Name]) 145 os.environ["SAS_OPENCL"] = self.option_button[button.Name] 146 sasmodels.kernelcl.ENV = None 147 reload(sasmodels.core) 148 #if self.option_button[button.Name] == "None": 149 # sasmodels.core.HAVE_OPENCL = False 150 #else: 151 # sasmodels.kernelcl.ENV. 152 153 def OnAccept(self, event): 154 """ 155 Save the current fitter and options to the fit config. 156 """ 157 event.Skip() 158 159 def OnHelp(self, event): 160 """ 161 Provide help on the selected fitter. 162 """ 163 #if self.help is not None: 164 # self.help(self._get_fitter()) 165 166 def OnClose(self, event): 167 """ 168 Don't close the window, just hide it. 169 """ 170 event.Skip() 127 171 128 172 ##### testing code ############################################################
Note: See TracChangeset
for help on using the changeset viewer.