Ignore:
Timestamp:
Sep 9, 2011 5:24:12 PM (13 years ago)
Author:
Gervaise Alina <gervyh@…>
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:
06772f6
Parents:
6446f87
Message:

working data processor

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sansguiframe/src/sans/guiframe/data_processor.py

    r73197d0 r850525c  
    66import math 
    77import re 
     8import os 
    89import sys 
    910import copy 
     
    625626    Allow to select where the result of batch will be displayed or stored 
    626627    """ 
    627     def __init__(self, parent=None, data=None, *args, **kwds): 
     628    def __init__(self, parent=None, data=None, file_name="", 
     629                 details="", *args, **kwds): 
    628630        """ 
    629631        :param parent: Window instantiating this dialog 
     
    631633                application. 
    632634        """ 
    633         kwds['style'] = wx.CAPTION|wx.SYSTEM_MENU  
     635        #kwds['style'] = wx.CAPTION|wx.SYSTEM_MENU  
    634636        wx.Dialog.__init__(self, parent, *args, **kwds) 
    635637        self.parent = parent 
     638        self.file_name = file_name 
     639        self.details = details 
    636640        self.data = data 
    637641        self.flag = 1 
     
    667671        self.external_app_selected.SetValue(False) 
    668672        self.save_to_file.SetValue(False) 
    669    
    670673        button_OK = wx.Button(self, wx.ID_OK, "Ok") 
    671674        button_OK.SetFocus() 
     
    700703        """ 
    701704        if self.save_to_file.GetValue(): 
    702             self.flag = 3 
    703             if self.parent is not None and  self.data is not None: 
    704                 self.parent.save_batch_into_file(self.data) 
    705         elif self.local_app_selected.GetValue(): 
     705            reader, ext = os.path.splitext(self.file_name) 
     706            path = None 
     707            location = os.getcwd() 
     708            if self.parent is not None:  
     709                location = self.parent._default_save_location 
     710                dlg = wx.FileDialog(self, "Save Project file", 
     711                            location, self.file_name, ext, wx.SAVE) 
     712                path = None 
     713                if dlg.ShowModal() == wx.ID_OK: 
     714                    path = dlg.GetPath() 
     715                    if self.parent is not None: 
     716                        self.parent._default_save_location = os.path.dirname(path) 
     717                dlg.Destroy() 
     718                if path != None: 
     719                    if self.parent is not None and  self.data is not None: 
     720                        self.parent.write_batch_output(data=self.data,  
     721                                               file_name=path, 
     722                                               details=self.details) 
     723         
     724        if self.local_app_selected.GetValue(): 
    706725            self.flag = 1 
    707726        else: 
    708727            self.flag = 2 
    709728        return self.flag 
     729     
     730    def save_file(self): 
     731        """ 
     732        Save inot file 
     733        """ 
     734         
    710735     
    711736   
Note: See TracChangeset for help on using the changeset viewer.