cef
Last change
on this file since 692:eea9d6135944 was 651:b4db6e38de49, checked in by István Váradi <ivaradi@…>, 9 years ago |
PyGTK is the default on Linux too, as it is required by CEF (re #272)
|
File size:
1.7 KB
|
Rev | Line | |
---|
[575] | 1 | import os
|
---|
| 2 |
|
---|
| 3 | #-----------------------------------------------------------------------------
|
---|
| 4 |
|
---|
| 5 | ## @package mlx.common
|
---|
| 6 | #
|
---|
| 7 | # Common definitions to be used by both the GUI and possible other parts
|
---|
| 8 | #
|
---|
| 9 | # The main purpose of this module is to import Gtk+2 or 3 and related modules
|
---|
| 10 | # and provide common names for them. There is a similator module in the GUI
|
---|
| 11 | # part (\ref mlx.gui.common), which contains the GUI-specific names. This one
|
---|
| 12 | # contains only what is used by other modules as well.
|
---|
| 13 | # The variable \c pygobject tells which version of Gtk is being used. If it is
|
---|
| 14 | # \c True, Gtk+ 3 is used via the PyGObject interface. Otherwise Gtk+ 2 is
|
---|
| 15 | # used, which is the default on Windows or when the \c FORCE_PYGTK environment
|
---|
| 16 | # variable is set.
|
---|
| 17 |
|
---|
| 18 | #-------------------------------------------------------------------------------
|
---|
| 19 |
|
---|
[651] | 20 | # Due to CEF, PyGTK is the default
|
---|
| 21 | if "FORCE_PYGOBJECT" not in os.environ:
|
---|
[575] | 22 | print "Using PyGTK"
|
---|
| 23 | pygobject = False
|
---|
| 24 | import gobject
|
---|
| 25 | try:
|
---|
| 26 | import pygst
|
---|
| 27 | pygst.require('0.10')
|
---|
| 28 | import gst
|
---|
| 29 |
|
---|
[585] | 30 | def gst_init():
|
---|
| 31 | pass
|
---|
| 32 |
|
---|
[575] | 33 | def gst_element_factory_make(what):
|
---|
| 34 | return gst.element_factory_make(what)
|
---|
| 35 |
|
---|
| 36 | GST_STATE_PLAYING=gst.STATE_PLAYING
|
---|
| 37 | GST_MESSAGE_EOS=gst.MESSAGE_EOS
|
---|
| 38 | except:
|
---|
| 39 | pass
|
---|
| 40 | else:
|
---|
| 41 | print "Using PyGObject"
|
---|
| 42 | pygobject = True
|
---|
| 43 |
|
---|
| 44 | from gi.repository import GObject as gobject
|
---|
| 45 |
|
---|
| 46 | try:
|
---|
| 47 | from gi.repository import Gst as gst
|
---|
| 48 |
|
---|
[585] | 49 | def gst_init():
|
---|
| 50 | gst.init()
|
---|
| 51 |
|
---|
[575] | 52 | def gst_element_factory_make(what):
|
---|
| 53 | return gst.ElementFactory.make(what)
|
---|
| 54 |
|
---|
| 55 | GST_STATE_PLAYING=gst.State.PLAYING
|
---|
| 56 | GST_MESSAGE_EOS=gst.MessageType.EOS
|
---|
| 57 | except:
|
---|
| 58 | import traceback
|
---|
| 59 | traceback.print_exc()
|
---|
| 60 | pass
|
---|
Note:
See
TracBrowser
for help on using the repository browser.