Changeset 6f59a98 in sasview


Ignore:
Timestamp:
Feb 27, 2010 9:07:20 AM (15 years ago)
Author:
Mathieu Doucet <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:
272d91e
Parents:
4ea3600
Message:

Fixed issue with "Panel" menu. Moved to Window menu if app has 1 and only 1 perspective and it has >1 panels.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • guiframe/gui_manager.py

    rb28278e r6f59a98  
    374374            # Check whether we need to put this panel 
    375375            # in the center pane 
    376             if hasattr(p, "CENTER_PANE"): 
     376            if hasattr(p, "CENTER_PANE") and p.CENTER_PANE: 
    377377                if p.CENTER_PANE: 
    378378                    self.panels[str(id)] = p 
     
    487487        menubar.Append(self.filemenu,  '&File') 
    488488         
    489         # Plot menu 
     489        # Window menu 
    490490        # Attach a menu item for each panel in our 
    491491        # panel list that also appears in a plug-in. 
    492         # TODO: clean this up. We should just identify 
    493         # plug-in panels and add them all. 
    494          
    495         # Only add the panel menu if there is more than two panels 
    496         n_panels = 0 
    497         for plug in self.plugins: 
     492         
     493        # Only add the panel menu if there is only one perspective and 
     494        # it has more than two panels. 
     495        # Note: the first plug-in is always the plotting plug-in. The first application 
     496        # plug-in is always the second one in the list. 
     497        if len(self.plugins)==2: 
     498            plug = self.plugins[1] 
    498499            pers = plug.get_perspective() 
    499             if len(pers)>0: 
    500                 n_panels += 1 
    501500        
    502         if n_panels>2: 
    503             viewmenu = wx.Menu() 
    504             for plug in self.plugins: 
    505                 plugmenu = wx.Menu() 
    506                 pers = plug.get_perspective() 
    507                 if len(pers)>0: 
    508                     for item in self.panels: 
    509                         if item == 'default': 
    510                             continue 
    511                         panel = self.panels[item] 
    512                         if panel.window_name in pers: 
    513                             plugmenu.Append(int(item), panel.window_caption, "Show %s window" % panel.window_caption) 
    514                             
    515                             wx.EVT_MENU(self, int(item), self._on_view) 
    516                      
    517                     viewmenu.AppendMenu(wx.NewId(), plug.sub_menu, plugmenu, plug.sub_menu) 
    518             menubar.Append(viewmenu, '&Panel') 
     501            if len(pers)>1: 
     502                viewmenu = wx.Menu() 
     503                for item in self.panels: 
     504                    if item == 'default': 
     505                        continue 
     506                    panel = self.panels[item] 
     507                    if panel.window_name in pers: 
     508                        viewmenu.Append(int(item), panel.window_caption, "Show %s window" % panel.window_caption) 
     509                        wx.EVT_MENU(self, int(item), self._on_view) 
     510                menubar.Append(viewmenu, '&Window') 
    519511 
    520512        # Perspective 
Note: See TracChangeset for help on using the changeset viewer.