[pitivi] Fix remaining issues after the pygi compat removal



commit 930903e2dc0b699d935268655adbfcb905c7158d
Author: Nicolas Dufresne <nicolas dufresne collabora com>
Date:   Wed Sep 5 18:55:28 2012 -0400

    Fix remaining issues after the pygi compat removal

 pitivi/clipproperties.py       |    1 -
 pitivi/dialogs/prefs.py        |   12 +++++++-----
 pitivi/effects.py              |    5 ++---
 pitivi/mainwindow.py           |    4 ++--
 pitivi/mediafilespreviewer.py  |   19 ++++++++++---------
 pitivi/medialibrary.py         |    7 ++++---
 pitivi/render.py               |    2 +-
 pitivi/timeline/layer.py       |    4 ++--
 pitivi/timeline/thumbnailer.py |    6 +++---
 pitivi/timeline/timeline.py    |    2 +-
 pitivi/transitions.py          |    2 +-
 pitivi/utils/extract.py        |    4 ++--
 pitivi/utils/pipeline.py       |    2 +-
 pitivi/utils/widgets.py        |   12 ++++++------
 14 files changed, 42 insertions(+), 40 deletions(-)
---
diff --git a/pitivi/clipproperties.py b/pitivi/clipproperties.py
index 9d164c4..2215d82 100644
--- a/pitivi/clipproperties.py
+++ b/pitivi/clipproperties.py
@@ -195,7 +195,6 @@ class EffectProperties(Gtk.Expander):
         self.treeview.append_column(typecol)
         typecol.set_spacing(SPACING)
         typecol.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
-        typecol.set_min_width(50)
         typecell = Gtk.CellRendererText()
         typecell.props.xpad = PADDING
         typecell.set_property("ellipsize", Pango.EllipsizeMode.END)
diff --git a/pitivi/dialogs/prefs.py b/pitivi/dialogs/prefs.py
index 15c9778..513263c 100644
--- a/pitivi/dialogs/prefs.py
+++ b/pitivi/dialogs/prefs.py
@@ -58,7 +58,9 @@ class PreferencesDialog():
         self._current = None
         self._createUi()
         self._fillContents()
-        min_width, min_height = self.contents.size_request()
+        req = self.contents.size_request()
+        min_width = req.width
+        min_height = req.height
         width = max(min_width, self.settings.prefsDialogWidth)
         height = max(min_height, self.settings.prefsDialogHeight)
         self.dialog.set_default_size(width, height)
@@ -130,8 +132,8 @@ class PreferencesDialog():
         upper=None, lower=None):
         """
         Add an auto-generated user preference that will show up as either a
-        Gtk.SpinButton or a Gtk.HScale, depending whether both the upper and lower
-        limits are set.
+        Gtk.SpinButton or an horizontal Gtk.Scale, depending whether both the
+        upper and lower limits are set.
 
         @param label: user-visible name for this option
         @type label: C{str}
@@ -154,8 +156,8 @@ class PreferencesDialog():
         matches=None):
         """
         Add an auto-generated user preference that will show up as either a
-        Gtk.SpinButton or a Gtk.HScale, depending on the upper and lower
-        limits
+        Gtk.SpinButton or an horizontal Gtk.Scale, depending on the upper and
+        lower limits
 
         @param label: user-visible name for this option
         @type label: C{str}
diff --git a/pitivi/effects.py b/pitivi/effects.py
index bbfad0a..7d22c69 100644
--- a/pitivi/effects.py
+++ b/pitivi/effects.py
@@ -385,7 +385,6 @@ class EffectListWidget(Gtk.VBox, Loggable):
         text_col.set_expand(True)
         text_col.set_spacing(SPACING)
         text_col.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
-        text_col.set_min_width(150)
         text_cell = Gtk.CellRendererText()
         text_cell.props.yalign = 0.0
         text_cell.props.xpad = 6
@@ -410,7 +409,7 @@ class EffectListWidget(Gtk.VBox, Loggable):
         scrollwin.props.vscrollbar_policy = Gtk.PolicyType.AUTOMATIC
         scrollwin.add(self.view)
 
-        self.pack_start(toolbar, expand=False)
+        self.pack_start(toolbar, False, False, 0)
         self.pack_start(scrollwin, True, True, 0)
 
         # Delay the loading of the available effects so the application
@@ -495,7 +494,7 @@ class EffectListWidget(Gtk.VBox, Loggable):
 
         if event.button == 3:
             chain_up = False
-        elif event.type == Gdk.EventType._2BUTTON_PRESS:
+        elif event.type == getattr(Gdk.EventType, '2BUTTON_PRESS'):
             factory_name = self.getSelectedItems()
             if factory_name is not None:
                 self.app.gui.clipconfig.effect_expander.addEffectToCurrentSelection(factory_name)
diff --git a/pitivi/mainwindow.py b/pitivi/mainwindow.py
index 7597761..579b564 100644
--- a/pitivi/mainwindow.py
+++ b/pitivi/mainwindow.py
@@ -705,7 +705,7 @@ class PitiviMainWindow(Gtk.Window, Loggable):
             chooser.add_filter(filt)
         default = Gtk.FileFilter()
         default.set_name(_("All Supported Formats"))
-        default.add_custom(Gtk.FILE_FILTER_URI, GES.formatter_can_load_uri, None)
+        default.add_custom(Gtk.FileFilterFlags.URI, GES.formatter_can_load_uri, None)
         chooser.add_filter(default)
 
         response = chooser.run()
@@ -1237,7 +1237,7 @@ class PitiviMainWindow(Gtk.Window, Loggable):
             # Try to keep it 1:1 if it can fit within 85% of the parent window
             img_width = info.get_video_streams()[0].get_width()
             img_height = info.get_video_streams()[0].get_height()
-            controls_height = previewer.bbox.size_request()[1]
+            controls_height = previewer.bbox.size_request().height
             mainwindow_width, mainwindow_height = self.get_size()
             max_width = 0.85 * mainwindow_width
             max_height = 0.85 * mainwindow_height
diff --git a/pitivi/mediafilespreviewer.py b/pitivi/mediafilespreviewer.py
index 5fc8260..3508202 100644
--- a/pitivi/mediafilespreviewer.py
+++ b/pitivi/mediafilespreviewer.py
@@ -3,6 +3,7 @@ from gi.repository import GObject
 from gi.repository import Gst
 from gi.repository import Gtk
 from gi.repository import Gdk
+from gi.repository import GdkPixbuf
 from gi.repository import Pango
 import os
 
@@ -77,7 +78,7 @@ class PreviewWidget(Gtk.VBox, Loggable):
 
         #some global variables for preview handling
         self.is_playing = False
-        self.time_format = Gst.Format(Gst.FORMAT_TIME)
+        self.time_format = Gst.Format(Gst.Format.TIME)
         self.original_dims = (PREVIEW_WIDTH, PREVIEW_HEIGHT)
         self.countinuous_seek = False
         self.current_selected_uri = ""
@@ -88,7 +89,7 @@ class PreviewWidget(Gtk.VBox, Loggable):
         # Gui elements:
         # Drawing area for video output
         self.preview_video = ViewerWidget()
-        self.preview_video.modify_bg(Gtk.StateType.NORMAL, self.preview_video.style.black)
+        self.preview_video.modify_bg(Gtk.StateType.NORMAL, self.preview_video.get_style().black)
         self.pack_start(self.preview_video, False, True, 0)
 
         # An image for images and audio
@@ -105,7 +106,7 @@ class PreviewWidget(Gtk.VBox, Loggable):
 
         #Scale for position handling
         self.pos_adj = Gtk.Adjustment()
-        self.seeker = Gtk.HScale(self.pos_adj)
+        self.seeker = Gtk.Scale.new(Gtk.Orientation.HORIZONTAL, self.pos_adj)
         self.seeker.connect('button-press-event', self._on_seeker_press_cb)
         self.seeker.connect('button-release-event', self._on_seeker_press_cb)
         self.seeker.connect('motion-notify-event', self._on_motion_notify_cb)
@@ -146,7 +147,7 @@ class PreviewWidget(Gtk.VBox, Loggable):
         self.b_zoom_in.hide()
         self.b_zoom_out.hide()
         # Allow expanding/filling and pack the video preview below the controls
-        self.set_child_packing(self.preview_video, True, True, 0, Gtk.PACK_END)
+        self.set_child_packing(self.preview_video, True, True, 0, Gtk.PackType.END)
 
     def add_preview_request(self, dialogbox):
         """add a preview request """
@@ -298,7 +299,7 @@ class PreviewWidget(Gtk.VBox, Loggable):
             self.countinuous_seek = True
             if self.is_playing:
                 self.player.set_state(Gst.State.PAUSED)
-        elif event.type == Gdk.BUTTON_RELEASE:
+        elif event.type == Gdk.EventType.BUTTON_RELEASE:
             self.countinuous_seek = False
             value = long(widget.get_value())
             self.player.seek_simple(self.time_format, Gst.SeekFlags.FLUSH, value)
@@ -311,12 +312,12 @@ class PreviewWidget(Gtk.VBox, Loggable):
             self.player.seek_simple(self.time_format, Gst.SeekFlags.FLUSH, value)
 
     def _bus_message_cb(self, bus, message):
-        if message.type == Gst.MESSAGE_EOS:
+        if message.type == Gst.MessageType.EOS:
             self.player.set_state(Gst.State.NULL)
             self.is_playing = False
             self.play_button.set_stock_id(Gtk.STOCK_MEDIA_PLAY)
             self.pos_adj.set_value(0)
-        elif message.type == Gst.MESSAGE_ERROR:
+        elif message.type == Gst.MessageType.ERROR:
             self.player.set_state(Gst.State.NULL)
             self.is_playing = False
             err, dbg = message.parse_error()
@@ -372,7 +373,7 @@ class PreviewWidget(Gtk.VBox, Loggable):
             self.settings.FCpreviewHeight = int(h)
 
     def _sync_message_cb(self, bus, mess):
-        if mess.type == Gst.MESSAGE_ELEMENT:
+        if mess.type == Gst.MessageType.ELEMENT:
             if mess.has_name('prepare-window-handle'):
                 sink = mess.src
 
@@ -398,7 +399,7 @@ class PreviewWidget(Gtk.VBox, Loggable):
                     sink.set_window_handle(self.preview_video.window_xid)
                     sink.expose()
                     Gdk.threads_leave()
-        return Gst.BUS_PASS
+        return Gst.BusSyncReply.PASS
 
     def _appendTag(self, taglist, tag, unused_udata):
             if tag in acceptable_tags and Gst.tag_get_type(tag) in (GObject.TYPE_STRING,
diff --git a/pitivi/medialibrary.py b/pitivi/medialibrary.py
index 4efbf27..4241aa2 100644
--- a/pitivi/medialibrary.py
+++ b/pitivi/medialibrary.py
@@ -26,6 +26,7 @@ from gi.repository import Gst
 from gi.repository import GES
 from gi.repository import GObject
 from gi.repository import Gtk
+from gi.repository import Gdk
 from gi.repository import Pango
 from gi.repository import GdkPixbuf
 
@@ -428,7 +429,7 @@ class MediaLibraryWidget(Gtk.VBox, Loggable):
             self._listview_button.set_active(False)
 
         # add all child widgets
-        self.pack_start(toolbar, expand=False)
+        self.pack_start(toolbar, False, False, 0)
         self.pack_start(self._welcome_infobar, False, False, 0)
         self.pack_start(self._import_warning_infobar, False, False, 0)
         self.pack_start(self.iconview_scrollwin, True, True, 0)
@@ -920,7 +921,7 @@ class MediaLibraryWidget(Gtk.VBox, Loggable):
     def _treeViewButtonPressEventCb(self, treeview, event):
         chain_up = True
 
-        if event.type == Gdk._2BUTTON_PRESS:
+        if event.type == getattr(Gdk.EventType, '2BUTTON_PRESS'):
             if self.getSelectedPaths() != []:
                 # It is possible to double-click outside of clips!
                 self._previewClip()
@@ -979,7 +980,7 @@ class MediaLibraryWidget(Gtk.VBox, Loggable):
     def _iconViewButtonPressEventCb(self, iconview, event):
         chain_up = True
 
-        if event.type == Gdk._2BUTTON_PRESS:
+        if event.type == getattr(Gdk.EventType, '2BUTTON_PRESS'):
             if self.getSelectedPaths() != []:
                 # It is possible to double-click outside of clips!
                 self._previewClip()
diff --git a/pitivi/render.py b/pitivi/render.py
index f2a8eea..18dbacf 100644
--- a/pitivi/render.py
+++ b/pitivi/render.py
@@ -973,7 +973,7 @@ class RenderDialog(Loggable):
 
     #-- GStreamer callbacks
     def _busMessageCb(self, unused_bus, message):
-        if message.type == Gst.MESSAGE_EOS:  # Render complete
+        if message.type == Gst.MessageType.EOS:  # Render complete
             self.debug("got EOS message, render complete")
             self._shutDown()
             self._destroyProgressWindow()
diff --git a/pitivi/timeline/layer.py b/pitivi/timeline/layer.py
index 476cc4b..0442936 100644
--- a/pitivi/timeline/layer.py
+++ b/pitivi/timeline/layer.py
@@ -299,7 +299,7 @@ class VideoLayerControl(BaseLayerControl):
 
         # Opacity scale
         opacity_adjust = Gtk.Adjustment(value=100, upper=100, step_incr=5, page_incr=10)
-        opacity_scale = Gtk.HScale(adjustment=opacity_adjust)
+        opacity_scale = Gtk.Scale.new(Gtk.Orientation.HORIZONTAL, adjustment=opacity_adjust)
         opacity_scale.set_value_pos(Gtk.PositionType.LEFT)
         opacity_scale.set_digits(0)
         opacity_scale.set_tooltip_text(_("Change video opacity"))
@@ -325,7 +325,7 @@ class AudioLayerControl(BaseLayerControl):
         panning = Gtk.Label(label=_("Pan:"))
         # Volume scale
         panning_adjust = Gtk.Adjustment(value=0, lower=-100, upper=100, step_incr=5, page_incr=10)
-        panning_scale = Gtk.HScale(adjustment=panning_adjust)
+        panning_scale = Gtk.Scale.new(Gtk.Orientation.HORIZONTAL, adjustment=panning_adjust)
         panning_scale.set_value_pos(Gtk.PositionType.LEFT)
         panning_scale.set_digits(0)
         panning_scale.set_tooltip_text(_("Change audio panning"))
diff --git a/pitivi/timeline/thumbnailer.py b/pitivi/timeline/thumbnailer.py
index d040132..ccbed17 100644
--- a/pitivi/timeline/thumbnailer.py
+++ b/pitivi/timeline/thumbnailer.py
@@ -463,7 +463,7 @@ class RandomAccessVideoPreviewer(RandomAccessPreviewer):
             factory = element.get_factory()
             if factory and "GstVideoScale" == factory.get_element_type().name:
                 element.props.method = 3
-        return Gst.BUS_PASS
+        return Gst.BusSyncReply.PASS
 
     def _pipelineInit(self, factory, sbin):
         """
@@ -590,13 +590,13 @@ class RandomAccessAudioPreviewer(RandomAccessPreviewer):
         error, debug = message.parse_error()
         self.error("Event bus error: %s: %s", str(error), str(debug))
 
-        return Gst.BUS_PASS
+        return Gst.BusSyncReply.PASS
 
     def _startThumbnail(self, (timestamp, duration)):
         RandomAccessPreviewer._startThumbnail(self, (timestamp, duration))
         self._audio_cur = timestamp, duration
         res = self.audioPipeline.seek(1.0,
-            Gst.FORMAT_TIME,
+            Gst.Format.TIME,
             Gst.SeekFlags.FLUSH | Gst.SeekFlags.ACCURATE | Gst.SeekFlags.SEGMENT,
             Gst.SeekType.SET, timestamp,
             Gst.SeekType.SET, timestamp + duration)
diff --git a/pitivi/timeline/timeline.py b/pitivi/timeline/timeline.py
index c31a6bc..2af98d7 100644
--- a/pitivi/timeline/timeline.py
+++ b/pitivi/timeline/timeline.py
@@ -1002,7 +1002,7 @@ class Timeline(Gtk.Table, Loggable, Zoomable):
         self._zoomAdjustment.connect("value-changed", self._zoomAdjustmentChangedCb)
         self._zoomAdjustment.props.lower = 0
         self._zoomAdjustment.props.upper = Zoomable.zoom_steps
-        zoomslider = Gtk.HScale(adjustment=self._zoomAdjustment)
+        zoomslider = Gtk.Scale.new(Gtk.Orientation.HORIZONTAL, adjustment=self._zoomAdjustment)
         zoomslider.props.draw_value = False
         zoomslider.set_tooltip_text(_("Zoom Timeline"))
         zoomslider.connect("scroll-event", self._zoomSliderScrollCb)
diff --git a/pitivi/transitions.py b/pitivi/transitions.py
index 35ad90d..ceeec27 100644
--- a/pitivi/transitions.py
+++ b/pitivi/transitions.py
@@ -72,7 +72,7 @@ class TransitionsListWidget(Signallable, Gtk.VBox, Loggable):
         self.border_mode_normal = Gtk.RadioButton(group=None, label=_("Normal"))
         self.border_mode_loop = Gtk.RadioButton(group=self.border_mode_normal, label=_("Loop"))
         self.border_mode_normal.set_active(True)
-        self.borderScale = Gtk.HScale()
+        self.borderScale = Gtk.Scale.new(Gtk.Orientation.HORIZONTAL, None)
         self.borderScale.set_draw_value(False)
 
         borderTable.attach(self.border_mode_normal, 0, 1, 0, 1, xoptions=Gtk.AttachOptions.FILL, yoptions=Gtk.AttachOptions.FILL)
diff --git a/pitivi/utils/extract.py b/pitivi/utils/extract.py
index 2c760a0..b59cd6f 100644
--- a/pitivi/utils/extract.py
+++ b/pitivi/utils/extract.py
@@ -181,7 +181,7 @@ class RandomAccessAudioExtractor(RandomAccessExtractor):
         error, debug = message.parse_error()
         self.error("Event bus error: %s; %s", error, debug)
 
-        return Gst.BUS_PASS
+        return Gst.BusSyncReply.PASS
 
     def _busMessageAsyncDoneCb(self, bus, message):
         self.debug("Pipeline is ready for seeking")
@@ -194,7 +194,7 @@ class RandomAccessAudioExtractor(RandomAccessExtractor):
         self.debug("processing segment with timestamp=%i and duration=%i",
                    timestamp, duration)
         res = self.audioPipeline.seek(1.0,
-            Gst.FORMAT_TIME,
+            Gst.Format.TIME,
             Gst.SeekFlags.FLUSH | Gst.SeekFlags.ACCURATE,
             Gst.SeekType.SET, timestamp,
             Gst.SeekType.SET, timestamp + duration)
diff --git a/pitivi/utils/pipeline.py b/pitivi/utils/pipeline.py
index 113a27d..3c3359c 100644
--- a/pitivi/utils/pipeline.py
+++ b/pitivi/utils/pipeline.py
@@ -414,7 +414,7 @@ class SimplePipeline(Signallable, Loggable):
         elif message.type == Gst.MessageType.ERROR:
             error, detail = message.parse_error()
             self._handleErrorMessage(error, detail, message.src)
-        elif message.type == Gst.MessageType.DURATION:
+        elif message.type == Gst.MessageType.DURATION_CHANGED:
             self.debug("Duration might have changed, querying it")
             GObject.idle_add(self._queryDurationAsync)
         else:
diff --git a/pitivi/utils/widgets.py b/pitivi/utils/widgets.py
index cdc7837..0b6ab43 100644
--- a/pitivi/utils/widgets.py
+++ b/pitivi/utils/widgets.py
@@ -187,8 +187,8 @@ class TextWidget(Gtk.HBox, DynamicWidget):
 
 class NumericWidget(Gtk.HBox, DynamicWidget):
 
-    """A Gtk.HScale and a Gtk.SpinButton which share an adjustment. The
-    SpinButton is always displayed, while the HScale only appears if both
+    """An horizontal Gtk.Scale and a Gtk.SpinButton which share an adjustment.
+    The SpinButton is always displayed, while the Scale only appears if both
     lower and upper bounds are defined"""
 
     def __init__(self, upper=None, lower=None, default=None):
@@ -202,8 +202,8 @@ class NumericWidget(Gtk.HBox, DynamicWidget):
         self._type = None
         if (upper != None) and (lower != None) and\
             (upper < 5000) and (lower > -5000):
-            self.slider = Gtk.HScale(self.adjustment)
-            self.pack_start(self.slider, fill=True, expand=True)
+            self.slider = Gtk.Scale.new(Gtk.Orientation.HORIZONTAL, self.adjustment)
+            self.pack_start(self.slider, fill=True, expand=True, padding=0)
             self.slider.show()
             self.slider.props.draw_value = False
 
@@ -491,7 +491,7 @@ class PresetChoiceWidget(Gtk.HBox, DynamicWidget):
 
         save_button = Gtk.Button(stock=Gtk.STOCK_SAVE)
         self._save_button = save_button
-        self.pack_start(save_button, False, False)
+        self.pack_start(save_button, False, False, 0)
         save_button.connect("clicked", self._savePreset)
         self.show_all()
 
@@ -933,7 +933,7 @@ class GstElementSettingsDialog(Loggable):
 
         # Try to avoid scrolling, whenever possible.
         screen_height = self.window.get_screen().get_height()
-        contents_height = self.elementsettings.size_request()[1]
+        contents_height = self.elementsettings.size_request().height
         maximum_contents_height = max(500, 0.7 * screen_height)
         if contents_height < maximum_contents_height:
             # The height of the content is small enough, disable the scrollbars.



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