Package dtk :: Package ui :: Module mplayer_view

Source Code for Module dtk.ui.mplayer_view

 1  #! /usr/bin/env python 
 2  # -*- coding: utf-8 -*- 
 3   
 4  # Copyright (C) 2011 ~ 2012 Deepin, Inc. 
 5  #               2011 ~ 2012 Wang Yong 
 6  #  
 7  # Author:     Wang Yong <lazycat.manatee@gmail.com> 
 8  # Maintainer: Wang Yong <lazycat.manatee@gmail.com> 
 9  #  
10  # This program is free software: you can redistribute it and/or modify 
11  # it under the terms of the GNU General Public License as published by 
12  # the Free Software Foundation, either version 3 of the License, or 
13  # any later version. 
14  #  
15  # This program is distributed in the hope that it will be useful, 
16  # but WITHOUT ANY WARRANTY; without even the implied warranty of 
17  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
18  # GNU General Public License for more details. 
19  #  
20  # You should have received a copy of the GNU General Public License 
21  # along with this program.  If not, see <http://www.gnu.org/licenses/>. 
22   
23  import gobject 
24  import gtk 
25   
26 -class MplayerView(gtk.DrawingArea):
27 ''' 28 View to offer a drawing area for mplayer. 29 30 MplayerView default disable double buffered to avoid video blinking when mplayer draw on it. 31 32 @undocumented: realize_mplayer_view 33 ''' 34 35 __gsignals__ = { 36 "get-xid" : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, (long,)) 37 } 38
39 - def __init__(self):
40 ''' 41 Initialize MplayerView class. 42 ''' 43 # Init. 44 gtk.DrawingArea.__init__(self) 45 self.unset_flags(gtk.DOUBLE_BUFFERED) # disable double buffered to avoid video blinking 46 47 # Handle signal. 48 self.connect("realize", self.realize_mplayer_view)
49
50 - def realize_mplayer_view(self, widget):
51 ''' 52 Internal callback for `realize` signal. 53 ''' 54 if self.get_window() and self.get_window().xid: 55 self.emit("get-xid", self.get_window().xid)
56 57 gobject.type_register(MplayerView) 58