From c343bd509c44f61bbb6ea482b3f66cb9db82d242 Mon Sep 17 00:00:00 2001 From: davemds Date: Sun, 31 Aug 2014 13:00:40 +0200 Subject: [PATCH] Correctly set size_hints so the popup resize well --- GADGETS/audio/__init__.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/GADGETS/audio/__init__.py b/GADGETS/audio/__init__.py index 94f4a7d..e4c4a10 100644 --- a/GADGETS/audio/__init__.py +++ b/GADGETS/audio/__init__.py @@ -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'