Tooltip to Ships and Fittings
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import wx
|
||||
import re
|
||||
import copy
|
||||
from gui.bitmapLoader import BitmapLoader
|
||||
import gui.mainFrame
|
||||
@@ -742,17 +743,17 @@ class ShipBrowser(wx.Panel):
|
||||
fits = sFit.countFitsWithShip(ship.ID)
|
||||
t_fits += fits
|
||||
filter = subRacesFilter[ship.race] if ship.race else True
|
||||
|
||||
shipTrait = re.sub("<.*?>", " ", ship.traits.traitText)
|
||||
if override:
|
||||
filter = True
|
||||
|
||||
if self.filterShipsWithNoFits:
|
||||
if fits>0:
|
||||
if filter:
|
||||
self.lpane.AddWidget(ShipItem(self.lpane, ship.ID, (ship.name, fits), ship.race))
|
||||
if filter:
|
||||
self.lpane.AddWidget(ShipItem(self.lpane, ship.ID, (ship.name, shipTrait, fits), ship.race))
|
||||
else:
|
||||
if filter:
|
||||
self.lpane.AddWidget(ShipItem(self.lpane, ship.ID, (ship.name, fits), ship.race))
|
||||
self.lpane.AddWidget(ShipItem(self.lpane, ship.ID, (ship.name, shipTrait, fits), ship.race))
|
||||
|
||||
self.raceselect.RebuildRaces(racesList)
|
||||
|
||||
@@ -843,12 +844,13 @@ class ShipBrowser(wx.Panel):
|
||||
|
||||
fitList.sort(key=self.nameKey)
|
||||
shipName = ship.name
|
||||
shipTrait = re.sub("<.*?>", " ", ship.traits.traitText)
|
||||
|
||||
self._stage3ShipName = shipName
|
||||
self._stage3Data = shipID
|
||||
|
||||
for ID, name, booster, timestamp in fitList:
|
||||
self.lpane.AddWidget(FitItem(self.lpane, ID, (shipName, name, booster, timestamp),shipID))
|
||||
self.lpane.AddWidget(FitItem(self.lpane, ID, (shipName, shipTrait, name, booster, timestamp),shipID))
|
||||
|
||||
self.lpane.RefreshList()
|
||||
self.lpane.Thaw()
|
||||
@@ -880,12 +882,15 @@ class ShipBrowser(wx.Panel):
|
||||
if query:
|
||||
ships = sMkt.searchShips(query)
|
||||
fitList = sFit.searchFits(query)
|
||||
|
||||
|
||||
for ship in ships:
|
||||
self.lpane.AddWidget(ShipItem(self.lpane, ship.ID, (ship.name, len(sFit.getFitsWithShip(ship.ID))), ship.race))
|
||||
|
||||
shipTrait = re.sub("<.*?>", " ", ship.traits.traitText)
|
||||
self.lpane.AddWidget(ShipItem(self.lpane, ship.ID, (ship.name, shipTrait, len(sFit.getFitsWithShip(ship.ID))), ship.race))
|
||||
|
||||
for ID, name, shipID, shipName, booster, timestamp in fitList:
|
||||
self.lpane.AddWidget(FitItem(self.lpane, ID, (shipName, name, booster, timestamp), shipID))
|
||||
ship = sMkt.getItem(shipID)
|
||||
shipTrait = re.sub("<.*?>", " ", ship.traits.traitText)
|
||||
self.lpane.AddWidget(FitItem(self.lpane, ID, (shipName, shipTrait, name, booster, timestamp), shipID))
|
||||
if len(ships) == 0 and len(fitList) == 0 :
|
||||
self.lpane.AddWidget(PFStaticText(self.lpane, label = u"No matching results."))
|
||||
self.lpane.RefreshList(doFocus = False)
|
||||
@@ -924,6 +929,7 @@ class ShipBrowser(wx.Panel):
|
||||
self.lpane,
|
||||
fit.ID, (
|
||||
fit.ship.item.name,
|
||||
re.sub("<.*?>", " ", fit.ship.traits.traitText),
|
||||
fit.name,
|
||||
fit.booster,
|
||||
fit.timestamp),
|
||||
@@ -1080,7 +1086,7 @@ class CategoryItem(SFItem.SFBrowserItem):
|
||||
|
||||
|
||||
class ShipItem(SFItem.SFBrowserItem):
|
||||
def __init__(self, parent, shipID=None, shipFittingInfo=("Test", 2), itemData=None,
|
||||
def __init__(self, parent, shipID=None, shipFittingInfo=("Test","TestTrait", 2), itemData=None,
|
||||
id=wx.ID_ANY, pos=wx.DefaultPosition,
|
||||
size=(0, 40), style=0):
|
||||
SFItem.SFBrowserItem.__init__(self, parent, size = size)
|
||||
@@ -1104,7 +1110,7 @@ class ShipItem(SFItem.SFBrowserItem):
|
||||
self.shipBmp = BitmapLoader.getBitmap("ship_no_image_big", "gui")
|
||||
|
||||
self.shipFittingInfo = shipFittingInfo
|
||||
self.shipName, self.shipFits = shipFittingInfo
|
||||
self.shipName, self.shipTrait, self.shipFits = shipFittingInfo
|
||||
|
||||
self.newBmp = BitmapLoader.getBitmap("fit_add_small", "gui")
|
||||
self.acceptBmp = BitmapLoader.getBitmap("faccept_small", "gui")
|
||||
@@ -1122,6 +1128,8 @@ class ShipItem(SFItem.SFBrowserItem):
|
||||
|
||||
self.raceDropShadowBmp = drawUtils.CreateDropShadowBitmap(self.raceBmp, 0.2)
|
||||
|
||||
self.SetToolTip(wx.ToolTip(self.shipTrait))
|
||||
|
||||
self.shipBrowser = self.Parent.Parent
|
||||
|
||||
self.editWidth = 150
|
||||
@@ -1198,7 +1206,7 @@ class ShipItem(SFItem.SFBrowserItem):
|
||||
self.newBtn.SetBitmap(self.newBmp)
|
||||
self.Refresh()
|
||||
else:
|
||||
shipName, fittings = self.shipFittingInfo
|
||||
shipName, shipTrait, fittings = self.shipFittingInfo
|
||||
if fittings > 0:
|
||||
wx.PostEvent(self.shipBrowser, Stage3Selected(shipID=self.shipID, back=True))
|
||||
else:
|
||||
@@ -1264,7 +1272,7 @@ class ShipItem(SFItem.SFBrowserItem):
|
||||
|
||||
self.shipNamey = (rect.height - self.shipBmp.GetHeight()) / 2
|
||||
|
||||
shipName, fittings = self.shipFittingInfo
|
||||
shipName, shipTrait, fittings = self.shipFittingInfo
|
||||
|
||||
mdc.SetFont(self.fontBig)
|
||||
wtext, htext = mdc.GetTextExtent(shipName)
|
||||
@@ -1303,7 +1311,7 @@ class ShipItem(SFItem.SFBrowserItem):
|
||||
mdc.DrawBitmap(self.raceDropShadowBmp, self.raceBmpx + 1, self.raceBmpy + 1)
|
||||
mdc.DrawBitmap(self.raceBmp,self.raceBmpx, self.raceBmpy)
|
||||
|
||||
shipName, fittings = self.shipFittingInfo
|
||||
shipName, shipTrait, fittings = self.shipFittingInfo
|
||||
|
||||
if fittings <1:
|
||||
fformat = "No fits"
|
||||
@@ -1401,7 +1409,7 @@ class PFBitmapFrame(wx.Frame):
|
||||
|
||||
|
||||
class FitItem(SFItem.SFBrowserItem):
|
||||
def __init__(self, parent, fitID=None, shipFittingInfo=("Test", "cnc's avatar", 0, 0 ), shipID = None, itemData=None,
|
||||
def __init__(self, parent, fitID=None, shipFittingInfo=("Test", "TestTrait", "cnc's avatar", 0, 0 ), shipID = None, itemData=None,
|
||||
id=wx.ID_ANY, pos=wx.DefaultPosition,
|
||||
size=(0, 40), style=0):
|
||||
|
||||
@@ -1435,7 +1443,7 @@ class FitItem(SFItem.SFBrowserItem):
|
||||
self.shipBmp = BitmapLoader.getBitmap("ship_no_image_big","gui")
|
||||
|
||||
self.shipFittingInfo = shipFittingInfo
|
||||
self.shipName, self.fitName, self.fitBooster, self.timestamp = shipFittingInfo
|
||||
self.shipName, self.shipTrait, self.fitName, self.fitBooster, self.timestamp = shipFittingInfo
|
||||
|
||||
# see GH issue #62
|
||||
if self.fitBooster is None: self.fitBooster = False
|
||||
@@ -1456,6 +1464,7 @@ class FitItem(SFItem.SFBrowserItem):
|
||||
|
||||
self.bkBitmap = None
|
||||
|
||||
self.SetToolTip(wx.ToolTip(self.shipName+'\n--------------------------\n'+self.shipTrait))
|
||||
self.padding = 4
|
||||
self.editWidth = 150
|
||||
|
||||
@@ -1805,7 +1814,7 @@ class FitItem(SFItem.SFBrowserItem):
|
||||
|
||||
mdc.DrawBitmap(self.shipBmp, self.shipBmpx, self.shipBmpy, 0)
|
||||
|
||||
shipName, fittings, booster, timestamp = self.shipFittingInfo
|
||||
shipName, shipTrait, fittings, booster, timestamp = self.shipFittingInfo
|
||||
|
||||
mdc.SetFont(self.fontNormal)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user