Changeset 9455d77 in sasview for sansview


Ignore:
Timestamp:
Feb 2, 2010 12:17:26 PM (15 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:
629e8b9
Parents:
c1469ebe
Message:

working on the close welcome page

Location:
sansview
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • sansview/perspectives/fitting/fitting.py

    r25e3fc9 r9455d77  
    478478            if fitproblem_count == 1: 
    479479                #qmin, qmax= self.current_pg.get_range() 
    480                 print "went here fitproblem_count == 1",fitproblem_count == 1 
     480                #print "went here fitproblem_count == 1",fitproblem_count == 1 
    481481                calc_fit=FitThread(parent =self.parent, 
    482482                                        fn= self.fitter, 
     
    634634            self.fitter.set_data(data=metadata,Uid=self.fit_id, 
    635635                                 smearer=smearer,qmin= qmin,qmax=qmax ) 
    636             print "self.fitter.set_data" 
     636            #print "self.fitter.set_data" 
    637637            self.fitter.select_problem_for_fit(Uid= self.fit_id, 
    638638                                               value= value.get_scheduled()) 
  • sansview/sansview.py

    r6e0e2d85 r9455d77  
    4242        #from gui_manager import ViewApp 
    4343        self.gui = SansViewApp(0)  
    44          
     44        # Set the application manager for the GUI 
     45        self.gui.set_manager(self) 
    4546        # Add perspectives to the basic application 
    4647        # Additional perspectives can still be loaded 
     
    5354        try: 
    5455            import sans.perspectives.pr as module     
    55             fitting_plug = module.Plugin(standalone=False) 
    56             self.gui.add_perspective(fitting_plug) 
     56            self.fitting_plug = module.Plugin(standalone=False) 
     57            self.gui.add_perspective(self.fitting_plug) 
    5758        except: 
    5859            logging.error("SansView: could not find P(r) plug-in module")  
     
    7677        # Fitting perspective 
    7778        import perspectives.fitting as module     
    78         fitting_plug = module.Plugin() 
    79         self.gui.add_perspective(fitting_plug) 
    80        
     79        self.fitting_plug = module.Plugin() 
     80        self.gui.add_perspective(self.fitting_plug) 
     81         
    8182        # Add welcome page 
    8283        self.gui.set_welcome_panel(WelcomePanel) 
     
    8586        self.gui.build_gui() 
    8687         
    87         # Set the application manager for the GUI 
    88         self.gui.set_manager(self) 
    89          
    9088        # Start the main loop 
    9189        self.gui.MainLoop()   
    9290         
     91    def on_close_welcome_panel(self): 
     92        """ 
     93            When closing the welcome panel, set to the default perspective 
     94        """ 
     95        default_perspective = self.fitting_plug.get_perspective() 
     96        return 
     97        self.fitting_plug.on_perspective(event=None) 
     98     
    9399 
    94100if __name__ == "__main__":  
  • sansview/welcome_panel.py

    rf1aa385 r9455d77  
    1313 
    1414import wx 
     15import wx.aui 
    1516import wx.lib.hyperlink 
    1617import os.path 
     
    2324else: 
    2425    FONT_VARIANT = 1  
     26  
     27class WelcomePanel(wx.aui.AuiNotebook): 
     28    """ 
     29        Panel created like about box  as a welcome page 
     30        Shows product name, current version, authors, and link to the product page. 
     31    """ 
     32    ## Internal nickname for the window, used by the AUI manager 
     33    window_name = "default" 
     34    ## Name to appear on the window title bar 
     35    window_caption = "Welcome panel" 
     36    ## Flag to tell the AUI manager to put this panel in the center pane 
     37    CENTER_PANE = True 
     38    
    2539     
    26 class WelcomePanel(wx.Panel): 
     40    def __init__(self,parent,manager=None, *args, **kwds): 
     41         
     42        kwds["style"] = wx.aui.AUI_NB_DEFAULT_STYLE 
     43         
     44        wx.aui.AuiNotebook.__init__(self, parent, *args, **kwds) 
     45        #For sansview the parent is guiframe 
     46        self.parent = parent 
     47        #For sansview the manager is sansview application 
     48        self.manager = manager 
     49        welcome_page = WelcomePage(self) 
     50        self.AddPage(page=welcome_page, caption="Welcome") 
     51         
     52        pageClosedEvent = wx.aui.EVT_AUINOTEBOOK_PAGE_CLOSE 
     53        self.Bind(wx.aui.EVT_AUINOTEBOOK_PAGE_CLOSE, self.on_close_page) 
     54        self.Center() 
     55     
     56    def set_manager(self, manager): 
     57        """ 
     58            the manager of the panel in this case the application itself 
     59        """ 
     60        self.manager = manager 
     61         
     62    def on_close_page(self, event): 
     63        """ 
     64             
     65        """ 
     66        if self.parent is not None: 
     67            self.parent.on_close_welcome_panel() 
     68        if self.manager is not None: 
     69            self.manager.on_close_welcome_panel() 
     70        event.Veto()  
     71    
     72class WelcomePage(wx.Panel): 
    2773    """ 
    2874        Panel created like about box  as a welcome page 
Note: See TracChangeset for help on using the changeset viewer.