[pitivi] bin/pitivi.in : Don't call GObject.threads_init if pygobject is recent enough.
- From: Jean-François Fortin Tam <jfft src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] bin/pitivi.in : Don't call GObject.threads_init if pygobject is recent enough.
- Date: Tue, 17 Dec 2013 01:42:22 +0000 (UTC)
commit a66be04a4abfea8447b6fc8f742e5e5c7653bc6a
Author: Mathieu Duponchelle <mduponchelle1 gmail com>
Date: Mon Dec 2 17:25:03 2013 +0100
bin/pitivi.in : Don't call GObject.threads_init if pygobject is recent enough.
bin/pitivi.in | 10 ++++++----
pitivi/check.py | 8 ++++++++
pitivi/timeline/timeline.py | 6 ++++--
3 files changed, 18 insertions(+), 6 deletions(-)
---
diff --git a/bin/pitivi.in b/bin/pitivi.in
index 15e4ee2..11a9c70 100644
--- a/bin/pitivi.in
+++ b/bin/pitivi.in
@@ -119,10 +119,12 @@ def _check_dependencies():
def _run_pitivi():
import pitivi.application as ptv
import pitivi.timeline.timeline as timeline
- from gi.repository import GObject
- # You really need this line if you don't want the UI to lock up as soon as
- # you start using GStreamer:
- GObject.threads_init()
+ from pitivi.check import at_least_version
+ import gi
+
+ if not at_least_version(gi.version_info, (3, 11, 0)):
+ from gi.repository import GObject
+ GObject.threads_init()
# Make it easy for developers to debug the application startup.
if os.environ.get('PITIVI_DEBUG_NO_UI') == '1':
diff --git a/pitivi/check.py b/pitivi/check.py
index 7b02b68..54afc21 100644
--- a/pitivi/check.py
+++ b/pitivi/check.py
@@ -56,6 +56,14 @@ global missing_soft_deps
missing_soft_deps = {}
+def at_least_version(version, required):
+ for i, item in enumerate(version):
+ if required[i] != item:
+ return item > required[i]
+
+ return True
+
+
def _initiate_videosinks(Gst):
# TODO: eventually switch to a clutter sink
sink = Gst.ElementFactory.make("autovideosink", None)
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index 571ddc9..0f7b75a 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -23,6 +23,7 @@
import sys
import os
+import gi
from gi.repository import GtkClutter
GtkClutter.init([])
@@ -30,7 +31,7 @@ GtkClutter.init([])
from gi.repository import Gst, GES, GObject, Clutter, Gtk, GLib, Gdk
from pitivi.autoaligner import AlignmentProgressDialog, AutoAligner
-from pitivi.check import missing_soft_deps
+from pitivi.check import missing_soft_deps, at_least_version
from pitivi.utils.timeline import Zoomable, Selection, SELECT, UNSELECT
from pitivi.settings import GlobalSettings
from pitivi.dialogs.prefs import PreferencesDialog
@@ -696,7 +697,8 @@ class Timeline(Gtk.VBox, Zoomable, Loggable):
Zoomable.__init__(self)
Gtk.VBox.__init__(self)
Loggable.__init__(self)
- GObject.threads_init()
+ if not at_least_version(gi.version_info, (3, 11, 0)):
+ GObject.threads_init()
# Allows stealing focus from other GTK widgets, prevent accidents:
self.props.can_focus = True
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]