Add "Can fit" grouping

This commit is contained in:
Ryan Holmes
2019-03-21 19:47:31 -04:00
parent 5940625e24
commit 1603201166
3 changed files with 20 additions and 3 deletions

View File

@@ -207,8 +207,15 @@ AttrGroupDict = {
"fighterSquadronOrbitRange",
]
},
GuiAttrGroup.SHIP_GROUP : {
"label" : "Can Fit To",
"attributes": []
},
}
AttrGroupDict[GuiAttrGroup.SHIP_GROUP]["attributes"].extend([("canFitShipGroup{:02d}".format(i+1), "Group") for i in range(20)])
AttrGroupDict[GuiAttrGroup.SHIP_GROUP]["attributes"].extend([("canFitShipType{:01d}".format(i+1), "Ship") for i in range(20)])
Group1 = [
GuiAttrGroup.FITTING,
GuiAttrGroup.STRUCTURE,
@@ -222,6 +229,7 @@ Group1 = [
GuiAttrGroup.ON_DEATH,
GuiAttrGroup.JUMP_SYSTEMS,
GuiAttrGroup.PROPULSIONS,
GuiAttrGroup.SHIP_GROUP
]
CategoryGroups = {

View File

@@ -173,9 +173,15 @@ class ItemParams(wx.Panel):
self.paramList.AssignImageList(self.imageList)
def AddAttribute(self, parent, attr):
display = None
if isinstance(attr, tuple):
display = attr[1]
attr = attr[0]
if attr in self.attrValues and attr not in self.processed_attribs:
data = self.GetData(attr)
data = self.GetData(attr, display)
if data is None:
return
@@ -203,7 +209,7 @@ class ItemParams(wx.Panel):
misc_parent = root
# We must first deet4ermine if it's categorey already has defined groupings set for it. Otherwise, we default to just using the fitting group
order = CategoryGroups.get(self.item.category.categoryName, [GuiAttrGroup.FITTING])
order = CategoryGroups.get(self.item.category.categoryName, [GuiAttrGroup.FITTING, GuiAttrGroup.SHIP_GROUP])
# start building out the tree
for data in [AttrGroupDict[o] for o in order]:
heading = data.get("label")
@@ -257,6 +263,8 @@ class ItemParams(wx.Panel):
self.paramList.SetColumnWidth(i, wx.LIST_AUTOSIZE)
def GetData(self, attr):
def GetData(self, attr, displayOveride = None):
info = self.attrInfo.get(attr)
att = self.attrValues[attr]
@@ -275,7 +283,7 @@ class ItemParams(wx.Panel):
return None
if info and info.displayName and self.toggleView == AttributeView.NORMAL:
attrName = info.displayName
attrName = displayOveride or info.displayName
else:
attrName = attr

View File

@@ -101,3 +101,4 @@ class GuiAttrGroup(IntEnum):
JUMP_SYSTEMS = auto()
PROPULSIONS = auto()
FIGHTERS = auto()
SHIP_GROUP = auto()