| 64 | |
| 65 | |
| 66 | class Esi(EsiAccess): |
| 67 | _instance = None |
| 68 | |
| 69 | @classmethod |
| 70 | def getInstance(cls): |
| 71 | if cls._instance is None: |
| 72 | cls._instance = Esi() |
| 73 | |
| 74 | return cls._instance |
| 75 | |
| 76 | def __init__(self): |
| 77 | self.settings = EsiSettings.getInstance() |
| 78 | |
| 79 | super().__init__() |
| 80 | |
| 81 | # these will be set when needed |
| 82 | self.httpd = None |
| 83 | self.state = None |
| 84 | self.ssoTimer = None |
| 85 | |
| 86 | self.implicitCharacter = None |
| 87 | |
| 88 | # until I can get around to making proper caching and modifications to said cache, storee deleted fittings here |
| 89 | # so that we can easily hide them in the fitting browser |
| 90 | self.fittings_deleted = set() |
| 91 | |
| 92 | # need these here to post events |
| 93 | import gui.mainFrame # put this here to avoid loop |
| 94 | self.mainFrame = gui.mainFrame.MainFrame.getInstance() |
| 95 | |
| 96 | def delSsoCharacter(self, id): |
| 97 | char = eos.db.getSsoCharacter(id, config.getClientSecret()) |
| 98 | |
| 99 | # There is an issue in which the SSO character is not removed from any linked characters - a reference to the |
| 100 | # sso character remains even though the SSO character is deleted which should have deleted the link. This is a |
| 101 | # work around until we can figure out why. Manually delete SSOCharacter from all of it's characters |
| 102 | for x in char.characters: |
| 103 | x._Character__ssoCharacters.remove(char) |
| 104 | eos.db.remove(char) |
| 105 | wx.PostEvent(self.mainFrame, GE.SsoLogout(charID=id)) |
| 106 | |
| 107 | def getSsoCharacters(self): |
| 108 | chars = eos.db.getSsoCharacters(config.getClientSecret()) |
| 109 | return chars |
| 110 | |
| 111 | def getSsoCharacter(self, id, server=None): |
| 112 | char = eos.db.getSsoCharacter(id, config.getClientSecret(), server) |
| 113 | eos.db.commit() |
| 114 | return char |
| 115 | |
| 116 | def getSkills(self, id): |
| 117 | char = self.getSsoCharacter(id) |
| 118 | resp = super().getSkills(char) |
| 119 | return resp.json() |
| 120 | |
| 121 | def getSecStatus(self, id): |
| 122 | char = self.getSsoCharacter(id) |
| 123 | resp = super().getSecStatus(char) |