home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / usr / share / doc / python-gst0.10 / examples / debugslider.py < prev    next >
Encoding:
Python Source  |  2006-07-31  |  1.8 KB  |  60 lines

  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()
  60.