Changeset f5500b3 in sasview for calculatorview/src/sans
- Timestamp:
- Jun 21, 2012 5:59:54 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:
- 848913c
- Parents:
- 9e00363
- Location:
- calculatorview/src/sans/perspectives/calculator
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
calculatorview/src/sans/perspectives/calculator/data_operator.py
r9e00363 rf5500b3 113 113 self.equal_pic = SmallPanel(self, -1, True, '=', size=(50, _BOX_WIDTH), 114 114 style=wx.NO_BORDER) 115 self.data1_pic = SmallPanel(self, -1, True, size=(_BOX_WIDTH, _BOX_WIDTH), 115 self.data1_pic = SmallPanel(self, -1, True, 116 size=(_BOX_WIDTH, _BOX_WIDTH), 116 117 style=wx.NO_BORDER) 117 self.operator_pic = SmallPanel(self, -1, True, "+", size=(50, _BOX_WIDTH), 118 style=wx.NO_BORDER) 119 self.data2_pic = SmallPanel(self, -1, True, size=(_BOX_WIDTH, _BOX_WIDTH), 118 self.operator_pic = SmallPanel(self, -1, True, 119 '+', size=(50, _BOX_WIDTH), 120 style=wx.NO_BORDER) 121 self.data2_pic = SmallPanel(self, -1, True, 122 size=(_BOX_WIDTH, _BOX_WIDTH), 120 123 style=wx.NO_BORDER) 121 124 for ax in self.equal_pic.axes: … … 136 139 (self.operator_pic, 0, wx.LEFT, 3)]) 137 140 data2_hori_sizer.AddMany([(self.data2_cbox, 0, wx.LEFT, 0), 138 (self.numberctr, 0, wx. LEFT, 0)])141 (self.numberctr, 0, wx.RIGHT, 0)]) 139 142 old_data2_sizer.AddMany([(data2_name, 0, wx.LEFT, 3), 140 143 (data2_hori_sizer, 0, wx.LEFT, 3), … … 146 149 (old_data2_sizer, 0, wx.TOP, 5)]) 147 150 self.data2_cbox.Show(True) 148 self.numberctr.Hide() 151 if not ON_MAC: 152 self.numberctr.Show(False) 153 else: 154 self.numberctr.Disable() 149 155 wx.EVT_TEXT_ENTER(self.data_namectr, -1, self.on_name) 150 156 wx.EVT_TEXT_ENTER(self.numberctr, -1, self.on_number) … … 157 163 On data name typing 158 164 """ 165 if event != None: 166 event.Skip() 159 167 item = event.GetEventObject() 160 168 item.SetBackgroundColour('white') … … 188 196 On selecting Number for Data2 189 197 """ 198 if event != None: 199 event.Skip() 190 200 self.send_warnings('') 191 201 self.numberctr.SetBackgroundColour('white') … … 211 221 On select data1 212 222 """ 223 if event != None: 224 event.Skip() 213 225 self.send_warnings('') 214 226 item = event.GetEventObject() … … 229 241 On Select an Operator 230 242 """ 243 if event != None: 244 event.Skip() 231 245 self.send_warnings('') 232 246 item = event.GetEventObject() … … 242 256 On Selecting Data2 243 257 """ 258 if event != None: 259 event.Skip() 244 260 self.send_warnings('') 245 261 item = event.GetEventObject() 246 262 text = item.GetLabel().strip().lower() 247 self.numberctr.Show(text=='number') 263 if ON_MAC: 264 self.numberctr.Enable() 265 else: 266 self.numberctr.Show(text=='number') 267 248 268 pos = item.GetSelection() 249 269 data = item.GetClientData(pos) … … 296 316 self.output = None 297 317 return flag 298 if self.numberctr.IsShown() :318 if self.numberctr.IsShown() or (ON_MAC and self.numberctr.Enabled()): 299 319 self.numberctr.SetBackgroundColour('white') 300 320 try: … … 433 453 pos3 = self.data2_cbox.Append("Number") 434 454 val = None 435 if self.numberctr.IsShown(): 455 if self.numberctr.IsShown() or \ 456 (ON_MAC and self.numberctr.Enabled()): 436 457 try: 437 val = float(self.numberctr.Get Label())458 val = float(self.numberctr.GetValue()) 438 459 except: 439 460 val = None … … 446 467 self.data2_cbox.SetSelection(pos2) 447 468 self.data2_cbox.SetClientData(pos2, None) 448 pos3 = self.data2_cbox.Append( "Number")469 pos3 = self.data2_cbox.Append('Number') 449 470 val = None 450 if self.numberctr.IsShown(): 471 if self.numberctr.IsShown() or \ 472 (ON_MAC and self.numberctr.Enabled()): 451 473 try: 452 val = float(self.numberctr.Get Label())474 val = float(self.numberctr.GetValue()) 453 475 except: 454 476 val = None -
calculatorview/src/sans/perspectives/calculator/model_editor.py
r9e00363 rf5500b3 380 380 381 381 item = event.GetEventObject() 382 text = item.Get Label().strip()382 text = item.GetValue().strip() 383 383 if text == '+': 384 384 name = 'Sum' 385 385 factor = 'scale_factor' 386 386 f_oper = '*' 387 el se:387 elif text == '*': 388 388 name = 'Multi' 389 389 factor = 'BackGround' 390 390 f_oper = '+' 391 else: 392 raise 391 393 self.factor = str(factor) 392 self.operator = str(text) 393 self.explanation = " custom model = %s %s "% (self.factor, 394 f_oper) 395 self.explanation += "(model1 %s model2)\n"% self.operator 394 self.operator = text 395 self.explanation = " Custom Model = %s %s (model1 %s model2)\n"% \ 396 (self.factor, f_oper, self.operator) 396 397 self.explanationctr.SetLabel(self.explanation) 397 398 self.name = name + M_NAME
Note: See TracChangeset
for help on using the changeset viewer.