Commit the base of the drone stuff. Next step: making adding drones actualy work! :D

This commit is contained in:
cncfanatics
2010-09-03 22:05:26 +02:00
parent 0574217303
commit 6014e0c62d
8 changed files with 146 additions and 9 deletions

View File

@@ -1,4 +1,4 @@
__all__ = ["moduleState", "moduleNameOrSlot", "attributeDisplay", "maxRange"]
__all__ = ["moduleState", "moduleNameOrSlot", "attributeDisplay", "maxRange", "name", "droneDps"]
columns = {}
def registerColumn(column):

View File

@@ -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 <http://www.gnu.org/licenses/>.
#===============================================================================
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)

View File

@@ -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

View File

@@ -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 <http://www.gnu.org/licenses/>.
#===============================================================================
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)

View File

@@ -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

View File

@@ -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

View File

@@ -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)

Binary file not shown.

After

Width:  |  Height:  |  Size: 839 B