[pitivi: 31/94] Moved the gobject.threads_init call to pitivi/__init__.py
- From: Thibault Saunier <tsaunier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi: 31/94] Moved the gobject.threads_init call to pitivi/__init__.py
- Date: Sun, 11 Sep 2011 16:15:03 +0000 (UTC)
commit 1f9f86f86424e7ca557c45ea9481f57117e2e93c
Author: Alex BÄluÈ <alexandru balut gmail com>
Date: Thu Jul 7 13:26:22 2011 +0200
Moved the gobject.threads_init call to pitivi/__init__.py
pitivi/__init__.py | 4 ++++
pitivi/application.py | 1 -
pitivi/discoverer.py | 1 -
pitivi/elements/arraysink.py | 8 ++------
pitivi/formatters/etree.py | 1 -
pitivi/projectmanager.py | 1 -
pitivi/ui/mainwindow.py | 2 --
tests/__init__.py | 4 ++++
tests/common.py | 3 ---
tests/runtests.py | 6 ++++++
tests/test_alpha_passthrough.py | 8 +-------
tests/test_discoverer.py | 2 --
tests/test_gap.py | 5 +----
tests/test_pipeline.py | 5 ++---
tests/test_still_image.py | 7 +++----
tests/test_timeline_factory.py | 3 +--
tests/test_timeline_undo.py | 5 +----
tests/test_utils.py | 2 --
18 files changed, 25 insertions(+), 43 deletions(-)
---
diff --git a/pitivi/__init__.py b/pitivi/__init__.py
index 35a895c..af30c89 100644
--- a/pitivi/__init__.py
+++ b/pitivi/__init__.py
@@ -1,3 +1,7 @@
"""
Main PiTiVi package
"""
+
+import gobject
+# This call must be made before any "import gst" call!
+gobject.threads_init()
diff --git a/pitivi/application.py b/pitivi/application.py
index fc5d18b..4530b33 100644
--- a/pitivi/application.py
+++ b/pitivi/application.py
@@ -25,7 +25,6 @@
Main application
"""
import gobject
-gobject.threads_init()
import gtk
from optparse import OptionParser
import os
diff --git a/pitivi/discoverer.py b/pitivi/discoverer.py
index 74a7b7b..7bdcc6b 100644
--- a/pitivi/discoverer.py
+++ b/pitivi/discoverer.py
@@ -27,7 +27,6 @@ Discover file multimedia information.
from gettext import gettext as _
import os
import gobject
-gobject.threads_init()
import gst
from gst import pbutils
import tempfile
diff --git a/pitivi/elements/arraysink.py b/pitivi/elements/arraysink.py
index b9c7b24..62b1e8e 100644
--- a/pitivi/elements/arraysink.py
+++ b/pitivi/elements/arraysink.py
@@ -23,9 +23,7 @@ Stores audio samples in an array for plotting waveforms
"""
import gobject
-gobject.threads_init()
import gst
-import gtk
import array
from pitivi.utils import native_endianness
@@ -40,16 +38,14 @@ class ArraySink(gst.BaseSink):
"endianness = (int) %s, "
"channels = (int) 1,"
"rate = (int) [1, 96000]"
- % native_endianness
- )
+ % native_endianness)
__gsttemplates__ = (
gst.PadTemplate(
"sink",
gst.PAD_SINK,
gst.PAD_ALWAYS,
- caps
- ),
+ caps),
)
def __init__(self):
diff --git a/pitivi/formatters/etree.py b/pitivi/formatters/etree.py
index a70ad71..7218261 100644
--- a/pitivi/formatters/etree.py
+++ b/pitivi/formatters/etree.py
@@ -22,7 +22,6 @@
from gettext import gettext as _
import gobject
-gobject.threads_init()
import gst
from xml.etree.ElementTree import Element, SubElement, tostring, parse
diff --git a/pitivi/projectmanager.py b/pitivi/projectmanager.py
index 1d5941a..0497295 100644
--- a/pitivi/projectmanager.py
+++ b/pitivi/projectmanager.py
@@ -21,7 +21,6 @@
from gettext import gettext as _
import gobject
-gobject.threads_init()
import gst
import os
diff --git a/pitivi/ui/mainwindow.py b/pitivi/ui/mainwindow.py
index 3d38803..0b21e3b 100644
--- a/pitivi/ui/mainwindow.py
+++ b/pitivi/ui/mainwindow.py
@@ -26,8 +26,6 @@ Main GTK+ window
import os
import gtk
-import gobject
-gobject.threads_init()
import gst
from urllib import unquote
import webbrowser
diff --git a/tests/__init__.py b/tests/__init__.py
index ad60903..619126a 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -1,3 +1,7 @@
+import gobject
+# This call has to be made before any "import gst" call!
+gobject.threads_init()
+
from pitivi.check import initial_checks
diff --git a/tests/common.py b/tests/common.py
index 8ea84fb..b44d778 100644
--- a/tests/common.py
+++ b/tests/common.py
@@ -2,8 +2,6 @@
A collection of objects to use for testing
"""
-import gobject
-gobject.threads_init()
import gst
import os
import gc
@@ -38,7 +36,6 @@ class TestCase(unittest.TestCase):
return ret
def gcverify(self):
- new = []
leaked = []
for obj in gc.get_objects():
if not isinstance(obj, self._tracked_types) or \
diff --git a/tests/runtests.py b/tests/runtests.py
index 6392358..e3f7c2e 100644
--- a/tests/runtests.py
+++ b/tests/runtests.py
@@ -2,6 +2,12 @@ import os
import sys
import unittest
+import gobject
+# This call has to be made before any "import gst" call!
+# We have to do this call here, even though it already is in __init__.py,
+# because this tool is run directly, as an executable.
+gobject.threads_init()
+
def gettestnames(file_names):
test_names = [file_name[:-3] for file_name in file_names]
diff --git a/tests/test_alpha_passthrough.py b/tests/test_alpha_passthrough.py
index 610c7e4..75c2620 100644
--- a/tests/test_alpha_passthrough.py
+++ b/tests/test_alpha_passthrough.py
@@ -22,17 +22,11 @@
from unittest import TestCase
-import random
-
-import gobject
-gobject.threads_init()
import gst
from pitivi.factories.test import VideoTestSourceFactory
from pitivi.stream import VideoStream
-from pitivi.timeline.track import Track, SourceTrackObject, Interpolator
-from pitivi.elements.mixer import SmartVideomixerBinPropertyHelper
-from pitivi.utils import infinity
+from pitivi.timeline.track import Track, SourceTrackObject
def set_one_keyframe(track_object, value):
diff --git a/tests/test_discoverer.py b/tests/test_discoverer.py
index 5910598..4e03452 100644
--- a/tests/test_discoverer.py
+++ b/tests/test_discoverer.py
@@ -20,8 +20,6 @@
# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
# Boston, MA 02110-1301, USA.
-import gobject
-gobject.threads_init()
import gst
from common import TestCase
diff --git a/tests/test_gap.py b/tests/test_gap.py
index c618000..ad26a84 100644
--- a/tests/test_gap.py
+++ b/tests/test_gap.py
@@ -21,8 +21,6 @@
from unittest import TestCase
-import gobject
-gobject.threads_init()
import gst
from common import StubFactory
@@ -161,8 +159,7 @@ class TestGap(TestCase):
simple = (
(3 * gst.SECOND, 1 * gst.SECOND),
- (1 * gst.SECOND, 1 * gst.SECOND)
- )
+ (1 * gst.SECOND, 1 * gst.SECOND))
objs = []
for start, duration in simple:
diff --git a/tests/test_pipeline.py b/tests/test_pipeline.py
index e0efec6..c21f8e0 100644
--- a/tests/test_pipeline.py
+++ b/tests/test_pipeline.py
@@ -20,13 +20,12 @@
# Boston, MA 02110-1301, USA.
import gobject
-gobject.threads_init()
import gst
from unittest import main
from pitivi.pipeline import Pipeline, STATE_NULL, STATE_READY, STATE_PAUSED, STATE_PLAYING, PipelineError
from pitivi.action import Action, STATE_ACTIVE, STATE_NOT_ACTIVE
-from pitivi.stream import AudioStream, VideoStream
-from common import TestCase, SignalMonitor, FakeSinkFactory, FakeEffectFactory
+from pitivi.stream import VideoStream
+from common import TestCase, SignalMonitor, FakeSinkFactory
from pitivi.factories.test import VideoTestSourceFactory
diff --git a/tests/test_still_image.py b/tests/test_still_image.py
index 18cced9..908c634 100644
--- a/tests/test_still_image.py
+++ b/tests/test_still_image.py
@@ -23,21 +23,20 @@ import os.path
from unittest import TestCase
import gobject
-gobject.threads_init()
import gst
import common
-from pitivi.factories.file import FileSourceFactory, PictureFileSourceFactory
+from pitivi.factories.file import PictureFileSourceFactory
from pitivi.factories.timeline import TimelineSourceFactory
from pitivi.timeline.track import Track, SourceTrackObject
-from pitivi.timeline.timeline import Timeline, TimelineObject
+from pitivi.timeline.timeline import Timeline
from pitivi.encode import RenderSinkFactory, RenderFactory
from pitivi.action import RenderAction
from pitivi.settings import StreamEncodeSettings, RenderSettings
from pitivi.stream import VideoStream
from pitivi.factories.test import VideoTestSourceFactory
-from pitivi.pipeline import Pipeline, PipelineError
+from pitivi.pipeline import Pipeline
class TestStillImage(TestCase):
diff --git a/tests/test_timeline_factory.py b/tests/test_timeline_factory.py
index 925b38a..9ea8246 100644
--- a/tests/test_timeline_factory.py
+++ b/tests/test_timeline_factory.py
@@ -1,6 +1,6 @@
# PiTiVi , Non-linear video editor
#
-# tests/test_timeline.py
+# tests/test_timeline_factory.py
#
# Copyright (c) 2008, Alessandro Decina <alessandro decina collabora co uk>
#
@@ -20,7 +20,6 @@
# Boston, MA 02110-1301, USA.
import gobject
-gobject.threads_init()
import gst
from common import TestCase
from pitivi.factories.base import ObjectFactoryError
diff --git a/tests/test_timeline_undo.py b/tests/test_timeline_undo.py
index 5c900ab..d1da484 100644
--- a/tests/test_timeline_undo.py
+++ b/tests/test_timeline_undo.py
@@ -21,8 +21,6 @@
from unittest import TestCase
-import gobject
-gobject.threads_init()
import gst
from pitivi.pipeline import Pipeline
@@ -32,8 +30,7 @@ from pitivi.factories.test import VideoTestSourceFactory, TestEffectFactory
from pitivi.stream import VideoStream
from pitivi.timeline.timeline_undo import TimelineLogObserver, \
TimelineObjectAdded, TimelineObjectRemoved, \
- TimelineObjectPropertyChanged, TrackEffectAdded, \
- TrackEffectRemoved
+ TimelineObjectPropertyChanged, TrackEffectAdded
from pitivi.undo import UndoableActionLog
diff --git a/tests/test_utils.py b/tests/test_utils.py
index e07aa05..0e989ce 100644
--- a/tests/test_utils.py
+++ b/tests/test_utils.py
@@ -22,8 +22,6 @@
from unittest import TestCase
-import gobject
-gobject.threads_init()
import gst
from pitivi.utils import beautify_length
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]