oh god this isn't gonna work
Merge branch 'ebag_importchanges' into test_import Conflicts: config.py eos/db/saveddata/queries.py eos/effects/chargebonuswarfarecharge.py eos/effects/elitebonuscommandshipinformationhiddencs3.py eos/effects/elitebonuslogisticremotearmorrepairoptimalfalloff1.py eos/effects/energydestabilizationnew.py eos/effects/iceharvestingdroneoperationdurationbonus.py eos/effects/miningforemanstrengthbonus.py eos/effects/modulebonuswarfarelinkarmor.py eos/effects/modulebonuswarfarelinkinfo.py eos/effects/modulebonuswarfarelinkmining.py eos/effects/modulebonuswarfarelinkshield.py eos/effects/modulebonuswarfarelinkskirmish.py eos/effects/moduletitaneffectgenerator.py eos/effects/remotehullrepair.py eos/effects/rolebonusremotearmorrepairoptimalfalloff.py eos/effects/shipbonusforceauxiliarya4warfarelinksbonus.py eos/effects/shipmodesmallmissiledamagepostdiv.py eos/effects/structureenergyneutralizerfalloff.py eos/effects/structuremoduleeffectstasiswebifier.py eos/effects/structurerigmaxtargets.py eos/effects/subsystembonusamarrdefensiveinformationwarfarehidden.py eos/effects/subsystembonuscaldaridefensiveinformationwarfarehidden.py eos/effects/subsystembonusgallentedefensiveinformationwarfarehidden.py eos/effects/techtwocommandburstbonus.py eos/saveddata/fighter.py eos/saveddata/fit.py eos/saveddata/module.py eve.db gui/bitmapLoader.py gui/builtinContextMenus/itemStats.py gui/builtinStatsViews/miningyieldViewFull.py gui/builtinViewColumns/misc.py gui/builtinViews/__init__.py gui/builtinViews/fittingView.py gui/contextMenu.py gui/graphFrame.py gui/itemStats.py gui/mainFrame.py gui/marketBrowser.py service/__init__.py service/character.py service/fit.py service/port.py service/prefetch.py service/pycrest/eve.py service/settings.py
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,21 +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/>.
|
||||
#===============================================================================
|
||||
# =============================================================================
|
||||
|
||||
import wx
|
||||
|
||||
from gui import builtinViewColumns
|
||||
from gui.viewColumn import ViewColumn
|
||||
from gui.bitmapLoader import BitmapLoader
|
||||
from gui.utils.numberFormatter import formatAmount
|
||||
|
||||
import service
|
||||
import wx
|
||||
from service.attribute import Attribute
|
||||
from service.market import Market
|
||||
|
||||
|
||||
class AttributeDisplay(ViewColumn):
|
||||
name = "attr"
|
||||
|
||||
def __init__(self, fittingView, params):
|
||||
ViewColumn.__init__(self, fittingView)
|
||||
sAttr = service.Attribute.getInstance()
|
||||
sAttr = Attribute.getInstance()
|
||||
info = sAttr.getAttributeInfo(params["attribute"])
|
||||
self.info = info
|
||||
if params["showIcon"]:
|
||||
@@ -57,9 +60,10 @@ class AttributeDisplay(ViewColumn):
|
||||
self.direct = True
|
||||
self.view = fittingView
|
||||
originalRefresh = fittingView.refresh
|
||||
sMkt = service.Market.getInstance()
|
||||
#Hack into our master view and add a callback for ourselves to know when to query
|
||||
sMkt = Market.getInstance()
|
||||
|
||||
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)
|
||||
|
||||
@@ -76,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))
|
||||
@@ -102,4 +106,5 @@ class AttributeDisplay(ViewColumn):
|
||||
("showIcon", bool, True),
|
||||
("direct", bool, False))
|
||||
|
||||
|
||||
AttributeDisplay.register()
|
||||
|
||||
@@ -1,44 +1,46 @@
|
||||
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
|
||||
|
||||
class BaseIcon(ViewColumn):
|
||||
name = "Base Icon"
|
||||
def __init__(self, fittingView, params):
|
||||
ViewColumn.__init__(self, fittingView)
|
||||
self.size = 24
|
||||
self.maxsize = self.size
|
||||
self.mask = wx.LIST_MASK_IMAGE
|
||||
self.columnText = ""
|
||||
self.shipImage = fittingView.imageList.GetImageIndex("ship_small", "gui")
|
||||
|
||||
def getImageId(self, stuff):
|
||||
if isinstance(stuff, Drone):
|
||||
return -1
|
||||
if isinstance(stuff, Fit):
|
||||
return self.shipImage
|
||||
if isinstance(stuff, Rack):
|
||||
return -1
|
||||
if 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):
|
||||
if stuff.isEmpty:
|
||||
return self.fittingView.imageList.GetImageIndex("slot_%s_small" % Slot.getName(stuff.slot).lower(), "gui")
|
||||
else:
|
||||
return self.loadIconFile(stuff.item.icon.iconFile if stuff.item.icon else "")
|
||||
|
||||
item = getattr(stuff, "item", stuff)
|
||||
return self.loadIconFile(item.icon.iconFile if item.icon else "")
|
||||
|
||||
def loadIconFile(self, iconFile):
|
||||
if iconFile:
|
||||
return self.fittingView.imageList.GetImageIndex(iconFile, "icons")
|
||||
else:
|
||||
return -1
|
||||
|
||||
BaseIcon.register()
|
||||
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
|
||||
self.maxsize = self.size
|
||||
self.mask = wx.LIST_MASK_IMAGE
|
||||
self.columnText = ""
|
||||
self.shipImage = fittingView.imageList.GetImageIndex("ship_small", "gui")
|
||||
|
||||
def getImageId(self, stuff):
|
||||
if isinstance(stuff, Drone):
|
||||
return -1
|
||||
elif isinstance(stuff, Fit):
|
||||
return self.shipImage
|
||||
elif isinstance(stuff, Rack):
|
||||
return -1
|
||||
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
|
||||
elif isinstance(stuff, Module):
|
||||
if stuff.isEmpty:
|
||||
return self.fittingView.imageList.GetImageIndex("slot_%s_small" % Slot.getName(stuff.slot).lower(),
|
||||
"gui")
|
||||
else:
|
||||
return self.loadIconFile(stuff.item.icon.iconFile if stuff.item.icon else "")
|
||||
|
||||
item = getattr(stuff, "item", stuff)
|
||||
return self.loadIconFile(item.icon.iconFile if item.icon else "")
|
||||
|
||||
def loadIconFile(self, iconFile):
|
||||
if iconFile:
|
||||
return self.fittingView.imageList.GetImageIndex(iconFile, "icons")
|
||||
else:
|
||||
return -1
|
||||
|
||||
|
||||
BaseIcon.register()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#===============================================================================
|
||||
# coding: utf-8
|
||||
# =============================================================================
|
||||
# Copyright (C) 2010 Diego Duclos
|
||||
#
|
||||
# This file is part of pyfa.
|
||||
@@ -16,17 +16,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
|
||||
|
||||
import wx
|
||||
from eos.types import Drone, Cargo, Fit, Module, Slot, Rack, Implant, Fighter
|
||||
import service
|
||||
|
||||
class BaseName(ViewColumn):
|
||||
name = "Base Name"
|
||||
|
||||
def __init__(self, fittingView, params):
|
||||
ViewColumn.__init__(self, fittingView)
|
||||
|
||||
@@ -39,8 +40,9 @@ class BaseName(ViewColumn):
|
||||
def getText(self, stuff):
|
||||
if isinstance(stuff, Drone):
|
||||
return "%dx %s" % (stuff.amount, stuff.item.name)
|
||||
if isinstance(stuff, Fighter):
|
||||
return "%d/%d %s" % (stuff.amountActive, stuff.getModifiedItemAttr("fighterSquadronMaxSize"), stuff.item.name)
|
||||
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)
|
||||
elif isinstance(stuff, Fit):
|
||||
@@ -51,7 +53,7 @@ class BaseName(ViewColumn):
|
||||
else:
|
||||
return "%s (%s)" % (stuff.name, stuff.ship.item.name)
|
||||
elif isinstance(stuff, Rack):
|
||||
if service.Fit.getInstance().serviceFittingOptions["rackLabels"]:
|
||||
if Fit.getInstance().serviceFittingOptions["rackLabels"]:
|
||||
if stuff.slot == Slot.MODE:
|
||||
return u'─ Tactical Mode ─'
|
||||
else:
|
||||
@@ -68,15 +70,16 @@ class BaseName(ViewColumn):
|
||||
else:
|
||||
item = getattr(stuff, "item", stuff)
|
||||
|
||||
if service.Fit.getInstance().serviceFittingOptions["showMarketShortcuts"]:
|
||||
if Fit.getInstance().serviceFittingOptions["showMarketShortcuts"]:
|
||||
marketShortcut = getattr(item, "marketShortcut", None)
|
||||
|
||||
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
|
||||
import service
|
||||
|
||||
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
|
||||
|
||||
|
||||
class CapacitorUse(ViewColumn):
|
||||
name = "Capacitor Usage"
|
||||
|
||||
def __init__(self, fittingView, params):
|
||||
ViewColumn.__init__(self, fittingView)
|
||||
|
||||
self.mask = wx.LIST_MASK_IMAGE
|
||||
|
||||
sAttr = service.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,25 +15,27 @@
|
||||
#
|
||||
# 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
|
||||
import service
|
||||
from gui.utils.numberFormatter import formatAmount
|
||||
import wx
|
||||
from eos.types import Mode
|
||||
|
||||
|
||||
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 = service.Attribute.getInstance()
|
||||
sAttr = Attribute.getInstance()
|
||||
info = sAttr.getAttributeInfo("maxRange")
|
||||
self.info = info
|
||||
if params["showIcon"]:
|
||||
@@ -71,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()
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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
|
||||
import service
|
||||
|
||||
|
||||
class Price(ViewColumn):
|
||||
name = "Price"
|
||||
|
||||
def __init__(self, fittingView, params):
|
||||
ViewColumn.__init__(self, fittingView)
|
||||
self.mask = wx.LIST_MASK_IMAGE
|
||||
@@ -36,7 +39,7 @@ class Price(ViewColumn):
|
||||
if stuff.item is None or stuff.item.group.name == "Ship Modifiers":
|
||||
return ""
|
||||
|
||||
sMkt = service.Market.getInstance()
|
||||
sMkt = Market.getInstance()
|
||||
price = sMkt.getPriceNow(stuff.item.ID)
|
||||
|
||||
if not price or not price.price or not price.isValid:
|
||||
@@ -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 = service.Market.getInstance()
|
||||
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,70 +1,71 @@
|
||||
#===============================================================================
|
||||
# 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
|
||||
import service
|
||||
|
||||
class PropertyDisplay(ViewColumn):
|
||||
name = "prop"
|
||||
def __init__(self, fittingView, params):
|
||||
ViewColumn.__init__(self, fittingView)
|
||||
sAttr = service.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.utils.numberFormatter import formatAmount
|
||||
from service.attribute import Attribute
|
||||
|
||||
|
||||
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()
|
||||
@@ -44,7 +47,8 @@ class State(ViewColumn):
|
||||
|
||||
def getImageId(self, stuff):
|
||||
generic_active = self.fittingView.imageList.GetImageIndex("state_%s_small" % State_.getName(1).lower(), "gui")
|
||||
generic_inactive = self.fittingView.imageList.GetImageIndex("state_%s_small" % State_.getName(-1).lower(), "gui")
|
||||
generic_inactive = self.fittingView.imageList.GetImageIndex("state_%s_small" % State_.getName(-1).lower(),
|
||||
"gui")
|
||||
|
||||
if isinstance(stuff, Drone):
|
||||
if stuff.amountActive > 0:
|
||||
@@ -57,7 +61,8 @@ class State(ViewColumn):
|
||||
if stuff.isEmpty:
|
||||
return -1
|
||||
else:
|
||||
return self.fittingView.imageList.GetImageIndex("state_%s_small" % State_.getName(stuff.state).lower(), "gui")
|
||||
return self.fittingView.imageList.GetImageIndex("state_%s_small" % State_.getName(stuff.state).lower(),
|
||||
"gui")
|
||||
elif isinstance(stuff, Fit):
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
projectionInfo = stuff.getProjectionInfo(fitID)
|
||||
@@ -78,4 +83,5 @@ class State(ViewColumn):
|
||||
return generic_active
|
||||
return generic_inactive
|
||||
|
||||
|
||||
State.register()
|
||||
|
||||
Reference in New Issue
Block a user