Merge tag 'v1.13.2' into wx3

Conflicts:
	config.py
	A lot of icons
This commit is contained in:
blitzmann
2015-07-20 13:21:00 -04:00
137 changed files with 1183 additions and 774 deletions

View File

@@ -97,7 +97,8 @@ class Fit(object):
"rackSlots": True,
"rackLabels": True,
"compactSkills": True,
"showTooltip": True}
"showTooltip": True,
"showMarketShortcuts": False}
self.serviceFittingOptions = SettingsProvider.getInstance().getSettings(
"pyfaServiceFittingOptions", serviceFittingDefaultOptions)
@@ -149,8 +150,8 @@ class Fit(object):
return fit.modules[pos]
def newFit(self, shipID, name=None):
fit = eos.types.Fit()
fit.ship = eos.types.Ship(eos.db.getItem(shipID))
ship = eos.types.Ship(eos.db.getItem(shipID))
fit = eos.types.Fit(ship)
fit.name = name if name is not None else "New %s" % fit.ship.item.name
fit.damagePattern = self.pattern
fit.targetResists = self.targetResists
@@ -274,7 +275,6 @@ class Fit(object):
except ValueError:
return False
fit.implants.freeSlot(implant)
fit.implants.append(implant)
self.recalc(fit)
return True
@@ -300,7 +300,6 @@ class Fit(object):
except ValueError:
return False
fit.boosters.freeSlot(booster)
fit.boosters.append(booster)
self.recalc(fit)
return True
@@ -893,7 +892,7 @@ class Fit(object):
State.ONLINE: State.ACTIVE} # Just in case
def __getProposedState(self, mod, click, proposedState=None):
if mod.slot in (Slot.RIG, Slot.SUBSYSTEM) or mod.isEmpty:
if mod.slot is Slot.SUBSYSTEM or mod.isEmpty:
return State.ONLINE
currState = mod.state

View File

@@ -71,6 +71,7 @@ class ShipBrowserWorkerThread(threading.Thread):
class PriceWorkerThread(threading.Thread):
def run(self):
self.queue = Queue.Queue()
self.wait = {}
self.processUpdates()
def processUpdates(self):
@@ -86,9 +87,21 @@ class PriceWorkerThread(threading.Thread):
wx.CallAfter(callback)
queue.task_done()
# After we fetch prices, go through the list of waiting items and call their callbacks
for price in requests:
callbacks = self.wait.pop(price.typeID, None)
if callbacks:
for callback in callbacks:
wx.CallAfter(callback)
def trigger(self, prices, callbacks):
self.queue.put((callbacks, prices))
def setToWait(self, itemID, callback):
if itemID not in self.wait:
self.wait[itemID] = []
self.wait[itemID].append(callback)
class SearchWorkerThread(threading.Thread):
def run(self):
self.cv = threading.Condition()
@@ -218,9 +231,8 @@ class Market():
"Mobile Decoy Unit": False, # Seems to be left over test mod for deployables
"Tournament Micro Jump Unit": False, # Normally seen only on tournament arenas
"Council Diplomatic Shuttle": False, # CSM X celebration
"Federation Navy 200mm Steel Plates": True, # Accidentally unpublished by CCP
"Imperial Navy 200mm Steel Plates": True, # Accidentally unpublished by CCP
"Syndicate 200mm Steel Plates": True, # Accidentally unpublished by CCP
"Imp": False, # AT13 prize, not a real ship yet
"Fiend": False, # AT13 prize, not a real ship yet
}
# do not publish ships that we convert
@@ -693,10 +705,6 @@ class Market():
self.priceCache[typeID] = price
if not price.isValid:
# if the price has expired
price.price = None
return price
def getPricesNow(self, typeIDs):
@@ -719,6 +727,21 @@ class Market():
self.priceWorkerThread.trigger(requests, cb)
def waitForPrice(self, item, callback):
"""
Wait for prices to be fetched and callback when finished. This is used with the column prices for modules.
Instead of calling them individually, we set them to wait until the entire fit price is called and calculated
(see GH #290)
"""
def cb():
try:
callback(item)
except:
pass
self.priceWorkerThread.setToWait(item.ID, cb)
def clearPriceCache(self):
self.priceCache.clear()
deleted_rows = eos.db.clearPrices()

View File

@@ -55,4 +55,4 @@ else:
# If database does not exist, do not worry about migration. Simply
# create and set version
eos.db.saveddata_meta.create_all()
eos.db.saveddata_engine.execute('PRAGMA user_version = %d'%config.dbversion)
eos.db.saveddata_engine.execute('PRAGMA user_version = {}'.format(migration.getAppVersion()))

View File

@@ -52,7 +52,7 @@ class Price():
item = eos.db.getItem(typeID)
# We're not going to request items only with market group, as eve-central
# doesn't provide any data for items not on the market
if item.marketGroupID:
if item is not None and item.marketGroupID:
toRequest.add(typeID)
# Do not waste our time if all items are not on the market
@@ -71,7 +71,6 @@ class Price():
# Attempt to send request and process it
try:
len(priceMap)
network = service.Network.getInstance()
data = network.request(baseurl, network.PRICES, data)
xml = minidom.parse(data)
@@ -102,7 +101,7 @@ class Price():
for typeID in priceMap.keys():
priceobj = priceMap[typeID]
priceobj.time = time.time() + TIMEOUT
priceobj.failed = None
priceobj.failed = True
del priceMap[typeID]
except:
# all other errors will pass and continue onward to the REREQUEST delay
@@ -111,6 +110,5 @@ class Price():
# if we get to this point, then we've got an error. Set to REREQUEST delay
for typeID in priceMap.keys():
priceobj = priceMap[typeID]
priceobj.price = 0
priceobj.time = time.time() + REREQUEST
priceobj.failed = None
priceobj.failed = True