Correctly set size_hints so the popup resize well

This commit is contained in:
Davide Andreoli 2014-08-31 13:00:40 +02:00
parent 1ff9d69434
commit c343bd509c
1 changed files with 8 additions and 4 deletions

View File

@ -36,7 +36,7 @@ class Gadget(e.Gadget):
super().__init__()
self.player_objs = {} # key: "player name" val: (list of edje objs)
self.player_objs = {} # key: Player instance val: (list of edje objs)
self.channel_objs = {} # key: Channel instance val: (list of elm Slider)
self.mpris = Mpris2_Client()
@ -114,7 +114,6 @@ class Gadget(e.Gadget):
# create the edje obj for this player from 'e/gadgets/audio/player'
o = edje.Edje(popup.evas, update_hints=True)
e.theme_edje_object_set(o, 'audio', 'player')
o.size_hint_min = o.size_min
o.signal_callback_add('act,play', '', lambda o,sig,src: player.play())
o.signal_callback_add('act,prev', '', lambda o,sig,src: player.prev())
@ -126,6 +125,7 @@ class Gadget(e.Gadget):
# insert the player in the popup box
popup.part_box_append('players.box', o)
popup.size_hint_min = popup.size_min
# keep track of this obj in the player_objs dict
if not player in self.player_objs:
@ -152,6 +152,9 @@ class Gadget(e.Gadget):
# remove the player from our list
del self.player_objs[player]
for popup in self._popups:
popup.size_hint_min = popup.size_min
def player_update(self, obj, player):
# player name
obj.part_text_set('player_name', player.label or player.name)
@ -199,7 +202,7 @@ class Gadget(e.Gadget):
# insert the slider in the popup box
popup.part_box_prepend('volumes.box', sl)
# popup.calc_force()
popup.size_hint_min = popup.size_min
# keep track of this obj in the channel_objs dict
if not channel in self.channel_objs:
@ -248,6 +251,8 @@ class Gadget(e.Gadget):
del self.channel_objs[channel][:]
del self.channel_objs[channel]
for popup in self._popups:
popup.size_hint_min = popup.size_min
class Mpris2_Client(object):
BASE_PATH = 'org.mpris.MediaPlayer2.'
@ -363,7 +368,6 @@ class AudioChannel(object):
return '[%s]: "%s" volume: %s' % \
(self.iface.split('.')[-1], self.name, self.volume[:])
class PulseAudio_Client(object):
PULSE_OBJ = '/org/pulseaudio/core1'
PULSE_IFACE = 'org.PulseAudio.Core1'