diff --git a/eos b/eos index 219a16227..c000423ee 160000 --- a/eos +++ b/eos @@ -1 +1 @@ -Subproject commit 219a1622711cc53c6bc60e7b46d04e3219397cc7 +Subproject commit c000423ee92a864e7d5a4c657cc11fc29ac92fa6 diff --git a/gui/builtinViewColumns/attributeDisplay.py b/gui/builtinViewColumns/attributeDisplay.py index 6e16c266d..a36798921 100644 --- a/gui/builtinViewColumns/attributeDisplay.py +++ b/gui/builtinViewColumns/attributeDisplay.py @@ -54,15 +54,32 @@ class AttributeDisplay(ViewColumn): self.columnText = info.displayName if info.displayName != "" else info.name self.mask |= wx.LIST_MASK_IMAGE + if params["direct"]: + self.direct = True + self.view = fittingView + originalRefresh = fittingView.refresh + sMarket = service.Market.getInstance() + #Hack into our master view and add a callback for ourselves to know when to query + def refresh(stuff): + self.directInfo = sMarket.directRequest(stuff, info.ID) if stuff is not None else None + originalRefresh(stuff) + + fittingView.refresh = refresh + def getText(self, mod): if hasattr(mod, "item"): attr = mod.getModifiedItemAttr(self.info.name) else: - attr = mod.getAttribute(self.info.name) - if attr: + if self.direct: + info = self.directInfo + attr = info.get(mod.ID, "") if info else "" + else: + attr = mod.getAttribute(self.info.name) + + if isinstance(attr, (float, int)): return (formatAmount(attr, 3, 0, 3)) else: - return "" + return attr if attr is not None else "" def getImageId(self, mod): return -1 @@ -71,6 +88,7 @@ class AttributeDisplay(ViewColumn): def getParameters(): return (("attribute", str, None), ("displayName", bool, False), - ("showIcon", bool, True)) + ("showIcon", bool, True), + ("direct", bool, True)) AttributeDisplay.register() diff --git a/gui/display.py b/gui/display.py index ae13be38b..ab5e4bd0a 100644 --- a/gui/display.py +++ b/gui/display.py @@ -46,8 +46,9 @@ class Display(wx.ListCtrl): for x, param in enumerate(paramList): name, type, defaultValue = param value = params[x] if len(params) > x else defaultValue - if type == bool: - value = bool(value) if value != "False" else False + value = value if value != "" else defaultValue + if type == bool and isinstance(value, basestring): + value = bool(value) if value.lower() != "false" and value != "0" else False paramDict[name] = value col = colClass(self, paramDict) else: diff --git a/gui/marketBrowser.py b/gui/marketBrowser.py index 906716391..09159314b 100644 --- a/gui/marketBrowser.py +++ b/gui/marketBrowser.py @@ -199,7 +199,9 @@ class MarketTree(wx.TreeCtrl): class ItemView(d.Display): DEFAULT_COLS = ["Base Icon", - "Base Name"] + "Base Name", + "attr:power,,,True", + "attr:cpu,,,True"] def __init__(self, parent, marketBrowser): d.Display.__init__(self, parent) diff --git a/service/market.py b/service/market.py index 8a16e6a4a..5571bdf41 100644 --- a/service/market.py +++ b/service/market.py @@ -25,6 +25,8 @@ import threading from sqlalchemy.orm.exc import NoResultFound import Queue import traceback +import sqlalchemy.sql +import sqlalchemy.orm class ShipBrowserWorkerThread(threading.Thread): def run(self): @@ -334,3 +336,12 @@ class Market(): eos.db.commit() self.priceWorkerThread.trigger(requests, cb) + + def directRequest(self, items, attrID): + itemIDs = map(lambda i: i.ID, items) + info = {} + for ID, val in eos.db.directAttributeRequest(itemIDs, attrID): + info[ID] = val + + return info +