[pitivi] Get rid of deprecation warning using latest pygobject



commit 8dcaba3246702cea7d56e2c3343375d8410e35a1
Author: Nicolas Dufresne <nicolas dufresne collabora co uk>
Date:   Sat Mar 9 10:18:11 2013 -0500

    Get rid of deprecation warning using latest pygobject

 pitivi/application.py          |    4 ++--
 pitivi/autoaligner.py          |   10 +++++-----
 pitivi/effects.py              |    5 +++--
 pitivi/mainwindow.py           |    8 ++++----
 pitivi/medialibrary.py         |    5 ++---
 pitivi/timeline/thumbnailer.py |    4 ++--
 pitivi/timeline/timeline.py    |    4 ++--
 pitivi/transitions.py          |    4 ++--
 pitivi/utils/pipeline.py       |   13 +++++++------
 9 files changed, 29 insertions(+), 28 deletions(-)
---
diff --git a/pitivi/application.py b/pitivi/application.py
index 04b1f1f..15901e1 100644
--- a/pitivi/application.py
+++ b/pitivi/application.py
@@ -29,7 +29,7 @@ import sys
 import urllib
 from gi.repository import GES
 from gi.repository import Gio
-from gi.repository import GObject
+from gi.repository import GLib
 from gi.repository import Gtk
 
 from gettext import gettext as _
@@ -246,7 +246,7 @@ class InteractivePitivi(Pitivi):
 
     def __init__(self, debug=False):
         Pitivi.__init__(self)
-        self.mainloop = GObject.MainLoop()
+        self.mainloop = GLib.MainLoop()
         self.actioner = None
         self.gui = None
         if debug:
diff --git a/pitivi/autoaligner.py b/pitivi/autoaligner.py
index b385c1d..2edac8f 100644
--- a/pitivi/autoaligner.py
+++ b/pitivi/autoaligner.py
@@ -372,7 +372,7 @@ class ProgressAggregator(ProgressMeter):
 
         def cb(thusfar):
             self._portions[i] = thusfar
-            GObject.idle_add(self._callForward)
+            GLib.idle_add(self._callForward)
         return cb
 
     def addWatcher(self, function):
@@ -380,7 +380,7 @@ class ProgressAggregator(ProgressMeter):
 
     def _callForward(self):
         # This function always returns False so that it may be safely
-        # invoked via GObject.idle_add(). Use of idle_add() is necessary
+        # invoked via GLib.idle_add(). Use of idle_add() is necessary
         # to ensure that watchers are always called from the main thread,
         # even if progress updates are received from other threads.
         total_target = sum(self._targets)
@@ -587,7 +587,7 @@ class AutoAligner(Loggable):
                 extractee.addWatcher(progress_aggregator.getPortionCB(numsamples))
                 self._extraction_stack.append((audiotrack, extractee))
             # After we return, start the extraction cycle.
-            # This GObject.idle_add call should not be necessary;
+            # This GLib.idle_add call should not be necessary;
             # we should be able to invoke _extractNextEnvelope directly
             # here.  However, there is some as-yet-unexplained
             # race condition between the Python GIL, GTK UI updates,
@@ -595,10 +595,10 @@ class AutoAligner(Loggable):
             # occasional deadlocks during autoalignment.
             # This call to idle_add() reportedly eliminates the deadlock.
             # No one knows why.
-            GObject.idle_add(self._extractNextEnvelope)
+            GLib.idle_add(self._extractNextEnvelope)
         else:  # We can't do anything without at least two audio tracks
             # After we return, call the callback function (once)
-            GObject.idle_add(call_false, self._callback)
+            GLib.idle_add(call_false, self._callback)
         return progress_aggregator
 
     def _chooseReference(self):
diff --git a/pitivi/effects.py b/pitivi/effects.py
index 94534a9..405a321 100644
--- a/pitivi/effects.py
+++ b/pitivi/effects.py
@@ -39,6 +39,7 @@ import re
 import os
 import time
 
+from gi.repository import GLib
 from gi.repository import Gst
 from gi.repository import Gtk
 from gi.repository import Gdk
@@ -422,7 +423,7 @@ class EffectListWidget(Gtk.VBox, Loggable):
 
         self.view.drag_source_set(0, [], Gdk.DragAction.COPY)
         self.view.enable_model_drag_source(Gdk.ModifierType.BUTTON1_MASK, [("pitivi/effect", 0, 
TYPE_PITIVI_EFFECT)], Gdk.DragAction.COPY)
-        self.view.drag_source_set_target_list(None)
+        self.view.drag_source_set_target_list([])
         self.view.drag_source_add_text_targets()
 
         self.view.connect("button-press-event", self._buttonPressEventCb)
@@ -440,7 +441,7 @@ class EffectListWidget(Gtk.VBox, Loggable):
 
         # Delay the loading of the available effects so the application
         # starts faster.
-        GObject.idle_add(self._loadAvailableEffectsCb)
+        GLib.idle_add(self._loadAvailableEffectsCb)
         self.populate_categories_widget()
 
         # Individually show the tab's widgets.
diff --git a/pitivi/mainwindow.py b/pitivi/mainwindow.py
index 86f7df8..27cd67e 100644
--- a/pitivi/mainwindow.py
+++ b/pitivi/mainwindow.py
@@ -35,7 +35,7 @@ from gi.repository import Gtk
 from gi.repository import Gdk
 from gi.repository import Gst
 from gi.repository import GES
-from gi.repository import GObject
+from gi.repository import GLib
 from gi.repository import GdkPixbuf
 from gi.repository.GstPbutils import InstallPluginsContext, install_plugins_async
 
@@ -513,7 +513,7 @@ class PitiviMainWindow(Gtk.Window, Loggable):
             self._fullscreen_toolbar_win.add(self.toolbar)
             self._fullscreen_toolbar_win.show()
             # The first time, wait a little before sliding out the toolbar:
-            GObject.timeout_add(750, self._slideFullscreenToolbarOut)
+            GLib.timeout_add(750, self._slideFullscreenToolbarOut)
         else:
             self.unfullscreen()
             self.menu.show()
@@ -524,11 +524,11 @@ class PitiviMainWindow(Gtk.Window, Loggable):
 
     def _slideFullscreenToolbarIn(self, *args):
         self._fullscreenToolbarDirection = "down"
-        GObject.timeout_add(25, self._animateFullscreenToolbar)
+        GLib.timeout_add(25, self._animateFullscreenToolbar)
 
     def _slideFullscreenToolbarOut(self, *args):
         self._fullscreenToolbarDirection = "up"
-        GObject.timeout_add(25, self._animateFullscreenToolbar)
+        GLib.timeout_add(25, self._animateFullscreenToolbar)
         return False  # Stop the initial gobject timer
 
     def _animateFullscreenToolbar(self, *args):
diff --git a/pitivi/medialibrary.py b/pitivi/medialibrary.py
index d023d3e..7485909 100644
--- a/pitivi/medialibrary.py
+++ b/pitivi/medialibrary.py
@@ -26,7 +26,6 @@ from gi.repository import Gst
 from gi.repository import GES
 from gi.repository import GLib
 from gi.repository import GObject
-from gi._glib import GError
 from gi.repository import Gtk
 from gi.repository import Gdk
 from gi.repository import Pango
@@ -310,7 +309,7 @@ class MediaLibraryWidget(Gtk.VBox, Loggable):
     def _setup_view_for_drag_and_drop(self, view, target_entries):
         view.drag_source_set(0, [], Gdk.DragAction.COPY)
         view.enable_model_drag_source(Gdk.ModifierType.BUTTON1_MASK, target_entries, Gdk.DragAction.COPY)
-        view.drag_source_set_target_list(None)
+        view.drag_source_set_target_list([])
         view.drag_source_add_uri_targets()
         view.drag_source_add_text_targets()
         view.connect("drag_begin", self._dndDragBeginCb)
@@ -524,7 +523,7 @@ class MediaLibraryWidget(Gtk.VBox, Loggable):
                 GdkPixbuf.InterpType.BILINEAR)
 
             return thumbnail, thumbnail_large
-        except GError:
+        except GLib.GError:
             return None, None
 
     def _addAsset(self, asset):
diff --git a/pitivi/timeline/thumbnailer.py b/pitivi/timeline/thumbnailer.py
index d380f05..8ac55e4 100644
--- a/pitivi/timeline/thumbnailer.py
+++ b/pitivi/timeline/thumbnailer.py
@@ -515,7 +515,7 @@ class RandomAccessVideoPreviewer(RandomAccessPreviewer):
         return utils.misc.quantize(time, self.tperiod)
 
     def _thumbnailCb(self, unused_thsink, pixbuf, timestamp):
-        GObject.idle_add(self._finishThumbnail, pixbuf, timestamp)
+        GLib.idle_add(self._finishThumbnail, pixbuf, timestamp)
 
     def _startThumbnail(self, timestamp):
         RandomAccessPreviewer._startThumbnail(self, timestamp)
@@ -625,7 +625,7 @@ class RandomAccessAudioPreviewer(RandomAccessPreviewer):
             cr.fill()
             surfaces.append(scaled)
         surfaces.append(surface)
-        GObject.idle_add(self._finishThumbnail, surfaces, self._audio_cur)
+        GLib.idle_add(self._finishThumbnail, surfaces, self._audio_cur)
 
     def _plotWaveform(self, cr, base_width):
         # clear background
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index 8fd1000..4103b98 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -1194,7 +1194,7 @@ class Timeline(Gtk.Table, Loggable, Zoomable):
         """
         self.debug("Drag leave")
         self._canvas.handler_block_by_func(self._dragMotionCb)
-        GObject.timeout_add(75, self._dragCleanUp, context)
+        GLib.timeout_add(75, self._dragCleanUp, context)
 
     def _dragCleanUp(self, context):
         """
@@ -1497,7 +1497,7 @@ class Timeline(Gtk.Table, Loggable, Zoomable):
         if position > self.hadj.props.upper:
             # we can't perform the scroll because the canvas needs to be
             # updated
-            GObject.idle_add(self._scrollToPosition, position)
+            GLib.idle_add(self._scrollToPosition, position)
         else:
             self._scrollToPosition(position)
 
diff --git a/pitivi/transitions.py b/pitivi/transitions.py
index e558b81..46bdebe 100644
--- a/pitivi/transitions.py
+++ b/pitivi/transitions.py
@@ -23,9 +23,9 @@
 import glib
 import os
 
+from gi.repository import GLib
 from gi.repository import GES
 from gi.repository import Gtk
-from gi.repository import GObject
 from gi.repository import GdkPixbuf
 
 from gettext import gettext as _
@@ -129,7 +129,7 @@ class TransitionsListWidget(Signallable, Gtk.VBox, Loggable):
         self.border_mode_loop.connect("released", self._borderTypeChangedCb)
 
         # Speed-up startup by only checking available transitions on idle
-        GObject.idle_add(self._loadAvailableTransitionsCb)
+        GLib.idle_add(self._loadAvailableTransitionsCb)
 
         self.pack_start(self.infobar, False, True, 0)
         self.pack_start(self.searchbar, False, True, 0)
diff --git a/pitivi/utils/pipeline.py b/pitivi/utils/pipeline.py
index 23aee6f..574b432 100644
--- a/pitivi/utils/pipeline.py
+++ b/pitivi/utils/pipeline.py
@@ -30,6 +30,7 @@ from pitivi.utils.loggable import Loggable
 from pitivi.utils.signal import Signallable
 from pitivi.utils.misc import print_ns
 
+from gi.repository import GLib
 from gi.repository import GObject
 from gi.repository import Gst
 from gi.repository import GES
@@ -79,7 +80,7 @@ class Seeker(Signallable, Loggable):
 
         if self.pending_seek_id is None:
             if on_idle:
-                GObject.idle_add(self._seekTimeoutCb)
+                GLib.idle_add(self._seekTimeoutCb)
             else:
                 self._seekTimeoutCb()
             self.pending_seek_id = self._scheduleSeek(self.timeout, self._seekTimeoutCb)
@@ -88,7 +89,7 @@ class Seeker(Signallable, Loggable):
         if self.pending_seek_id is None:
             self._time = time
             if on_idle:
-                GObject.idle_add(self._seekTimeoutCb, True)
+                GLib.idle_add(self._seekTimeoutCb, True)
             else:
                 self._seekTimeoutCb()
             self.pending_seek_id = self._scheduleSeek(self.timeout, self._seekTimeoutCb, True)
@@ -97,7 +98,7 @@ class Seeker(Signallable, Loggable):
         self.seekRelative(0, on_idle)
 
     def _scheduleSeek(self, timeout, callback, relative=False):
-        return GObject.timeout_add(timeout, callback, relative)
+        return GLib.timeout_add(timeout, callback, relative)
 
     def _seekTimeoutCb(self, relative=False):
         self.pending_seek_id = None
@@ -335,10 +336,10 @@ class SimplePipeline(Signallable, Loggable):
         # i.e. it does NOT check for current state
         if listen:
             if self._listening and self._listeningSigId == 0:
-                self._listeningSigId = GObject.timeout_add(self._listeningInterval,
+                self._listeningSigId = GLib.timeout_add(self._listeningInterval,
                     self._positionListenerCb)
         elif self._listeningSigId != 0:
-            GObject.source_remove(self._listeningSigId)
+            GLib.source_remove(self._listeningSigId)
             self._listeningSigId = 0
 
     def simple_seek(self, position, format=Gst.Format.TIME):
@@ -408,7 +409,7 @@ class SimplePipeline(Signallable, Loggable):
             self._handleErrorMessage(error, detail, message.src)
         elif message.type == Gst.MessageType.DURATION_CHANGED:
             self.debug("Duration might have changed, querying it")
-            GObject.idle_add(self._queryDurationAsync)
+            GLib.idle_add(self._queryDurationAsync)
         else:
             if self._has_sync_bus_handler is False:
                 # Pass message async to the sync bus handler


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]