From 41b6000f6ecde9599aae753a359bc91cae0e9ac9 Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Tue, 12 Feb 2019 10:17:19 +0300 Subject: [PATCH 1/2] Rename ranges to something more sensible --- gui/builtinItemStatsViews/itemMutator.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/gui/builtinItemStatsViews/itemMutator.py b/gui/builtinItemStatsViews/itemMutator.py index 43bfbe1cb..df20f9567 100644 --- a/gui/builtinItemStatsViews/itemMutator.py +++ b/gui/builtinItemStatsViews/itemMutator.py @@ -31,22 +31,22 @@ class ItemMutator(wx.Panel): for m in sorted(stuff.mutators.values(), key=lambda x: x.attribute.displayName): # Format: [raw value, modifier applied to base raw value, display value] - range1 = (m.minValue, m.attribute.unit.SimplifyValue(m.minValue)) - range2 = (m.maxValue, m.attribute.unit.SimplifyValue(m.maxValue)) + minRange = (m.minValue, m.attribute.unit.SimplifyValue(m.minValue)) + maxRange = (m.maxValue, m.attribute.unit.SimplifyValue(m.maxValue)) - if (m.highIsGood and range1[0] >= range2[0]) or (not m.highIsGood and range1[0] <= range2[0]): - betterRange = range1 - worseRange = range2 + if (m.highIsGood and minRange[0] >= maxRange[0]) or (not m.highIsGood and minRange[0] <= maxRange[0]): + betterRange = minRange + worseRange = maxRange else: - betterRange = range2 - worseRange = range1 + betterRange = maxRange + worseRange = minRange - if range1[1] >= range2[1]: - displayMaxRange = range1 - displayMinRange = range2 + if minRange[1] >= maxRange[1]: + displayMaxRange = minRange + displayMinRange = maxRange else: - displayMaxRange = range2 - displayMinRange = range1 + displayMaxRange = maxRange + displayMinRange = minRange # If base value is outside of mutation range, make sure that center of slider # corresponds to the value which is closest available to actual base value. It's From dfc0a896c4086e79b51b240b062fb635c68c4a84 Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Tue, 12 Feb 2019 12:10:17 +0300 Subject: [PATCH 2/2] Do not commit price right away when creating the object --- eos/gamedata.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/eos/gamedata.py b/eos/gamedata.py index f8345ac87..31e6f262e 100644 --- a/eos/gamedata.py +++ b/eos/gamedata.py @@ -459,7 +459,10 @@ class Item(EqBase): pyfalog.debug("Creating a price for {}".format(self.ID)) self.__price = types_Price(self.ID) eos.db.add(self.__price) - eos.db.commit() + # Commented out by DarkPhoenix: it caused issues when opening stats for item with many + # variations, as each commit takes ~50 ms, for items with 30 variations time to open stats + # window could reach 2 seconds. Hopefully just adding it is sufficient. + # eos.db.commit() else: self.__price = db_price