Changeset 2e3f9e3 in sasview
- Timestamp:
- Apr 25, 2011 1:06:01 PM (14 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:
- 6f28e70
- Parents:
- fd224fd
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
guiframe/gui_manager.py
r5342eb8 r2e3f9e3 1341 1341 reader, ext = self._current_perspective.get_extensions() 1342 1342 path = None 1343 extension = '*' + APPLICATION_STATE_EXTENSION 1343 1344 dlg = wx.FileDialog(self, "Save Project file", 1344 1345 self._default_save_location, "", 1345 APPLICATION_STATE_EXTENSION,1346 extension, 1346 1347 wx.SAVE) 1347 1348 if dlg.ShowModal() == wx.ID_OK: … … 1358 1359 doc = self.on_save_helper(doc, reader, panel, path) 1359 1360 1360 1361 def on_save_helper(self, doc, reader, panel, path):1362 """1363 Save state into a file1364 """1365 try:1366 data = panel.get_data()1367 state = panel.get_state()1368 1369 if reader is not None:1370 if data is not None:1371 new_doc = reader.write_toXML(data, state)1372 if hasattr(doc, "firstChild"):1373 child = new_doc.firstChild.firstChild1374 doc.firstChild.appendChild(child)1375 else:1376 doc = new_doc1377 except:1378 raise1379 #pass1380 1361 # Write the XML document 1381 1362 if doc != None: … … 1386 1367 msg = "%s cannot read %s\n" % (str(APPLICATION_NAME), str(path)) 1387 1368 #raise RuntimeError, msg 1369 1370 def on_save_helper(self, doc, reader, panel, path): 1371 """ 1372 Save state into a file 1373 """ 1374 try: 1375 if reader is not None: 1376 # case of a panel with multi-pages 1377 if hasattr(panel, "opened_pages"): 1378 for uid, page in panel.opened_pages.iteritems(): 1379 data = page.get_data() 1380 # state must be cloned 1381 state = page.get_state().clone() 1382 if data is not None: 1383 new_doc = reader.write_toXML(data, state) 1384 if doc != None and hasattr(doc, "firstChild"): 1385 child = new_doc.firstChild.firstChild 1386 doc.firstChild.appendChild(child) 1387 else: 1388 doc = new_doc 1389 # case of only a panel 1390 else: 1391 data = panel.get_data() 1392 state = panel.get_state() 1393 if data is not None: 1394 new_doc = reader.write_toXML(data, state) 1395 if doc != None and hasattr(doc, "firstChild"): 1396 child = new_doc.firstChild.firstChild 1397 doc.firstChild.appendChild(child) 1398 else: 1399 doc = new_doc 1400 except: 1401 raise 1402 #pass 1403 1388 1404 return doc 1389 1405
Note: See TracChangeset
for help on using the changeset viewer.