| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 |
- """
- 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 <https://www.gnu.org/licenses/>.
- """
- 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()
|