44import gui .builtinMarketBrowser .pfSearchBox as SBox
55from config import slotColourMap , slotColourMapDark
66from eos .saveddata .module import Module
7- from gui .builtinMarketBrowser .events import ItemSelected , RECENTLY_USED_MODULES
7+ from gui .builtinMarketBrowser .events import ItemSelected , RECENTLY_USED_MODULES , CHARGES_FOR_FIT
88from gui .contextMenu import ContextMenu
99from gui .display import Display
1010from gui .utils .staticHelpers import DragDropHelper
1111from gui .utils .dark import isDark
1212from service .fit import Fit
1313from service .market import Market
14+ from service .ammo import Ammo
1415
1516
1617pyfalog = Logger (__name__ )
@@ -91,7 +92,19 @@ def selectionMade(self, context):
9192 if sel .IsOk ():
9293 # Get data field of the selected item (which is a marketGroup ID if anything was selected)
9394 seldata = self .marketView .GetItemData (sel )
94- if seldata is not None and seldata != RECENTLY_USED_MODULES :
95+ if seldata == RECENTLY_USED_MODULES :
96+ items = self .sMkt .getRecentlyUsed ()
97+ elif seldata == CHARGES_FOR_FIT :
98+ fitId = self .mainFrame .getActiveFit ()
99+ items = set ()
100+ if fitId is not None :
101+ fit = self .sFit .getFit (fitId )
102+ items = set ()
103+ for mod in fit .modules :
104+ charges = Ammo .getInstance ().getModuleFlatAmmo (mod )
105+ for charge in charges :
106+ items .add (charge )
107+ elif seldata is not None :
95108 # If market group treeview item doesn't have children (other market groups or dummies),
96109 # then it should have items in it and we want to request them
97110 if self .marketView .ItemHasChildren (sel ) is False :
@@ -103,11 +116,7 @@ def selectionMade(self, context):
103116 else :
104117 items = set ()
105118 else :
106- # If method was called but selection wasn't actually made or we have a hit on recently used modules
107- if seldata == RECENTLY_USED_MODULES :
108- items = self .sMkt .getRecentlyUsed ()
109- else :
110- items = set ()
119+ items = set ()
111120
112121 # Fill store
113122 self .updateItemStore (items )
0 commit comments