Swap a module from fitting window with cargo
(self, x, y, modIdx)
| 146 | event.Skip() |
| 147 | |
| 148 | def swapModule(self, x, y, modIdx): |
| 149 | """Swap a module from fitting window with cargo""" |
| 150 | sFit = Fit.getInstance() |
| 151 | fit = sFit.getFit(self.mainFrame.getActiveFit()) |
| 152 | dstRow, _ = self.HitTest((x, y)) |
| 153 | |
| 154 | if dstRow > -1: |
| 155 | try: |
| 156 | dstCargoItemID = getattr(self.cargo[dstRow], 'itemID', None) |
| 157 | except IndexError: |
| 158 | dstCargoItemID = None |
| 159 | else: |
| 160 | dstCargoItemID = None |
| 161 | |
| 162 | self.mainFrame.command.Submit(cmd.GuiLocalModuleToCargoCommand( |
| 163 | fitID=self.mainFrame.getActiveFit(), |
| 164 | modPosition=modIdx, |
| 165 | cargoItemID=dstCargoItemID, |
| 166 | copy=wx.GetMouseState().GetModifiers() == wx.MOD_CONTROL)) |
| 167 | |
| 168 | def fitChanged(self, event): |
| 169 | event.Skip() |
no test coverage detected