Changeset 4c01978 in sasview


Ignore:
Timestamp:
Mar 25, 2011 11:09:31 AM (14 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:
fcc5680
Parents:
d18e208
Message:

add new menu item to load project and load application

Location:
guiframe
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • guiframe/config.py

    r957723f r4c01978  
    4646#PLUGIN_STATE_EXTENSIONS = ['.prv','.fitv', '.inv'] 
    4747#APPLICATION_STATE_EXTENSION = '.svs' 
    48 #WLIST = ['SansView files (*.svs)|*.svs','P(r) files (*.prv)|*.prv', 
     48#PLUGINS_WLIST = ['P(r) files (*.prv)|*.prv', 
    4949#                  'Fitting files (*.fitv)|*.fitv', 
    5050#                  'Invariant files (*.inv)|*.inv'] 
    51  
     51#APPLICATION_WLIST = 'SansView files (*.svs)|*.svs' 
     52APPLICATION_WLIST = '' 
     53APPLICATION_STATE_EXTENSION = None 
     54PLUGINS_WLIST = [] 
    5255PLUGIN_STATE_EXTENSIONS = [] 
    53 APPLICATION_STATE_EXTENSION = None 
    54 WLIST = [] 
    5556SPLASH_SCREEN_PATH = "images/danse_logo.png"      
    5657DEFAULT_STYLE = GUIFRAME.SINGLE_APPLICATION 
  • guiframe/gui_manager.py

    rd18e208 r4c01978  
    5353#read some constants from config 
    5454APPLICATION_STATE_EXTENSION = config.APPLICATION_STATE_EXTENSION 
    55  
    5655APPLICATION_NAME = config.__appname__ 
    5756SPLASH_SCREEN_PATH = config.SPLASH_SCREEN_PATH 
     
    7069EXTENSIONS = PLUGIN_STATE_EXTENSIONS + extension_list 
    7170try: 
    72     WLIST = '|'.join(config.WLIST) 
     71    PLUGINS_WLIST = '|'.join(config.PLUGINS_WLIST) 
    7372except: 
    74     WLIST = '' 
    75  
     73    PLUGINS_WLIST = '' 
     74APPLICATION_WLIST = config.APPLICATION_WLIST 
    7675 
    7776class ViewerFrame(wx.Frame): 
     
    798797        self._file_menu = wx.Menu() 
    799798        style = self.__gui_style & GUIFRAME.DATALOADER_ON 
     799        style1 = self.__gui_style & GUIFRAME.MULTIPLE_APPLICATIONS 
    800800        if style == GUIFRAME.DATALOADER_ON: 
    801             # some menu of plugin to be seen under file menu 
    802             hint_load_file = "Read state's files and load" 
    803             hint_load_file += " them into the application" 
     801            if style1 == GUIFRAME.MULTIPLE_APPLICATIONS: 
     802                # some menu of plugin to be seen under file menu 
     803                hint_load_file = "Read state's files and load" 
     804                hint_load_file += " them into the application" 
     805                id = wx.NewId() 
     806                self._save_appl_menu = self._file_menu.Append(id,  
     807                                        '&Load Application', hint_load_file) 
     808                wx.EVT_MENU(self, id, self._on_open_state_application) 
     809                 
    804810            id = wx.NewId() 
     811            hint_load_file = "read all applications states save previously" 
    805812            self._save_appl_menu = self._file_menu.Append(id,  
    806                                     '&Open State from File', hint_load_file) 
    807             wx.EVT_MENU(self, id, self._on_open_state) 
    808             id = wx.NewId() 
    809             self._save_appl_menu = self._file_menu.Append(id,  
     813                                    '&Load Project', hint_load_file) 
     814            wx.EVT_MENU(self, id, self._on_open_state_project) 
     815            
     816            if style1 == GUIFRAME.MULTIPLE_APPLICATIONS: 
     817                self._file_menu.AppendSeparator() 
     818                id = wx.NewId() 
     819                self._save_appl_menu = self._file_menu.Append(id,  
    810820                                                          '&Save Application', 
    811821                                 'Save state of the current active application') 
    812             wx.EVT_MENU(self, id, self._on_save_application) 
     822                wx.EVT_MENU(self, id, self._on_save_application) 
    813823            id = wx.NewId() 
    814824            self._file_menu.Append(id, '&Save Project', 
     
    10691079            print error_message 
    10701080            
    1071              
    1072     def _on_open_state(self, event): 
     1081       
     1082    def _on_open_state_application(self, event): 
    10731083        """ 
    10741084        """ 
     
    10801090                            "Choose a file",  
    10811091                            self._default_save_location, "", 
    1082                              WLIST) 
     1092                             PLUGINS_WLIST) 
     1093        if dlg.ShowModal() == wx.ID_OK: 
     1094            path = dlg.GetPath() 
     1095            if path is not None: 
     1096                self._default_save_location = os.path.dirname(path) 
     1097        dlg.Destroy() 
     1098        self.load_state(path=path)   
     1099             
     1100    def _on_open_state_project(self, event): 
     1101        """ 
     1102        """ 
     1103        path = None 
     1104        if self._default_save_location == None: 
     1105            self._default_save_location = os.getcwd() 
     1106  
     1107        dlg = wx.FileDialog(self,  
     1108                            "Choose a file",  
     1109                            self._default_save_location, "", 
     1110                             APPLICATION_WLIST) 
    10831111        if dlg.ShowModal() == wx.ID_OK: 
    10841112            path = dlg.GetPath() 
Note: See TracChangeset for help on using the changeset viewer.