so many pep8 fixes
(cherry picked from commit bee125d)
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#===============================================================================
|
||||
# =============================================================================
|
||||
# Copyright (C) 2010 Diego Duclos
|
||||
#
|
||||
# This file is part of pyfa.
|
||||
@@ -16,17 +15,18 @@
|
||||
#
|
||||
# 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.viewColumn import ViewColumn
|
||||
import gui.mainFrame
|
||||
|
||||
import wx
|
||||
from eos.types import Fighter
|
||||
from gui.viewColumn import ViewColumn
|
||||
import gui.mainFrame
|
||||
|
||||
|
||||
class Abilities(ViewColumn):
|
||||
name = "Fighter Abilities"
|
||||
|
||||
def __init__(self, fittingView, params):
|
||||
ViewColumn.__init__(self, fittingView)
|
||||
|
||||
@@ -41,4 +41,5 @@ class Abilities(ViewColumn):
|
||||
return "None"
|
||||
return ", ".join(active)
|
||||
|
||||
|
||||
Abilities.register()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#===============================================================================
|
||||
# =============================================================================
|
||||
# Copyright (C) 2010 Diego Duclos
|
||||
#
|
||||
# This file is part of pyfa.
|
||||
@@ -15,17 +15,17 @@
|
||||
#
|
||||
# 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.bitmapLoader import BitmapLoader
|
||||
import wx
|
||||
from eos.types import Fighter
|
||||
from gui.viewColumn import ViewColumn
|
||||
from gui.bitmapLoader import BitmapLoader
|
||||
|
||||
|
||||
class Ammo(ViewColumn):
|
||||
name = "Ammo"
|
||||
|
||||
def __init__(self, fittingView, params):
|
||||
ViewColumn.__init__(self, fittingView)
|
||||
self.mask = wx.LIST_MASK_IMAGE
|
||||
@@ -43,7 +43,7 @@ class Ammo(ViewColumn):
|
||||
charges = stuff.numCharges
|
||||
if charges > 0:
|
||||
cycles = stuff.numShots
|
||||
if cycles !=0 and charges != cycles:
|
||||
if cycles != 0 and charges != cycles:
|
||||
return "%s (%d, %d cycles)" % (stuff.charge.name, charges, cycles)
|
||||
else:
|
||||
return "%s (%d)" % (stuff.charge.name, charges)
|
||||
@@ -54,5 +54,5 @@ class Ammo(ViewColumn):
|
||||
def getImageId(self, mod):
|
||||
return -1
|
||||
|
||||
Ammo.register()
|
||||
|
||||
Ammo.register()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#===============================================================================
|
||||
# =============================================================================
|
||||
# Copyright (C) 2010 Diego Duclos
|
||||
#
|
||||
# This file is part of pyfa.
|
||||
@@ -15,16 +15,16 @@
|
||||
#
|
||||
# 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.bitmapLoader import BitmapLoader
|
||||
import wx
|
||||
from eos.types import Module
|
||||
|
||||
|
||||
class AmmoIcon(ViewColumn):
|
||||
name = "Ammo Icon"
|
||||
|
||||
def __init__(self, fittingView, params):
|
||||
ViewColumn.__init__(self, fittingView)
|
||||
self.size = 24
|
||||
@@ -52,4 +52,5 @@ class AmmoIcon(ViewColumn):
|
||||
if isinstance(mod, Module) and mod.charge is not None:
|
||||
return mod.charge.name
|
||||
|
||||
|
||||
AmmoIcon.register()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#===============================================================================
|
||||
# =============================================================================
|
||||
# Copyright (C) 2010 Diego Duclos
|
||||
#
|
||||
# This file is part of pyfa.
|
||||
@@ -15,9 +15,10 @@
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with pyfa. If not, see <http://www.gnu.org/licenses/>.
|
||||
#===============================================================================
|
||||
# =============================================================================
|
||||
|
||||
import wx
|
||||
|
||||
from gui import builtinViewColumns
|
||||
from gui.viewColumn import ViewColumn
|
||||
from gui.bitmapLoader import BitmapLoader
|
||||
from gui.utils.numberFormatter import formatAmount
|
||||
@@ -25,10 +26,10 @@ from gui.utils.numberFormatter import formatAmount
|
||||
from service.attribute import Attribute
|
||||
from service.market import Market
|
||||
|
||||
import wx
|
||||
|
||||
class AttributeDisplay(ViewColumn):
|
||||
name = "attr"
|
||||
|
||||
def __init__(self, fittingView, params):
|
||||
ViewColumn.__init__(self, fittingView)
|
||||
sAttr = Attribute.getInstance()
|
||||
@@ -60,8 +61,9 @@ class AttributeDisplay(ViewColumn):
|
||||
self.view = fittingView
|
||||
originalRefresh = fittingView.refresh
|
||||
sMkt = Market.getInstance()
|
||||
#Hack into our master view and add a callback for ourselves to know when to query
|
||||
|
||||
def refresh(stuff):
|
||||
# Hack into our master view and add a callback for ourselves to know when to query
|
||||
self.directInfo = sMkt.directAttrRequest(stuff, info) if stuff else None
|
||||
originalRefresh(stuff)
|
||||
|
||||
@@ -78,10 +80,10 @@ class AttributeDisplay(ViewColumn):
|
||||
attr = mod.getAttribute(self.info.name)
|
||||
|
||||
if self.info.name == "volume":
|
||||
str = (formatAmount(attr, 3, 0, 3))
|
||||
str_ = (formatAmount(attr, 3, 0, 3))
|
||||
if hasattr(mod, "amount"):
|
||||
str = str + u"m\u00B3 (%s m\u00B3)"%(formatAmount(attr*mod.amount, 3, 0, 3))
|
||||
attr = str
|
||||
str_ = str_ + u"m\u00B3 (%s m\u00B3)" % (formatAmount(attr * mod.amount, 3, 0, 3))
|
||||
attr = str_
|
||||
|
||||
if isinstance(attr, (float, int)):
|
||||
attr = (formatAmount(attr, 3, 0, 3))
|
||||
@@ -104,4 +106,5 @@ class AttributeDisplay(ViewColumn):
|
||||
("showIcon", bool, True),
|
||||
("direct", bool, False))
|
||||
|
||||
|
||||
AttributeDisplay.register()
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
from gui import builtinViewColumns
|
||||
from gui.viewColumn import ViewColumn
|
||||
from gui.bitmapLoader import BitmapLoader
|
||||
import wx
|
||||
from eos.types import Drone, Fit, Module, Slot, Rack, Implant
|
||||
from gui.viewColumn import ViewColumn
|
||||
|
||||
|
||||
class BaseIcon(ViewColumn):
|
||||
name = "Base Icon"
|
||||
|
||||
def __init__(self, fittingView, params):
|
||||
ViewColumn.__init__(self, fittingView)
|
||||
self.size = 24
|
||||
@@ -17,16 +17,16 @@ class BaseIcon(ViewColumn):
|
||||
def getImageId(self, stuff):
|
||||
if isinstance(stuff, Drone):
|
||||
return -1
|
||||
if isinstance(stuff, Fit):
|
||||
elif isinstance(stuff, Fit):
|
||||
return self.shipImage
|
||||
if isinstance(stuff, Rack):
|
||||
elif isinstance(stuff, Rack):
|
||||
return -1
|
||||
if isinstance(stuff, Implant):
|
||||
elif isinstance(stuff, Implant):
|
||||
if stuff.character: # if it has a character as it's parent
|
||||
return self.fittingView.imageList.GetImageIndex("character_small", "gui")
|
||||
else:
|
||||
return self.shipImage
|
||||
if isinstance(stuff, Module):
|
||||
elif isinstance(stuff, Module):
|
||||
if stuff.isEmpty:
|
||||
return self.fittingView.imageList.GetImageIndex("slot_%s_small" % Slot.getName(stuff.slot).lower(), "gui")
|
||||
else:
|
||||
@@ -41,4 +41,5 @@ class BaseIcon(ViewColumn):
|
||||
else:
|
||||
return -1
|
||||
|
||||
|
||||
BaseIcon.register()
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#===============================================================================
|
||||
# =============================================================================
|
||||
# Copyright (C) 2010 Diego Duclos
|
||||
#
|
||||
# This file is part of pyfa.
|
||||
@@ -16,18 +15,18 @@
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with pyfa. If not, see <http://www.gnu.org/licenses/>.
|
||||
#===============================================================================
|
||||
# =============================================================================
|
||||
|
||||
import wx
|
||||
from eos.types import Drone, Cargo, Module, Slot, Rack, Implant, Fighter
|
||||
from service.fit import Fit
|
||||
from gui.viewColumn import ViewColumn
|
||||
import gui.mainFrame
|
||||
|
||||
#from eos.saveddata.fit import Fit
|
||||
from service.fit import Fit
|
||||
import wx
|
||||
from eos.types import Drone, Cargo, Module, Slot, Rack, Implant, Fighter
|
||||
|
||||
class BaseName(ViewColumn):
|
||||
name = "Base Name"
|
||||
|
||||
def __init__(self, fittingView, params):
|
||||
ViewColumn.__init__(self, fittingView)
|
||||
|
||||
@@ -40,7 +39,7 @@ class BaseName(ViewColumn):
|
||||
def getText(self, stuff):
|
||||
if isinstance(stuff, Drone):
|
||||
return "%dx %s" % (stuff.amount, stuff.item.name)
|
||||
if isinstance(stuff, Fighter):
|
||||
elif isinstance(stuff, Fighter):
|
||||
return "%d/%d %s" % (stuff.amountActive, stuff.getModifiedItemAttr("fighterSquadronMaxSize"), stuff.item.name)
|
||||
elif isinstance(stuff, Cargo):
|
||||
return "%dx %s" % (stuff.amount, stuff.item.name)
|
||||
@@ -74,10 +73,11 @@ class BaseName(ViewColumn):
|
||||
|
||||
if marketShortcut:
|
||||
# use unicode subscript to display shortcut value
|
||||
shortcut = unichr(marketShortcut+8320)+u" "
|
||||
shortcut = unichr(marketShortcut + 8320) + u" "
|
||||
del item.marketShortcut
|
||||
return shortcut+item.name
|
||||
return shortcut + item.name
|
||||
|
||||
return item.name
|
||||
|
||||
|
||||
BaseName.register()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#===============================================================================
|
||||
# =============================================================================
|
||||
# Copyright (C) 2010 Diego Duclos
|
||||
#
|
||||
# This file is part of pyfa.
|
||||
@@ -15,25 +15,26 @@
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with pyfa. If not, see <http://www.gnu.org/licenses/>.
|
||||
#===============================================================================
|
||||
# =============================================================================
|
||||
|
||||
import wx
|
||||
|
||||
from eos.types import Mode
|
||||
from service.attribute import Attribute
|
||||
from gui.utils.numberFormatter import formatAmount
|
||||
from gui.viewColumn import ViewColumn
|
||||
from gui.bitmapLoader import BitmapLoader
|
||||
from eos.types import Mode
|
||||
from service.attribute import Attribute
|
||||
|
||||
|
||||
class CapacitorUse(ViewColumn):
|
||||
name = "Capacitor Usage"
|
||||
|
||||
def __init__(self, fittingView, params):
|
||||
ViewColumn.__init__(self, fittingView)
|
||||
|
||||
self.mask = wx.LIST_MASK_IMAGE
|
||||
|
||||
sAttr = Attribute.getInstance()
|
||||
info = sAttr.getAttributeInfo("capacitorNeed")
|
||||
Attribute.getInstance().getAttributeInfo("capacitorNeed")
|
||||
self.imageId = fittingView.imageList.GetImageIndex("capacitorRecharge_small", "gui")
|
||||
self.bitmap = BitmapLoader.getBitmap("capacitorRecharge_small", "gui")
|
||||
|
||||
@@ -53,4 +54,5 @@ class CapacitorUse(ViewColumn):
|
||||
def getToolTip(self, mod):
|
||||
return self.name
|
||||
|
||||
|
||||
CapacitorUse.register()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#===============================================================================
|
||||
# =============================================================================
|
||||
# Copyright (C) 2010 Diego Duclos
|
||||
#
|
||||
# This file is part of pyfa.
|
||||
@@ -15,23 +15,24 @@
|
||||
#
|
||||
# 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
|
||||
import wx
|
||||
|
||||
from eos.types import Mode
|
||||
from service.attribute import Attribute
|
||||
from gui.viewColumn import ViewColumn
|
||||
from gui.bitmapLoader import BitmapLoader
|
||||
from gui.utils.numberFormatter import formatAmount
|
||||
import wx
|
||||
from eos.types import Mode
|
||||
|
||||
from service.attribute import Attribute
|
||||
|
||||
class MaxRange(ViewColumn):
|
||||
name = "Max Range"
|
||||
def __init__(self, fittingView, params = None):
|
||||
if params == None:
|
||||
params = {"showIcon": True,
|
||||
"displayName": False}
|
||||
|
||||
def __init__(self, fittingView, params=None):
|
||||
if params is None:
|
||||
params = {"showIcon": True, "displayName": False}
|
||||
|
||||
ViewColumn.__init__(self, fittingView)
|
||||
|
||||
sAttr = Attribute.getInstance()
|
||||
@@ -72,10 +73,10 @@ class MaxRange(ViewColumn):
|
||||
return -1
|
||||
|
||||
def getParameters(self):
|
||||
return (("displayName", bool, False),
|
||||
("showIcon", bool, True))
|
||||
return (("displayName", bool, False), ("showIcon", bool, True))
|
||||
|
||||
def getToolTip(self, mod):
|
||||
return "Optimal + Falloff"
|
||||
|
||||
|
||||
MaxRange.register()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#===============================================================================
|
||||
# =============================================================================
|
||||
# Copyright (C) 2010 Diego Duclos
|
||||
#
|
||||
# This file is part of pyfa.
|
||||
@@ -15,24 +15,26 @@
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with pyfa. If not, see <http://www.gnu.org/licenses/>.
|
||||
#===============================================================================
|
||||
# =============================================================================
|
||||
|
||||
import wx
|
||||
|
||||
from service.fit import Fit
|
||||
from service.market import Market
|
||||
import gui.mainFrame
|
||||
from gui.viewColumn import ViewColumn
|
||||
from gui.bitmapLoader import BitmapLoader
|
||||
from gui.utils.numberFormatter import formatAmount
|
||||
from gui.utils.listFormatter import formatList
|
||||
from service.fit import Fit, Market
|
||||
|
||||
import wx
|
||||
|
||||
class Miscellanea(ViewColumn):
|
||||
name = "Miscellanea"
|
||||
def __init__(self, fittingView, params = None):
|
||||
if params == None:
|
||||
params = {"showIcon": True,
|
||||
"displayName": False}
|
||||
|
||||
def __init__(self, fittingView, params=None):
|
||||
if params is None:
|
||||
params = {"showIcon": True, "displayName": False}
|
||||
|
||||
ViewColumn.__init__(self, fittingView)
|
||||
if params["showIcon"]:
|
||||
self.imageId = fittingView.imageList.GetImageIndex("column_misc", "gui")
|
||||
@@ -47,19 +49,16 @@ class Miscellanea(ViewColumn):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
|
||||
def getText(self, stuff):
|
||||
text = self.__getData(stuff)[0]
|
||||
return text
|
||||
return self.__getData(stuff)[0]
|
||||
|
||||
def getToolTip(self, mod):
|
||||
text = self.__getData(mod)[1]
|
||||
return text
|
||||
return self.__getData(mod)[1]
|
||||
|
||||
def getImageId(self, mod):
|
||||
return -1
|
||||
|
||||
def getParameters(self):
|
||||
return (("displayName", bool, False),
|
||||
("showIcon", bool, True))
|
||||
return (("displayName", bool, False), ("showIcon", bool, True))
|
||||
|
||||
def __getData(self, stuff):
|
||||
item = stuff.item
|
||||
@@ -81,10 +80,10 @@ class Miscellanea(ViewColumn):
|
||||
slots = ("hi", "med", "low")
|
||||
info = []
|
||||
for slot in slots:
|
||||
n = int(stuff.getModifiedItemAttr("%sSlotModifier"%slot))
|
||||
n = int(stuff.getModifiedItemAttr("%sSlotModifier" % slot))
|
||||
if n > 0:
|
||||
info.append("{0}{1}".format(n, slot[0].upper()))
|
||||
return "+ "+", ".join(info), "Slot Modifiers"
|
||||
return "+ " + ", ".join(info), "Slot Modifiers"
|
||||
elif itemGroup == "Energy Neutralizer":
|
||||
neutAmount = stuff.getModifiedItemAttr("energyNeutralizerAmount")
|
||||
cycleTime = stuff.cycleTime
|
||||
@@ -276,7 +275,7 @@ class Miscellanea(ViewColumn):
|
||||
recalibration = stuff.getModifiedItemAttr("cloakingTargetingDelay")
|
||||
if recalibration is None:
|
||||
return "", None
|
||||
text = "{0}s".format(formatAmount(float(recalibration)/1000, 3, 0, 3))
|
||||
text = "{0}s".format(formatAmount(float(recalibration) / 1000, 3, 0, 3))
|
||||
tooltip = "Sensor recalibration time"
|
||||
return text, tooltip
|
||||
elif itemGroup == "Remote Armor Repairer":
|
||||
@@ -487,10 +486,10 @@ class Miscellanea(ViewColumn):
|
||||
|
||||
return text, tooltip
|
||||
elif itemGroup == "Armor Resistance Shift Hardener":
|
||||
itemArmorResistanceShiftHardenerEM = (1-stuff.getModifiedItemAttr("armorEmDamageResonance"))*100
|
||||
itemArmorResistanceShiftHardenerTherm = (1-stuff.getModifiedItemAttr("armorThermalDamageResonance")) * 100
|
||||
itemArmorResistanceShiftHardenerKin = (1-stuff.getModifiedItemAttr("armorKineticDamageResonance")) * 100
|
||||
itemArmorResistanceShiftHardenerExp = (1-stuff.getModifiedItemAttr("armorExplosiveDamageResonance")) * 100
|
||||
itemArmorResistanceShiftHardenerEM = (1 - stuff.getModifiedItemAttr("armorEmDamageResonance")) * 100
|
||||
itemArmorResistanceShiftHardenerTherm = (1 - stuff.getModifiedItemAttr("armorThermalDamageResonance")) * 100
|
||||
itemArmorResistanceShiftHardenerKin = (1 - stuff.getModifiedItemAttr("armorKineticDamageResonance")) * 100
|
||||
itemArmorResistanceShiftHardenerExp = (1 - stuff.getModifiedItemAttr("armorExplosiveDamageResonance")) * 100
|
||||
|
||||
text = "{0}% | {1}% | {2}% | {3}%".format(
|
||||
formatAmount(itemArmorResistanceShiftHardenerEM, 3, 0, 3),
|
||||
@@ -540,4 +539,5 @@ class Miscellanea(ViewColumn):
|
||||
else:
|
||||
return "", None
|
||||
|
||||
|
||||
Miscellanea.register()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#===============================================================================
|
||||
# =============================================================================
|
||||
# Copyright (C) 2010 Diego Duclos, Lucas Thode
|
||||
#
|
||||
# This file is part of pyfa.
|
||||
@@ -15,17 +15,20 @@
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with pyfa. If not, see <http://www.gnu.org/licenses/>.
|
||||
#===============================================================================
|
||||
# =============================================================================
|
||||
|
||||
import wx
|
||||
|
||||
from eos.types import Drone, Cargo
|
||||
from service.market import Market
|
||||
from gui.viewColumn import ViewColumn
|
||||
from gui.bitmapLoader import BitmapLoader
|
||||
from gui.utils.numberFormatter import formatAmount
|
||||
from eos.types import Drone, Cargo
|
||||
import wx
|
||||
from service.market import Market
|
||||
|
||||
|
||||
class Price(ViewColumn):
|
||||
name = "Price"
|
||||
|
||||
def __init__(self, fittingView, params):
|
||||
ViewColumn.__init__(self, fittingView)
|
||||
self.mask = wx.LIST_MASK_IMAGE
|
||||
@@ -45,21 +48,22 @@ class Price(ViewColumn):
|
||||
price = price.price # Set new price variable with what we need
|
||||
|
||||
if isinstance(stuff, Drone) or isinstance(stuff, Cargo):
|
||||
price *= stuff.amount
|
||||
price *= stuff.amount
|
||||
|
||||
return formatAmount(price, 3, 3, 9, currency=True)
|
||||
|
||||
def delayedText(self, mod, display, colItem):
|
||||
sMkt = Market.getInstance()
|
||||
|
||||
def callback(item):
|
||||
price = sMkt.getPriceNow(item.ID)
|
||||
text = formatAmount(price.price, 3, 3, 9, currency=True) if price.price else ""
|
||||
if price.failed: text += " (!)"
|
||||
if price.failed:
|
||||
text += " (!)"
|
||||
colItem.SetText(text)
|
||||
|
||||
display.SetItem(colItem)
|
||||
|
||||
|
||||
sMkt.waitForPrice(mod.item, callback)
|
||||
|
||||
def getImageId(self, mod):
|
||||
@@ -68,4 +72,5 @@ class Price(ViewColumn):
|
||||
def getToolTip(self, mod):
|
||||
return self.name
|
||||
|
||||
|
||||
Price.register()
|
||||
|
||||
@@ -1,69 +1,73 @@
|
||||
#===============================================================================
|
||||
# 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.viewColumn import ViewColumn
|
||||
from gui.bitmapLoader import BitmapLoader
|
||||
from gui.utils.numberFormatter import formatAmount
|
||||
import wx
|
||||
|
||||
class PropertyDisplay(ViewColumn):
|
||||
name = "prop"
|
||||
def __init__(self, fittingView, params):
|
||||
ViewColumn.__init__(self, fittingView)
|
||||
sAttr = Attribute.getInstance()
|
||||
attributeSlave = params["attributeSlave"] or params["property"]
|
||||
# This function can throw an exception if the database isn't sane
|
||||
# We need to do a sanity check before this runs
|
||||
info = sAttr.getAttributeInfo(attributeSlave)
|
||||
|
||||
self.mask = 0
|
||||
self.propertyName = params["property"]
|
||||
self.info = info
|
||||
if params["showIcon"]:
|
||||
if info.name == "power":
|
||||
iconFile = "pg_small"
|
||||
iconType = "gui"
|
||||
else:
|
||||
iconFile = info.icon.iconFile if info.icon else None
|
||||
iconType = "icons"
|
||||
if iconFile:
|
||||
self.imageId = fittingView.imageList.GetImageIndex(iconFile, iconType)
|
||||
else:
|
||||
self.imageId = -1
|
||||
else:
|
||||
self.imageId = -1
|
||||
|
||||
if params["displayName"] or self.imageId == -1:
|
||||
self.columnText = info.displayName if info.displayName != "" else info.name
|
||||
|
||||
def getText(self, stuff):
|
||||
attr = getattr(stuff, self.propertyName, None)
|
||||
if attr:
|
||||
return (formatAmount(attr, 3, 0, 3))
|
||||
else:
|
||||
return ""
|
||||
|
||||
@staticmethod
|
||||
def getParameters():
|
||||
return (("property", str, None),
|
||||
("attributeSlave", str, None),
|
||||
("displayName", bool, False),
|
||||
("showIcon", bool, True))
|
||||
|
||||
PropertyDisplay.register()
|
||||
# =============================================================================
|
||||
# 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.viewColumn import ViewColumn
|
||||
from gui.bitmapLoader import BitmapLoader
|
||||
from gui.utils.numberFormatter import formatAmount
|
||||
from service.attribute import Attribute
|
||||
import wx
|
||||
|
||||
|
||||
class PropertyDisplay(ViewColumn):
|
||||
name = "prop"
|
||||
|
||||
def __init__(self, fittingView, params):
|
||||
ViewColumn.__init__(self, fittingView)
|
||||
sAttr = Attribute.getInstance()
|
||||
attributeSlave = params["attributeSlave"] or params["property"]
|
||||
# This function can throw an exception if the database isn't sane
|
||||
# We need to do a sanity check before this runs
|
||||
info = sAttr.getAttributeInfo(attributeSlave)
|
||||
|
||||
self.mask = 0
|
||||
self.propertyName = params["property"]
|
||||
self.info = info
|
||||
if params["showIcon"]:
|
||||
if info.name == "power":
|
||||
iconFile = "pg_small"
|
||||
iconType = "gui"
|
||||
else:
|
||||
iconFile = info.icon.iconFile if info.icon else None
|
||||
iconType = "icons"
|
||||
if iconFile:
|
||||
self.imageId = fittingView.imageList.GetImageIndex(iconFile, iconType)
|
||||
else:
|
||||
self.imageId = -1
|
||||
else:
|
||||
self.imageId = -1
|
||||
|
||||
if params["displayName"] or self.imageId == -1:
|
||||
self.columnText = info.displayName if info.displayName != "" else info.name
|
||||
|
||||
def getText(self, stuff):
|
||||
attr = getattr(stuff, self.propertyName, None)
|
||||
if attr:
|
||||
return (formatAmount(attr, 3, 0, 3))
|
||||
else:
|
||||
return ""
|
||||
|
||||
@staticmethod
|
||||
def getParameters():
|
||||
return (("property", str, None),
|
||||
("attributeSlave", str, None),
|
||||
("displayName", bool, False),
|
||||
("showIcon", bool, True))
|
||||
|
||||
|
||||
PropertyDisplay.register()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#===============================================================================
|
||||
# =============================================================================
|
||||
# Copyright (C) 2010 Diego Duclos
|
||||
#
|
||||
# This file is part of pyfa.
|
||||
@@ -15,18 +15,21 @@
|
||||
#
|
||||
# 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.viewColumn import ViewColumn
|
||||
from gui.bitmapLoader import BitmapLoader
|
||||
import gui.mainFrame
|
||||
|
||||
import wx
|
||||
|
||||
from eos.types import Drone, Module, Rack, Fit, Implant
|
||||
from eos.types import State as State_
|
||||
from gui.viewColumn import ViewColumn
|
||||
|
||||
import gui.mainFrame
|
||||
|
||||
|
||||
class State(ViewColumn):
|
||||
name = "State"
|
||||
|
||||
def __init__(self, fittingView, params):
|
||||
ViewColumn.__init__(self, fittingView)
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
@@ -78,4 +81,5 @@ class State(ViewColumn):
|
||||
return generic_active
|
||||
return generic_inactive
|
||||
|
||||
|
||||
State.register()
|
||||
|
||||
Reference in New Issue
Block a user