Changeset 306219c in sasview for calculatorview/src/sans/perspectives
- Timestamp:
- Jun 27, 2012 1:22:08 PM (12 years ago)
- Branches:
- master, 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, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 49a2b7cc
- Parents:
- 709cd83
- Location:
- calculatorview/src/sans/perspectives/calculator
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
calculatorview/src/sans/perspectives/calculator/calculator.py
ra48842a2 r306219c 97 97 self.put_icon(self.data_operator_frame) 98 98 self.data_operator_frame.Show(False) 99 self.data_operator_frame.panel.set_panel_on_focus(None) 99 100 self.data_operator_frame.Show(True) 100 101 -
calculatorview/src/sans/perspectives/calculator/data_operator.py
r743f480 r306219c 94 94 operator_name = wx.StaticText(self, -1, 'Operator') 95 95 data2_name = wx.StaticText(self, -1, 'Data2 (or Number)') 96 self.data_namectr = wx.TextCtrl(self, -1, size=(_BOX_WIDTH, 25) )96 self.data_namectr = wx.TextCtrl(self, -1, size=(_BOX_WIDTH, 25), style=wx.TE_PROCESS_ENTER) 97 97 self.data_namectr.SetToolTipString("Hit 'Enter' key after typing.") 98 98 self.data_namectr.SetValue(str('MyNewDataName')) 99 self.numberctr = wx.TextCtrl(self, -1, size=(_BOX_WIDTH/3, 25) )99 self.numberctr = wx.TextCtrl(self, -1, size=(_BOX_WIDTH/3, 25), style=wx.TE_PROCESS_ENTER) 100 100 self.numberctr.SetToolTipString("Hit 'Enter' key after typing.") 101 101 self.numberctr.SetValue(str(1.0)) … … 172 172 if len(children) > 0: 173 173 ctrl.GetChildren()[0].SetBackGroundColour(self.color) 174 if enable: 175 wx.EVT_TEXT_ENTER(self.numberctr, -1, self.on_number) 174 176 else: 175 177 if not ctrl.IsEnabled(): … … 187 189 self._set_textctrl_color(item, 'white') 188 190 else: 189 self._set_textctrl_color(item, self. GetBackgroundColour())191 self._set_textctrl_color(item, self.color) 190 192 text = item.GetValue().strip() 191 193 self._check_newname(text) … … 239 241 """ 240 242 self.send_warnings('') 241 if self.numberctr.IsEnabled():242 self._set_textctrl_color(self.numberctr, 'white')243 else:244 self._set_textctrl_color(self.numberctr, self.GetBackgroundColour())245 246 243 item = event.GetEventObject() 247 244 text = item.GetValue().strip() 248 try: 249 val = float(text) 250 pos = self.data2_cbox.GetSelection() 251 self.data2_cbox.SetClientData(pos, val) 252 except: 253 self._set_textctrl_color(self.numberctr, 'pink') 254 msg = "DataOperation: Number requires a float number." 255 self.send_warnings(msg, 'error') 256 return 257 self.put_text_pic(self.data2_pic, content=str(val)) 245 if self.numberctr.IsShown(): 246 if self.numberctr.IsEnabled(): 247 self._set_textctrl_color(self.numberctr, 'white') 248 try: 249 val = float(text) 250 pos = self.data2_cbox.GetCurrentSelection() 251 self.data2_cbox.SetClientData(pos, val) 252 except: 253 self._set_textctrl_color(self.numberctr, 'pink') 254 msg = "DataOperation: Number requires a float number." 255 self.send_warnings(msg, 'error') 256 return 257 else: 258 self._set_textctrl_color(self.numberctr, self.color) 259 260 self.put_text_pic(self.data2_pic, content=str(val)) 258 261 self.check_data_inputs() 259 262 if self.output != None: … … 266 269 On select data1 267 270 """ 268 if event != None:269 event.Skip()270 271 self.send_warnings('') 271 272 item = event.GetEventObject() 272 pos = item.Get Selection()273 pos = item.GetCurrentSelection() 273 274 data = item.GetClientData(pos) 274 275 if data == None: … … 303 304 text = item.GetValue().strip().lower() 304 305 self._show_numctrl(self.numberctr, text=='number') 305 306 pos = item.GetSelection() 306 pos = item.GetCurrentSelection() 307 307 data = item.GetClientData(pos) 308 308 content = "?" … … 311 311 content = "?" 312 312 self.put_text_pic(self.data2_pic, content) 313 #item.SetClientData(pos, content)314 313 else: 315 314 self.data2_pic.add_image(data) … … 356 355 pos2 = self.data2_cbox.GetCurrentSelection() 357 356 data2 = self.data2_cbox.GetClientData(pos2) 357 358 358 if data2 == None: 359 359 self.output = None … … 362 362 if self.numberctr.IsEnabled(): 363 363 self._set_textctrl_color(self.numberctr, 'white') 364 else: 365 self._set_textctrl_color(self.numberctr, self.color ) 366 try: 367 float(data2) 368 if self.operator_cbox.GetValue().strip() == '|': 369 msg = "DataOperation: This operation can not accept " 370 msg += "a float number." 364 try: 365 float(data2) 366 if self.operator_cbox.GetValue().strip() == '|': 367 msg = "DataOperation: This operation can not accept " 368 msg += "a float number." 369 self.send_warnings(msg, 'error') 370 self._set_textctrl_color(self.numberctr, 'pink') 371 self.output = None 372 return flag 373 except: 374 msg = "DataOperation: Number requires a float number." 371 375 self.send_warnings(msg, 'error') 372 376 self._set_textctrl_color(self.numberctr, 'pink') 373 377 self.output = None 374 378 return flag 375 except: 376 msg = "DataOperation: Number requires a float number." 377 self.send_warnings(msg, 'error') 378 self._set_textctrl_color(self.numberctr, 'pink') 379 self.output = None 380 return flag 379 else: 380 self._set_textctrl_color(self.numberctr, self.color ) 381 381 elif data1.__class__.__name__ != data2.__class__.__name__: 382 382 self._set_textctrl_color(self.data1_cbox, 'pink') … … 697 697 pass 698 698 self.subplot.figure.canvas.resizing = False 699 self.subplot.set_xticks([0.0]) 700 self.subplot.set_yticks([0.0]) 699 self.subplot.tick_params(axis='both', labelsize=9) 701 700 # Draw zero axis lines 702 701 self.subplot.axhline(linewidth = 1, color='r')
Note: See TracChangeset
for help on using the changeset viewer.