Added copy module by drag/drop module while holding Ctrl key. This has been planned since 2011 according to blame. =D

This commit is contained in:
blitzmann
2014-03-25 00:33:40 -04:00
parent 7a2ddad70c
commit 47c46cc9c5
2 changed files with 21 additions and 3 deletions

View File

@@ -352,7 +352,7 @@ class FittingView(d.Display):
cFit = service.Fit.getInstance()
if clone:
if clone and mod2.isEmpty:
cFit.cloneModule(self.mainFrame.getActiveFit(), mod1.position, mod2.position)
else:
cFit.swapModules(self.mainFrame.getActiveFit(), mod1.position, mod2.position)

View File

@@ -395,8 +395,26 @@ class Fit(object):
eos.db.commit()
def cloneModule(self, fitID, src, dst):
#need implementation of module clone based on module positions (also make sure the dst is empty else do nothing)
pass
'''
Clone a module from src to dst
This will overwrite dst! Checking for empty module must be
done at a higher level
'''
fit = eos.db.getFit(fitID)
# Gather modules
srcMod = fit.modules[src]
dstMod = fit.modules[dst]
new = copy.deepcopy(srcMod)
# remove empty mod
fit.modules.remove(dstMod)
# insert copy
fit.modules.insert(dst, new)
eos.db.commit()
def addDrone(self, fitID, itemID):
if fitID == None: