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

Method handleDragDrop

gui/builtinAdditionPanes/droneView.py:159–185  ·  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

157 dropSource.DoDragDrop()
158
159 def handleDragDrop(self, x, y, data):
160 """
161 Handles dragging of items from various pyfa displays which support it
162
163 data is list with two indices:
164 data[0] is hard-coded str of originating source
165 data[1] is typeID or index of data we want to manipulate
166 """
167 if data[0] == "drone":
168 srcRow = int(data[1])
169 if srcRow != -1:
170 if wx.GetMouseState().GetModifiers() == wx.MOD_CONTROL:
171 try:
172 srcDrone = self.drones[srcRow]
173 except IndexError:
174 return
175 if srcDrone not in self.original:
176 return
177 self.mainFrame.command.Submit(cmd.GuiCloneLocalDroneCommand(
178 fitID=self.mainFrame.getActiveFit(),
179 position=self.original.index(srcDrone)))
180 else:
181 dstRow, _ = self.HitTest((x, y))
182 if dstRow != -1:
183 self._merge(srcRow, dstRow)
184 elif data[0] == "market":
185 wx.PostEvent(self.mainFrame, ItemSelected(itemID=int(data[1])))
186
187 def _merge(self, srcRow, dstRow):
188 fitID = self.mainFrame.getActiveFit()

Callers

nothing calls this directly

Calls 3

_mergeMethod · 0.95
getActiveFitMethod · 0.45
HitTestMethod · 0.45

Tested by

no test coverage detected