Audio: Fix cleanup of tracking lists

This was used to work, but it doesn't anymore :(

box.children is always empty, probably E is deleting the contents
of the popup before calling us. Try out a new implementation.
This commit is contained in:
Davide Andreoli 2020-05-02 10:37:30 +02:00
parent 335381d6f2
commit 18c4be96dc
1 changed files with 23 additions and 10 deletions

View File

@ -116,16 +116,29 @@ class Gadget(e.Gadget):
return main_box
def popup_destroyed(self, popup):
# DBG("POPUP DESTROYED")
# remove the objects from our lists
for obj in popup.data['players_box'].children:
for player, objs in self.player_objs.items():
while obj in objs:
objs.remove(obj)
for obj in popup.data['volumes_box'].children:
for channel, objs in self.channel_objs.items():
while obj in objs:
objs.remove(obj)
""" remove the popup objects from our tracking lists """
""" This was used to work, but it doesn't work anymore :(
box.children is always empty, probably E is deleting the contents
before calling us """
# for obj in popup.data['players_box'].children:
# for player, objs in self.player_objs.items():
# while obj in objs:
# objs.remove(obj)
# for obj in popup.data['volumes_box'].children:
# for channel, objs in self.channel_objs.items():
# while obj in objs:
# objs.remove(obj)
""" new implementation """
for player, objs_list in self.player_objs.items():
for obj in objs_list:
if obj.is_deleted():
objs_list.remove(obj)
for channel, sliders_list in self.channel_objs.items():
for slider in sliders_list:
if slider.is_deleted():
sliders_list.remove(slider)
def popup_player_add(self, popup, player):
# create the edje obj for this player from 'e/gadgets/audio/player'