Added method to check/get modes, and start GUI integration (simple context menu)
This commit is contained in:
@@ -14,6 +14,7 @@ __all__ = [
|
||||
"whProjector",
|
||||
"cargo",
|
||||
"shipJump",
|
||||
"tacticalMode",
|
||||
"targetResists",
|
||||
"priceClear"
|
||||
]
|
||||
|
||||
47
gui/builtinContextMenus/tacticalMode.py
Normal file
47
gui/builtinContextMenus/tacticalMode.py
Normal file
@@ -0,0 +1,47 @@
|
||||
import wx
|
||||
from gui.contextMenu import ContextMenu
|
||||
import gui.mainFrame
|
||||
import service
|
||||
from gui.shipBrowser import Stage3Selected
|
||||
|
||||
class TacticalMode(ContextMenu):
|
||||
def __init__(self):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
|
||||
def display(self, srcContext, selection):
|
||||
sFit = service.Fit.getInstance()
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
self.ship = sFit.getFit(fitID).ship
|
||||
self.modes = self.ship.getValidModes()
|
||||
|
||||
if not srcContext in ("fittingShip") or self.modes is None:
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
def getText(self, itmContext, selection):
|
||||
return "Modes"
|
||||
|
||||
def handleModeChange(self, event):
|
||||
mode = self.modeIds[event.Id]
|
||||
print mode
|
||||
# @todo fit service change mode
|
||||
|
||||
def addMode(self, menu, mode):
|
||||
label = mode.item.name.rsplit()[-2]
|
||||
id = wx.NewId()
|
||||
self.modeIds[id] = mode
|
||||
menuItem = wx.MenuItem(menu, id, label, kind=wx.ITEM_CHECK)
|
||||
menu.Bind(wx.EVT_MENU, self.handleModeChange, menuItem)
|
||||
return menuItem
|
||||
|
||||
def getSubMenu(self, context, selection, menu, i, pitem):
|
||||
sub = wx.Menu()
|
||||
self.modeIds = {}
|
||||
# Items that have a parent
|
||||
for mode in self.modes:
|
||||
sub.AppendItem(self.addMode(sub, mode))
|
||||
|
||||
return sub
|
||||
|
||||
TacticalMode.register()
|
||||
@@ -22,9 +22,9 @@ import re
|
||||
import gui.mainFrame
|
||||
import bitmapLoader
|
||||
import sys
|
||||
import wx.lib.mixins.listctrl as listmix
|
||||
import wx.lib.mixins.listctrl as listmix
|
||||
import wx.html
|
||||
from eos.types import Ship, Module, Skill, Booster, Implant, Drone
|
||||
from eos.types import Ship, Module, Skill, Booster, Implant, Drone, Mode
|
||||
from gui.utils.numberFormatter import formatAmount
|
||||
import service
|
||||
import config
|
||||
@@ -535,7 +535,7 @@ class ItemEffects (wx.Panel):
|
||||
|
||||
|
||||
class ItemAffectedBy (wx.Panel):
|
||||
ORDER = [Ship, Module, Drone, Implant, Booster, Skill]
|
||||
ORDER = [Ship, Mode, Module, Drone, Implant, Booster, Skill]
|
||||
def __init__(self, parent, stuff, item):
|
||||
wx.Panel.__init__ (self, parent)
|
||||
self.stuff = stuff
|
||||
|
||||
Reference in New Issue
Block a user