def handleListDrag(self, x, y, data): """ Handles dragging of items from various pyfa displays which support it data is list with two indices: data[0] is hard-coded str of originating source data[1] is typeID or index of data we want to manipulate """ fitID = self.mainFrame.getActiveFit() fit = Fit.getInstance().getFit(fitID) if data[0] == 'fitting': dstRow, _ = self.HitTest((x, y)) # Gather module information to get position self.mainFrame.command.Submit( cmd.GuiAddProjectedModuleCommand(fitID=fitID, itemID=fit.modules[int( data[1])].itemID)) elif data[0] == 'market': itemID = int(data[1]) item = Market.getInstance().getItem(itemID) if item.isModule: self.mainFrame.command.Submit( cmd.GuiAddProjectedModuleCommand(fitID=fitID, itemID=itemID)) elif item.isDrone: self.mainFrame.command.Submit( cmd.GuiAddProjectedDroneCommand(fitID=fitID, itemID=itemID)) elif item.isFighter: self.mainFrame.command.Submit( cmd.GuiAddProjectedFighterCommand(fitID=fitID, itemID=itemID))
def activate(self, callingWindow, fullContext, mainItem, i): fitID = self.mainFrame.getActiveFit() if mainItem.isModule: success = self.mainFrame.command.Submit(cmd.GuiAddProjectedModuleCommand(fitID=fitID, itemID=mainItem.ID)) elif mainItem.isDrone: success = self.mainFrame.command.Submit(cmd.GuiAddProjectedDroneCommand(fitID=fitID, itemID=mainItem.ID)) elif mainItem.isFighter: success = self.mainFrame.command.Submit(cmd.GuiAddProjectedFighterCommand(fitID=fitID, itemID=mainItem.ID)) else: success = False if success: self.mainFrame.additionsPane.select('Projected', focus=False)
def activate(self, fullContext, selection, i): fitID = self.mainFrame.getActiveFit() category = selection[0].category.name if category == 'Module': success = self.mainFrame.command.Submit( cmd.GuiAddProjectedModuleCommand(fitID=fitID, itemID=selection[0].ID)) elif category == 'Drone': success = self.mainFrame.command.Submit( cmd.GuiAddProjectedDroneCommand(fitID=fitID, itemID=selection[0].ID)) elif category == 'Fighter': success = self.mainFrame.command.Submit( cmd.GuiAddProjectedFighterCommand(fitID=fitID, itemID=selection[0].ID)) else: success = False if success: self.mainFrame.additionsPane.select('Projected')