differentiate command processors based on fitID
This commit is contained in:
@@ -170,8 +170,6 @@ class MainFrame(wx.Frame):
|
||||
i = wx.Icon(BitmapLoader.getBitmap("pyfa", "gui"))
|
||||
self.SetIcon(i)
|
||||
|
||||
self.command = wx.CommandProcessor()
|
||||
|
||||
# Create the layout and windows
|
||||
mainSizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||
|
||||
@@ -246,6 +244,10 @@ class MainFrame(wx.Frame):
|
||||
self.Bind(GE.EVT_SSO_LOGIN, self.onSSOLogin)
|
||||
self.Bind(GE.EVT_SSO_LOGGING_IN, self.ShowSsoLogin)
|
||||
|
||||
@property
|
||||
def command(self):
|
||||
return Fit.getCommandProcessor(self.getActiveFit())
|
||||
|
||||
def ShowSsoLogin(self, event):
|
||||
if getattr(event, "login_mode", LoginMethod.SERVER) == LoginMethod.MANUAL and getattr(event, "sso_mode", SsoMode.AUTO) == SsoMode.AUTO:
|
||||
dlg = SsoLogin(self)
|
||||
|
||||
@@ -38,6 +38,8 @@ from service.character import Character
|
||||
from service.damagePattern import DamagePattern
|
||||
from service.settings import SettingsProvider
|
||||
from utils.deprecated import deprecated
|
||||
import wx
|
||||
|
||||
pyfalog = Logger(__name__)
|
||||
|
||||
|
||||
@@ -57,6 +59,7 @@ class DeferRecalc():
|
||||
|
||||
class Fit(object):
|
||||
instance = None
|
||||
processors = {}
|
||||
|
||||
@classmethod
|
||||
def getInstance(cls):
|
||||
@@ -213,12 +216,21 @@ class Fit(object):
|
||||
|
||||
eos.db.remove(fit)
|
||||
|
||||
if fitID in Fit.__class__.processors:
|
||||
del Fit.__class__.processors[fitID]
|
||||
|
||||
pyfalog.debug(" Need to refresh {} fits: {}", len(refreshFits), refreshFits)
|
||||
for fit in refreshFits:
|
||||
eos.db.saveddata_session.refresh(fit)
|
||||
|
||||
eos.db.saveddata_session.commit()
|
||||
|
||||
@classmethod
|
||||
def getCommandProcessor(cls, fitID):
|
||||
if fitID not in cls.processors:
|
||||
cls.processors[fitID] = wx.CommandProcessor()
|
||||
return cls.processors[fitID]
|
||||
|
||||
@staticmethod
|
||||
def copyFit(fitID):
|
||||
pyfalog.debug("Creating copy of fit ID: {0}", fitID)
|
||||
|
||||
Reference in New Issue
Block a user