Skip to content

Commit

Permalink
use mode to limit refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
lunedis committed Jul 7, 2024
1 parent 6a7cdda commit ce9ce17
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 9 additions & 3 deletions gui/builtinMarketBrowser/itemView.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def __init__(self, parent, marketBrowser):
self.Bind(wx.EVT_LIST_BEGIN_DRAG, self.startDrag)

# the "charges for active fitting" needs to listen to fitting changes
self.mainFrame.Bind(GE.FIT_CHANGED, self.selectedFittingChanged)
self.mainFrame.Bind(GE.FIT_CHANGED, self.fitChanged)

self.active = []

Expand Down Expand Up @@ -121,6 +121,9 @@ def selectionMade(self, context):
# Set toggle buttons / use search mode flag if recently used modules category is selected (in order to have all modules listed and not filtered)
if seldata == RECENTLY_USED_MODULES:
self.marketBrowser.mode = 'recent'

if seldata == CHARGES_FOR_FIT:
self.marketBrowser.mode = 'charges'

self.setToggles()
if context == 'tree' and self.marketBrowser.settings.get('marketMGMarketSelectMode') == 1:
Expand All @@ -146,11 +149,14 @@ def getChargesForActiveFit(self):
items.add(charge)
return items

def selectedFittingChanged(self, event):
def fitChanged(self, event):
# skip the event so the other handlers also get called
event.Skip()
activeFitID = self.mainFrame.getActiveFit()

if self.marketBrowser.mode != 'charges':
return

activeFitID = self.mainFrame.getActiveFit()
# if it was not the active fitting that was changed, do not do anything
if activeFitID is not None and activeFitID not in event.fitIDs:
return
Expand Down
2 changes: 1 addition & 1 deletion gui/marketBrowser.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def mode(self, newMode):
setting = self.settings.get('marketMGSearchMode')
# We turn on all meta buttons for the duration of search/recents
if setting == 1:
if newMode in ('search', 'recent'):
if newMode in ('search', 'recent', 'charges'):
for btn in self.metaButtons:
btn.setUserSelection(True)
if newMode == 'normal':
Expand Down

0 comments on commit ce9ce17

Please sign in to comment.