MCPcopy Create free account
hub / github.com/pyfa-org/Pyfa / handleListDrag

Method handleListDrag

gui/builtinAdditionPanes/projectedView.py:107–130  ·  view source on GitHub ↗

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

(self, x, y, data)

Source from the content-addressed store, hash-verified

105 self.refreshContents(fit)
106
107 def handleListDrag(self, x, y, data):
108 """
109 Handles dragging of items from various pyfa displays which support it
110
111 data is list with two indices:
112 data[0] is hard-coded str of originating source
113 data[1] is typeID or index of data we want to manipulate
114 """
115 fitID = self.mainFrame.getActiveFit()
116 fit = Fit.getInstance().getFit(fitID)
117 if data[0] == 'fitting':
118 dstRow, _ = self.HitTest((x, y))
119 # Gather module information to get position
120 self.mainFrame.command.Submit(cmd.GuiAddProjectedModuleCommand(
121 fitID=fitID, itemID=fit.modules[int(data[1])].itemID))
122 elif data[0] == 'market':
123 itemID = int(data[1])
124 item = Market.getInstance().getItem(itemID)
125 if item.isModule:
126 self.mainFrame.command.Submit(cmd.GuiAddProjectedModuleCommand(fitID=fitID, itemID=itemID))
127 elif item.isDrone:
128 self.mainFrame.command.Submit(cmd.GuiAddProjectedDroneCommand(fitID=fitID, itemID=itemID))
129 elif item.isFighter:
130 self.mainFrame.command.Submit(cmd.GuiAddProjectedFighterCommand(fitID=fitID, itemID=itemID))
131
132 def kbEvent(self, event):
133 keycode = event.GetKeyCode()

Callers

nothing calls this directly

Calls 5

getFitMethod · 0.80
getItemMethod · 0.80
getActiveFitMethod · 0.45
getInstanceMethod · 0.45
HitTestMethod · 0.45

Tested by

no test coverage detected