diff --git a/DvdPlayer.py b/DvdPlayer.py index 0296543..fa16c79 100644 --- a/DvdPlayer.py +++ b/DvdPlayer.py @@ -1,5 +1,6 @@ import clutter from clutter import cluttergst +from VideoController import osd class DvdPlayer: @@ -7,11 +8,15 @@ class DvdPlayer: self.stage = Stage self.video = cluttergst.VideoTexture() self.paused = False + self.isPlaying = False self.overlay = None self.video.set_uri("dvd://1") def on_key_press_event (self, stage, event): + if self.isPlaying: + self.osd.on_key_press_event(event) + if event.keyval == clutter.keysyms.p: if self.paused: self.unpause() @@ -22,17 +27,14 @@ class DvdPlayer: def begin(self, MenuMgr): + self.osd = osd(self.stage) self.stage.add(self.video) self.video.set_playing(True) + self.isPlaying = True - #Resize for fullscreen - #while self.video.get_buffer_percent() < 5: - print self.video.get_position() - - #xy_ratio = self.video.get_width() / self.video.get_height() - self.video.set_width( int(self.stage.get_width()) ) - #self.video.set_height(self.video.get_width() * xy_ratio) + #Set fullscreen event + self.video.connect('size-change', self.osd.set_fullscreen) self.video.show() diff --git a/VideoController.py b/VideoController.py index eef8b07..dde7fbb 100644 --- a/VideoController.py +++ b/VideoController.py @@ -87,8 +87,8 @@ class osd: self.bar_group = clutter.Group() self.background = clutter.Texture() - self.background.set_pixbuf( gtk.gdk.pixbuf_new_from_file("ui/osd_bar.png") ) - self.background.set_opacity(120) + self.background.set_pixbuf( gtk.gdk.pixbuf_new_from_file("ui/osd_bar3.png") ) + self.background.set_opacity(255) self.background.set_width(stage.get_width()) self.bar_group.add(self.background) self.bar_group.show_all() @@ -136,4 +136,16 @@ class osd: def on_key_press_event(self, event): self.enter() + def set_fullscreen(self, texture, width, height): + texture.set_property("sync-size", False) + texture.set_position(0, 0) + xy_ratio = float(width / height) + #print "XY Ratio: " + str(xy_ratio) + + width = int(self.stage.get_width()) + height = int (width / xy_ratio) + height = 768 + + texture.set_size(width, height) +