@@ -233,7 +233,7 @@ class FittingView(d.Display):
|
||||
def startDrag(self, event):
|
||||
row = event.GetIndex()
|
||||
|
||||
if row != -1 and row not in self.blanks:
|
||||
if row != -1 and row not in self.blanks and isinstance(self.mods[row], Module) and not self.mods[row].isEmpty:
|
||||
data = wx.PyTextDataObject()
|
||||
data.SetText("fitting:" + str(self.mods[row].modPosition))
|
||||
|
||||
@@ -330,11 +330,14 @@ class FittingView(d.Display):
|
||||
modules = []
|
||||
sel = self.GetFirstSelected()
|
||||
while sel != -1 and sel not in self.blanks:
|
||||
modules.append(self.mods[self.GetItemData(sel)])
|
||||
mod = self.mods[self.GetItemData(sel)]
|
||||
if isinstance(mod, Module) and not mod.isEmpty:
|
||||
modules.append(self.mods[self.GetItemData(sel)])
|
||||
sel = self.GetNextSelected(sel)
|
||||
|
||||
sFit.setAmmo(fitID, itemID, modules)
|
||||
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID))
|
||||
if len(modules) > 0:
|
||||
sFit.setAmmo(fitID, itemID, modules)
|
||||
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID))
|
||||
else:
|
||||
populate = sFit.appendModule(fitID, itemID)
|
||||
if populate is not None:
|
||||
@@ -375,6 +378,10 @@ class FittingView(d.Display):
|
||||
if dstRow != -1 and dstRow not in self.blanks:
|
||||
sFit = Fit.getInstance()
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
mod = self.mods[dstRow]
|
||||
if not isinstance(mod, Module): # make sure we're not adding something to a T3D Mode
|
||||
return
|
||||
|
||||
moduleChanged = sFit.changeModule(fitID, self.mods[dstRow].modPosition, srcIdx)
|
||||
if moduleChanged is None:
|
||||
# the new module doesn't fit in specified slot, try to simply append it
|
||||
@@ -390,6 +397,9 @@ class FittingView(d.Display):
|
||||
if dstRow != -1 and dstRow not in self.blanks:
|
||||
module = self.mods[dstRow]
|
||||
|
||||
if not isinstance(module, Module):
|
||||
return
|
||||
|
||||
sFit = Fit.getInstance()
|
||||
fit = sFit.getFit(self.activeFitID)
|
||||
typeID = fit.cargo[srcIdx].item.ID
|
||||
@@ -417,6 +427,9 @@ class FittingView(d.Display):
|
||||
mod1 = fit.modules[srcIdx]
|
||||
mod2 = self.mods[dstRow]
|
||||
|
||||
if not isinstance(mod2, Module):
|
||||
return
|
||||
|
||||
# can't swap modules to different racks
|
||||
if mod1.slot != mod2.slot:
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user