From 1315f8d8edff6bd87eafea553ad656d7f7a57e13 Mon Sep 17 00:00:00 2001 From: blitzmann Date: Fri, 8 Aug 2014 10:46:58 -0400 Subject: [PATCH] Adds prices to Drone and Cargo bay. Also removed redundant and broken columns in drone bay --- gui/builtinViewColumns/price.py | 12 +++++++++++- gui/cargoView.py | 3 ++- gui/droneView.py | 7 ++++--- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/gui/builtinViewColumns/price.py b/gui/builtinViewColumns/price.py index 483de2dff..0afcb22c0 100644 --- a/gui/builtinViewColumns/price.py +++ b/gui/builtinViewColumns/price.py @@ -20,6 +20,7 @@ from gui.viewColumn import ViewColumn from gui import bitmapLoader from gui.utils.numberFormatter import formatAmount +from eos.types import Drone, Cargo import wx import service @@ -37,7 +38,16 @@ class Price(ViewColumn): sMkt = service.Market.getInstance() price = sMkt.getPriceNow(stuff.item.ID) - return formatAmount(price.price, 3, 3, 9, currency=True) if price and price.price else False + + if not price or not price.price: + return False + + price = price.price # Set new price variable with what we need + + if isinstance(stuff, Drone) or isinstance(stuff, Cargo): + price *= stuff.amount + + return formatAmount(price, 3, 3, 9, currency=True) def delayedText(self, mod, display, colItem): def callback(requests): diff --git a/gui/cargoView.py b/gui/cargoView.py index 49d3a0cf1..f7c856e1b 100644 --- a/gui/cargoView.py +++ b/gui/cargoView.py @@ -43,7 +43,8 @@ class CargoViewDrop(wx.PyDropTarget): class CargoView(d.Display): DEFAULT_COLS = ["Base Icon", "Base Name", - "attr:volume"] + "attr:volume", + "Price"] def __init__(self, parent): d.Display.__init__(self, parent, style=wx.LC_SINGLE_SEL | wx.BORDER_NONE) diff --git a/gui/droneView.py b/gui/droneView.py index 39ee82bf1..ddf16bf72 100644 --- a/gui/droneView.py +++ b/gui/droneView.py @@ -41,12 +41,13 @@ class DroneViewDrop(wx.PyDropTarget): class DroneView(d.Display): DEFAULT_COLS = ["State", - "Base Icon", + #"Base Icon", "Base Name", - "prop:droneDps,droneBandwidth", + # "prop:droneDps,droneBandwidth", "Max Range", "Miscellanea", - "attr:maxVelocity",] + "attr:maxVelocity", + "Price",] def __init__(self, parent): d.Display.__init__(self, parent, style=wx.LC_SINGLE_SEL | wx.BORDER_NONE)