Merge branch 'master' of https://github.com/pyfa-org/Pyfa into origin_master
This commit is contained in:
@@ -736,6 +736,7 @@ class _TabsContainer(wx.Panel):
|
|||||||
self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnErase)
|
self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnErase)
|
||||||
self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
|
self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
|
||||||
self.Bind(wx.EVT_LEFT_UP, self.OnLeftUp)
|
self.Bind(wx.EVT_LEFT_UP, self.OnLeftUp)
|
||||||
|
self.Bind(wx.EVT_MIDDLE_UP, self.OnMiddleUp)
|
||||||
self.Bind(wx.EVT_MOTION, self.OnMotion)
|
self.Bind(wx.EVT_MOTION, self.OnMotion)
|
||||||
self.Bind(wx.EVT_SIZE, self.OnSize)
|
self.Bind(wx.EVT_SIZE, self.OnSize)
|
||||||
self.Bind(wx.EVT_SYS_COLOUR_CHANGED, self.OnSysColourChanged)
|
self.Bind(wx.EVT_SYS_COLOUR_CHANGED, self.OnSysColourChanged)
|
||||||
@@ -776,6 +777,29 @@ class _TabsContainer(wx.Panel):
|
|||||||
|
|
||||||
self.dragged_tab = tab
|
self.dragged_tab = tab
|
||||||
|
|
||||||
|
def OnMiddleUp(self, event):
|
||||||
|
mposx, mposy = event.GetPosition()
|
||||||
|
|
||||||
|
tab = self.FindTabAtPos(mposx, mposy)
|
||||||
|
|
||||||
|
if tab is None or not tab.closeable: # if not able to close, return False
|
||||||
|
return False
|
||||||
|
|
||||||
|
index = self.tabs.index(tab)
|
||||||
|
ev = PageClosing(index)
|
||||||
|
wx.PostEvent(self.Parent, ev)
|
||||||
|
|
||||||
|
if ev.isVetoed():
|
||||||
|
return False
|
||||||
|
|
||||||
|
index = self.GetTabIndex(tab)
|
||||||
|
self.Parent.DeletePage(index)
|
||||||
|
wx.PostEvent(self.Parent, PageClosed(index=index))
|
||||||
|
|
||||||
|
sel = self.GetSelected()
|
||||||
|
if sel is not None:
|
||||||
|
wx.PostEvent(self.Parent, PageChanged(-1, sel))
|
||||||
|
|
||||||
def OnMotion(self, event):
|
def OnMotion(self, event):
|
||||||
"""
|
"""
|
||||||
Determines what happens when the mouse moves. This handles primarily
|
Determines what happens when the mouse moves. This handles primarily
|
||||||
|
|||||||
@@ -23,6 +23,13 @@ class FitReplaceModuleCommand(wx.Command):
|
|||||||
self.old_module = None
|
self.old_module = None
|
||||||
|
|
||||||
def Do(self):
|
def Do(self):
|
||||||
|
fit = eos.db.getFit(self.fitID)
|
||||||
|
|
||||||
|
mod = fit.modules[self.position]
|
||||||
|
if not mod.isEmpty:
|
||||||
|
self.old_module = ModuleInfoCache(mod.modPosition, mod.item.ID, mod.state, mod.charge, mod.baseItemID,
|
||||||
|
mod.mutaplasmidID)
|
||||||
|
|
||||||
return self.change_module(self.fitID, self.position, self.itemID)
|
return self.change_module(self.fitID, self.position, self.itemID)
|
||||||
|
|
||||||
def Undo(self):
|
def Undo(self):
|
||||||
@@ -30,7 +37,6 @@ class FitReplaceModuleCommand(wx.Command):
|
|||||||
fit = eos.db.getFit(self.fitID)
|
fit = eos.db.getFit(self.fitID)
|
||||||
fit.modules.toDummy(self.position)
|
fit.modules.toDummy(self.position)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
self.change_module(self.fitID, self.position, self.old_module.itemID)
|
self.change_module(self.fitID, self.position, self.old_module.itemID)
|
||||||
self.module.state = self.old_module.state
|
self.module.state = self.old_module.state
|
||||||
self.module.charge = self.old_module.charge
|
self.module.charge = self.old_module.charge
|
||||||
@@ -52,10 +58,7 @@ class FitReplaceModuleCommand(wx.Command):
|
|||||||
pyfalog.debug("Changing position of module from position ({0}) for fit ID: {1}", self.position, fitID)
|
pyfalog.debug("Changing position of module from position ({0}) for fit ID: {1}", self.position, fitID)
|
||||||
|
|
||||||
item = eos.db.getItem(itemID, eager=("attributes", "group.category"))
|
item = eos.db.getItem(itemID, eager=("attributes", "group.category"))
|
||||||
|
|
||||||
mod = fit.modules[self.position]
|
mod = fit.modules[self.position]
|
||||||
if not mod.isEmpty:
|
|
||||||
self.old_module = ModuleInfoCache(mod.modPosition, mod.item.ID, mod.state, mod.charge, mod.baseItemID, mod.mutaplasmidID)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.module = Module(item)
|
self.module = Module(item)
|
||||||
@@ -75,6 +78,9 @@ class FitReplaceModuleCommand(wx.Command):
|
|||||||
if self.module.isValidState(State.ACTIVE):
|
if self.module.isValidState(State.ACTIVE):
|
||||||
self.module.state = State.ACTIVE
|
self.module.state = State.ACTIVE
|
||||||
|
|
||||||
|
if self.old_module.charge and self.module.isValidCharge(self.old_module.charge):
|
||||||
|
self.module.charge = self.old_module.charge
|
||||||
|
|
||||||
# Then, check states of all modules and change where needed. This will recalc if needed
|
# Then, check states of all modules and change where needed. This will recalc if needed
|
||||||
# self.checkStates(fit, m)
|
# self.checkStates(fit, m)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user