~nataliabidart/software-center/winged-migration

« back to all changes in this revision

Viewing changes to softwarecenter/ui/gtk3/widgets/videoplayer.py

  • Committer: Natalia B. Bidart
  • Date: 2012-05-30 18:39:55 UTC
  • mto: This revision was merged to the branch mainline in revision 3030.
  • Revision ID: natalia.bidart@canonical.com-20120530183955-zbnjczayktmmg5tv
- Initial test cleanup:
  - Renamed test/ dir to tests/.
  - Isolated test code into tests/ directory, including moving all the
    get_test_window_foo from the gtk3 production modules to
    tests/gtk3/windows.py module.
  - Removed all the calls to Gtk.main() in gtk3 tests since that blocks the
    execution of the suite.
  - Pep8 and pyflakes fixes in the files already modified in this branch.
  - Minor bug fix in the softwarecenter/log.py module when trying to create a
    log dir with proper perms.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
import logging
20
20
import subprocess
21
 
import sys
22
21
 
23
22
from gettext import gettext as _
24
23
from gi.repository import Gdk
156
155
            xid = self.player.movie_window.get_window().get_xid()
157
156
            imagesink.set_xwindow_id(xid)
158
157
            Gdk.threads_leave()
159
 
 
160
 
 
161
 
def get_test_videoplayer_window():
162
 
 
163
 
    # youtube example fragment
164
 
    html_youtube = """<iframe width="640" height="390"
165
 
src="http://www.youtube.com/embed/h3oBU0NZJuA" frameborder="0"
166
 
allowfullscreen></iframe>"""
167
 
    # vimeo example video fragment
168
 
    html_vimeo = """<iframe
169
 
src="http://player.vimeo.com/video/2891554?title=0&amp;byline=0&amp;portrait=0"
170
 
width="400" height="308" frameborder="0" webkitAllowFullScreen
171
 
allowFullScreen></iframe><p><a href="http://vimeo.com/2891554">
172
 
Supertuxkart 0.6</a> from <a href="http://vimeo.com/user1183699">
173
 
constantin pelikan</a> on <a href="http://vimeo.com">Vimeo</a>.</p>"""
174
 
    # dailymotion example video fragment
175
 
    html_dailymotion = """<iframe frameborder="0" width="480" height="270"
176
 
src="http://www.dailymotion.com/embed/video/xm4ysu"></iframe>"""
177
 
    html_dailymotion2 = """<iframe frameborder="0" width="480" height="379"
178
 
src="http://www.dailymotion.com/embed/video/xdiktp"></iframe>"""
179
 
 
180
 
    html_youtube  # pyflakes
181
 
    html_dailymotion  # pyflakes
182
 
    html_dailymotion2  # pyflakes
183
 
 
184
 
    win = Gtk.Window.new(Gtk.WindowType.TOPLEVEL)
185
 
    win.set_default_size(500, 400)
186
 
    win.connect("destroy", Gtk.main_quit)
187
 
    player = VideoPlayer()
188
 
    win.add(player)
189
 
    if len(sys.argv) < 2:
190
 
        #player.uri = "http://upload.wikimedia.org/wikipedia/commons/9/9b/" \
191
 
        #    "Pentagon_News_Sample.ogg"
192
 
        #player.uri = "http://people.canonical.com/~mvo/totem.html"
193
 
        player.load_html_string(html_vimeo)
194
 
    else:
195
 
        player.uri = sys.argv[1]
196
 
    win.show_all()
197
 
    return win
198
 
 
199
 
if __name__ == "__main__":
200
 
    logging.basicConfig()
201
 
    Gdk.threads_init()
202
 
    # Gst.init(sys.argv)
203
 
 
204
 
    win = get_test_videoplayer_window()
205
 
    Gtk.main()