Ignore:
Timestamp:
Sep 12, 2011 10:18:19 AM (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:
dc79cfc
Parents:
caf3a08f
Message:

modify batch dialog to frame window

File:
1 edited

Legend:

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

    rcaf3a08f r83eb1b52  
    3838from sans.guiframe.gui_toolbar import GUIToolBar 
    3939from sans.guiframe.data_processor import GridFrame 
    40 from sans.guiframe.data_processor import BatchOutputDialog 
     40from sans.guiframe.data_processor import BatchOutputFrame 
    4141from sans.guiframe.events import EVT_NEW_BATCH 
    4242from sans.dataloader.loader import Loader 
     
    299299        ext = ".csv" 
    300300        file_name = "Batch_" + str(plugin_name)+ "_" + time_str + ext 
     301        file_name = self._default_save_location + str(file_name) 
    301302        #Need to save configuration for later  
    302         dlg = BatchOutputDialog(parent=self, data=data,  
     303        frame = BatchOutputFrame(parent=self, data=data,  
    303304                                file_name=file_name, 
    304305                                details=details) 
    305         flag = None 
    306         if dlg.ShowModal() == wx.ID_CANCEL: 
    307             flag = dlg.flag 
    308             dlg.Show(True) 
    309         else: 
    310             dlg.Destroy() 
    311         if flag == 1: 
    312             self.batch_frame.set_data(data) 
    313             self.batch_frame.Show(True) 
    314         elif flag == 2: 
    315             file_name = self._default_save_location + str(file_name) 
    316             if not os.path.exists(file_name): 
    317                 self.write_batch_output(data=data, file_name=file_name, 
    318                                                details=details) 
    319             self.deplay_in_external_app(data=data, file_name=file_name, 
    320                                          plugin_name=plugin_name) 
    321          
    322     def write_batch_output(self, data, file_name, details=""): 
     306        frame.Show(True) 
     307     
     308    def open_with_localapp(self, data): 
     309        """ 
     310        Display value of data into the application grid 
     311        :param data: dictionary of string and list of items 
     312        """ 
     313        self.batch_frame.set_data(data) 
     314        self.batch_frame.Show(True) 
     315         
     316    def write_batch_tofile(self, data, file_name, details=""): 
    323317        """ 
    324318        Helper to write result from batch into cvs file 
    325319        """ 
    326          
     320        self._default_save_location = os.path.dirname(file_name) 
     321        file_name = os.path.basename(file_name) 
    327322        if data is None or file_name is None or file_name.strip() == "": 
    328323            return 
     
    357352        fd.close() 
    358353             
    359     def deplay_in_external_app(self, data, file_name, plugin_name): 
     354    def open_with_externalapp(self, data, file_name, details=""): 
    360355        """ 
    361356        Display data in the another application , by default Excel 
    362357        """ 
     358        if not os.path.exists(file_name): 
     359            self.write_batch_tofile(data=data, file_name=file_name, 
     360                                               details=details) 
    363361        try: 
    364362            from win32com.client import Dispatch 
Note: See TracChangeset for help on using the changeset viewer.