Flesh out a lot of the small graphical specifics. Stilll needs a bit of work and a few bugs worked out, but I feel it's coming along.

This commit is contained in:
blitzmann
2018-06-08 22:34:15 -04:00
parent 542f2b3061
commit ab2d6dbf3a
2 changed files with 100 additions and 57 deletions

View File

@@ -19,7 +19,6 @@ from gui.bitmap_loader import BitmapLoader
class ItemMutator(wx.Panel):
ORDER = [Fit, Ship, Citadel, Mode, Module, Drone, Fighter, Implant, Booster, Skill]
def __init__(self, parent, stuff, item):
wx.Panel.__init__(self, parent)
@@ -29,15 +28,57 @@ class ItemMutator(wx.Panel):
self.activeFit = gui.mainFrame.MainFrame.getInstance().getActiveFit()
mainSizer = wx.BoxSizer(wx.VERTICAL)
self.goodColor = wx.Colour(96, 191, 0)
self.badColor = wx.Colour(255, 64, 0)
for x in stuff.mutaplasmid.attributes:
# convert to percentages
# JFC this is ugly as sin
min = round(x.min, 2)
max = round(x.max, 2)
value = stuff.itemModifiedAttributes.getOriginal(x.name)
slider = AttributeSlider(self, value, min, max)
mainSizer.Add(wx.StaticText(self, wx.ID_ANY, x.displayName), 1, wx.ALL | wx.EXPAND, 0)
mainSizer.Add(slider, 1, wx.ALL | wx.EXPAND, 0)
slider = AttributeSlider(self, value, min, max, not x.highIsGood)
slider.SetValue(value)
headingSizer = wx.BoxSizer(wx.HORIZONTAL)
minValue = round(value*min, 3)
maxValue = round(value*max, 3)
badValue = minValue if x.highIsGood else maxValue
goodValue = maxValue if x.highIsGood else minValue
print("{}: \nHigh is good: {}".format(x.displayName, x.highIsGood))
minIsGood = badValue < value if not x.highIsGood else value < badValue
maxIsGood = goodValue < value if not x.highIsGood else value < goodValue
print ("======")
print("Value {}".format(value))
print("Min {} ({}) (good: {})".format(minValue, min, minIsGood))
print("Max {} ({}) (good: {})".format(maxValue, max, maxIsGood))
font = parent.GetFont()
font.SetWeight(wx.BOLD)
headingSizer.Add(BitmapLoader.getStaticBitmap(x.info.icon.iconFile, self, "icons"), 0, wx.RIGHT, 10)
displayName = wx.StaticText(self, wx.ID_ANY, x.displayName)
displayName.SetFont(font)
headingSizer.Add(displayName, 1, wx.ALL | wx.EXPAND, 0)
range_low=wx.StaticText(self, wx.ID_ANY, str(badValue))
range_low.SetForegroundColour(self.goodColor if minIsGood else self.badColor)
range_high = wx.StaticText(self, wx.ID_ANY, str(goodValue))
range_high.SetForegroundColour(self.goodColor if maxIsGood else self.badColor)
headingSizer.Add(range_low, 0, wx.ALL | wx.EXPAND, 0)
headingSizer.Add(wx.StaticText(self, wx.ID_ANY, " - "), 0, wx.ALL | wx.EXPAND, 0)
headingSizer.Add(range_high, 0, wx.ALL | wx.EXPAND, 0)
mainSizer.Add(headingSizer, 0, wx.ALL | wx.EXPAND, 5)
mainSizer.Add(slider, 0, wx.RIGHT | wx.LEFT | wx.EXPAND, 10)
mainSizer.Add(wx.StaticLine(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL), 0, wx.ALL | wx.EXPAND, 0)