Last change
on this file since 579:7d8bd4b502c4 was 575:a54baa5b89c3, checked in by István Váradi <ivaradi@…>, 10 years ago |
Extracted some of the common imports into a non-GUI-specific module
|
File size:
1.6 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 |
|
---|
| 20 | if os.name=="nt" or "FORCE_PYGTK" in os.environ:
|
---|
| 21 | print "Using PyGTK"
|
---|
| 22 | pygobject = False
|
---|
| 23 | import gobject
|
---|
| 24 | try:
|
---|
| 25 | import pygst
|
---|
| 26 | pygst.require('0.10')
|
---|
| 27 | import gst
|
---|
| 28 |
|
---|
| 29 | def gst_element_factory_make(what):
|
---|
| 30 | return gst.element_factory_make(what)
|
---|
| 31 |
|
---|
| 32 | GST_STATE_PLAYING=gst.STATE_PLAYING
|
---|
| 33 | GST_MESSAGE_EOS=gst.MESSAGE_EOS
|
---|
| 34 | except:
|
---|
| 35 | pass
|
---|
| 36 | else:
|
---|
| 37 | print "Using PyGObject"
|
---|
| 38 | pygobject = True
|
---|
| 39 |
|
---|
| 40 | from gi.repository import GObject as gobject
|
---|
| 41 |
|
---|
| 42 | try:
|
---|
| 43 | from gi.repository import Gst as gst
|
---|
| 44 |
|
---|
| 45 | def gst_element_factory_make(what):
|
---|
| 46 | return gst.ElementFactory.make(what)
|
---|
| 47 |
|
---|
| 48 | GST_STATE_PLAYING=gst.State.PLAYING
|
---|
| 49 | GST_MESSAGE_EOS=gst.MessageType.EOS
|
---|
| 50 | except:
|
---|
| 51 | import traceback
|
---|
| 52 | traceback.print_exc()
|
---|
| 53 | pass
|
---|
Note:
See
TracBrowser
for help on using the repository browser.