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

Method ensureSelection

gui/display.py:303–320  ·  view source on GitHub ↗

On windows with Ctrl is pressed, or on Mac, when right-click on any item happens, the item doesn't get selected. This method ensures that only clicked item is selected.

(self, clickedPos)

Source from the content-addressed store, hash-verified

301 return propWidth
302
303 def ensureSelection(self, clickedPos):
304 """
305 On windows with Ctrl is pressed, or on Mac, when right-click on any item happens,
306 the item doesn't get selected. This method ensures that only clicked item is selected.
307 """
308 if (
309 'wxMac' in wx.PlatformInfo or
310 ('wxMSW' in wx.PlatformInfo and wx.GetMouseState().GetModifiers() == wx.MOD_CONTROL)
311 ):
312 if clickedPos != -1:
313 selectedPoss = self.getSelectedRows()
314 if clickedPos not in selectedPoss:
315 self.unselectAll()
316 self.Select(clickedPos)
317 # Change focus only when we manipulate selection
318 focusedPos = self.GetFocusedItem()
319 if clickedPos != focusedPos:
320 self.Focus(clickedPos)

Callers 11

spawnMenuMethod · 0.80
spawnMenuMethod · 0.80
contextMenuMethod · 0.80
spawnMenuMethod · 0.80
spawnMenuMethod · 0.80
spawnMenuMethod · 0.80
spawnMenuMethod · 0.80
spawnMenuMethod · 0.80
spawnMenuMethod · 0.80
spawnMenuMethod · 0.80
spawnMenuMethod · 0.80

Calls 3

getSelectedRowsMethod · 0.95
unselectAllMethod · 0.95
FocusMethod · 0.80

Tested by

no test coverage detected