Merge branch 'price-system-selection' of git://github.com/petosorus/Pyfa into petosorus-price-system-selection

Conflicts:
	gui/builtinPreferenceViews/pyfaGeneralPreferences.py
	gui/builtinStatsViews/priceViewFull.py
	service/fit.py
	service/price.py
This commit is contained in:
blitzman
2017-02-11 11:36:35 -05:00
4 changed files with 68 additions and 19 deletions

View File

@@ -69,8 +69,7 @@ class Fit(object):
"showMarketShortcuts": False,
"enableGaugeAnimation": True,
"exportCharges": True,
"openFitInNew": False,
}
"priceSystem": "Jita"}
self.serviceFittingOptions = SettingsProvider.getInstance().getSettings(
"pyfaServiceFittingOptions", serviceFittingDefaultOptions)

View File

@@ -30,6 +30,21 @@ TIMEOUT = 15 * 60 # Network timeout delay for connection issues, 15 minutes
class Price(object):
systemsList = {
"Jita": 30000142,
"Amarr": 30002187,
"Dodixie": 30002659,
"Rens": 30002510,
"Hek": 30002053
}
currentSystemId = ""
@classmethod
def invalidPrices(self, prices):
for price in prices:
price.time = 0
@classmethod
def fetchPrices(cls, prices):
"""Fetch all prices passed to this method"""
@@ -65,7 +80,7 @@ class Price(object):
# Base request URL
baseurl = "https://eve-central.com/api/marketstat"
data.append(("usesystem", 30000142)) # Use Jita for market
data.append(("usesystem", Price.currentSystemId)) # Use Jita for market
for typeID in toRequest: # Add all typeID arguments
data.append(("typeid", typeID))
@@ -113,3 +128,27 @@ class Price(object):
priceobj = priceMap[typeID]
priceobj.time = time.time() + REREQUEST
priceobj.failed = True
@classmethod
def fitItemsList(self, fit):
# Compose a list of all the data we need & request it
typeIDs = []
typeIDs.append(fit.ship.item.ID)
for mod in fit.modules:
if not mod.isEmpty:
typeIDs.append(mod.itemID)
for drone in fit.drones:
for _ in xrange(drone.amount):
typeIDs.append(drone.itemID)
for fighter in fit.fighters:
for _ in xrange(fighter.amountActive):
typeIDs.append(fighter.itemID)
for cargo in fit.cargo:
for _ in xrange(cargo.amount):
typeIDs.append(cargo.itemID)
return typeIDs