| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161 |
- """
- 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 Tab_List(wx.Listbook):
- """
- The main menu.
- Parameters
- ----------
- panel_units : PanelUnits
- Unit details view.
- panel_teams : PanelTeams
- Team management view.
- panel_optimizer : PanelOptimizer
- Optimizer view.
- panel_results : PanelUnits
- Optimization results view.
- panel_info : PanelInfo
- Info view.
- """
- _panel_units = None
- _panel_teams = None
- _panel_optimizer = None
- _panel_results = None
- _panel_info = None
-
- @property
- def panel_units(self):
- return self._panel_units
-
- @property
- def panel_teams(self):
- return self._panel_teams
-
- @property
- def panel_optimizer(self):
- return self._panel_optimizer
-
- @property
- def panel_results(self):
- return self._panel_results
-
- @property
- def panel_info(self):
- return self._panel_inif
- 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=(1000, 650), style=wx.BK_LEFT
- )
- # Load the icons
- icon_path = \
- os.path.dirname(os.path.realpath(__file__)) + "/res/icon/"
- if os.name == 'nt':
- icon_path = os.path.dirname(__file__)
- if icon_path == "":
- icon_path += "."
- icon_path += "\\res\\icon\\"
- il = wx.ImageList(50, 50)
- for ico in [
- "units.png", "teams.png", "optimize.png", "results.png", "info.png"
- ]:
- icon = wx.Bitmap(name=icon_path + ico, type=wx.BITMAP_TYPE_PNG)
- il.Add(icon)
- self.AssignImageList(il)
- # Create the entries
- self._panel_units = PanelUnits(self)
- self._panel_teams = PanelTeams(self)
- self._panel_optimizer = PanelOptimizer(self)
- self._panel_results = PanelResults(self)
- self._panel_info = PanelInfo(self)
- pages = [
- (self._panel_units, "Units"),
- (self._panel_teams, "Teams"),
- (self._panel_optimizer, "Optimize"),
- (self._panel_results, "Results"),
- (self._panel_info, "Info")
- ]
- # Add icons to the entries
- image_id = 0
- for page, label in pages:
- self.AddPage(page, label, imageId=image_id)
- image_id += 1
- # Binders for tab change
- self.Bind(wx.EVT_LISTBOOK_PAGE_CHANGED, self._on_page_changed)
- self.Bind(wx.EVT_LISTBOOK_PAGE_CHANGING, self._on_page_changing)
- def _on_page_changed(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 _on_page_changing(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()
|