Make use of proxy settings in service.character api stuff

This commit is contained in:
HomeWorld
2011-12-23 20:26:15 +02:00
parent ade951360f
commit 6b30eeaba1
2 changed files with 16 additions and 6 deletions

View File

@@ -125,13 +125,12 @@ class PFGlobalPref ( PreferenceView):
proxy = self.proxySettings.autodetect()
txt = "Auto-detected: "
if len(proxy) == 0:
txt += "None"
txt = "None"
else:
txt += proxy
txt = proxy
self.stPSAutoDetected.SetLabel(txt)
self.stPSAutoDetected.SetLabel("Auto-detected: " + txt)
self.stPSAutoDetected.Disable()
cChar = service.Character.getInstance()

View File

@@ -113,17 +113,28 @@ class Character():
char = eos.db.getCharacter(charID)
return (char.apiID or "", char.apiKey or "")
def getProxySettings(self):
ps = service.settings.ProxySettings.getInstance()
if ps.getMode() == 0:
return None
elif ps.getMode() == 1:
return ps.autodetect()
elif ps.getMode == 2:
return ps.getAddress() + ps.getPort()
def charList(self, charID, userID, apiKey):
char = eos.db.getCharacter(charID)
try:
char.apiID = userID
char.apiKey = apiKey
return char.apiCharList()
return char.apiCharList(proxy = self.getProxySettings())
except:
return None
def apiFetch(self, charID, charName):
char = eos.db.getCharacter(charID)
char = eos.db.getCharacter(charID, proxy = self.getProxySettings())
char.apiFetch(charName)
eos.db.commit()