MCPcopy Index your code
hub / github.com/pyfa-org/Pyfa / ProjectedView

Class ProjectedView

gui/builtinAdditionPanes/projectedView.py:77–433  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75
76
77class ProjectedView(d.Display):
78 DEFAULT_COLS = ['State',
79 'Ammo Icon',
80 'Base Icon',
81 'Base Name',
82 'Ammo',
83 'Projection Range']
84
85 def __init__(self, parent):
86 d.Display.__init__(self, parent, style=wx.BORDER_NONE)
87
88 self.lastFitId = None
89
90 self.mainFrame.Bind(GE.FIT_CHANGED, self.fitChanged)
91 self.mainFrame.Bind(GE.FIT_REMOVED, self.OnFitRemoved)
92 self.Bind(wx.EVT_LEFT_DOWN, self.click)
93 self.Bind(wx.EVT_RIGHT_DOWN, self.click)
94 self.Bind(wx.EVT_LEFT_DCLICK, self.onLeftDoubleClick)
95 self.Bind(wx.EVT_KEY_UP, self.kbEvent)
96
97 self.Bind(wx.EVT_CONTEXT_MENU, self.spawnMenu)
98
99 self.SetDropTarget(ProjectedViewDrop(self.handleListDrag))
100
101 def OnFitRemoved(self, event):
102 event.Skip()
103 fitID = self.mainFrame.getActiveFit()
104 fit = Fit.getInstance().getFit(fitID)
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()
134 modifiers = event.GetModifiers()

Callers 1

__init__Method · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected