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

Class BoosterView

gui/builtinAdditionPanes/boosterView.py:54–252  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52
53
54class BoosterView(d.Display):
55
56 DEFAULT_COLS = [
57 "State",
58 "attr:boosterness",
59 "Base Name",
60 "Side Effects",
61 "Price",
62 "Miscellanea",
63 ]
64
65 def __init__(self, parent):
66 d.Display.__init__(self, parent, style=wx.BORDER_NONE)
67
68 self.lastFitId = None
69
70 self.mainFrame.Bind(GE.FIT_CHANGED, self.fitChanged)
71 self.mainFrame.Bind(ITEM_SELECTED, self.addItem)
72
73 self.Bind(wx.EVT_LEFT_DCLICK, self.onLeftDoubleClick)
74 self.Bind(wx.EVT_LEFT_DOWN, self.click)
75 self.Bind(wx.EVT_KEY_UP, self.kbEvent)
76
77 self.SetDropTarget(BoosterViewDrop(self.handleListDrag))
78
79 self.Bind(wx.EVT_CONTEXT_MENU, self.spawnMenu)
80
81 def handleListDrag(self, x, y, data):
82 """
83 Handles dragging of items from various pyfa displays which support it
84
85 data is list with two indices:
86 data[0] is hard-coded str of originating source
87 data[1] is typeID or index of data we want to manipulate
88 """
89
90 if data[0] == "market":
91 wx.PostEvent(self.mainFrame, ItemSelected(itemID=int(data[1])))
92
93 def kbEvent(self, event):
94 keycode = event.GetKeyCode()
95 modifiers = event.GetModifiers()
96 if keycode == wx.WXK_ESCAPE and modifiers == wx.MOD_NONE:
97 self.unselectAll()
98 elif keycode == 65 and modifiers == wx.MOD_CONTROL:
99 self.selectAll()
100 elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and modifiers == wx.MOD_NONE:
101 boosters = self.getSelectedBoosters()
102 self.removeBoosters(boosters)
103 event.Skip()
104
105 def fitChanged(self, event):
106 event.Skip()
107 activeFitID = self.mainFrame.getActiveFit()
108 if activeFitID is not None and activeFitID not in event.fitIDs:
109 return
110
111 sFit = Fit.getInstance()

Callers 1

__init__Method · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected