Merge branch 'master' into singularity

Conflicts:
	eos/db/saveddata/fit.py
	eos/effects/armoredwarfaremindlink.py
	eos/effects/elitebonuscommanddestroyerarmored1.py
	eos/effects/elitebonuscommanddestroyerinfo1.py
	eos/effects/elitebonuscommanddestroyerinfohidden1.py
	eos/effects/elitebonuscommanddestroyersiege1.py
	eos/effects/elitebonuscommanddestroyerskirmish1.py
	eos/effects/elitebonuscommandshiparmoredcs3.py
	eos/effects/elitebonuscommandshipinformationcs3.py
	eos/effects/elitebonuscommandshipinformationhiddencs3.py
	eos/effects/elitebonuscommandshipsiegecs3.py
	eos/effects/elitebonuscommandshipskirmishcs3.py
	eos/effects/miningforemanmindlink.py
	eos/effects/shipbonuscarriera4warfarelinksbonus.py
	eos/effects/shipbonuscarrierc4warfarelinksbonus.py
	eos/effects/shipbonuscarrierg4warfarelinksbonus.py
	eos/effects/shipbonuscarrierm4warfarelinksbonus.py
	eos/effects/shipbonusforceauxiliarya4warfarelinksbonus.py
	eos/effects/shipbonusforceauxiliaryc4warfarelinksbonus.py
	eos/effects/shipbonusforceauxiliaryg4warfarelinksbonus.py
	eos/effects/shipbonusforceauxiliarym4warfarelinksbonus.py
	eos/effects/shipbonussupercarriera5warfarelinksbonus.py
	eos/effects/shipbonussupercarrierc5warfarelinksbonus.py
	eos/effects/shipbonussupercarrierg5warfarelinksbonus.py
	eos/effects/shipbonussupercarrierm5warfarelinksbonus.py
	eos/effects/subsystembonusamarrdefensivearmoredwarfare.py
	eos/effects/subsystembonusamarrdefensiveinformationwarfare.py
	eos/effects/subsystembonusamarrdefensiveinformationwarfarehidden.py
	eos/effects/subsystembonusamarrdefensiveskirmishwarfare.py
	eos/effects/subsystembonuscaldaridefensiveinformationwarfare.py
	eos/effects/subsystembonuscaldaridefensiveinformationwarfarehidden.py
	eos/effects/subsystembonuscaldaridefensivesiegewarfare.py
	eos/effects/subsystembonuscaldaridefensiveskirmishwarfare.py
	eos/effects/subsystembonusgallentedefensivearmoredwarfare.py
	eos/effects/subsystembonusgallentedefensiveinformationwarfare.py
	eos/effects/subsystembonusgallentedefensiveinformationwarfarehidden.py
	eos/effects/subsystembonusgallentedefensiveskirmishwarfare.py
	eos/effects/subsystembonusminmatardefensivearmoredwarfare.py
	eos/effects/subsystembonusminmatardefensivesiegewarfare.py
	eos/effects/subsystembonusminmatardefensiveskirmishwarfare.py
	eos/saveddata/fit.py
	eos/saveddata/module.py
	gui/shipBrowser.py
	scripts/prep_data.py
	service/fit.py
This commit is contained in:
blitzman
2016-11-20 14:42:19 -05:00
2010 changed files with 7990 additions and 2520 deletions

View File

@@ -106,7 +106,9 @@ class Fit(object):
"showTooltip": True,
"showMarketShortcuts": False,
"enableGaugeAnimation": True,
"exportCharges": True}
"exportCharges": True,
"openFitInNew":False
}
self.serviceFittingOptions = SettingsProvider.getInstance().getSettings(
"pyfaServiceFittingOptions", serviceFittingDefaultOptions)
@@ -237,7 +239,6 @@ class Fit(object):
def getFit(self, fitID, projected=False, basic=False):
''' Gets fit from database, and populates fleet data.
Projected is a recursion flag that is set to reduce recursions into projected fits
Basic is a flag to simply return the fit without any other processing
'''
@@ -547,7 +548,6 @@ class Fit(object):
"""
Moves cargo to fitting window. Can either do a copy, move, or swap with current module
If we try to copy/move into a spot with a non-empty module, we swap instead.
To avoid redundancy in converting Cargo item, this function does the
sanity checks as opposed to the GUI View. This is different than how the
normal .swapModules() does things, which is mostly a blind swap.
@@ -613,7 +613,6 @@ class Fit(object):
def cloneModule(self, fitID, src, dst):
"""
Clone a module from src to dst
This will overwrite dst! Checking for empty module must be
done at a higher level
"""
@@ -977,7 +976,6 @@ class Fit(object):
Imports fits from file(s). First processes all provided paths and stores
assembled fits into a list. This allows us to call back to the GUI as
fits are processed as well as when fits are being saved.
returns
"""
defcodepage = locale.getpreferredencoding()
@@ -1168,4 +1166,5 @@ class Fit(object):
if fit.factorReload is not self.serviceFittingOptions["useGlobalForceReload"]:
fit.factorReload = self.serviceFittingOptions["useGlobalForceReload"]
fit.clear()
fit.calculateModifiedAttributes(withBoosters=False)

View File

@@ -43,6 +43,7 @@ class ServerError(StandardError):
class TimeoutError(StandardError):
pass
class Network():
# Request constants - every request must supply this, as it is checked if
# enabled or not via settings
@@ -71,13 +72,31 @@ class Network():
# Set up some things for the request
versionString = "{0} {1} - {2} {3}".format(config.version, config.tag, config.expansionName, config.expansionVersion)
headers={"User-Agent" : "pyfa {0} (Python-urllib2)".format(versionString)}
headers = {"User-Agent" : "pyfa {0} (Python-urllib2)".format(versionString)}
proxy = NetworkSettings.getInstance().getProxySettings()
if proxy is not None:
proxy = urllib2.ProxyHandler({'https': "{0}:{1}".format(*proxy)})
opener = urllib2.build_opener(proxy)
# proxy is a tuple of (host, port): (u'192.168.20.1', 3128)
proxy_auth = NetworkSettings.getInstance().getProxyAuthDetails()
# proxy_auth is a tuple of (login, password) or None
if proxy_auth is not None:
# add login:password@ in front of proxy address
proxy_handler = urllib2.ProxyHandler({'https': '{0}:{1}@{2}:{3}'.format(
proxy_auth[0], proxy_auth[1], proxy[0], proxy[1])})
else:
# build proxy handler with no login/pass info
proxy_handler = urllib2.ProxyHandler({'https': "{0}:{1}".format(proxy[0], proxy[1])})
opener = urllib2.build_opener(proxy_handler)
urllib2.install_opener(opener)
else:
# This is a bug fix, explicitly disable possibly previously installed
# opener with proxy, by urllib2.install_opener() a few lines above in code.
# Now this explicitly disables proxy handler, "uninstalling" opener.
# This is used in case when user had proxy enabled, so proxy_handler was already
# installed globally, and then user had disabled the proxy, so we should clear that opener
urllib2.install_opener(None)
# another option could be installing a default opener:
# urllib2.install_opener(urllib2.build_opener())
request = urllib2.Request(url, headers=headers, data=urllib.urlencode(data) if data else None)
try:

View File

@@ -113,6 +113,12 @@ class Settings():
class NetworkSettings():
_instance = None
# constants for serviceNetworkDefaultSettings["mode"] parameter
PROXY_MODE_NONE = 0 # 0 - No proxy
PROXY_MODE_AUTODETECT = 1 # 1 - Auto-detected proxy settings
PROXY_MODE_MANUAL = 2 # 2 - Manual proxy settings
@classmethod
def getInstance(cls):
if cls._instance == None:
@@ -122,13 +128,18 @@ class NetworkSettings():
def __init__(self):
# mode
# 0 - No proxy
# 1 - Auto-detected proxy settings
# 2 - Manual proxy settings
serviceNetworkDefaultSettings = {"mode": 1, "type": "https", "address": "", "port": "", "access": 15}
serviceNetworkDefaultSettings = {
"mode": self.PROXY_MODE_AUTODETECT,
"type": "https",
"address": "",
"port": "",
"access": 15,
"login": None,
"password": None
}
self.serviceNetworkSettings = SettingsProvider.getInstance().getSettings("pyfaServiceNetworkSettings", serviceNetworkDefaultSettings)
self.serviceNetworkSettings = SettingsProvider.getInstance().getSettings(
"pyfaServiceNetworkSettings", serviceNetworkDefaultSettings)
def isEnabled(self, type):
if type & self.serviceNetworkSettings["access"]:
@@ -198,13 +209,33 @@ class NetworkSettings():
def getProxySettings(self):
if self.getMode() == 0:
if self.getMode() == self.PROXY_MODE_NONE:
return None
if self.getMode() == 1:
if self.getMode() == self.PROXY_MODE_AUTODETECT:
return self.autodetect()
if self.getMode() == 2:
if self.getMode() == self.PROXY_MODE_MANUAL:
return (self.getAddress(), int(self.getPort()))
def getProxyAuthDetails(self):
if self.getMode() == self.PROXY_MODE_NONE:
return None
if (self.serviceNetworkSettings["login"] is None) or (self.serviceNetworkSettings["password"] is None):
return None
# in all other cases, return tuple of (login, password)
return (self.serviceNetworkSettings["login"], self.serviceNetworkSettings["password"])
def setProxyAuthDetails(self, login, password):
if (login is None) or (password is None):
self.serviceNetworkSettings["login"] = None
self.serviceNetworkSettings["password"] = None
return
if login == "": # empty login unsets proxy auth info
self.serviceNetworkSettings["login"] = None
self.serviceNetworkSettings["password"] = None
return
self.serviceNetworkSettings["login"] = login
self.serviceNetworkSettings["password"] = password
"""