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