From 5287456030d2c19e15935dbfe7529391610d9062 Mon Sep 17 00:00:00 2001 From: cncfanatics Date: Thu, 21 Oct 2010 14:02:34 +0200 Subject: [PATCH] Use the Implant toggle in the booster view too --- gui/boosterView.py | 16 +++++++++++++++- gui/preferenceDialog.py | 3 ++- service/fit.py | 10 ++++++++++ 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/gui/boosterView.py b/gui/boosterView.py index 8461d7246..0b2d4cfb5 100644 --- a/gui/boosterView.py +++ b/gui/boosterView.py @@ -22,9 +22,11 @@ import service import gui.display as d import gui.fittingView as fv import gui.marketBrowser as mb +from gui.builtinViewColumns.implantCheckbox import ImplantCheckbox class BoosterView(d.Display): - DEFAULT_COLS = ["Name", + DEFAULT_COLS = ["Implant Checkbox", + "Name", "attr:boosterness"] def __init__(self, parent): @@ -32,6 +34,7 @@ class BoosterView(d.Display): self.mainFrame.Bind(fv.FIT_CHANGED, self.fitChanged) self.mainFrame.Bind(mb.ITEM_SELECTED, self.addItem) self.Bind(wx.EVT_LEFT_DCLICK, self.removeItem) + self.Bind(wx.EVT_LEFT_DOWN, self.click) def fitChanged(self, event): cFit = service.Fit.getInstance() @@ -59,3 +62,14 @@ class BoosterView(d.Display): cFit = service.Fit.getInstance() cFit.removeBooster(fitID, self.GetItemData(row)) 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)) + diff --git a/gui/preferenceDialog.py b/gui/preferenceDialog.py index a5382283e..82a353225 100644 --- a/gui/preferenceDialog.py +++ b/gui/preferenceDialog.py @@ -24,8 +24,9 @@ class PreferenceDialog(wx.Dialog): def __init__(self, parent): wx.Dialog.__init__(self, parent, id=wx.ID_ANY, size=wx.Size(600, 400), style=wx.DEFAULT_DIALOG_STYLE) mainSizer = wx.BoxSizer(wx.VERTICAL) - 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) self.SetSizer(mainSizer) diff --git a/service/fit.py b/service/fit.py index 0fd3e41cd..06a35d082 100644 --- a/service/fit.py +++ b/service/fit.py @@ -244,6 +244,16 @@ class Fit(object): fit.calculateModifiedAttributes() 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): if fitID is None or charID is None: return