Correctly set size_hints so the popup resize well
This commit is contained in:
parent
1ff9d69434
commit
c343bd509c
|
@ -36,7 +36,7 @@ class Gadget(e.Gadget):
|
||||||
|
|
||||||
super().__init__()
|
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.channel_objs = {} # key: Channel instance val: (list of elm Slider)
|
||||||
|
|
||||||
self.mpris = Mpris2_Client()
|
self.mpris = Mpris2_Client()
|
||||||
|
@ -114,7 +114,6 @@ class Gadget(e.Gadget):
|
||||||
# create the edje obj for this player from 'e/gadgets/audio/player'
|
# create the edje obj for this player from 'e/gadgets/audio/player'
|
||||||
o = edje.Edje(popup.evas, update_hints=True)
|
o = edje.Edje(popup.evas, update_hints=True)
|
||||||
e.theme_edje_object_set(o, 'audio', 'player')
|
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,play', '', lambda o,sig,src: player.play())
|
||||||
o.signal_callback_add('act,prev', '', lambda o,sig,src: player.prev())
|
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
|
# insert the player in the popup box
|
||||||
popup.part_box_append('players.box', o)
|
popup.part_box_append('players.box', o)
|
||||||
|
popup.size_hint_min = popup.size_min
|
||||||
|
|
||||||
# keep track of this obj in the player_objs dict
|
# keep track of this obj in the player_objs dict
|
||||||
if not player in self.player_objs:
|
if not player in self.player_objs:
|
||||||
|
@ -152,6 +152,9 @@ class Gadget(e.Gadget):
|
||||||
# remove the player from our list
|
# remove the player from our list
|
||||||
del self.player_objs[player]
|
del self.player_objs[player]
|
||||||
|
|
||||||
|
for popup in self._popups:
|
||||||
|
popup.size_hint_min = popup.size_min
|
||||||
|
|
||||||
def player_update(self, obj, player):
|
def player_update(self, obj, player):
|
||||||
# player name
|
# player name
|
||||||
obj.part_text_set('player_name', player.label or 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
|
# insert the slider in the popup box
|
||||||
popup.part_box_prepend('volumes.box', sl)
|
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
|
# keep track of this obj in the channel_objs dict
|
||||||
if not channel in self.channel_objs:
|
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][:]
|
||||||
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):
|
class Mpris2_Client(object):
|
||||||
BASE_PATH = 'org.mpris.MediaPlayer2.'
|
BASE_PATH = 'org.mpris.MediaPlayer2.'
|
||||||
|
@ -363,7 +368,6 @@ class AudioChannel(object):
|
||||||
return '[%s]: "%s" volume: %s' % \
|
return '[%s]: "%s" volume: %s' % \
|
||||||
(self.iface.split('.')[-1], self.name, self.volume[:])
|
(self.iface.split('.')[-1], self.name, self.volume[:])
|
||||||
|
|
||||||
|
|
||||||
class PulseAudio_Client(object):
|
class PulseAudio_Client(object):
|
||||||
PULSE_OBJ = '/org/pulseaudio/core1'
|
PULSE_OBJ = '/org/pulseaudio/core1'
|
||||||
PULSE_IFACE = 'org.PulseAudio.Core1'
|
PULSE_IFACE = 'org.PulseAudio.Core1'
|
||||||
|
|
Loading…
Reference in New Issue