Changeset 00c3aac in sasview for sansview/perspectives/fitting
- Timestamp:
- Mar 27, 2009 5:27:12 PM (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:
- ff54ce7
- Parents:
- 872785f
- Location:
- sansview/perspectives/fitting
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sansview/perspectives/fitting/basepage.py
r4e6b5939 r00c3aac 72 72 ## drawing Initial dispersion parameters sizer 73 73 self.set_dispers_sizer() 74 self._fill_save_sizer() 74 75 ## layout 75 76 self.set_layout() … … 267 268 return 268 269 269 270 270 def onSave(self, event): 271 """ 272 save history of the data and model 273 """ 274 self.page_info.model= self.model 275 self.page_info.data = self.data 276 import os 277 278 279 path = None 280 dlg = wx.FileDialog(self, "Choose a file", os.getcwd(), "", "*.txt", wx.SAVE) 281 if dlg.ShowModal() == wx.ID_OK: 282 path = dlg.GetPath() 283 mypath = os.path.basename(path) 284 285 dlg.Destroy() 286 287 if not path == None: 288 out = open(path, 'w') 289 has_data = self.data !=None 290 has_model = self.model!=None 291 import time 292 year, month, day,hour,minute,second,tda,ty,tm_isdst= time.gmtime() 293 import os.path 294 out.write("Title: State for %s\n"%os.path.basename(path)) 295 out.write("Date: %g\%g\%g \n"%(year, month, day)) 296 out.write("GMT Time: %g:%g:%g \n\n"%(hour,minute, second)) 297 # Sanity check 298 if has_data: 299 out.write("Fit Data name: %s\n\n"%self.data.name) 300 301 if has_model: 302 out.write("Model name: %s\n"%self.model.name) 303 if len(self.parameters)>0: 304 out.write("Parameters Info:\n") 305 msg= "Name\t\tValues\t\t+\-\tErrors\t\tMin\t\tMax\t\tUnits\t\tstate\n" 306 out.write(msg) 307 ##self.parameters= 308 ##[cb state, name, value, "+/-", error of fit, min, max , units] 309 for item in self.parameters: 310 if item[1]!=None: 311 name= item[1] 312 else: 313 name="" 314 if item[2]!=None: 315 value= str(item[2].GetValue().rstrip().lstrip()) 316 else: 317 value="" 318 if item[3]!=None: 319 sign= str(item[3].GetLabelText().rstrip().lstrip()) 320 else: 321 sign="" 322 if item[4]!=None: 323 error= str(item[4].GetValue().rstrip().lstrip()) 324 else: 325 error="" 326 if item[5]!=None: 327 min= str(item[5].GetValue().rstrip().lstrip()) 328 else: 329 min="" 330 if item[6]!=None: 331 max= str(item[6].GetValue().rstrip().lstrip()) 332 else: 333 max="" 334 if item[7]!=None: 335 unit= str(item[7].GetLabelText().rstrip().lstrip()) 336 else: 337 unit="" 338 if item[0]!=None: 339 if item[0].GetValue(): 340 state= "Fitted" 341 else: 342 state= "Not Fitted" 343 else: 344 state="Not Fitted" 345 346 msg= "%s\t\t%s\t\t%s\t%s\t\t%s\t\t%s\t\t%s\t\t%s\n"\ 347 %(name,value,sign,error,min,max,unit,state) 348 out.write(msg) 349 350 351 out.close() 352 353 271 354 272 355 def read_file(self, path): … … 301 384 raise 302 385 303 386 304 387 def _selectDlg(self): 305 388 """ … … 860 943 self.SetScrollbars(20,20,200,100) 861 944 945 def _fill_save_sizer(self): 946 """ 947 Draw the layout for saving option 948 """ 949 self.sizer6.Clear(True) 950 box_description= wx.StaticBox(self, -1,"Save Options") 951 boxsizer1 = wx.StaticBoxSizer(box_description, wx.VERTICAL) 952 sizer_save = wx.BoxSizer(wx.HORIZONTAL) 953 954 self.btSave = wx.Button(self,wx.NewId(),'Save') 955 self.btSave.Bind(wx.EVT_BUTTON, self.onSave,id= self.btSave.GetId()) 956 self.btSave.SetToolTipString("Save current state") 957 958 sizer_save.Add((20,20),0, wx.LEFT|wx.RIGHT|wx.EXPAND,120) 959 sizer_save.Add(self.btSave) 960 961 boxsizer1.Add(sizer_save) 962 self.sizer6.Add(boxsizer1,0, wx.EXPAND | wx.ALL, 10) 963 self.sizer6.Layout() 964 self.SetScrollbars(20,20,200,100) 965 862 966 863 967 -
sansview/perspectives/fitting/fitpanel.py
r1d2782d r00c3aac 6 6 #import models 7 7 _BOX_WIDTH = 80 8 (FitPageEvent, EVT_FIT_PAGE) = wx.lib.newevent.NewEvent() 8 9 9 (FitPageEvent, EVT_FIT_PAGE) = wx.lib.newevent.NewEvent()10 10 class FitPanel(wx.aui.AuiNotebook): 11 11 … … 40 40 #dictionary of miodel {model class name, model class} 41 41 self.model_list_box={} 42 42 ##dictionary of page info 43 self.page_info_dict={} 43 44 # save the title of the last page tab added 44 45 self.fit_page_name=[]
Note: See TracChangeset
for help on using the changeset viewer.