diff --git a/gui/builtinViewColumns/__init__.py b/gui/builtinViewColumns/__init__.py index ad32ada35..7d94387bb 100644 --- a/gui/builtinViewColumns/__init__.py +++ b/gui/builtinViewColumns/__init__.py @@ -1,4 +1,4 @@ -__all__ = ["moduleState", "moduleNameOrSlot", "attributeDisplay", "maxRange"] +__all__ = ["moduleState", "moduleNameOrSlot", "attributeDisplay", "maxRange", "name", "droneDps"] columns = {} def registerColumn(column): diff --git a/gui/builtinViewColumns/droneDps.py b/gui/builtinViewColumns/droneDps.py new file mode 100644 index 000000000..3bc475d68 --- /dev/null +++ b/gui/builtinViewColumns/droneDps.py @@ -0,0 +1,39 @@ +#=============================================================================== +# 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 +from gui import bitmapLoader +from eos.types import Slot + +class DroneDps(ViewColumn): + name = "Drone DPS" + def __init__(self, fittingView, params): + ViewColumn.__init__(self, fittingView) + self.columnText = "" + bitmap = bitmapLoader.getBitmap("droneBandwidth_small", "icons") + self.imageId = fittingView.imageList.Add(bitmap) + + def getText(self, stuff): + return stuff.item.name + + def getImageId(self, mod): + return -1 + +builtinViewColumns.registerColumn(DroneDps) diff --git a/gui/builtinViewColumns/maxRange.py b/gui/builtinViewColumns/maxRange.py index d1dfb9ef4..0534bf6ec 100644 --- a/gui/builtinViewColumns/maxRange.py +++ b/gui/builtinViewColumns/maxRange.py @@ -49,12 +49,18 @@ class MaxRange(ViewColumn): if params["displayName"] or self.imageId == -1: self.columnText = info.displayName if info.displayName != "" else info.name - def getText(self, mod): - maxRange = mod.maxRange - if maxRange: - return "%sm" % shorten(mod.maxRange, 1) + def getText(self, stuff): + maxRange = stuff.maxRange if hasattr(stuff, "maxRange") else stuff.getModifiedItemAttr("maxRange") + falloff = stuff.getModifiedItemAttr("falloff") + if falloff is None: + falloff = "" else: - return "" + falloff = "+%sm" % shorten(falloff, 1) + + if maxRange: + return "%sm" % shorten(maxRange, 1) + falloff + else: + return "" + falloff def getImageId(self, mod): return -1 diff --git a/gui/builtinViewColumns/name.py b/gui/builtinViewColumns/name.py new file mode 100644 index 000000000..549cc461d --- /dev/null +++ b/gui/builtinViewColumns/name.py @@ -0,0 +1,37 @@ +#=============================================================================== +# 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 +from gui import bitmapLoader +from eos.types import Slot + +class StuffName(ViewColumn): + name = "Name" + def __init__(self, fittingView, params): + ViewColumn.__init__(self, fittingView) + self.columnText = "Name" + + def getText(self, stuff): + return stuff.item.name + + def getImageId(self, mod): + return -1 + +builtinViewColumns.registerColumn(StuffName) diff --git a/gui/droneView.py b/gui/droneView.py index df565fd01..1097d3db7 100644 --- a/gui/droneView.py +++ b/gui/droneView.py @@ -19,7 +19,59 @@ import wx -class DroneView(wx.Panel): +import gui.mainFrame +import gui.fittingView as fv +import gui.builtinViewColumns + +class DroneView(wx.ListCtrl): + DEFAULT_COLS = ["Name", + "Drone DPS", + "Max range", + "attr:trackingSpeed", + "attr:maxVelocity"] + def __init__(self, parent): - wx.Panel.__init__(self, parent) - self.SetBackgroundColour('cyan') + wx.ListCtrl.__init__(self, parent, style=wx.LC_REPORT | wx.BORDER_NONE) + + self.imageList = wx.ImageList(16, 16) + self.SetImageList(self.imageList, wx.IMAGE_LIST_SMALL) + self.activeColumns = [] + self.Bind(wx.EVT_LIST_COL_BEGIN_DRAG, self.resizeChecker) + + self.mainFrame = gui.mainFrame.MainFrame.getInstance() + self.mainFrame.Bind(fv.FIT_CHANGED, self.fitChanged) + + i = 0 + for colName in self.DEFAULT_COLS: + if colName[0:5] == "attr:": + attrName = colName[5:] + params = {"showIcon": True, + "displayName": False, + "attribute": attrName} + col = gui.builtinViewColumns.getColumn("Attribute Display")(self, params) + else: + col = gui.builtinViewColumns.getColumn(colName)(self, None) + + self.addColumn(i, col) + i += 1 + + self.imageListBase = self.imageList.ImageCount + + def addColumn(self, i, col): + self.activeColumns.append(col) + info = wx.ListItem() + info.m_mask = col.mask + info.m_image = col.imageId + info.m_text = col.columnText + self.InsertColumnInfo(i, info) + col.resized = False + self.SetColumnWidth(i, wx.LIST_AUTOSIZE_USEHEADER if col.size is wx.LIST_AUTOSIZE else col.size) + + def resizeChecker(self, event): + if self.activeColumns[event.Column].resizable is False: + event.Veto() + else: + self.activeColumns[event.Column].resized = True + + def fitChanged(self, event): + pass diff --git a/gui/fittingView.py b/gui/fittingView.py index c06ae266e..158c3fde0 100644 --- a/gui/fittingView.py +++ b/gui/fittingView.py @@ -45,8 +45,10 @@ class FittingView(wx.ListCtrl): self.SetImageList(self.imageList, wx.IMAGE_LIST_SMALL) self.activeColumns = [] self.Bind(wx.EVT_LIST_COL_BEGIN_DRAG, self.resizeChecker) + mainFrame = gui.mainFrame.MainFrame.getInstance() mainFrame.Bind(FIT_CHANGED, self.fitChanged) + self.shipBrowser = mainFrame.shipBrowser self.shipView = mainFrame.shipBrowser.shipView self.searchView = mainFrame.shipBrowser.shipView diff --git a/gui/statsPane.py b/gui/statsPane.py index 446b2a6f8..e1562e6a7 100644 --- a/gui/statsPane.py +++ b/gui/statsPane.py @@ -458,6 +458,7 @@ class StatsPane(wx.Panel): box = wx.BoxSizer(wx.HORIZONTAL) lbl = wx.StaticText(self.fullPanel, wx.ID_ANY, "0" if tankType != "damagePattern" else "", style = wx.ALIGN_CENTRE) lbl.SetMinSize(wx.Size(self.getTextExtentW("WWWWk"), -1)) + lbl.Refresh() box.Add(lbl, 1, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL) setattr(self, "labelResistance%sEhp" % tankType.capitalize(), lbl) sizerResistances.Add(box, 1, wx.ALIGN_CENTER_HORIZONTAL | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND) diff --git a/icons/droneBandwidth_small.png b/icons/droneBandwidth_small.png new file mode 100644 index 000000000..aa0fd99ae Binary files /dev/null and b/icons/droneBandwidth_small.png differ