Merge branch 'master' into price_optimize

This commit is contained in:
DarkPhoenix
2019-03-12 14:25:51 +03:00

View File

@@ -28,7 +28,7 @@ class ItemParams(wx.Panel):
mainSizer.Add(self.paramList, 1, wx.ALL | wx.EXPAND, 0)
self.SetSizer(mainSizer)
self.toggleView = 1
self.toggleView = AttributeView.NORMAL
self.stuff = stuff
self.item = item
self.attrInfo = {}
@@ -62,6 +62,8 @@ class ItemParams(wx.Panel):
mainSizer.Add(bSizer, 0, wx.ALIGN_RIGHT)
self.imageList = wx.ImageList(16, 16)
self.PopulateList()
self.toggleViewBtn.Bind(wx.EVT_TOGGLEBUTTON, self.ToggleViewMode)
@@ -164,6 +166,14 @@ class ItemParams(wx.Panel):
]
)
def SetupImageList(self):
self.imageList.RemoveAll()
self.blank_icon = self.imageList.Add(BitmapLoader.getBitmap("transparent16x16", "gui"))
self.unknown_icon = self.imageList.Add(BitmapLoader.getBitmap("0", "icons"))
self.paramList.AssignImageList(self.imageList)
def AddAttribute(self, parent, attr):
if attr in self.attrValues and attr not in self.processed_attribs:
@@ -188,7 +198,7 @@ class ItemParams(wx.Panel):
def PopulateList(self):
# self.paramList.setResizeColumn(0)
self.imageList = wx.ImageList(16, 16)
self.SetupImageList()
self.processed_attribs = set()
root = self.paramList.AddRoot("The Root Item")
@@ -243,7 +253,6 @@ class ItemParams(wx.Panel):
self.AddAttribute(root, name)
self.paramList.AssignImageList(self.imageList)
self.Layout()
def GetData(self, attr):
@@ -264,7 +273,7 @@ class ItemParams(wx.Panel):
if self.toggleView == AttributeView.NORMAL and ((attr not in GroupedAttributes and not value) or info is None or not info.published or attr in RequiredSkillAttrs):
return None
if info and info.displayName and self.toggleView == 1:
if info and info.displayName and self.toggleView == AttributeView.NORMAL:
attrName = info.displayName
else:
attrName = attr
@@ -278,27 +287,27 @@ class ItemParams(wx.Panel):
icon = BitmapLoader.getBitmap(iconFile, "icons")
if icon is None:
icon = BitmapLoader.getBitmap("transparent16x16", "gui")
attrIcon = self.imageList.Add(icon)
attrIcon = self.blank_icon
else:
attrIcon = self.imageList.Add(icon)
else:
attrIcon = self.imageList.Add(BitmapLoader.getBitmap("0", "icons"))
attrIcon = self.unknown_icon
else:
attrIcon = self.imageList.Add(BitmapLoader.getBitmap("0", "icons"))
attrIcon = self.unknown_icon
# index = self.paramList.AppendItem(root, attrName)
# idNameMap[idCount] = attrName
# self.paramList.SetPyData(index, idCount)
# idCount += 1
if self.toggleView != 1:
if self.toggleView == AttributeView.RAW:
valueUnit = str(value)
elif info and info.unit:
valueUnit = self.FormatValue(*info.unit.PreformatValue(value))
else:
valueUnit = formatAmount(value, 3, 0, 0)
if self.toggleView != 1:
if self.toggleView == AttributeView.RAW:
valueUnitDefault = str(valueDefault)
elif info and info.unit:
valueUnitDefault = self.FormatValue(*info.unit.PreformatValue(valueDefault))