""" This file is part of RuneOptimizer. RuneOptimizer is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. RuneOptimizer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with RuneOptimizer. If not, see . """ class TabList(wx.Listbook): """ The main menu. Parameters ---------- frameUnits : PanelUnits Unit details view. frameTeams : PanelTeams Team management view. frameOptimizer : PanelOptimizer Optimizer view. frameResults : PanelUnits Optimization results view. frameInfo : PanelInfo Info view. Methods ------- OnPageChanged(event) Things to do once the tab has finished changing. OnPageChanging(event) Things to do before changing tabs. """ frameUnits = None frameTeams = None frameOptimizer = None frameResults = None frameInfo = None def __init__( self, parent, id=wx.ID_ANY ): """ Initializes the tablist. Sets upt all the items. Parameters ---------- parent : wx.* Listbook parent. id : int, optional ID for the listbook (default wx.ID_ANY). """ # Parent constructor wx.Listbook.__init__( self, parent, id=id, pos=(0, 0), size=(800, 600), style=wx.BK_LEFT ) # Load the icons iconPath = \ os.path.dirname(os.path.realpath(__file__)) + "/res/icon/" if os.name == 'nt': iconPath = os.path.dirname(__file__) if iconPath == "": iconPath += "." iconPath += "\\res\\icon\\" il = wx.ImageList(50, 50) for ico in [ "units.png", "teams.png", "optimize.png", "results.png", "info.png" ]: icon = wx.Bitmap(name=iconPath + ico, type=wx.BITMAP_TYPE_PNG) il.Add(icon) self.AssignImageList(il) # Create the entries self.frameUnits = PanelUnits(self) self.frameTeams = PanelTeams(self) self.frameOptimizer = PanelOptimizer(self) self.frameResults = PanelResults(self) self.frameInfo = PanelInfo(self) pages = [ (self.frameUnits, "Units"), (self.frameTeams, "Teams"), (self.frameOptimizer, "Optimize"), (self.frameResults, "Results"), (self.frameInfo, "Info") ] # Add icons to the entries imID = 0 for page, label in pages: self.AddPage(page, label, imageId=imID) imID += 1 # Binders for tab change self.Bind(wx.EVT_LISTBOOK_PAGE_CHANGED, self.OnPageChanged) self.Bind(wx.EVT_LISTBOOK_PAGE_CHANGING, self.OnPageChanging) def OnPageChanged(self, event): """ Things to do once the tab has finished changing. Currently, it does nothing. Parameters ---------- event : wx.Event, optional The event that triggered the call (default is None). """ #old = event.GetOldSelection() #new = event.GetSelection() #sel = self.GetSelection() event.Skip() def OnPageChanging(self, event): """ Things to do before changing tabs. Currently, it does nothing. Parameters ---------- event : wx.Event, optional The event that triggered the call (default is None). """ #old = event.GetOldSelection() #new = event.GetSelection() #sel = self.GetSelection() event.Skip()