from ..overrides import override
from ..importer import modules
+
if sys.version_info >= (3, 0):
_basestring = str
_callable = lambda c: hasattr(c, '__call__')
warnings.warn(warn_msg, RuntimeWarning)
+class TrackElement(GES.TrackElement):
+ def set_child_property(self, prop_name, prop_value):
+ return TimelineElement.set_child_property(self, prop_name, prop_value)
+
+
+TrackElement = override(TrackElement)
+__all__.append('TrackElement')
+
+
+class TimelineElement(GES.TimelineElement):
+ def set_child_property(self, prop_name, prop_value):
+ res, child, unused_pspec = self.lookup_child(prop_name)
+ if not res:
+ print("No found any child")
+ return res
+
+ child.set_property(prop_name, prop_value)
+ return res
+
+
+TimelineElement = override(TimelineElement)
+__all__.append('TimelineElement')
+
+
try:
from gi.repository import Gst
Gst
--- /dev/null
+install_data(['gi/overrides/GES.py'], install_dir: pygi_override_dir)
\ No newline at end of file
subdir('tests')
subdir('examples')
+override_detector = '''
+import sys
+import os
+
+prefix = sys.argv[1]
+version = sys.version_info
+
+# If we are installing in the same prefix as PyGobject
+# make sure to install in the right place.
+import gi.overrides
+
+overrides_path = os.path.dirname(gi.overrides.__file__)
+if os.path.commonprefix([overrides_path, prefix]) == prefix:
+ print(overrides_path)
+ exit(0)
+
+# Otherwise follow python's way of install site packages inside
+# the provided prefix
+if os.name == 'posix':
+ print(os.path.join(
+ prefix, 'lib', 'python%d.%d' % (version.major, version.minor),
+ 'site-packages', 'gi', 'overrides'))
+else:
+ print(os.path.join(
+ prefix, 'Lib', 'Python%d%d' % (version.major, version.minor),
+ 'site-packages', 'gi', 'overrides'))
+'''
+python3 = import('python3').find_python()
+pygi_override_dir = get_option('pygi-overrides-dir')
+if pygi_override_dir == ''
+ cres = run_command(python3, '-c', override_detector, get_option('prefix'))
+ if cres.returncode() == 0
+ pygi_override_dir = cres.stdout().strip()
+ endif
+ if cres.stderr() != ''
+ message(cres.stderr())
+ endif
+endif
+
+if pygi_override_dir != ''
+ message('pygobject overrides directory ' + pygi_override_dir)
+ subdir('bindings/python')
+endif
+
if build_machine.system() == 'windows'
message('Disabling gtk-doc while building on Windows')
elif not get_option('gtk_doc')
endif
endif
-python3 = import('python3').find_python()
run_command(python3, '-c', 'import shutil; shutil.copy("hooks/pre-commit.hook", ".git/hooks/pre-commit")')
description : 'Generate gobject-introspection bindings')
option('gtk_doc', type : 'boolean', value : true, yield : true,
description : 'Build API documentation with gtk-doc')
+option('pygi-overrides-dir', type : 'string', value : '',
+ description: 'Path to pygobject overrides directory')
\ No newline at end of file
--- /dev/null
+import os
+import gi.overrides
+
+LOCAL_OVERRIDE_PATH = "gst-editing-services/bindings/python/gi/overrides/"
+FILE = os.path.realpath(__file__)
+if not gi.overrides.__path__[0].endswith(LOCAL_OVERRIDE_PATH):
+ local_overrides = None
+ # our overrides don't take precedence, let's fix it
+ for i, path in enumerate(gi.overrides.__path__):
+ if path.endswith(LOCAL_OVERRIDE_PATH):
+ local_overrides = path
+
+ if local_overrides:
+ gi.overrides.__path__.remove(local_overrides)
+ else:
+ local_overrides = os.path.abspath(os.path.join(FILE, "../../../../../", LOCAL_OVERRIDE_PATH))
+
+ gi.overrides.__path__.insert(0, local_overrides)
+
+# Execute previously set sitecustomize.py script if it existed
+if os.environ.get("GST_ENV"):
+ old_sitecustomize = os.path.join(os.path.dirname(__file__),
+ "old.sitecustomize.gstuninstalled.py")
+ if os.path.exists(old_sitecustomize):
+ exec(compile(open(old_sitecustomize).read(), old_sitecustomize, 'exec'))
# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301, USA.
-import gi
+from . import overrides_hack
+import gi
gi.require_version("Gst", "1.0")
gi.require_version("GES", "1.0")
from gi.repository import Gst # noqa
+Gst.init(None) # noqa
from gi.repository import GES # noqa
+GES.init()
import unittest # noqa
-
-Gst.init(None)
-GES.init()
-
-
class TestCopyPaste(unittest.TestCase):
def setUp(self):
class TestTitleClip(unittest.TestCase):
+ def testSetColor(self):
+ timeline = GES.Timeline.new_audio_video()
+ clip = GES.TitleClip.new()
+ timeline.append_layer().add_clip(clip )
+ self.assertTrue(clip.set_child_property('color', 1))
+ self.assertTrue(clip.set_child_property('color', 4294967295))
+
def testGetPropertyNotInTrack(self):
title_clip = GES.TitleClip.new()
self.assertEqual(title_clip.props.text, "")
# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301, USA.
+from . import overrides_hack
+
import gi
gi.require_version("Gst", "1.0")
# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301, USA.
+from . import overrides_hack
+
import gi
gi.require_version("Gst", "1.0")