(mod, click, proposedState=None)
| 1059 | |
| 1060 | @staticmethod |
| 1061 | def getProposedState(mod, click, proposedState=None): |
| 1062 | pyfalog.debug("Get proposed state for module.") |
| 1063 | if mod.slot == FittingSlot.SUBSYSTEM or mod.isEmpty: |
| 1064 | return FittingModuleState.ONLINE |
| 1065 | |
| 1066 | if mod.slot == FittingSlot.SYSTEM: |
| 1067 | transitionMap = ProjectedSystem |
| 1068 | else: |
| 1069 | transitionMap = ProjectedMap if mod.projected else LocalMap |
| 1070 | |
| 1071 | currState = mod.state |
| 1072 | |
| 1073 | if proposedState is not None: |
| 1074 | state = proposedState |
| 1075 | elif click == "right": |
| 1076 | state = FittingModuleState.OVERHEATED |
| 1077 | elif click == "ctrl": |
| 1078 | state = FittingModuleState.OFFLINE |
| 1079 | else: |
| 1080 | try: |
| 1081 | state = transitionMap[currState] |
| 1082 | except KeyError: |
| 1083 | state = min(transitionMap) |
| 1084 | # If passive module tries to transition into online and fails, |
| 1085 | # put it to passive instead |
| 1086 | if not mod.isValidState(state) and currState == FittingModuleState.ONLINE: |
| 1087 | state = FittingModuleState.OFFLINE |
| 1088 | |
| 1089 | return mod.getMaxState(proposedState=state) |
| 1090 | |
| 1091 | def __deepcopy__(self, memo): |
| 1092 | item = self.item |
no test coverage detected