Changeset 96d293da in sasview for src/sas/sasgui/perspectives/corfunc/corfunc_panel.py
- Timestamp:
- Aug 24, 2016 11:15:28 AM (8 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, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- d45d590
- Parents:
- 5a525e1
- git-author:
- Lewis O'Driscoll <lewis.o'driscoll@…> (08/24/16 10:59:41)
- git-committer:
- Lewis O'Driscoll <lewis.o'driscoll@…> (08/24/16 11:15:28)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/corfunc/corfunc_panel.py
r204f628 r96d293da 1 1 import wx 2 2 import sys 3 import os 3 4 import numpy as np 4 5 from wx.lib.scrolledpanel import ScrolledPanel 5 6 from sas.sasgui.guiframe.events import PlotQrangeEvent 6 7 from sas.sasgui.guiframe.events import StatusEvent 8 from sas.sasgui.guiframe.events import PanelOnFocusEvent 7 9 from sas.sasgui.guiframe.panel_base import PanelBase 8 10 from sas.sasgui.guiframe.utils import check_float … … 299 301 doc_viewer = DocumentationWindow(self, -1, tree_location, "", 300 302 "Correlation Function Help") 303 304 def get_save_flag(self): 305 if self._data is not None: 306 return True 307 return False 308 309 def on_set_focus(self, event=None): 310 if self._manager.parent is not None: 311 wx.PostEvent(self._manager.parent, PanelOnFocusEvent(panel=self)) 312 313 def on_save(self, event=None): 314 """ 315 Save corfunc state into a file 316 """ 317 # Ask the user the location of the file to write to. 318 path = None 319 default_save_location = os.getcwd() 320 if self._manager.parent != None: 321 default_save_location = self._manager.parent.get_save_location() 322 323 dlg = wx.FileDialog(self, "Choose a file", 324 default_save_location, \ 325 self.window_caption, "*.cor", wx.SAVE) 326 if dlg.ShowModal() == wx.ID_OK: 327 path = dlg.GetPath() 328 default_save_location = os.path.dirname(path) 329 if self._manager.parent != None: 330 self._manager.parent._default_save_location = default_save_location 331 else: 332 return None 333 334 dlg.Destroy() 335 # MAC always needs the extension for saving 336 extens = ".cor" 337 # Make sure the ext included in the file name 338 f_name = os.path.splitext(path)[0] + extens 339 self._manager.state_reader.write(f_name, self._data, self.get_state()) 301 340 302 341 def save_project(self, doc=None):
Note: See TracChangeset
for help on using the changeset viewer.