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

Class CommandView

gui/builtinAdditionPanes/commandView.py:68–278  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66
67
68class CommandView(d.Display):
69
70 DEFAULT_COLS = ["State", "Base Name"]
71
72 def __init__(self, parent):
73 d.Display.__init__(self, parent, style=wx.BORDER_NONE)
74
75 self.lastFitId = None
76
77 self.mainFrame.Bind(GE.FIT_CHANGED, AddCommandFit.fitChanged)
78 self.mainFrame.Bind(GE.FIT_REMOVED, self.OnFitRemoved)
79 self.mainFrame.Bind(GE.FIT_CHANGED, self.fitChanged)
80 self.Bind(wx.EVT_LEFT_DOWN, self.click)
81 self.Bind(wx.EVT_LEFT_DCLICK, self.onLeftDoubleClick)
82 self.Bind(wx.EVT_KEY_UP, self.kbEvent)
83
84 self.droneView = gui.builtinAdditionPanes.droneView.DroneView
85
86 self.Bind(wx.EVT_CONTEXT_MENU, self.spawnMenu)
87
88 self.SetDropTarget(CommandViewDrop(self.handleListDrag))
89
90 def OnFitRemoved(self, event):
91 event.Skip()
92 AddCommandFit.populateFits(event)
93 fitID = self.mainFrame.getActiveFit()
94 fit = Fit.getInstance().getFit(fitID)
95 self.refreshContents(fit)
96
97 @staticmethod
98 def handleListDrag(x, y, data):
99 """
100 Handles dragging of items from various pyfa displays which support it
101
102 data is list with two indices:
103 data[0] is hard-coded str of originating source
104 data[1] is typeID or index of data we want to manipulate
105 """
106 pass
107
108 def kbEvent(self, event):
109 keycode = event.GetKeyCode()
110 modifiers = event.GetModifiers()
111 if keycode == wx.WXK_ESCAPE and modifiers == wx.MOD_NONE:
112 self.unselectAll()
113 elif keycode == 65 and modifiers == wx.MOD_CONTROL:
114 self.selectAll()
115 elif keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE) and modifiers == wx.MOD_NONE:
116 commandFits = self.getSelectedCommandFits()
117 self.removeCommandFits(commandFits)
118 event.Skip()
119
120 def handleDrag(self, type, fitID):
121 # Those are drags coming from pyfa sources, NOT builtin wx drags
122 if type == "fit":
123 activeFit = self.mainFrame.getActiveFit()
124 if activeFit:
125 self.mainFrame.command.Submit(cmd.GuiAddCommandFitsCommand(fitID=activeFit, commandFitIDs=[fitID]))

Callers 1

__init__Method · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected