diff --git a/eos/saveddata/cargo.py b/eos/saveddata/cargo.py index 34ab42db3..4b82dfc33 100644 --- a/eos/saveddata/cargo.py +++ b/eos/saveddata/cargo.py @@ -17,6 +17,7 @@ # along with eos. If not, see . # =============================================================================== +import sys import logging from sqlalchemy.orm import validates, reconstructor @@ -68,10 +69,14 @@ class Cargo(HandledItem, ItemAttrShortcut): def clear(self): self.itemModifiedAttributes.clear() - @validates("fitID", "itemID") + @validates("fitID", "itemID", "amount") def validator(self, key, val): map = {"fitID": lambda val: isinstance(val, int), - "itemID": lambda val: isinstance(val, int)} + "itemID": lambda val: isinstance(val, int), + "amount": lambda val: isinstance(val, int)} + + if key == "amount" and val > sys.maxint: + val = sys.maxint if not map[key](val): raise ValueError(str(val) + " is not a valid value for " + key) diff --git a/gui/builtinContextMenus/amount.py b/gui/builtinContextMenus/amount.py index f727ded74..a4984a635 100644 --- a/gui/builtinContextMenus/amount.py +++ b/gui/builtinContextMenus/amount.py @@ -49,6 +49,11 @@ class AmountChanger(wx.Dialog): self.button.Bind(wx.EVT_BUTTON, self.change) def change(self, event): + sFit = Fit.getInstance() + if self.input.GetLineText(0).strip() == '': + event.Skip() + return + sFit = Fit.getInstance() mainFrame = gui.mainFrame.MainFrame.getInstance() fitID = mainFrame.getActiveFit() @@ -63,7 +68,6 @@ class AmountChanger(wx.Dialog): wx.PostEvent(mainFrame, GE.FitChanged(fitID=fitID)) event.Skip() - self.Close() # checks to make sure it's valid number def onChar(self, event): diff --git a/gui/builtinStatsViews/priceViewFull.py b/gui/builtinStatsViews/priceViewFull.py index c02f723c1..bb222d94a 100644 --- a/gui/builtinStatsViews/priceViewFull.py +++ b/gui/builtinStatsViews/priceViewFull.py @@ -82,16 +82,14 @@ class PriceViewFull(StatsView): typeIDs.append(mod.itemID) for drone in fit.drones: - for _ in range(drone.amount): - typeIDs.append(drone.itemID) + typeIDs.append(drone.itemID) for fighter in fit.fighters: - for _ in range(fighter.amountActive): + if fighter.amountActive > 0: typeIDs.append(fighter.itemID) for cargo in fit.cargo: - for _ in range(cargo.amount): - typeIDs.append(cargo.itemID) + typeIDs.append(cargo.itemID) sMkt = Market.getInstance() sMkt.getPrices(typeIDs, self.processPrices) diff --git a/gui/mainFrame.py b/gui/mainFrame.py index 6570bcfc6..244ac215b 100644 --- a/gui/mainFrame.py +++ b/gui/mainFrame.py @@ -107,6 +107,7 @@ class PFPanel(wx.Panel): class OpenFitsThread(threading.Thread): def __init__(self, fits, callback): threading.Thread.__init__(self) + self.name = "LoadingOpenFits" self.mainFrame = MainFrame.getInstance() self.callback = callback self.fits = fits diff --git a/gui/utils/exportHtml.py b/gui/utils/exportHtml.py index 59b54319d..41fa7584d 100644 --- a/gui/utils/exportHtml.py +++ b/gui/utils/exportHtml.py @@ -31,6 +31,7 @@ class exportHtml(): class exportHtmlThread(threading.Thread): def __init__(self, callback=False): threading.Thread.__init__(self) + self.name = "HTMLExport" self.callback = callback self.stopRunning = False diff --git a/service/character.py b/service/character.py index be0000494..33cd4c765 100644 --- a/service/character.py +++ b/service/character.py @@ -44,6 +44,7 @@ logger = logging.getLogger(__name__) class CharacterImportThread(threading.Thread): def __init__(self, paths, callback): threading.Thread.__init__(self) + self.name = "CharacterImport" self.paths = paths self.callback = callback @@ -100,6 +101,7 @@ class CharacterImportThread(threading.Thread): class SkillBackupThread(threading.Thread): def __init__(self, path, saveFmt, activeFit, callback): threading.Thread.__init__(self) + self.name = "SkillBackup" self.path = path self.saveFmt = saveFmt self.activeFit = activeFit diff --git a/service/market.py b/service/market.py index 3384b3ecb..6edb3d432 100644 --- a/service/market.py +++ b/service/market.py @@ -49,6 +49,10 @@ mktRdy = threading.Event() class ShipBrowserWorkerThread(threading.Thread): + def __init__(self): + threading.Thread.__init__(self) + self.name = "ShipBrowser" + def run(self): self.queue = Queue.Queue() self.cache = {} @@ -80,6 +84,10 @@ class ShipBrowserWorkerThread(threading.Thread): class PriceWorkerThread(threading.Thread): + def __init__(self): + threading.Thread.__init__(self) + self.name = "PriceWorker" + def run(self): self.queue = Queue.Queue() self.wait = {} @@ -115,6 +123,10 @@ class PriceWorkerThread(threading.Thread): class SearchWorkerThread(threading.Thread): + def __init__(self): + threading.Thread.__init__(self) + self.name = "SearchWorker" + def run(self): self.cv = threading.Condition() self.searchRequest = None diff --git a/service/prefetch.py b/service/prefetch.py index 6e86683e5..d744fea1b 100644 --- a/service/prefetch.py +++ b/service/prefetch.py @@ -31,24 +31,6 @@ import logging logger = logging.getLogger(__name__) - -class PrefetchThread(threading.Thread): - def run(self): - # We're a daemon thread, as such, interpreter might get shut down while we do stuff - # Make sure we don't throw tracebacks to console - try: - es_Character.setSkillList(db.getItemsByCategory( - "Skill", - eager=("effects", "attributes", "attributes.info.icon", "attributes.info.unit", "icon") - )) - except: - pass - - -prefetch = PrefetchThread() -prefetch.daemon = True -prefetch.start() - # The following code does not belong here, however until we rebuild skeletons # to include modified pyfa.py, this is the best place to put it. See GH issue # #176 diff --git a/service/update.py b/service/update.py index 05f05efd7..2c09910d7 100644 --- a/service/update.py +++ b/service/update.py @@ -32,6 +32,7 @@ from service.settings import UpdateSettings class CheckUpdateThread(threading.Thread): def __init__(self, callback): threading.Thread.__init__(self) + self.name = "CheckUpdate" self.callback = callback self.settings = UpdateSettings.getInstance() self.network = Network.getInstance()