本文整理汇总了Python中eos.types.Module.buildEmpty方法的典型用法代码示例。如果您正苦于以下问题:Python Module.buildEmpty方法的具体用法?Python Module.buildEmpty怎么用?Python Module.buildEmpty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eos.types.Module
的用法示例。
在下文中一共展示了Module.buildEmpty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: fill
# 需要导入模块: from eos.types import Module [as 别名]
# 或者: from eos.types.Module import buildEmpty [as 别名]
def fill(self):
"""
Fill this fit's module slots with enough dummy slots so that all slots are used.
This is mostly for making the life of gui's easier.
GUI's can call fill() and then stop caring about empty slots completely.
"""
if self.ship is None:
return
for slotType in (Slot.LOW, Slot.MED, Slot.HIGH, Slot.RIG, Slot.SUBSYSTEM):
amount = self.getSlotsFree(slotType, True)
if amount > 0:
for _ in xrange(int(amount)):
self.modules.append(Module.buildEmpty(slotType))
if amount < 0:
#Look for any dummies of that type to remove
toRemove = []
for mod in self.modules:
if mod.isEmpty and mod.slot == slotType:
toRemove.append(mod)
amount += 1
if amount == 0:
break
for mod in toRemove:
self.modules.remove(mod)