Пример #1
0
    def swapModule(self, x, y, modIdx):
        """Swap a module from fitting window with cargo"""
        sFit = Fit.getInstance()
        fit = sFit.getFit(self.mainFrame.getActiveFit())
        dstRow, _ = self.HitTest((x, y))
        mstate = wx.GetMouseState()

        self.mainFrame.command.Submit(cmd.GuiLocalModuleToCargoCommand(
            fitID=self.mainFrame.getActiveFit(),
            modPosition=fit.modules[modIdx].modPosition,
            cargoItemID=self.cargo[dstRow].itemID if dstRow > -1 else None,
            copy=mstate.cmdDown))
Пример #2
0
    def swapModule(self, x, y, modIdx):
        """Swap a module from fitting window with cargo"""
        sFit = Fit.getInstance()
        fit = sFit.getFit(self.mainFrame.getActiveFit())
        dstRow, _ = self.HitTest((x, y))

        if dstRow > -1:
            try:
                dstCargoItemID = getattr(self.cargo[dstRow], 'itemID', None)
            except IndexError:
                dstCargoItemID = None
        else:
            dstCargoItemID = None

        self.mainFrame.command.Submit(cmd.GuiLocalModuleToCargoCommand(
            fitID=self.mainFrame.getActiveFit(),
            modPosition=modIdx,
            cargoItemID=dstCargoItemID,
            copy=wx.GetMouseState().GetModifiers() == wx.MOD_CONTROL))