Changeset 7dfdd56 in sasview


Ignore:
Timestamp:
Apr 25, 2012 7:14:43 AM (12 years ago)
Author:
Robert Whitley <robert.whitley@…>
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:
567e88d
Parents:
036e9ba
Message:

Refs #57. Clean up some warnings in gui_manager.py

File:
1 edited

Legend:

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

    r036e9ba r7dfdd56  
    122122    custom_config = _find_local_config('custom_config', os.getcwd()) 
    123123    if custom_config is None: 
    124         msg = "Custom_config file was not imported" 
    125         logging.info(msg) 
     124        msgConfig = "Custom_config file was not imported" 
     125        logging.info(msgConfig) 
    126126    else: 
    127127        logging.info("using custom_config in %s" % os.getcwd()) 
     
    215215        """ 
    216216         
    217         wx.Frame.__init__(self, parent=parent, title=title, pos=pos,size=size) 
     217        wx.Frame.__init__(self, parent=parent, title=title, pos=pos, size=size) 
    218218        # title 
    219219        self.title = title 
     
    263263        #tool bar 
    264264        self._toolbar = None 
     265        # Status bar 
     266        self.sb = None 
    265267        # number of plugins 
    266268        self._num_perspectives = 0 
     
    293295        #data manager 
    294296        self.batch_on = False 
    295         from data_manager import DataManager 
     297        from sans.guiframe.data_manager import DataManager 
    296298        self._data_manager = DataManager() 
    297299        self._data_panel = DataPanel(parent=self) 
    298300        if self.panel_on_focus is not None: 
    299             self._data_panel.set_panel_on_focus(self.panel_on_focus.window_caption) 
     301            self._data_panel.set_panel_on_focus( 
     302                                self.panel_on_focus.window_caption) 
    300303        # list of plot panels in schedule to full redraw 
    301304        self.schedule = False 
     
    349352        t = time.localtime(time.time()) 
    350353        time_str = time.strftime("%b %d %H;%M of %Y", t) 
    351         name = "Batch"  +  time_str 
    352354        details = "File Generated by %s : %s" % (APPLICATION_NAME, 
    353355                                                     str(plugin_name)) 
     
    492494            excel_app.Visible = 1 
    493495        except: 
    494             msg = "Error occured when calling Excel\n" 
    495             msg += "Check that Excel in installed in this machine or \n" 
    496             msg += "Check that %s really exists.\n" % str(file_name) 
     496            msg = "Error occured when calling Excel\n" + 
     497                        "Check that Excel in installed in this machine or \n" + 
     498                        "Check that %s really exists.\n" % str(file_name) 
    497499            wx.PostEvent(self, StatusEvent(status=msg, 
    498500                                             info="error")) 
     
    577579    def get_data_manager(self): 
    578580        """ 
     581        return the data manager. 
    579582        """ 
    580583        return self._data_manager 
     
    582585    def get_toolbar(self): 
    583586        """ 
     587        return the toolbar. 
    584588        """ 
    585589        return self._toolbar 
     
    622626            self._data_panel.disable_app_combo(enable) 
    623627        if self._menubar is not None: 
    624             for menu,_ in self._menubar.GetMenus(): 
     628            for menu, _ in self._menubar.GetMenus(): 
    625629                for items in menu.GetMenuItems(): 
    626630                    items.Enable(enable) 
     
    677681    def build_gui(self): 
    678682        """ 
     683        Build the GUI by setting up the toolbar, menu and layout. 
    679684        """ 
    680685        # set tool bar 
     
    720725        """ 
    721726        # Status bar 
    722         from gui_statusbar import StatusBar 
     727        from sans.guiframe.gui_statusbar import StatusBar 
    723728        self.sb = StatusBar(self, wx.ID_ANY) 
    724729        self.SetStatusBar(self.sb) 
     
    750755        field = self.sb.get_msg_position() 
    751756        wx.Frame.PushStatusText(self, field=field,  
    752                                 string="FIXME: PushStatusText called without text") 
     757                        string="FIXME: PushStatusText called without text") 
    753758 
    754759    def add_perspective(self, plugin): 
     
    807812         
    808813        """ 
    809         import imp 
    810814        plugins = [] 
    811815        # Go through files in panels directory 
     
    935939        data_pane = self._mgr.GetPane(self.panels["data_panel"].window_name) 
    936940        if style != GUIFRAME.MANAGER_ON: 
    937             self._mgr.GetPane(self.panels["data_panel"].window_name).Hide() 
     941            data_pane.Hide() 
    938942        else: 
    939             self._mgr.GetPane(self.panels["data_panel"].window_name).Show() 
     943            data_pane.Show() 
    940944             
    941945        # Add the panels to the AUI manager 
     
    971975    def update_data(self, prev_data, new_data): 
    972976        """ 
    973         """ 
    974         prev_id, data_state = self._data_manager.update_data(prev_data=prev_data,  
    975                                        new_data=new_data) 
     977        Update the data. 
     978        """ 
     979        prev_id, data_state = self._data_manager.update_data( 
     980                              prev_data=prev_data, new_data=new_data) 
    976981         
    977982        self._data_panel.remove_by_id(prev_id) 
     
    980985    def update_theory(self, data_id, theory, state=None): 
    981986        """ 
     987        Update the theory 
    982988        """  
    983989        data_state = self._data_manager.update_theory(data_id=data_id,  
     
    10101016    def delete_data(self, data): 
    10111017        """ 
     1018        Delete the data. 
    10121019        """ 
    10131020        self._current_perspective.delete_data(data) 
     
    12331240            menu_list = self._current_perspective.populate_menu(self) 
    12341241            if menu_list: 
    1235                 for (menu,name) in menu_list: 
     1242                for (menu, name) in menu_list: 
    12361243                    if self._applications_menu_pos == -1: 
    12371244                        self._menubar.Append(menu, name) 
    12381245                    else: 
    1239                         self._menubar.Insert(self._applications_menu_pos, menu, name) 
     1246                        self._menubar.Insert(self._applications_menu_pos,  
     1247                                             menu, name) 
    12401248                    self._applications_menu_name = name 
    12411249                   
     
    12631271            self._help_menu.AppendSeparator() 
    12641272            id = wx.NewId() 
    1265             self._help_menu.Append(id,'&Tutorial', 'Software tutorial') 
     1273            self._help_menu.Append(id, '&Tutorial', 'Software tutorial') 
    12661274            wx.EVT_MENU(self, id, self._onTutorial) 
    12671275             
     
    12691277            self._help_menu.AppendSeparator() 
    12701278            id = wx.NewId() 
    1271             self._help_menu.Append(id,'&About', 'Software information') 
     1279            self._help_menu.Append(id, '&About', 'Software information') 
    12721280            wx.EVT_MENU(self, id, self._onAbout) 
    12731281         
     
    13001308        style1 = self.__gui_style & GUIFRAME.TOOLBAR_ON 
    13011309        if style1 == GUIFRAME.TOOLBAR_ON: 
    1302             self._toolbar_menu = self._view_menu.Append(id,'&Hide Toolbar', '') 
     1310            self._toolbar_menu = self._view_menu.Append(id, '&Hide Toolbar', '') 
    13031311        else: 
    1304             self._toolbar_menu = self._view_menu.Append(id,'&Show Toolbar', '') 
     1312            self._toolbar_menu = self._view_menu.Append(id, '&Show Toolbar', '') 
    13051313        wx.EVT_MENU(self, id, self._on_toggle_toolbar) 
    13061314                     
     
    13141322            self._view_menu.AppendSeparator() 
    13151323            id = wx.NewId() 
    1316             preference_menu = self._view_menu.Append(id,'Startup Setting', '') 
     1324            preference_menu = self._view_menu.Append(id, 'Startup Setting', '') 
    13171325            wx.EVT_MENU(self, id, self._on_preference_menu) 
    13181326             
     
    13961404            id = wx.NewId() 
    13971405            hint = "Clean up the dock area for plots on new-plot" 
    1398             preferences_menu.AppendCheckItem(id, '&CleanUp Dock on NewPlot', hint) 
     1406            preferences_menu.AppendCheckItem(id, '&CleanUp Dock on NewPlot',  
     1407                                             hint) 
    13991408            wx.EVT_MENU(self, id, self.on_cleanup_dock) 
    14001409            flag = self.cleanup_plots 
     
    14071416            self._menubar.Remove(pos) 
    14081417        #wx.EVT_MENU(self, id, self.show_preferences_panel)    
    1409         """ 
    1410         if len(self.plugins) == 2: 
    1411             plug = self.plugins[1] 
    1412             pers = plug.get_perspective() 
    1413         
    1414             if len(pers) > 1: 
    1415                 self._window_menu = wx.Menu() 
    1416                 for item in self.panels: 
    1417                     if item == 'default': 
    1418                         continue 
    1419                     panel = self.panels[item] 
    1420                     if panel.window_name in pers: 
    1421                         self._window_menu.Append(int(item), 
    1422                                                   panel.window_caption, 
    1423                                         "Show %s window" % panel.window_caption) 
    1424                         wx.EVT_MENU(self, int(item), self.on_view) 
    1425                 self._menubar.Append(self._window_menu, '&Window') 
    1426                 """ 
     1418        #if len(self.plugins) == 2: 
     1419        #    plug = self.plugins[1] 
     1420        #    pers = plug.get_perspective() 
     1421        # 
     1422        #    if len(pers) > 1: 
     1423        #        self._window_menu = wx.Menu() 
     1424        #        for item in self.panels: 
     1425        #            if item == 'default': 
     1426        #                continue 
     1427        #            panel = self.panels[item] 
     1428        #            if panel.window_name in pers: 
     1429        #                self._window_menu.Append(int(item), 
     1430        #                                          panel.window_caption, 
     1431        #                                "Show %s window" % panel.window_caption) 
     1432        #                wx.EVT_MENU(self, int(item), self.on_view) 
     1433        #        self._menubar.Append(self._window_menu, '&Window') 
    14271434 
    14281435                 
    14291436    def _add_menu_application(self): 
    14301437        """ 
    1431          
    14321438        # Attach a menu item for each defined perspective or application. 
    14331439        # Only add the perspective menu if there are more than one perspectives 
     
    14841490        #append item from plugin under menu file if necessary 
    14851491        self._populate_file_menu() 
    1486         style = self.__gui_style & GUIFRAME.DATALOADER_ON 
    14871492        style1 = self.__gui_style & GUIFRAME.MULTIPLE_APPLICATIONS 
    14881493        if OPEN_SAVE_MENU: 
     
    15601565    def get_style(self): 
    15611566        """ 
     1567        Return the gui style 
    15621568        """ 
    15631569        return  self.__gui_style 
     
    17891795    def clear_panel(self): 
    17901796        """ 
     1797        Clear the panel 
    17911798        """ 
    17921799        for item in self.panels: 
     
    18931900            print log_msg 
    18941901            return 
    1895         message = "" 
    18961902        log_msg = '' 
    18971903        output = {} 
     
    19641970            return PLUGINS_WLIST  
    19651971        try: 
    1966             # Find the extension of the perspective and get that as 1st item in list 
     1972            # Find the extension of the perspective  
     1973            # and get that as 1st item in list 
    19671974            ind = None 
    19681975            app_ext = self._current_perspective._extensions 
     
    19771984                plug_wlist.insert(0, ind) 
    19781985                try: 
    1979                     plug_wlist ='|'.join(plug_wlist) 
     1986                    plug_wlist = '|'.join(plug_wlist) 
    19801987                except: 
    19811988                    plug_wlist = '' 
     
    21392146            f=urllib2.urlopen(config.__update_URL__,  
    21402147                              timeout=1.0) 
    2141             content=f.read() 
     2148            content = f.read() 
    21422149        except: 
    21432150            content = "0.0.0" 
     
    21952202        """ 
    21962203        if config._do_aboutbox: 
    2197             import aboutbox  
     2204            import sans.guiframe.aboutbox  
    21982205            dialog = aboutbox.DialogAbout(None, -1, "") 
    21992206            dialog.ShowModal()    
     
    26162623                dx_val = 0.0 
    26172624            if data.dxl != None: 
    2618                 if index == 0: x_st = "Xl" 
     2625                if index == 0:  
     2626                    x_st = "Xl" 
    26192627                dx_val = data.dxl[index] 
    26202628            elif data.dxw != None: 
    2621                 if index == 0: x_st = "Xw" 
     2629                if index == 0:  
     2630                    x_st = "Xw" 
    26222631                dx_val = data.dxw[index] 
    26232632             
Note: See TracChangeset for help on using the changeset viewer.