More channel changing work

This commit is contained in:
noisymime 2008-02-17 11:23:38 +00:00
parent b53e422fbf
commit e706e4c094
6 changed files with 94 additions and 43 deletions

View File

@ -14,7 +14,7 @@ class Spinner (clutter.Texture):
self.timeline = clutter.Timeline(40,20)
self.timeline.set_loop(True)
alpha = clutter.Alpha(self.timeline, clutter.ramp_inc_func)
self.spin_behaviour = clutter.BehaviourRotate( axis=clutter.Z_AXIS , direction=clutter.ROTATE_CW, angle_start=0, angle_end=359, alpha=alpha)
self.spin_behaviour = clutter.BehaviourRotate( axis=clutter.Z_AXIS , direction=clutter.ROTATE_CW, angle_start=0, angle_end=360, alpha=alpha)
self.spin_behaviour.set_center(self.get_width()/2,self.get_height()/2, 0)
self.spin_behaviour.apply(self)
self.timeline.start()

Binary file not shown.

View File

@ -52,6 +52,10 @@ class SplashScr(clutter.Group):
self.detail = clutter.Label()
self.detail.set_font_name(self.font + str(self.detail_font_size))
self.detail.set_color(clutter.color_parse('White'))
self.detail.set_position(\
self.message.get_x(),\
self.message.get_y() + self.message.get_height()\
)
self.centre_group.add(self.detail)
def display(self):
@ -68,7 +72,7 @@ class SplashScr(clutter.Group):
self.show()
self.spinner.start()
#Same as above, except fades everything in
def display_elegant(self):
self.set_opacity(0)
self.stage.add(self)
@ -77,7 +81,8 @@ class SplashScr(clutter.Group):
group_x = (self.stage.get_width()/2) - (self.box.get_width()/2)
group_y = (self.stage.get_height()/2) - (self.box.get_height()/2)
self.centre_group.set_position(group_x, group_y)
self.show()
self.centre_group.show_all()
self.centre_group.show()
timeline_opacity = clutter.Timeline(20, 25)
alpha_opacity = clutter.Alpha(timeline_opacity, clutter.ramp_inc_func)
@ -95,7 +100,7 @@ class SplashScr(clutter.Group):
self.message.set_text(msg)
def set_details(self, detail):
self.detail.set_test(detail)
self.detail.set_text(detail)

View File

@ -229,42 +229,40 @@ class VideoController:
texture.set_size(width, height)
def pause_video(self):
#Use the overlay to go over show
if self.overlay == None:
self.overlay = clutter.Texture()
pixbuf = gtk.gdk.pixbuf_new_from_file('ui/backdrop.png')
self.overlay.set_pixbuf(pixbuf)
self.overlay.set_width(self.stage.get_width())
self.overlay.set_height(self.stage.get_height())
self.stage.add(self.overlay)
self.overlay.set_opacity(0)
self.overlay.show()
def pause_video(self, use_backdrop):
if use_backdrop:
#Use the overlay to go over show
if self.overlay == None:
self.overlay = clutter.Rectangle()
self.overlay.set_color(clutter.color_parse('Black'))
self.overlay.set_size(self.stage.get_width(), self.stage.get_height())
self.stage.add(self.overlay)
self.overlay.set_opacity(0)
self.overlay.show()
#self.video_texture.lower_actor(self.overlay)
#self.overlay.raise_actor(self.video_texture)
#Fade the overlay in
timeline_overlay = clutter.Timeline(10,30)
alpha = clutter.Alpha(timeline_overlay, clutter.ramp_inc_func)
overlay_behaviour = clutter.BehaviourOpacity(alpha, 0, 200)
#video_behaviour = clutter.BehaviourOpacity(alpha, 255, 80)
overlay_behaviour.apply(self.overlay)
#video_behaviour.apply(self.video_texture)
timeline_overlay.start()
#self.video_texture.lower_actor(self.overlay)
#self.overlay.raise_actor(self.video_texture)
#Fade the overlay in
timeline_overlay = clutter.Timeline(10,30)
alpha = clutter.Alpha(timeline_overlay, clutter.ramp_inc_func)
self.overlay_behaviour = clutter.BehaviourOpacity(opacity_start=0, opacity_end=200, alpha=alpha)
self.overlay_behaviour.apply(self.overlay)
#video_behaviour.apply(self.video_texture)
timeline_overlay.start()
#Pause the video
self.video_texture.set_playing(False)
def unpause_video(self):
#Fade the backdrop in
timeline_unpause = clutter.Timeline(10,30)
alpha = clutter.Alpha(timeline_unpause, clutter.ramp_inc_func)
overlay_behaviour = clutter.BehaviourOpacity(alpha, 200, 0)
#video_behaviour = clutter.BehaviourOpacity(alpha, 80, 255)
overlay_behaviour.apply(self.overlay)
#video_behaviour.apply(self.video_texture)
timeline_unpause.start()
if not self.overlay is None:
#Fade the backdrop in
timeline_unpause = clutter.Timeline(10,30)
alpha = clutter.Alpha(timeline_unpause, clutter.ramp_inc_func)
self.overlay_behaviour = clutter.BehaviourOpacity(opacity_start=200, opacity_end=0, alpha=alpha)
self.overlay_behaviour.apply(self.overlay)
#video_behaviour.apply(self.video_texture)
timeline_unpause.start()
#Resume the video
self.video_texture.set_playing(True)

View File

@ -30,6 +30,7 @@ class MythBackendConnection(threading.Thread):
#self.sock.connect( ("192.168.0.8", 6543) )
self.connected = False
self.recorder = None # Mythtv recorder
self.chanNum = None
self.connect(self.server, self.server_port)
threading.Thread.__init__(self)
@ -102,18 +103,43 @@ class MythBackendConnection(threading.Thread):
else:
print "TV_PLAYER: Backend reports no recorders available"
#Sends the SET CHANNEL commands
def set_channel(self):
if self.recorder == None:
print "TV_PLAYER: Cannot set channel, no recorder available"
return
#First check its a valid channel name
validate_cmd = "QUERY_RECORDER "+str(self.recorder) +"[]:[]CHECK CHANNEL[]:[]"+str(self.chanNum)
self.send_cmd(self.sock, validate_cmd)
result = self.receive_reply(self.sock)
print "Recorder Result: " + result
if result == "ok":
print "Attempting to change to: " + self.chanNum
change_cmd = "QUERY_RECORDER "+str(self.recorder) +"[]:[]SET_CHANNEL[]:[]"+str(self.chanNum)
self.send_cmd(self.sock, change_cmd)
result = self.receive_reply(self.sock)
print "Change result: " + result
def spawn_live(self):
if self.recorder == None:
print "TV_PLAYER: Cannot spawn live tv, no recorder available"
chainID = "live-" + self.localhost_name + "-2007-08-03T21:54:21"#+str(time.clock())
spawn_string = "QUERY_RECORDER "+str(self.recorder)+"[]:[]SPAWN_LIVETV[]:[]"+chainID +"[]:[]0"
self.send_cmd(self.sock, spawn_string)
spawn_receive_string = "ok"
result = self.receive_reply(self.sock)
if not result == spawn_receive_string:
print "TV_PLAYER: failed to spawn live tv. Result: "+str(result)
#Set channel if it has been set
if not self.chanNum is None:
self.set_channel()
self.setup_recording()
def setup_recording(self):

View File

@ -41,8 +41,8 @@ class Module:
self.menuMgr = menuMgr
#self.buffer_file_reader = open("test.mpg","r")
menuMgr.get_selector_bar().set_spinner(True)
(server, port) = self.dbMgr.get_backend_server()
self.myConn = MythBackendConnection(self, server, port)
(self.server, self.port) = self.dbMgr.get_backend_server()
self.myConn = MythBackendConnection(self, self.server, self.port)
self.myConn.start()
#vid.begin(self.stage)
@ -76,7 +76,19 @@ class Module:
if (event.keyval == clutter.keysyms.Return):
if self.osd.on_screen:
self.loading_scr = SplashScr(self.stage)
self.myConn.change_channel(self.currentChannel.name)
self.loading_scr.set_msg("Loading Channel ")
self.loading_scr.set_details(self.osd.currentChannel.name)
self.loading_scr.backdrop.set_opacity(180)
self.loading_scr.display_elegant()
self.videoController.pause_video(False)
self.myConn.stop()
self.myConn = None
self.myConn = MythBackendConnection(self, self.server, self.port)
self.myConn.chanNum = self.osd.currentChannel.channum
self.myConn.start()
self.videoController.unpause_video()
#self.loading_scr.remove()
#self.myConn.change_channel(self.currentChannel.name)
if event.keyval == clutter.keysyms.Escape:
return True
@ -121,6 +133,7 @@ class osd:
self.on_screen = False
self.channelOffset = 0
self.input_count = 0
def on_key_press_event(self, stage, event, tv_player):
if self.on_screen:
@ -129,6 +142,8 @@ class osd:
elif (event.keyval == clutter.keysyms.Down):
self.channelOffset -= 1
#Increment the input counter (Only when this reaches 0 will the osd be removed from screen
self.input_count += 1
else:
stage.add(self.text)
self.channelOffset = 0
@ -141,6 +156,13 @@ class osd:
self.timeout_id = gobject.timeout_add(3000, self.exit, stage)
def exit(self, stage):
stage.remove(self.text)
self.on_screen = False
#First check the input counter, we only remove the osd from screen if this is 0
if self.input_count > 0:
self.input_count -= 1
return False
if self.on_screen:
stage.remove(self.text)
self.on_screen = False
return False