Use the Implant toggle in the booster view too
This commit is contained in:
@@ -22,9 +22,11 @@ import service
|
|||||||
import gui.display as d
|
import gui.display as d
|
||||||
import gui.fittingView as fv
|
import gui.fittingView as fv
|
||||||
import gui.marketBrowser as mb
|
import gui.marketBrowser as mb
|
||||||
|
from gui.builtinViewColumns.implantCheckbox import ImplantCheckbox
|
||||||
|
|
||||||
class BoosterView(d.Display):
|
class BoosterView(d.Display):
|
||||||
DEFAULT_COLS = ["Name",
|
DEFAULT_COLS = ["Implant Checkbox",
|
||||||
|
"Name",
|
||||||
"attr:boosterness"]
|
"attr:boosterness"]
|
||||||
|
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
@@ -32,6 +34,7 @@ class BoosterView(d.Display):
|
|||||||
self.mainFrame.Bind(fv.FIT_CHANGED, self.fitChanged)
|
self.mainFrame.Bind(fv.FIT_CHANGED, self.fitChanged)
|
||||||
self.mainFrame.Bind(mb.ITEM_SELECTED, self.addItem)
|
self.mainFrame.Bind(mb.ITEM_SELECTED, self.addItem)
|
||||||
self.Bind(wx.EVT_LEFT_DCLICK, self.removeItem)
|
self.Bind(wx.EVT_LEFT_DCLICK, self.removeItem)
|
||||||
|
self.Bind(wx.EVT_LEFT_DOWN, self.click)
|
||||||
|
|
||||||
def fitChanged(self, event):
|
def fitChanged(self, event):
|
||||||
cFit = service.Fit.getInstance()
|
cFit = service.Fit.getInstance()
|
||||||
@@ -59,3 +62,14 @@ class BoosterView(d.Display):
|
|||||||
cFit = service.Fit.getInstance()
|
cFit = service.Fit.getInstance()
|
||||||
cFit.removeBooster(fitID, self.GetItemData(row))
|
cFit.removeBooster(fitID, self.GetItemData(row))
|
||||||
wx.PostEvent(self.mainFrame, fv.FitChanged(fitID=fitID))
|
wx.PostEvent(self.mainFrame, fv.FitChanged(fitID=fitID))
|
||||||
|
|
||||||
|
def click(self, event):
|
||||||
|
row, _ = self.HitTest(event.Position)
|
||||||
|
if row != -1:
|
||||||
|
col = self.getColumn(event.Position)
|
||||||
|
if col == self.getColIndex(ImplantCheckbox):
|
||||||
|
fitID = self.mainFrame.getActiveFit()
|
||||||
|
cFit = service.Fit.getInstance()
|
||||||
|
cFit.toggleBooster(fitID, row)
|
||||||
|
wx.PostEvent(self.mainFrame, fv.FitChanged(fitID=fitID))
|
||||||
|
|
||||||
|
|||||||
@@ -24,8 +24,9 @@ class PreferenceDialog(wx.Dialog):
|
|||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
wx.Dialog.__init__(self, parent, id=wx.ID_ANY, size=wx.Size(600, 400), style=wx.DEFAULT_DIALOG_STYLE)
|
wx.Dialog.__init__(self, parent, id=wx.ID_ANY, size=wx.Size(600, 400), style=wx.DEFAULT_DIALOG_STYLE)
|
||||||
mainSizer = wx.BoxSizer(wx.VERTICAL)
|
mainSizer = wx.BoxSizer(wx.VERTICAL)
|
||||||
|
|
||||||
self.listbook = wx.Listbook(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LB_DEFAULT)
|
self.listbook = wx.Listbook(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LB_DEFAULT)
|
||||||
|
self.listbook.GetListView().SetMinSize((500, -1))
|
||||||
|
self.listbook.GetListView().SetSize((500, -1))
|
||||||
|
|
||||||
mainSizer.Add(self.listbook, 1, wx.EXPAND | wx.ALL, 5)
|
mainSizer.Add(self.listbook, 1, wx.EXPAND | wx.ALL, 5)
|
||||||
self.SetSizer(mainSizer)
|
self.SetSizer(mainSizer)
|
||||||
|
|||||||
@@ -244,6 +244,16 @@ class Fit(object):
|
|||||||
fit.calculateModifiedAttributes()
|
fit.calculateModifiedAttributes()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def toggleBooster(self, fitID, i):
|
||||||
|
fit = eos.db.getFit(fitID)
|
||||||
|
booster = fit.boosters[i]
|
||||||
|
booster.active = not booster.active
|
||||||
|
|
||||||
|
eos.db.commit()
|
||||||
|
fit.clear()
|
||||||
|
fit.calculateModifiedAttributes()
|
||||||
|
return True
|
||||||
|
|
||||||
def changeChar(self, fitID, charID):
|
def changeChar(self, fitID, charID):
|
||||||
if fitID is None or charID is None:
|
if fitID is None or charID is None:
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user