(self, stuff)
| 50 | return State_(mod.state).name.title() |
| 51 | |
| 52 | def getImageId(self, stuff): |
| 53 | generic_active = self.fittingView.imageList.GetImageIndex("state_%s_small" % State_.ACTIVE.name.lower(), "gui") |
| 54 | generic_inactive = self.fittingView.imageList.GetImageIndex("state_%s_small" % State_.OFFLINE.name.lower(), "gui") |
| 55 | |
| 56 | if isinstance(stuff, Drone): |
| 57 | if stuff.amountActive > 0: |
| 58 | return generic_active |
| 59 | else: |
| 60 | return generic_inactive |
| 61 | elif isinstance(stuff, Rack): |
| 62 | return -1 |
| 63 | elif isinstance(stuff, Module): |
| 64 | if stuff.isEmpty: |
| 65 | return -1 |
| 66 | else: |
| 67 | return self.fittingView.imageList.GetImageIndex("state_%s_small" % State_(stuff.state).name.lower(), |
| 68 | "gui") |
| 69 | elif isinstance(stuff, Fit): |
| 70 | fitID = self.mainFrame.getActiveFit() |
| 71 | |
| 72 | # Can't use isinstance here due to being prevented from importing CommandView. |
| 73 | # So we do the next best thing and compare Name of class. |
| 74 | if self.fittingView.__class__.__name__ == "CommandView": |
| 75 | info = stuff.getCommandInfo(fitID) |
| 76 | else: |
| 77 | info = stuff.getProjectionInfo(fitID) |
| 78 | |
| 79 | if info is None: |
| 80 | return -1 |
| 81 | if info.active: |
| 82 | return generic_active |
| 83 | return generic_inactive |
| 84 | elif isinstance(stuff, Implant) and stuff.character: |
| 85 | # if we're showing character implants, show an "online" state, which should not be changed |
| 86 | return self.fittingView.imageList.GetImageIndex("state_%s_small" % State_.ONLINE.name.lower(), "gui") |
| 87 | else: |
| 88 | active = getattr(stuff, "active", None) |
| 89 | if active is None: |
| 90 | return -1 |
| 91 | if active: |
| 92 | return generic_active |
| 93 | return generic_inactive |
| 94 | |
| 95 | |
| 96 | State.register() |
nothing calls this directly
no test coverage detected