Changeset caf3a08f in sasview for sansguiframe/src


Ignore:
Timestamp:
Sep 10, 2011 7:00:33 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:
83eb1b52
Parents:
06772f6
Message:

add functon to output result to excel

Location:
sansguiframe/src/sans/guiframe
Files:
2 edited

Legend:

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

    r850525c rcaf3a08f  
    655655        selection_sizer = wx.GridBagSizer(5,5) 
    656656        button_sizer = wx.BoxSizer(wx.HORIZONTAL) 
    657         text = "Open with SansView" 
     657        text = "Open with %s" % self.parent.application_name  
    658658        self.local_app_selected = wx.RadioButton(self, -1, text, 
    659659                                                style=wx.RB_GROUP) 
     
    664664        self.Bind(wx.EVT_RADIOBUTTON, self.onselect, 
    665665                    id=self.external_app_selected.GetId()) 
    666         text = "Save to file" 
     666        text = "Save to File" 
    667667        self.save_to_file = wx.CheckBox(self, -1, text) 
    668668        self.Bind(wx.EVT_CHECKBOX, self.onselect, 
     
    671671        self.external_app_selected.SetValue(False) 
    672672        self.save_to_file.SetValue(False) 
    673         button_OK = wx.Button(self, wx.ID_OK, "Ok") 
     673        button_close = wx.Button(self, wx.ID_OK, "Close") 
     674        button_OK = wx.Button(self, wx.ID_CANCEL, "Apply") 
    674675        button_OK.SetFocus() 
    675676        hint = "" 
     
    689690        #contruction the sizer contaning button 
    690691        button_sizer.Add((20, 20), 1, wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
     692 
     693        button_sizer.Add(button_close, 0, 
     694                        wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
    691695        button_sizer.Add(button_OK, 0, 
    692696                                wx.LEFT|wx.RIGHT|wx.ADJUST_MINSIZE, 10) 
  • sansguiframe/src/sans/guiframe/gui_manager.py

    r06772f6 rcaf3a08f  
    204204                    self.SetIcon(wx.Icon(ico_file, wx.BITMAP_TYPE_ICO)) 
    205205        self.path = PATH_APP 
     206        self.application_name = APPLICATION_NAME  
    206207        ## Application manager 
    207208        self._input_file = None 
     
    298299        ext = ".csv" 
    299300        file_name = "Batch_" + str(plugin_name)+ "_" + time_str + ext 
    300         #Neeed to save configuration for later  
     301        #Need to save configuration for later  
    301302        dlg = BatchOutputDialog(parent=self, data=data,  
    302303                                file_name=file_name, 
    303304                                details=details) 
    304305        flag = None 
    305         if dlg.ShowModal() == wx.ID_OK: 
     306        if dlg.ShowModal() == wx.ID_CANCEL: 
    306307            flag = dlg.flag 
     308            dlg.Show(True) 
     309        else: 
    307310            dlg.Destroy() 
    308311        if flag == 1: 
     
    310313            self.batch_frame.Show(True) 
    311314        elif flag == 2: 
     315            file_name = self._default_save_location + str(file_name) 
    312316            if not os.path.exists(file_name): 
    313317                self.write_batch_output(data=data, file_name=file_name, 
    314318                                               details=details) 
    315             self.deplay_in_external_app(data=data, file_name=file_name) 
     319            self.deplay_in_external_app(data=data, file_name=file_name, 
     320                                         plugin_name=plugin_name) 
    316321         
    317322    def write_batch_output(self, data, file_name, details=""): 
     
    352357        fd.close() 
    353358             
    354     def deplay_in_external_app(self, data, file_name): 
     359    def deplay_in_external_app(self, data, file_name, plugin_name): 
    355360        """ 
    356361        Display data in the another application , by default Excel 
    357362        """ 
     363        try: 
     364            from win32com.client import Dispatch 
     365            excel_app = Dispatch('Excel.Application')      
     366            wb = excel_app.Workbooks.Open(file_name)  
     367            excel_app.Visible = 1 
     368        except: 
     369            msg = "Error occured when calling Excel\n" 
     370            msg += "Check that Excel in installed in this machine or \n" 
     371            msg += "Check that %s really exists.\n" % str(file_name) 
     372            wx.PostEvent(self, StatusEvent(status=msg, 
     373                                             info="error")) 
     374             
    358375          
    359376    def on_batch_selection(self, event): 
Note: See TracChangeset for help on using the changeset viewer.