- Improvement to resizing of rounded rectangles

- Added dynamic resizing to message class
- Added smooth handling of invalid codec error in video player
- Fixed selector_bar in Pear music player
- Minor changes to element layout in Pear music play screen
This commit is contained in:
noisymime 2008-06-24 12:32:27 +00:00
parent 7a63146189
commit 9cc2264c25
7 changed files with 32 additions and 24 deletions

View File

@ -176,7 +176,7 @@ class MythBackendConnection(threading.Thread):
(self.pipe_rfd, self.pipe_wfd) = os.pipe()
self.videoPlayer.begin_playback(self.pipe_rfd)
print "BEGINNING PLAYBACK!"
print "TV Player: BEGINNING PLAYBACK!"
self.Playing = True
while self.Playing:
#print "Begin loop"
@ -201,11 +201,12 @@ class MythBackendConnection(threading.Thread):
elif (request_size > request_size_step) and (num_bytes != request_size):
request_size -= request_size_step
if num_bytes < request_size and self.videoPlayer.glossMgr.debug:
print "TV_PLAYER: Failed to receive full allocation"
#print "End optimisation"
print "TV_PLAYER: (Warning) Failed to receive full allocation. Adjusting request size"
print "Ending playback"
self.stop()
self.videoPlayer.stop()
self.videoPlayer.glossMgr.kill_plugin()
#self.stop()
def message_socket_mgr(self, msg_socket):
#Do the protocol version check
@ -276,10 +277,11 @@ class MythBackendConnection(threading.Thread):
if not self.pipe_wfd is None:
os.close(self.pipe_wfd)
self.pipe_wfd = None
if not self.pipe_rfd is None:
if not self.pipe_rfd is None:
os.close(self.pipe_rfd)
self.pipe_rfd = None
if not self.data_socket_id is None:
end_transfer_cmd = "QUERY_FILETRANSFER "+str(self.data_socket_id) +"[]:[]DONE"
self.send_cmd(self.sock, end_transfer_cmd)

View File

@ -20,6 +20,7 @@ class MediaController(gobject.GObject):
def __init__(self, glossMgr):
gobject.GObject.__init__(self)
self.stage = glossMgr.stage
self.glossMgr = glossMgr
#self.media_element = clutter.Media()
self.use_osd = True

View File

@ -91,6 +91,7 @@ class VideoController(MediaController):
return
if struc.get_name() == "missing-plugin":
self.glossMgr.display_msg("Missing Plugin", message.structure.to_string())
print "GStreamer Error (missing-plugin): " + message.structure.to_string()
self.isPlaying = False
self.video_texture.set_playing(False)

View File

@ -36,6 +36,7 @@
<texture id="selector_bar">
<image>active_bar.png</image>
<height_percent>1.20</height_percent>
<dimensions type="relativeToSelf">
<width>100%</width>
<height>relative</height>

View File

@ -89,7 +89,7 @@
</dimensions>
<position type="relativeToStage">
<x>10%</x>
<y>35%</y>
<y>30%</y>
</position>
</image_frame>
@ -118,12 +118,12 @@
<!-- These labels make up the currently playing song details -->
<group id="music_play_screen_song_details">
<dimensions type="relativeToStage">
<width>25%</width>
<width>30%</width>
<height>20%</height>
</dimensions>
<position type="relativeToParent">
<x>0</x>
<y>0</y>
<position type="relativeToStage">
<x>10%</x>
<y>15%</y>
</position>
</group>
<label id="music_play_screen_song_heading">

View File

@ -24,15 +24,6 @@ class Message():
self.main_group = clutter.Group()
"""
pixbuf = gtk.gdk.pixbuf_new_from_file(self.theme_dir + "/splash_box.png")
self.box = clutter.Texture()
self.box.set_pixbuf(pixbuf)
self.box.set_opacity(int(255 * 0.75))
self.box.set_height(int(self.stage.get_height()* 0.3))
self.main_group.add(self.box)
"""
width = int(self.stage.get_width()* 0.4)
height = int(self.stage.get_height()* 0.3)
self.box = RoundedRectangle(width, height, clutter.color_parse('White'))
@ -78,6 +69,11 @@ class Message():
self.detail.set_width(width)
self.message.set_width(width)
box_height = self.message.get_height() + self.detail.get_height() + (self.message.get_y() - self.box.get_y())
if box_height > self.stage.get_height(): box_height = self.stage.get_height()
self.box.set_height(box_height)
box_y = int( (self.stage.get_height() - box_height) /2 )
self.main_group.set_y(box_y)
self.main_group.set_opacity(0)
self.backdrop.set_opacity(0)

View File

@ -28,12 +28,12 @@ class RoundedRectangle(clutter.Group):
#context = self.cairo_create()
self.texture = CairoTexture(self.width, self.height)
self.setup_rounded_context()
self.refresh()
self.add(self.texture)
self.texture.show()
self.setup_rounded_context()
self.refresh()
def setup_rounded_context(self):
# Round corners
x = 0 + self.MARGIN
@ -43,6 +43,11 @@ class RoundedRectangle(clutter.Group):
radius_x = self.RADIUS
radius_y = self.RADIUS
old_tex = self.texture
self.texture = CairoTexture(self.width, self.height)
self.add(self.texture)
self.texture.show()
self.remove(old_tex)
context = self.texture.cairo_create()
#Clear the texture
@ -84,7 +89,6 @@ class RoundedRectangle(clutter.Group):
#hr = height / float(pixbuf.get_height())
#context.scale(wr,hr)
#ct.set_source_pixbuf(pixbuf,0,0)
self.ct.rectangle(
(0, 0, self.width, self.height)
)
@ -108,7 +112,10 @@ class RoundedRectangle(clutter.Group):
clutter.Group.set_width(self, new_width)
def set_height(self, new_height):
self.texture.set_height(new_height)
self.height = new_height
self.setup_rounded_context()
self.refresh()
clutter.Group.set_height(self,new_height)
def set_size(self, new_width, new_height):