home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / usr / share / doc / python-gnome2-desktop / examples / mediaprofiles / profiles.py
Encoding:
Python Source  |  2006-01-20  |  1.2 KB  |  48 lines

  1. #! /usr/bin/env python
  2. import pygtk; pygtk.require("2.0")
  3. import gtk
  4. import mediaprofiles
  5.  
  6. # Fetch existing profiles
  7. profiles = mediaprofiles.get_active_list()
  8.  
  9. # Dump infos over a profile
  10. def dump(profile):
  11.     print 'Active:', profile.get_active()
  12.     print 'Description:',profile.get_description()
  13.     print 'Extension:',profile.get_extension()
  14.     print 'Id:',profile.get_id()
  15.     print 'Name:',profile.get_name()
  16.     print 'Pipeline:',profile.get_pipeline()
  17.     
  18. # Print info about existing profiles
  19. for profile in profiles:
  20.     print '----------------'
  21.     dump(profile)
  22.     print '----------------\n'
  23.     
  24. # Retreive the profile from an ID
  25. profile = mediaprofiles.lookup("voice")
  26. print '----------------'
  27. print 'Audio profile for ID="voice"'
  28. dump(profile)
  29. print '----------------\n'
  30.  
  31. # Show a window to allow a profile selection
  32. win = gtk.Window()
  33. # This returns in fact a combo box filled with profiles name,
  34. # so you can use normal combobox methods
  35. chooser = mediaprofiles.chooser_combo()
  36. mediaprofiles.chooser_combo_set_profile(chooser, "voice")
  37.  
  38. def on_profile_changed(chooser):
  39.     print '----------------'
  40.     dump(mediaprofiles.chooser_combo_get_profile(chooser))
  41.     print '----------------\n'
  42. chooser.connect('changed', on_profile_changed)
  43.  
  44. win.add(chooser)
  45. win.show_all()
  46.  
  47. gtk.main()
  48.