source: src/mlx/common.py@ 781:d4455b2cd469

Last change on this file since 781:d4455b2cd469 was 740:940403ee48fb, checked in by István Váradi <ivaradi@…>, 9 years ago

Added support for an environment variable that can be set to use a different base URL for the MAVA site.

File size: 1.9 KB
Line 
1import 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
20MAVA_BASE_URL = os.environ.get("MAVA_BASE_URL", "http://virtualairlines.hu")
21
22#-------------------------------------------------------------------------------
23
24# Due to CEF, PyGTK is the default
25if "FORCE_PYGOBJECT" not in os.environ:
26 print "Using PyGTK"
27 pygobject = False
28 import gobject
29 try:
30 import pygst
31 pygst.require('0.10')
32 import gst
33
34 def gst_init():
35 pass
36
37 def gst_element_factory_make(what):
38 return gst.element_factory_make(what)
39
40 GST_STATE_PLAYING=gst.STATE_PLAYING
41 GST_MESSAGE_EOS=gst.MESSAGE_EOS
42 except:
43 pass
44else:
45 print "Using PyGObject"
46 pygobject = True
47
48 from gi.repository import GObject as gobject
49
50 try:
51 from gi.repository import Gst as gst
52
53 def gst_init():
54 gst.init()
55
56 def gst_element_factory_make(what):
57 return gst.ElementFactory.make(what)
58
59 GST_STATE_PLAYING=gst.State.PLAYING
60 GST_MESSAGE_EOS=gst.MessageType.EOS
61 except:
62 import traceback
63 traceback.print_exc()
64 pass
Note: See TracBrowser for help on using the repository browser.