Changeset 78f75d02 in sasview


Ignore:
Timestamp:
Jul 2, 2015 11:32:45 AM (9 years ago)
Author:
Doucet, Mathieu <doucetm@…>
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:
d06c34c
Parents:
f21d496
Message:

Minor cleanup

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sasview/sasview.py

    rf21d496 r78f75d02  
    9191APP_NAME = 'SasView' 
    9292 
    93 class SasViewApp(gui_manager.ViewApp): 
    94     """ 
    95     """ 
    96    
    97  
    9893class SasView(): 
    9994    """ 
     
    10499        """ 
    105100        #from gui_manager import ViewApp 
    106         self.gui = SasViewApp(0) 
     101        self.gui = gui_manager.SasViewApp(0) 
    107102        # Set the application manager for the GUI 
    108103        self.gui.set_manager(self) 
  • src/sas/guiframe/gui_manager.py

    rf21d496 r78f75d02  
    231231        Initialize the Frame object 
    232232        """ 
    233  
    234233        PARENT_FRAME.__init__(self, parent=parent, title=title, pos=pos, size=size) 
    235234        # title 
     
    360359                    frame.SetIcon(icon) 
    361360                except: 
    362                     pass 
     361                    logging.error("ViewerFrame.put_icon: could not set icon") 
    363362 
    364363    def get_client_size(self): 
     
    748747            self._toolbar.Realize() 
    749748 
    750  
    751749    def build_gui(self): 
    752750        """ 
     
    774772        # Append item from plugin under menu file if necessary 
    775773        self._populate_file_menu() 
    776  
    777774 
    778775        if not wx.VERSION_STRING >= '3.0.0.0': 
     
    14941491                for item in plugin.populate_file_menu(): 
    14951492                    m_name, m_hint, m_handler = item 
    1496                     id = wx.NewId() 
    1497                     self._file_menu.Append(id, m_name, m_hint) 
    1498                     wx.EVT_MENU(self, id, m_handler) 
     1493                    wx_id = wx.NewId() 
     1494                    self._file_menu.Append(wx_id, m_name, m_hint) 
     1495                    wx.EVT_MENU(self, wx_id, m_handler) 
    14991496                self._file_menu.AppendSeparator() 
    15001497 
    15011498        style1 = self.__gui_style & GUIFRAME.MULTIPLE_APPLICATIONS 
    15021499        if OPEN_SAVE_MENU: 
    1503             id = wx.NewId() 
     1500            wx_id = wx.NewId() 
    15041501            hint_load_file = "read all analysis states saved previously" 
    1505             self._save_appl_menu = self._file_menu.Append(id, '&Open Project', hint_load_file) 
    1506             wx.EVT_MENU(self, id, self._on_open_state_project) 
     1502            self._save_appl_menu = self._file_menu.Append(wx_id, '&Open Project', hint_load_file) 
     1503            wx.EVT_MENU(self, wx_id, self._on_open_state_project) 
    15071504 
    15081505        if style1 == GUIFRAME.MULTIPLE_APPLICATIONS: 
     
    15101507            hint_load_file = "Read a status files and load" 
    15111508            hint_load_file += " them into the analysis" 
    1512             id = wx.NewId() 
    1513             self._save_appl_menu = self._file_menu.Append(id, 
     1509            wx_id = wx.NewId() 
     1510            self._save_appl_menu = self._file_menu.Append(wx_id, 
    15141511                                                          '&Open Analysis', hint_load_file) 
    1515             wx.EVT_MENU(self, id, self._on_open_state_application) 
     1512            wx.EVT_MENU(self, wx_id, self._on_open_state_application) 
    15161513        if OPEN_SAVE_MENU: 
    15171514            self._file_menu.AppendSeparator() 
    1518             id = wx.NewId() 
    1519             self._file_menu.Append(id, '&Save Project', 
     1515            wx_id = wx.NewId() 
     1516            self._file_menu.Append(wx_id, '&Save Project', 
    15201517                                   'Save the state of the whole analysis') 
    1521             wx.EVT_MENU(self, id, self._on_save_project) 
     1518            wx.EVT_MENU(self, wx_id, self._on_save_project) 
    15221519        if style1 == GUIFRAME.MULTIPLE_APPLICATIONS: 
    1523             id = wx.NewId() 
    1524             self._save_appl_menu = self._file_menu.Append(id, \ 
     1520            wx_id = wx.NewId() 
     1521            self._save_appl_menu = self._file_menu.Append(wx_id, \ 
    15251522                '&Save Analysis', 'Save state of the current active analysis panel') 
    1526             wx.EVT_MENU(self, id, self._on_save_application) 
     1523            wx.EVT_MENU(self, wx_id, self._on_save_application) 
    15271524        if not sys.platform == 'darwin': 
    15281525            self._file_menu.AppendSeparator() 
    1529             id = wx.NewId() 
    1530             self._file_menu.Append(id, '&Quit', 'Exit') 
    1531             wx.EVT_MENU(self, id, self.Close) 
     1526            wx_id = wx.NewId() 
     1527            self._file_menu.Append(wx_id, '&Quit', 'Exit') 
     1528            wx.EVT_MENU(self, wx_id, self.Close) 
    15321529 
    15331530    def _add_menu_file(self): 
     
    17001697        """ 
    17011698        """ 
    1702         message = "" 
    17031699        log_msg = '' 
    1704         output = [] 
    1705         error_message = "" 
    17061700        basename = os.path.basename(path) 
    1707         root, extension = os.path.splitext(basename) 
     1701        _, extension = os.path.splitext(basename) 
    17081702        if extension.lower() not in EXTENSIONS: 
    17091703            log_msg = "File Loader cannot " 
     
    23712365            total_plot_list.append(theory_data) 
    23722366        for new_plot in total_plot_list: 
    2373             id = new_plot.id 
    23742367            for group_id in new_plot.list_group_id: 
    2375                 wx.PostEvent(self, NewPlotEvent(id=id, 
     2368                wx.PostEvent(self, NewPlotEvent(id=new_plot.id, 
    23762369                                                group_id=group_id, 
    23772370                                                action='remove')) 
    23782371                #remove res plot: Todo: improve 
    2379                 wx.CallAfter(self._remove_res_plot, id) 
     2372                wx.CallAfter(self._remove_res_plot, new_plot.id) 
    23802373        self._data_manager.delete_data(data_id=data_id, 
    23812374                                       theory_id=theory_id) 
     
    24122405            ext_num = dlg.GetFilterIndex() 
    24132406            if ext_num == 0: 
    2414                 format = '.txt' 
     2407                ext_format = '.txt' 
    24152408            else: 
    2416                 format = '.xml' 
    2417             path = os.path.splitext(path)[0] + format 
     2409                ext_format = '.xml' 
     2410            path = os.path.splitext(path)[0] + ext_format 
    24182411            mypath = os.path.basename(path) 
    24192412 
    24202413            #Instantiate a loader 
    24212414            loader = Loader() 
    2422             format = ".txt" 
    2423             if os.path.splitext(mypath)[1].lower() == format: 
     2415            ext_format = ".txt" 
     2416            if os.path.splitext(mypath)[1].lower() == ext_format: 
    24242417                # Make sure the ext included in the file name 
    24252418                # especially on MAC 
    2426                 fName = os.path.splitext(path)[0] + format 
     2419                fName = os.path.splitext(path)[0] + ext_format 
    24272420                self._onsaveTXT(data, fName) 
    2428             format = ".xml" 
    2429             if os.path.splitext(mypath)[1].lower() == format: 
     2421            ext_format = ".xml" 
     2422            if os.path.splitext(mypath)[1].lower() == ext_format: 
    24302423                # Make sure the ext included in the file name 
    24312424                # especially on MAC 
    2432                 fName = os.path.splitext(path)[0] + format 
    2433                 loader.save(fName, data, format) 
     2425                fName = os.path.splitext(path)[0] + ext_format 
     2426                loader.save(fName, data, ext_format) 
    24342427            try: 
    24352428                self._default_save_location = os.path.dirname(path) 
     
    25542547            ext_num = dlg.GetFilterIndex() 
    25552548            if ext_num == 0: 
    2556                 format = '.dat' 
     2549                ext_format = '.dat' 
    25572550            else: 
    2558                 format = '' 
    2559             path = os.path.splitext(path)[0] + format 
     2551                ext_format = '' 
     2552            path = os.path.splitext(path)[0] + ext_format 
    25602553            mypath = os.path.basename(path) 
    25612554 
     
    25632556            loader = Loader() 
    25642557 
    2565             format = ".dat" 
    2566             if os.path.splitext(mypath)[1].lower() == format: 
     2558            ext_format = ".dat" 
     2559            if os.path.splitext(mypath)[1].lower() == ext_format: 
    25672560                # Make sure the ext included in the file name 
    25682561                # especially on MAC 
    2569                 fileName = os.path.splitext(path)[0] + format 
    2570                 loader.save(fileName, data, format) 
     2562                fileName = os.path.splitext(path)[0] + ext_format 
     2563                loader.save(fileName, data, ext_format) 
    25712564            try: 
    25722565                self._default_save_location = os.path.dirname(path) 
     
    31613154 
    31623155 
    3163 class ViewApp(wx.App): 
     3156class SasViewApp(wx.App): 
    31643157    """ 
    3165     Toy application to test this Frame 
     3158    SasView application 
    31663159    """ 
    31673160    def OnInit(self): 
     
    32493242            if len(os.listdir(model_folder)) > 0: 
    32503243                try: 
    3251                     for file in os.listdir(model_folder): 
    3252                         file_path = os.path.join(model_folder, file) 
     3244                    for filename in os.listdir(model_folder): 
     3245                        file_path = os.path.join(model_folder, filename) 
    32533246                        if os.path.isfile(file_path): 
    32543247                            os.remove(file_path) 
     
    32693262        """ 
    32703263        #try to load file at the start 
    3271         try: 
    3272             self.open_file() 
    3273         except: 
    3274             raise 
     3264        self.open_file() 
    32753265        self.frame.build_gui() 
    32763266 
Note: See TracChangeset for help on using the changeset viewer.