~ubuntu-branches/ubuntu/precise/gst0.10-python/precise

« back to all changes in this revision

Viewing changes to examples/debugslider.py

  • Committer: Bazaar Package Importer
  • Author(s): Loic Minier
  • Date: 2006-06-25 19:37:45 UTC
  • Revision ID: james.westby@ubuntu.com-20060625193745-9yeg0wq56r24n57x
Tags: upstream-0.10.4
ImportĀ upstreamĀ versionĀ 0.10.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
# -*- Mode: Python -*-
 
3
# vi:si:et:sw=4:sts=4:ts=4
 
4
 
 
5
# gst-python
 
6
# Copyright (C) 2005 Fluendo S.L.
 
7
#
 
8
# This library is free software; you can redistribute it and/or
 
9
# modify it under the terms of the GNU Library General Public
 
10
# License as published by the Free Software Foundation; either
 
11
# version 2 of the License, or (at your option) any later version.
 
12
#
 
13
# This library is distributed in the hope that it will be useful,
 
14
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
16
# Library General Public License for more details.
 
17
#
 
18
# You should have received a copy of the GNU Library General Public
 
19
# License along with this library; if not, write to the
 
20
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 
21
# Boston, MA 02111-1307, USA.
 
22
#
 
23
# Author: Andy Wingo <wingo@pobox.com>
 
24
 
 
25
import gtk
 
26
from gtk import gdk
 
27
import gobject
 
28
 
 
29
import pygst
 
30
pygst.require('0.10')
 
31
import gst
 
32
 
 
33
class DebugSlider(gtk.HScale):
 
34
    def __init__(self):
 
35
        adj = gtk.Adjustment(int(gst.debug_get_default_threshold()),
 
36
                             0, 5, 1, 0, 0)
 
37
        gtk.HScale.__init__(self, adj)
 
38
        self.set_digits(0)
 
39
        self.set_draw_value(True)
 
40
        self.set_value_pos(gtk.POS_TOP)
 
41
 
 
42
        def value_changed(self):
 
43
            newlevel = int(self.get_adjustment().get_value())
 
44
            gst.debug_set_default_threshold(newlevel)
 
45
 
 
46
        self.connect('value-changed', value_changed)
 
47
 
 
48
if __name__ == '__main__':
 
49
    p = gst.parse_launch('fakesrc ! fakesink')
 
50
    p.set_state(gst.STATE_PLAYING)
 
51
 
 
52
    w = gtk.Window()
 
53
    s = DebugSlider()
 
54
    w.add(s)
 
55
    s.show()
 
56
    w.set_default_size(200, 40)
 
57
    w.show()
 
58
    w.connect('delete-event', lambda *args: gtk.main_quit())
 
59
    gtk.main()