diff --git a/gui/builtinViewColumns/__init__.py b/gui/builtinViewColumns/__init__.py index 5e476a333..1cc571252 100644 --- a/gui/builtinViewColumns/__init__.py +++ b/gui/builtinViewColumns/__init__.py @@ -1,5 +1,5 @@ __all__ = ["moduleState", "moduleNameOrSlot", "attributeDisplay", "maxRange", - "name", "droneDps", "droneNameAmount"] + "name", "droneDps", "droneNameAmount", "checkbox"] columns = {} def registerColumn(column): diff --git a/gui/builtinViewColumns/checkbox.py b/gui/builtinViewColumns/checkbox.py new file mode 100644 index 000000000..6d876f7b1 --- /dev/null +++ b/gui/builtinViewColumns/checkbox.py @@ -0,0 +1,51 @@ +#=============================================================================== +# Copyright (C) 2010 Diego Duclos +# +# This file is part of pyfa. +# +# pyfa 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. +# +# pyfa 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 pyfa. If not, see . +#=============================================================================== + +from gui import builtinViewColumns +from gui.viewColumn import ViewColumn +import gui.mainFrame +import wx + +class Checkbox(ViewColumn): + name = "Checkbox" + def __init__(self, fittingView, params): + ViewColumn.__init__(self, fittingView) + self.resizable = False + self.size = 16 + self.checked = False + + for name, state in (("checked", wx.CONTROL_CHECKED), ("unchecked", 0)): + bitmap = wx.EmptyBitmap(16, 16) + dc = wx.MemoryDC() + dc.SelectObject(bitmap) + dc.SetBackground(wx.TheBrushList.FindOrCreateBrush(fittingView.GetBackgroundColour(), wx.SOLID)) + dc.Clear() + wx.RendererNative.Get().DrawCheckBox(fittingView, dc, wx.Rect(0, 0, 16, 16), state) + setattr(self, "%sId" % name, fittingView.imageList.Add(bitmap)) + + def getText(self, mod): + return "" + + def getImageId(self, mod): + if self.checked: + return self.checkedId + else: + return self.uncheckedId + +builtinViewColumns.registerColumn(Checkbox) diff --git a/gui/droneView.py b/gui/droneView.py index 0ad7dc534..865e777cb 100644 --- a/gui/droneView.py +++ b/gui/droneView.py @@ -20,17 +20,14 @@ import wx import controller -import gui.mainFrame -from gui import bitmapLoader import gui.fittingView as fv import gui.marketBrowser as mb import gui.builtinViewColumns.display as d -from gui.builtinViewColumns import registerColumn -from gui.viewColumn import ViewColumn +from gui.builtinViewColumns.checkbox import Checkbox + class DroneView(d.Display): - DEFAULT_COLS = ["Activate Drone", - "Deactivate Drone", + DEFAULT_COLS = ["Checkbox", "Drone Name/Amount", "Drone DPS", "Max range", @@ -61,7 +58,7 @@ class DroneView(d.Display): row, _ = self.HitTest(event.Position) if row != -1: col = self.getColumn(event.Position) - if col not in (self.getColIndex(DroneMore), self.getColIndex(DroneLess)): + if col != self.getColIndex(Checkbox): fitID = self.mainFrame.getActiveFit() cFit = controller.Fit.getInstance() cFit.removeDrone(fitID, self.GetItemData(row)) @@ -71,44 +68,5 @@ class DroneView(d.Display): row, _ = self.HitTest(event.Position) if row != -1: col = self.getColumn(event.Position) - cFit = controller.Fit.getInstance() - fitID = self.mainFrame.getActiveFit() - if col == self.getColIndex(DroneMore): - cFit.activateDrone(fitID, row) - wx.PostEvent(self.mainFrame, fv.FitChanged(fitID=fitID)) - elif col == self.getColIndex(DroneLess): - cFit.deactivateDrone(fitID, row) - wx.PostEvent(self.mainFrame, fv.FitChanged(fitID=fitID)) - -class DroneMore(ViewColumn): - name = "Activate Drone" - def __init__(self, fittingView, params): - ViewColumn.__init__(self, fittingView) - bitmap = bitmapLoader.getBitmap("more_small", "icons") - self.moreId = fittingView.imageList.Add(bitmap) - self.size = 16 - self.columnText = "" - - def getText(self, drone): - return "" - - def getImageId(self, mod): - return self.moreId - -class DroneLess(ViewColumn): - name = "Deactivate Drone" - def __init__(self, fittingView, params): - ViewColumn.__init__(self, fittingView) - bitmap = bitmapLoader.getBitmap("less_small", "icons") - self.lessId = fittingView.imageList.Add(bitmap) - self.size = 16 - self.columnText = "" - - def getText(self, drone): - return "" - - def getImageId(self, mod): - return self.lessId - -registerColumn(DroneMore) -registerColumn(DroneLess) + if col == self.getColIndex(Checkbox): + pass diff --git a/icons/.directory b/icons/.directory deleted file mode 100644 index 23a15eac6..000000000 --- a/icons/.directory +++ /dev/null @@ -1,3 +0,0 @@ -[Dolphin] -ShowPreview=true -Timestamp=2010,8,13,20,51,36 diff --git a/icons/less_small.png b/icons/less_small.png deleted file mode 100644 index e1e61f2a7..000000000 Binary files a/icons/less_small.png and /dev/null differ diff --git a/icons/more_small.png b/icons/more_small.png deleted file mode 100644 index d470d3366..000000000 Binary files a/icons/more_small.png and /dev/null differ