Do not use GetItemData where we do not need it
This commit is contained in:
@@ -153,7 +153,7 @@ class BoosterView(d.Display):
|
||||
col = self.getColumn(event.Position)
|
||||
if col != self.getColIndex(State):
|
||||
try:
|
||||
booster = self.boosters[self.GetItemData(row)]
|
||||
booster = self.boosters[row]
|
||||
except IndexError:
|
||||
return
|
||||
self.removeBoosters([booster])
|
||||
@@ -217,7 +217,7 @@ class BoosterView(d.Display):
|
||||
boosters = []
|
||||
for row in self.getSelectedRows():
|
||||
try:
|
||||
booster = self.boosters[self.GetItemData(row)]
|
||||
booster = self.boosters[row]
|
||||
except IndexError:
|
||||
continue
|
||||
boosters.append(booster)
|
||||
|
||||
@@ -170,7 +170,7 @@ class CargoView(d.Display):
|
||||
row, _ = self.HitTest(event.Position)
|
||||
if row != -1:
|
||||
try:
|
||||
cargo = self.cargo[self.GetItemData(row)]
|
||||
cargo = self.cargo[row]
|
||||
except IndexError:
|
||||
return
|
||||
self.removeCargos([cargo])
|
||||
@@ -205,7 +205,7 @@ class CargoView(d.Display):
|
||||
cargos = []
|
||||
for row in self.getSelectedRows():
|
||||
try:
|
||||
cargo = self.cargo[self.GetItemData(row)]
|
||||
cargo = self.cargo[row]
|
||||
except IndexError:
|
||||
continue
|
||||
cargos.append(cargo)
|
||||
|
||||
@@ -198,7 +198,7 @@ class CommandView(d.Display):
|
||||
row, _ = self.HitTest(event.Position)
|
||||
if row != -1:
|
||||
try:
|
||||
commandFit = self.fits[self.GetItemData(row)]
|
||||
commandFit = self.fits[row]
|
||||
except IndexError:
|
||||
return
|
||||
self.removeCommandFits([commandFit])
|
||||
@@ -215,7 +215,7 @@ class CommandView(d.Display):
|
||||
commandFits = []
|
||||
for row in self.getSelectedRows():
|
||||
try:
|
||||
commandFit = self.fits[self.GetItemData(row)]
|
||||
commandFit = self.fits[row]
|
||||
except IndexError:
|
||||
continue
|
||||
commandFits.append(commandFit)
|
||||
|
||||
@@ -103,7 +103,7 @@ class DroneView(Display):
|
||||
self.hoveredColumn = col
|
||||
if row != -1 and col != -1 and col < len(self.DEFAULT_COLS):
|
||||
try:
|
||||
mod = self.drones[self.GetItemData(row)]
|
||||
mod = self.drones[row]
|
||||
except IndexError:
|
||||
return
|
||||
if self.DEFAULT_COLS[col] == "Miscellanea":
|
||||
@@ -242,7 +242,7 @@ class DroneView(Display):
|
||||
col = self.getColumn(event.Position)
|
||||
if col != self.getColIndex(State):
|
||||
try:
|
||||
drone = self.drones[self.GetItemData(row)]
|
||||
drone = self.drones[row]
|
||||
except IndexError:
|
||||
return
|
||||
if wx.GetMouseState().GetModifiers() == wx.MOD_ALT:
|
||||
@@ -316,7 +316,7 @@ class DroneView(Display):
|
||||
drones = []
|
||||
for row in self.getSelectedRows():
|
||||
try:
|
||||
drone = self.drones[self.GetItemData(row)]
|
||||
drone = self.drones[row]
|
||||
except IndexError:
|
||||
continue
|
||||
drones.append(drone)
|
||||
|
||||
@@ -166,7 +166,7 @@ class FighterDisplay(d.Display):
|
||||
self.hoveredColumn = col
|
||||
if row != -1 and col != -1 and col < len(self.DEFAULT_COLS):
|
||||
try:
|
||||
mod = self.fighters[self.GetItemData(row)]
|
||||
mod = self.fighters[row]
|
||||
except IndexError:
|
||||
return
|
||||
if self.DEFAULT_COLS[col] == "Miscellanea":
|
||||
@@ -292,7 +292,7 @@ class FighterDisplay(d.Display):
|
||||
if col != self.getColIndex(State):
|
||||
mstate = wx.GetMouseState()
|
||||
try:
|
||||
fighter = self.fighters[self.GetItemData(row)]
|
||||
fighter = self.fighters[row]
|
||||
except IndexError:
|
||||
return
|
||||
if mstate.GetModifiers() == wx.MOD_ALT:
|
||||
@@ -364,7 +364,7 @@ class FighterDisplay(d.Display):
|
||||
fighters = []
|
||||
for row in self.getSelectedRows():
|
||||
try:
|
||||
fighter = self.fighters[self.GetItemData(row)]
|
||||
fighter = self.fighters[row]
|
||||
except IndexError:
|
||||
continue
|
||||
fighters.append(fighter)
|
||||
|
||||
@@ -19,17 +19,18 @@
|
||||
|
||||
# noinspection PyPackageRequirements
|
||||
import wx
|
||||
|
||||
import gui.display as d
|
||||
from gui.builtinMarketBrowser.events import ITEM_SELECTED
|
||||
import gui.mainFrame
|
||||
from gui.builtinViewColumns.state import State
|
||||
from gui.utils.staticHelpers import DragDropHelper
|
||||
from gui.contextMenu import ContextMenu
|
||||
import gui.fitCommands as cmd
|
||||
import gui.globalEvents as GE
|
||||
import gui.mainFrame
|
||||
from eos.const import ImplantLocation
|
||||
from gui.builtinMarketBrowser.events import ITEM_SELECTED
|
||||
from gui.builtinViewColumns.state import State
|
||||
from gui.contextMenu import ContextMenu
|
||||
from gui.utils.staticHelpers import DragDropHelper
|
||||
from service.fit import Fit
|
||||
from service.market import Market
|
||||
import gui.fitCommands as cmd
|
||||
|
||||
|
||||
class ImplantViewDrop(wx.DropTarget):
|
||||
@@ -207,7 +208,7 @@ class ImplantDisplay(d.Display):
|
||||
col = self.getColumn(event.Position)
|
||||
if col != self.getColIndex(State):
|
||||
try:
|
||||
implant = self.implants[self.GetItemData(row)]
|
||||
implant = self.implants[row]
|
||||
except IndexError:
|
||||
return
|
||||
self.removeImplants([implant])
|
||||
@@ -280,7 +281,7 @@ class ImplantDisplay(d.Display):
|
||||
implants = []
|
||||
for row in self.getSelectedRows():
|
||||
try:
|
||||
implant = self.implants[self.GetItemData(row)]
|
||||
implant = self.implants[row]
|
||||
except IndexError:
|
||||
continue
|
||||
implants.append(implant)
|
||||
|
||||
@@ -190,7 +190,7 @@ class FittingView(d.Display):
|
||||
self.hoveredRow = row
|
||||
self.hoveredColumn = col
|
||||
if row != -1 and row not in self.blanks and col != -1 and col < len(self.DEFAULT_COLS):
|
||||
mod = self.mods[self.GetItemData(row)]
|
||||
mod = self.mods[row]
|
||||
tooltip = self.activeColumns[col].getToolTip(mod)
|
||||
if tooltip is not None:
|
||||
self.SetToolTip(tooltip)
|
||||
@@ -271,7 +271,7 @@ class FittingView(d.Display):
|
||||
mods = []
|
||||
for row in self.getSelectedRows():
|
||||
try:
|
||||
mod = self.mods[self.GetItemData(row)]
|
||||
mod = self.mods[row]
|
||||
except IndexError:
|
||||
continue
|
||||
if mod and not isinstance(mod, Rack):
|
||||
@@ -693,7 +693,7 @@ class FittingView(d.Display):
|
||||
|
||||
if row not in sel:
|
||||
try:
|
||||
selectedMods = [self.mods[self.GetItemData(row)]]
|
||||
selectedMods = [self.mods[row]]
|
||||
except IndexError:
|
||||
return
|
||||
else:
|
||||
@@ -702,7 +702,7 @@ class FittingView(d.Display):
|
||||
click = "ctrl" if event.GetModifiers() == wx.MOD_CONTROL or event.middleIsDown else "right" if event.GetButton() == 3 else "left"
|
||||
|
||||
try:
|
||||
mainMod = self.mods[self.GetItemData(row)]
|
||||
mainMod = self.mods[row]
|
||||
except IndexError:
|
||||
return
|
||||
if mainMod.isEmpty:
|
||||
@@ -726,7 +726,7 @@ class FittingView(d.Display):
|
||||
click=click))
|
||||
|
||||
# update state tooltip
|
||||
tooltip = self.activeColumns[col].getToolTip(self.mods[self.GetItemData(row)])
|
||||
tooltip = self.activeColumns[col].getToolTip(self.mods[row])
|
||||
if tooltip:
|
||||
self.SetToolTip(tooltip)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user