From 887ad4d9f694b1b496d2f5b194b9ba50f132d083 Mon Sep 17 00:00:00 2001 From: cncfanatics Date: Tue, 2 Nov 2010 10:04:21 +0100 Subject: [PATCH] Prettify the missing skills tooltip a bit by also displaying the item requiring said skills --- eos | 2 +- gui/characterSelection.py | 13 +++++++++---- gui/projectedView.py | 2 +- service/character.py | 5 ++++- 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/eos b/eos index 2dc357ce1..6f6c3b488 160000 --- a/eos +++ b/eos @@ -1 +1 @@ -Subproject commit 2dc357ce1fe4f2bf6f8d337c795f41be371b4555 +Subproject commit 6f6c3b488044102879fff4358f97f881224e616b diff --git a/gui/characterSelection.py b/gui/characterSelection.py index a17d753e2..3cc0f985c 100644 --- a/gui/characterSelection.py +++ b/gui/characterSelection.py @@ -132,9 +132,14 @@ class CharacterSelection(wx.Panel): def _buildSkillsTooltip(self, reqs, tabulationLevel = 0): tip = "" - for name, info in reqs.iteritems(): - level, more = info - tip += "%s%s: %d\n" % (" " * tabulationLevel, name, level) - tip += self._buildSkillsTooltip(more, tabulationLevel + 1) + if tabulationLevel == 0: + for item, subReqs in reqs.iteritems(): + tip += "%s:\n" % item.name + tip += self._buildSkillsTooltip(subReqs, 1) + else: + for name, info in reqs.iteritems(): + level, more = info + tip += "%s%s: %d\n" % (" " * tabulationLevel, name, level) + tip += self._buildSkillsTooltip(more, tabulationLevel + 1) return tip diff --git a/gui/projectedView.py b/gui/projectedView.py index f6c1a0a17..8e4ca756c 100644 --- a/gui/projectedView.py +++ b/gui/projectedView.py @@ -33,7 +33,7 @@ class ProjectedView(d.Display): "Projected Ammo"] def __init__(self, parent): - d.Display.__init__(self, parent) + d.Display.__init__(self, parent, style = wx.LC_SINGLE_SEL) self.mainFrame.Bind(fv.FIT_CHANGED, self.fitChanged) self.Bind(wx.EVT_LEFT_DOWN, self.click) self.Bind(wx.EVT_RIGHT_DOWN, self.click) diff --git a/service/character.py b/service/character.py index 182b27c05..cc3c237ab 100644 --- a/service/character.py +++ b/service/character.py @@ -146,8 +146,11 @@ class Character(): for thing in itertools.chain(fit.modules, fit.drones, (fit.ship,)): for attr in ("item", "charge"): subThing = getattr(thing, attr, None) + subReqs = {} if subThing is not None: - self._checkRequirements(fit, fit.character, subThing, reqs) + self._checkRequirements(fit, fit.character, subThing, subReqs) + if subReqs: + reqs[subThing] = subReqs return reqs