Changeset b28717b in sasview for sansview/perspectives
- Timestamp:
- Mar 26, 2009 11:18:19 AM (16 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:
- 8bd4dc0
- Parents:
- 2549c1b
- Location:
- sansview/perspectives/fitting
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sansview/perspectives/fitting/fitpanel.py
r2140e68 rb28717b 125 125 """ 126 126 from simfitpage import SimultaneousFitPage 127 self.sim_page = SimultaneousFitPage(self, id=-1) 127 page_finder= self.manager.get_page_finder() 128 self.sim_page = SimultaneousFitPage(self,page_finder=page_finder, id=-1) 129 128 130 self.AddPage(self.sim_page,caption="Simultaneous Fit",select=True) 129 131 self.sim_page.set_manager(self.manager) -
sansview/perspectives/fitting/fitting.py
r2140e68 rb28717b 126 126 127 127 self.sim_page= self.fit_panel.add_sim_page() 128 self.sim_page.draw_page(self.page_finder)128 129 129 130 130 … … 787 787 788 788 if self.sim_page!=None: 789 self.sim_page.draw_page( self.page_finder)789 self.sim_page.draw_page() 790 790 791 791 -
sansview/perspectives/fitting/simfitpage.py
r2549c1b rb28717b 48 48 self.parent = parent 49 49 ## store page_finder 50 self.page_finder =page_finder50 self.page_finder = page_finder 51 51 ## list contaning info to set constraint 52 52 ## look like self.constraint_dict[page]=FitConstraint(model, page) … … 58 58 ## selected mdoel to fit 59 59 self.model_toFit=[] 60 ## draw 60 ## number of constraint 61 self.nb_constraint= 0 62 ## draw page 61 63 self.define_page_structure() 62 self.draw_page(self.page_finder) 63 64 self.draw_page() 64 65 self.set_layout() 65 66 … … 117 118 """ 118 119 self.manager = manager 119 self.draw_page( self.manager.page_finder) 120 120 121 121 122 122 def check_all_model_name(self,event): … … 135 135 ## display constraint fields 136 136 if self.show_constraint.GetValue(): 137 self._hide_constraint()138 137 self._show_constraint() 139 138 return … … 162 161 self.model_toFit.remove(item) 163 162 self.cb1.SetValue(False) 163 164 164 ## display constraint fields 165 if len(self.model_toFit) >=2 and len(self.model_list)==len(self.model_toFit):165 if len(self.model_toFit)==2: 166 166 self._store_model() 167 if self.show_constraint.GetValue(): 168 self._hide_constraint() 167 if self.show_constraint.GetValue() and len(self.constraints_list)==0: 169 168 self._show_constraint() 170 169 elif len(self.model_toFit)< 2: 170 ##constraint info 171 self._hide_constraint() 171 172 172 173 ## set the value of the main check button 173 174 if len(self.model_list)==len(self.model_toFit): 174 175 self.cb1.SetValue(True) 175 ## constraint info 176 self._store_model() 177 ## display constraint fields 178 if self.show_constraint.GetValue(): 179 self._hide_constraint() 180 self._show_constraint() 181 return 176 return 182 177 else: 183 178 self.cb1.SetValue(False) 184 if len(self.model_toFit)>=2: 185 self._store_model() 186 if self.show_constraint.GetValue(): 187 self._show_constraint() 188 return 189 ##constraint info 190 self._hide_constraint() 179 191 180 192 181 193 def draw_page(self , page_finder={}):182 def draw_page(self): 194 183 """ 195 184 Draw a sizer containing couples of data and model 196 """ 197 ## receive a new page_finder 198 self.page_finder = page_finder 199 185 """ 186 200 187 self.model_list=[] 201 188 self.model_toFit=[] … … 266 253 return 267 254 if self.show_constraint.GetValue(): 268 self._hide_constraint()269 255 self._show_constraint() 270 256 return … … 287 273 msg += "Parameters name reached %s"%str(nb_fit_param) 288 274 wx.PostEvent(self.parent.Parent, StatusEvent(status= msg )) 289 self.sizer_co uples.Layout()275 self.sizer_constraints.Layout() 290 276 self.sizer2.Layout() 291 277 self.SetScrollbars(20,20,200,100) … … 295 281 msg= "Select at least 2 model to add constraint " 296 282 wx.PostEvent(self.parent.Parent, StatusEvent(status= msg )) 297 self.sizer_co uples.Layout()283 self.sizer_constraints.Layout() 298 284 self.sizer2.Layout() 299 285 self.SetScrollbars(20,20,200,100) … … 306 292 307 293 param_cbox = wx.ComboBox(self, -1) 294 param_cbox.Hide() 308 295 wx.EVT_COMBOBOX(param_cbox,-1, self._on_select_param) 309 296 … … 325 312 self.constraints_list.append([model_cbox, param_cbox, egal_txt, ctl2]) 326 313 327 sizer_constraint.Add(model_cbox )328 sizer_constraint.Add( (10,10))329 sizer_constraint.Add( param_cbox)330 sizer_constraint.Add( egal_txt)331 sizer_constraint.Add(ctl2)332 s izer_constraint.Add((10,10))333 334 335 self.sizer_couples.Add(sizer_constraint)336 self. sizer_couples.Add((10,10))337 self.sizer_co uples.Layout()314 sizer_constraint.Add(model_cbox, flag= wx.RIGHT|wx.EXPAND,border=10) 315 sizer_constraint.Add(param_cbox, flag= wx.RIGHT|wx.EXPAND,border=5) 316 sizer_constraint.Add(egal_txt, flag= wx.RIGHT|wx.EXPAND,border=5) 317 sizer_constraint.Add(ctl2, flag= wx.RIGHT|wx.EXPAND,border=10) 318 319 self.sizer_constraints.Insert(before=self.nb_constraint, 320 item=sizer_constraint, flag= wx.TOP|wx.BOTTOM|wx.EXPAND, 321 border=5, userData=0) 322 323 self.nb_constraint += 1 324 self.sizer_constraints.Layout() 338 325 self.sizer2.Layout() 339 326 self.SetScrollbars(20,20,200,100) … … 345 332 if len(self.constraint_dict)>0: 346 333 for item in self.constraints_list: 347 model = item[0].GetClientData( 0)334 model = item[0].GetClientData(item[0].GetCurrentSelection()) 348 335 if model in self.constraint_dict.keys(): 349 336 page = self.constraint_dict[model].page 350 337 self.page_finder[page].clear_model_param() 351 338 339 self.nb_constraint =0 352 340 self.constraint_dict={} 353 341 self._store_model() 354 self.btAdd.Hide()342 355 343 self.constraints_list=[] 356 self.sizer_co uples.Clear(True)357 self.sizer_co uples.Layout()344 self.sizer_constraints.Clear(True) 345 self.sizer_constraints.Layout() 358 346 self.sizer2.Layout() 359 347 self.SetScrollbars(20,20,200,100) … … 401 389 ctl2.Show(True) 402 390 403 self.btAdd.Show(True)391 404 392 self.sizer2.Layout() 405 393 self.SetScrollbars(20,20,200,100) … … 428 416 ctl2 = item[3] 429 417 if ctl2.GetValue().lstrip().rstrip()=="": 430 msg= " Enter a constraint for %s.%s! "%(param_cbox.GetClientData(0).name,431 432 433 418 model= param_cbox.GetClientData(param_cbox.GetCurrentSelection()) 419 msg= " Enter a constraint for %s.%s! "%(model.name,param_cbox.GetString(0)) 420 wx.PostEvent(self.parent.Parent, StatusEvent(status= msg )) 421 return 434 422 435 423 ## some model or parameters can be constrained … … 452 440 boxsizer1 = wx.StaticBoxSizer(box_description, wx.VERTICAL) 453 441 sizer_title = wx.BoxSizer(wx.HORIZONTAL) 454 self.sizer_co uples = wx.BoxSizer(wx.VERTICAL)442 self.sizer_constraints = wx.BoxSizer(wx.VERTICAL) 455 443 sizer_button = wx.BoxSizer(wx.HORIZONTAL) 456 444 … … 477 465 self.btAdd.Bind(wx.EVT_BUTTON, self._onAdd_constraint,id= self.btAdd.GetId()) 478 466 self.btAdd.SetToolTipString("Add another constraint?") 479 self.btAdd.Hide()467 480 468 481 469 self.btFit = wx.Button(self,wx.NewId(),'Fit') … … 490 478 boxsizer1.Add(sizer_title) 491 479 boxsizer1.Add((10,10)) 492 boxsizer1.Add(self.sizer_co uples)480 boxsizer1.Add(self.sizer_constraints) 493 481 boxsizer1.Add((10,10)) 494 482 boxsizer1.Add(sizer_button)
Note: See TracChangeset
for help on using the changeset viewer.