Commit e6e84d90 authored by Thibault Saunier's avatar Thibault Saunier Committed by Jean-François Fortin Tam

Port everything to PyGI and remove pygtkcompat

parent b6b4fdfb
......@@ -21,6 +21,7 @@
# Boston, MA 02110-1301, USA.
import os
import gi
import sys
import string
import locale
......@@ -93,24 +94,27 @@ def _add_pitivi_path():
# ld caches LD_LIBRARY_PATH at startup so we need to execv() here. LALA.
jump_through_hoops()
def _init_gobject_gtk_gst_ges():
global localedir
try:
import pitivi.utils.pygtkcompat
pitivi.utils.pygtkcompat.enable()
pitivi.utils.pygtkcompat.enable_gtk(version='3.0')
from gi.repository import GdkX11
GdkX11 #pyflakes
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
Gtk #pyflakes
except ImportError, e:
raise SystemExit("PyGTK couldn't be found !", str(e))
try:
pitivi.utils.pygtkcompat.enable_gst()
gi.require_version('Gst', '1.0')
from gi.repository import Gst
Gst #pyflakes
except ImportError:
raise SystemExit("Gst-Python couldn't be found!")
raise SystemExit("Gst 1.0 couldn't be found!")
try:
pitivi.utils.pygtkcompat.enable_ges()
gi.require_version('GES', '1.0')
from gi.repository import GES
GES #pyflakes
except ImportError:
raise SystemExit("GStreamer Editing Services couldn't be found!")
......@@ -119,7 +123,9 @@ def _init_gobject_gtk_gst_ges():
GObject.threads_init()
try:
pitivi.utils.pygtkcompat.enable_goocanvas()
gi.require_version('GooCanvas', '2.0')
from gi.repository import GooCanvas
GooCanvas # pyflakes
except ImportError:
raise SystemExit("GooCanvas couldn't be found!")
......
......@@ -24,13 +24,13 @@
"""
Main application
"""
import gobject
import gtk
import os
import sys
import urllib
import ges
import gio
from gi.repository import GES
from gi.repository import Gio
from gi.repository import GObject
from gi.repository import Gtk
from gettext import gettext as _
from optparse import OptionParser
......@@ -214,7 +214,7 @@ class Pitivi(Loggable, Signallable):
# check if for version information online
def _checkVersion(self):
giofile = gio.File.new_for_uri(RELEASES_URL)
giofile = Gio.File.new_for_uri(RELEASES_URL)
self.info("Requesting version information")
giofile.load_contents_async(None, self._versionInfoReceivedCb, None)
......@@ -249,7 +249,7 @@ class InteractivePitivi(Pitivi):
def __init__(self, debug=False):
Pitivi.__init__(self)
self.mainloop = gobject.MainLoop()
self.mainloop = GObject.MainLoop()
self.actioner = None
self.gui = None
......@@ -291,6 +291,7 @@ class InteractivePitivi(Pitivi):
def run(self):
"""Runs the main loop."""
print "SELF,", self
self.mainloop.run()
......@@ -304,8 +305,8 @@ class GuiPitivi(InteractivePitivi):
self._showGui()
def _showStartupError(self, message, detail):
dialog = gtk.MessageDialog(type=gtk.MESSAGE_ERROR,
buttons=gtk.BUTTONS_OK)
dialog = Gtk.MessageDialog(type=Gtk.MessageType.ERROR,
buttons=Gtk.ButtonsType.OK)
dialog.set_icon_name("pitivi")
dialog.set_markup("<b>" + message + "</b>")
dialog.format_secondary_text(detail)
......@@ -315,7 +316,7 @@ class GuiPitivi(InteractivePitivi):
self.shutdown()
def _createGui(self):
"""Returns a gtk.Widget which represents the UI."""
"""Returns a Gtk.Widget which represents the UI."""
raise NotImplementedError()
def _showGui(self):
......@@ -368,7 +369,7 @@ class ProjectCreatorGuiPitivi(FullGuiPitivi):
if self._maybePopStartupUri(startup_uris, info.get_uri()) \
and add_to_timeline:
self.action_log.begin("add clip")
src = ges.TimelineFileSource(uri=info.get_uri())
src = GES.TimelineFileSource(uri=info.get_uri())
src.set_property("priority", 1)
self.current.timeline.get_layers()[0].add_object(src)
self.action_log.commit()
......
......@@ -24,11 +24,11 @@
Classes for automatic alignment of L{TimelineObject}s
"""
import gobject
import gst
from gi.repository import GObject
from gi.repository import Gst
import array
import time
import gtk
from gi.repository import Gtk
import os
......@@ -374,7 +374,7 @@ class ProgressAggregator(ProgressMeter):
def cb(thusfar):
self._portions[i] = thusfar
gobject.idle_add(self._callForward)
GObject.idle_add(self._callForward)
return cb
def addWatcher(self, function):
......@@ -382,7 +382,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 GObject.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)
......@@ -393,7 +393,7 @@ class ProgressAggregator(ProgressMeter):
now = time.time()
remaining = (now - self._start) * (1 - frac) / frac
for function in self._watchers:
function(frac, beautify_ETA(int(remaining * gst.SECOND)))
function(frac, beautify_ETA(int(remaining * Gst.SECOND)))
return False
......@@ -585,13 +585,13 @@ class AutoAligner(Loggable):
# numsamples is the total number of samples in the track,
# which is used by progress_aggregator to determine
# the percent completion.
numsamples = ((audiotrack.duration / gst.SECOND) *
numsamples = ((audiotrack.duration / Gst.SECOND) *
audiotrack.stream.rate)
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 GObject.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,
......@@ -599,10 +599,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)
GObject.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)
GObject.idle_add(call_false, self._callback)
return progress_aggregator
def _chooseReference(self):
......@@ -636,7 +636,7 @@ class AutoAligner(Loggable):
offsets = rigidalign(reference_envelope, envelopes)
for (movable, envelope), offset in zip(pairs, offsets):
# tshift is the offset rescaled to units of nanoseconds
tshift = int((offset * gst.SECOND) / self.BLOCKRATE)
tshift = int((offset * Gst.SECOND) / self.BLOCKRATE)
self.debug("Shifting %s to %i ns from %i",
movable, tshift, reference.start)
newstart = reference.start + tshift
......@@ -658,7 +658,7 @@ class AlignmentProgressDialog:
(read-only, no buttons)."""
def __init__(self, app):
self.builder = gtk.Builder()
self.builder = Gtk.Builder()
self.builder.add_from_file(os.path.join(configure.get_ui_dir(),
"alignmentprogress.ui"))
self.builder.connect_signals(self)
......@@ -671,7 +671,7 @@ class AlignmentProgressDialog:
# taken from RenderingProgressDialog. In both cases, it appears
# to work correctly, although there is a known bug for Gnome 3 in
# RenderingProgressDialog (bug #652917)
self.window.set_transient_for(app.gui)
self.set_transient_for(app.gui)
# UI widgets
# We currently reuse the render icon for this dialog.
......
......@@ -23,8 +23,9 @@
Runtime checks.
"""
import gtk
import gst
from gi.repository import Gdk
from gi.repository import Gtk
from gi.repository import Gst
from gettext import gettext as _
......@@ -40,10 +41,10 @@ def initiate_videosinks():
Test if the autovideosink element can initiate, return TRUE if it is the
case.
"""
sink = gst.element_factory_make("autovideosink")
if not sink.set_state(gst.STATE_READY):
sink = Gst.ElementFactory.make("autovideosink", None)
if not sink.set_state(Gst.State.READY):
return False
sink.set_state(gst.STATE_NULL)
sink.set_state(Gst.State.NULL)
return True
......@@ -52,13 +53,25 @@ def initiate_audiosinks():
Test if the autoaudiosink element can initiate, return TRUE if it is the
case.
"""
sink = gst.element_factory_make("autoaudiosink")
if not sink.set_state(gst.STATE_READY):
sink = Gst.ElementFactory.make("autoaudiosink", None)
if not sink.set_state(Gst.State.READY):
return False
sink.set_state(gst.STATE_NULL)
sink.set_state(Gst.State.NULL)
return True
def __try_import_from_gi__(modulename):
"""
Attempt to load given module.
Returns True on success, else False.
"""
try:
__import__("gi.repository." + modulename)
return True
except:
return False
def __try_import__(modulename):
"""
Attempt to load given module.
......@@ -86,31 +99,29 @@ def check_required_version(modulename):
containing the strings of the required version and the installed version.
This function does not check for the existence of the given module !
"""
if modulename == "pygtk":
if list(gtk.pygtk_version) < _string_to_list(PYGTK_REQ):
return [PYGTK_REQ, _version_to_string(gtk.pygtk_version)]
if modulename == "gtk":
if list(gtk.gtk_version) < _string_to_list(GTK_REQ):
return [GTK_REQ, _version_to_string(gtk.gtk_version)]
if modulename == "pygst":
if list(gst.get_pygst_version()) < _string_to_list(PYGST_REQ):
return [PYGST_REQ, _version_to_string(gst.get_pygst_version())]
if list((Gtk.MAJOR_VERSION, Gtk.MINOR_VERSION, Gtk.MICRO_VERSION)) < \
_string_to_list(GTK_REQ):
return [GTK_REQ, _version_to_string((Gtk.MAJOR_VERSION,
Gtk.MINOR_VERSION, Gtk.MICRO_VERSION))]
if modulename == "cairo":
import cairo
if _string_to_list(cairo.cairo_version_string()) < _string_to_list(PYCAIRO_REQ):
return [PYCAIRO_REQ, cairo.cairo_version_string()]
if modulename == "gst":
if list(gst.get_gst_version()) < _string_to_list(GST_REQ):
return [GST_REQ, _version_to_string(gst.get_gst_version())]
if list(Gst.version()) < _string_to_list(GST_REQ):
return [GST_REQ, _version_to_string(Gst.version())]
if modulename == "gnonlin":
gnlver = gst.registry_get_default().find_plugin("gnonlin").get_version()
gnlver = Gst.Registry.get().find_plugin("gnonlin").get_version()
if _string_to_list(gnlver) < _string_to_list(GNONLIN_REQ):
return [GNONLIN_REQ, gnlver]
return [None, None]
def initial_checks():
reg = gst.registry_get_default()
Gst.init(None)
reg = Gst.Registry.get()
if PiTiVi:
return (_("%s is already running") % APPNAME,
_("An instance of %s is already running in this script.") % APPNAME)
......@@ -120,7 +131,7 @@ def initial_checks():
if not reg.find_plugin("autodetect"):
return (_("Could not find the autodetect plugins"),
_("Make sure you have installed gst-plugins-good and that it's available in the GStreamer plugin path."))
if not hasattr(gtk.gdk.Window, 'cairo_create'):
if not hasattr(Gdk.Window, 'cairo_create'):
return (_("PyGTK doesn't have cairo support"),
_("Please use a version of the GTK+ Python bindings built with cairo support."))
if not initiate_videosinks():
......@@ -129,19 +140,15 @@ def initial_checks():
if not initiate_audiosinks():
return (_("Could not initiate the audio output plugins"),
_("Make sure you have at least one valid audio output sink available (alsasink or osssink)."))
if not __try_import__("cairo"):
if not __try_import_from_gi__("cairo"):
return (_("Could not import the cairo Python bindings"),
_("Make sure you have the cairo Python bindings installed."))
if not __try_import__("goocanvas"):
if not __try_import_from_gi__("GooCanvas"):
return (_("Could not import the goocanvas Python bindings"),
_("Make sure you have the goocanvas Python bindings installed."))
if not __try_import__("xdg"):
return (_("Could not import the xdg Python library"),
_("Make sure you have the xdg Python library installed."))
req, inst = check_required_version("pygtk")
if req:
return (_("You do not have a recent enough version of the GTK+ Python bindings (your version %s)") % inst,
_("Install a version of the GTK+ Python bindings greater than or equal to %s.") % req)
req, inst = check_required_version("gtk")
if req:
return (_("You do not have a recent enough version of GTK+ (your version %s)") % inst,
......@@ -162,7 +169,7 @@ def initial_checks():
if req:
return (_("You do not have a recent enough version of the GNonLin GStreamer plugin (your version %s)") % inst,
_("Install a version of the GNonLin GStreamer plugin greater than or equal to %s.") % req)
if not __try_import__("ges"):
if not __try_import_from_gi__("GES"):
#FIXME enable version checking in GES
return (_("Could not import GStreamer Editing Services "),
_("Make sure you have GStreamer Editing Services installed."))
......@@ -171,23 +178,20 @@ def initial_checks():
_("Make sure you have the distutils Python module installed."))
# The following are soft dependencies
# Note that instead of checking for plugins using gst.registry_get_default().find_plugin("foo"),
# we could check for elements using gst.element_factory_make("foo")
# Note that instead of checking for plugins using Gst.Registry.get().find_plugin("foo"),
# we could check for elements using Gst.ElementFactory.make("foo")
if not __try_import__("numpy"):
soft_deps["NumPy"] = _("Enables the autoalign feature")
try:
#if not gst.registry_get_default().find_plugin("frei0r"):
gst.element_factory_make("frei0r-filter-scale0tilt")
except gst.ElementNotFoundError:
if Gst.ElementFactory.make("frei0r-filter-scale0tilt", None) is None:
soft_deps["Frei0r"] = _("Additional video effects")
if not gst.registry_get_default().find_plugin("libav"):
if not Gst.Registry.get().find_plugin("libav"):
soft_deps["GStreamer Libav plugin"] = _('Additional multimedia codecs through the Libav library')
# Test for gst bad
# This is disabled because, by definition, gst bad is a set of plugins that can
# move to gst good or ugly, and we don't really have something to rely upon.
#if not gst.registry_get_default().find_plugin("swfdec"): # FIXME: find a more representative plugin
#if not Gst.Registry.get().find_plugin("swfdec"): # FIXME: find a more representative plugin
# soft_deps["GStreamer bad plugins"] = _('Additional GStreamer plugins whose code is not of good enough quality, or are not considered tested well enough. The licensing may or may not be LGPL')
# Test for gst ugly
#if not gst.registry_get_default().find_plugin("x264"):
#if not Gst.Registry.get().find_plugin("x264"):
# soft_deps["GStreamer ugly plugins"] = _('Additional good quality GStreamer plugins whose license is not LGPL or with licensing issues')
return None
......@@ -22,10 +22,12 @@
"""
Class handling the midle pane
"""
import gtk
import pango
import os
import ges
from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import Pango
from gi.repository import GES
from gettext import gettext as _
......@@ -56,43 +58,43 @@ class ClipPropertiesError(Exception):
def compare_type(track, effect_type):
if track.get_property("track_type") == ges.TRACK_TYPE_AUDIO and \
if track.get_property("track_type") == GES.TrackType.AUDIO and \
effect_type == AUDIO_EFFECT:
return True
elif track.get_property("track_type") == ges.TRACK_TYPE_VIDEO and \
elif track.get_property("track_type") == GES.TrackType.VIDEO and \
effect_type == VIDEO_EFFECT:
return True
return False
class ClipProperties(gtk.ScrolledWindow, Loggable):
class ClipProperties(Gtk.ScrolledWindow, Loggable):
"""
Widget for configuring clips properties
"""
def __init__(self, instance, uiman):
gtk.ScrolledWindow.__init__(self)
Gtk.ScrolledWindow.__init__(self)
Loggable.__init__(self)
self.app = instance
self.settings = instance.settings
self._project = None
self.infobar_box = gtk.VBox()
self.infobar_box = Gtk.VBox()
effect_properties_handling = EffectsPropertiesManager(instance)
self.effect_expander = EffectProperties(instance, effect_properties_handling, self)
self.transformation_expander = TransformationProperties(instance, instance.action_log)
self.effect_expander.set_vexpand(False)
self.transformation_expander.set_vexpand(False)
vbox = gtk.VBox()
vbox = Gtk.VBox()
vbox.set_spacing(SPACING)
vbox.pack_start(self.infobar_box, expand=False, fill=True)
vbox.pack_start(self.transformation_expander, expand=False, fill=True)
vbox.pack_start(self.effect_expander, expand=True, fill=True)
vbox.pack_start(self.infobar_box, False, True, 0)
vbox.pack_start(self.transformation_expander, False, True, 0)
vbox.pack_start(self.effect_expander, True, True, 0)
viewport = gtk.Viewport()
viewport = Gtk.Viewport()
viewport.add(vbox)
self.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
self.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
self.add(viewport)
viewport.show()
vbox.show()
......@@ -111,11 +113,11 @@ class ClipProperties(gtk.ScrolledWindow, Loggable):
project = property(_getProject, _setProject)
def addInfoBar(self, text):
label = gtk.Label(label=text)
label = Gtk.Label(label=text)
label.set_line_wrap(True)
info_bar = gtk.InfoBar()
info_bar = Gtk.InfoBar()
info_bar.get_content_area().add(label)
self.infobar_box.pack_start(info_bar, expand=False, fill=False)
self.infobar_box.pack_start(info_bar, False, False, 0)
return info_bar
def _getTimeline(self):
......@@ -129,15 +131,15 @@ class ClipProperties(gtk.ScrolledWindow, Loggable):
timeline = property(_getTimeline, _setTimeline)
class EffectProperties(gtk.Expander):
class EffectProperties(Gtk.Expander):
"""
Widget for viewing and configuring effects
"""
# Note: This should be inherited from gtk.Expander when we get other things
# Note: This should be inherited from Gtk.Expander when we get other things
# to put in ClipProperties, that is why this is done this way
def __init__(self, instance, effect_properties_handling, clip_properties):
gtk.Expander.__init__(self)
Gtk.Expander.__init__(self)
self.selected_effects = []
self.timeline_objects = []
......@@ -153,66 +155,66 @@ class EffectProperties(gtk.Expander):
self._config_ui_h_pos = None
self._timeline = None
self._vcontent = gtk.VPaned()
self._vcontent = Gtk.VPaned()
self.add(self._vcontent)
self._table = gtk.Table(3, 1, False)
self._table = Gtk.Table(3, 1, False)
self._toolbar = gtk.Toolbar()
self._removeEffectBt = gtk.ToolButton("gtk-delete")
self._toolbar = Gtk.Toolbar()
self._removeEffectBt = Gtk.ToolButton("gtk-delete")
self._removeEffectBt.set_label(_("Remove effect"))
self._removeEffectBt.set_use_underline(True)
self._removeEffectBt.set_is_important(True)
self._removeEffectBt.set_sensitive(False)
self._toolbar.insert(self._removeEffectBt, 0)
self._table.attach(self._toolbar, 0, 1, 0, 1, yoptions=gtk.FILL)
self._table.attach(self._toolbar, 0, 1, 0, 1, yoptions=Gtk.AttachOptions.FILL)
self.storemodel = gtk.ListStore(bool, str, str, str, object)
self.storemodel = Gtk.ListStore(bool, str, str, str, object)
#Treeview
self.treeview_scrollwin = gtk.ScrolledWindow()
self.treeview_scrollwin.set_policy(gtk.POLICY_NEVER,
gtk.POLICY_AUTOMATIC)
self.treeview_scrollwin.set_shadow_type(gtk.SHADOW_ETCHED_IN)
self.treeview_scrollwin = Gtk.ScrolledWindow()
self.treeview_scrollwin.set_policy(Gtk.PolicyType.NEVER,
Gtk.PolicyType.AUTOMATIC)
self.treeview_scrollwin.set_shadow_type(Gtk.ShadowType.ETCHED_IN)
# TreeView
# Displays name, description
self.treeview = gtk.TreeView(self.storemodel)
self.treeview = Gtk.TreeView(self.storemodel)
self.treeview_scrollwin.add(self.treeview)
self.treeview.set_property("rules_hint", True)
self.treeview.set_property("has_tooltip", True)
tsel = self.treeview.get_selection()
tsel.set_mode(gtk.SELECTION_SINGLE)
tsel.set_mode(Gtk.SelectionMode.SINGLE)
activatedcell = gtk.CellRendererToggle()
activatedcell = Gtk.CellRendererToggle()
activatedcell.props.xpad = PADDING
activatedcell.connect("toggled", self._effectActiveToggleCb)
typecol = gtk.TreeViewColumn(_("Type"))
typecol = Gtk.TreeViewColumn(_("Type"))
typecol.set_sort_column_id(COL_TYPE)
self.treeview.append_column(typecol)
typecol.set_spacing(SPACING)
typecol.set_sizing(gtk.TREE_VIEW_COLUMN_AUTOSIZE)
typecol.set_sizing(Gtk.TreeViewColumnSizing.AUTOSIZE)
typecol.set_min_width(50)
typecell = gtk.CellRendererText()
typecell = Gtk.CellRendererText()
typecell.props.xpad = PADDING
typecell.set_property("ellipsize", pango.ELLIPSIZE_END)
typecol.pack_start(typecell)
typecell.set_property("ellipsize", Pango.EllipsizeMode.END)
typecol.pack_start(typecell, True)
typecol.add_attribute(typecell, "text", COL_TYPE)
namecol = gtk.TreeViewColumn(_("Effect name"))
namecol = Gtk.TreeViewColumn(_("Effect name"))
namecol.set_sort_column_id(COL_NAME_TEXT)
self.treeview.append_column(namecol)
namecol.set_spacing(SPACING)
namecell = gtk.CellRendererText()
namecell = Gtk.CellRendererText()
namecell.props.xpad = PADDING
namecell.set_property("ellipsize", pango.ELLIPSIZE_END)
namecol.pack_start(namecell)
namecell.set_property("ellipsize", Pango.EllipsizeMode.END)
namecol.pack_start(namecell, True)
namecol.add_attribute(namecell, "text", COL_NAME_TEXT)
self.treeview.drag_dest_set(gtk.DEST_DEFAULT_MOTION,
self.treeview.drag_dest_set(Gtk.DestDefaults.MOTION,
[EFFECT_TARGET_ENTRY],
gtk.gdk.ACTION_COPY)
Gdk.DragAction.COPY)
self.treeview.drag_dest_add_text_targets()
......@@ -287,13 +289,13 @@ class EffectProperties(gtk.Expander):
self.updateAll()
def _trackObjectAddedCb(self, unused_timeline_object, track_object):
if isinstance(track_object, ges.TrackEffect):
if isinstance(track_object, GES.TrackEffect):
selec = self.timeline.selection.getSelectedTrackEffects()
self.selected_effects = selec
self.updateAll()
def _trackRemovedRemovedCb(self, unused_timeline_object, track_object):
if isinstance(track_object, ges.TrackEffect):
if isinstance(track_object, GES.TrackEffect):
selec = self.timeline.selection.getSelectedTrackEffects()
self.selected_effects = selec
self.updateAll()
......@@ -331,13 +333,13 @@ class EffectProperties(gtk.Expander):
# Which means, it has the corresponding media_type
for tckobj in tlobj.get_track_objects():
track = tckobj.get_track()
if track.get_property("track_type") == ges.TRACK_TYPE_AUDIO and \
if track.get_property("track_type") == GES.TrackType.AUDIO and \
media_type == AUDIO_EFFECT or \
track.get_property("track_type") == ges.TRACK_TYPE_VIDEO and \
track.get_property("track_type") == GES.TrackType.VIDEO and \
media_type == VIDEO_EFFECT:
#Actually add the effect
self.app.action_log.begin("add effect")
effect = ges.TrackParseLaunchEffect(bin_description=bin_desc)
effect = GES.TrackParseLaunchEffect(bin_description=bin_desc)
tlobj.add_track_object(effect)
track.add_object(effect)
self.updateAll()
......@@ -404,9 +406,9 @@ class EffectProperties(gtk.Expander):
track_effect.props.bin_description)
to_append = [track_effect.props.active]
track = track_effect.get_track()
if track.get_property("track_type") == ges.TRACK_TYPE_AUDIO:
if track.get_property("track_type") == GES.TrackType.AUDIO:
to_append.append("Audio")
elif track.get_property("track_type") == ges.TRACK_TYPE_VIDEO:
elif track.get_property("track_type") == GES.TrackType.VIDEO:
to_append.append("Video")
to_append.append(track_effect.props.bin_description)
......@@ -424,7 +426,7 @@ class EffectProperties(gtk.Expander):
def _setEffectDragable(self):
self.show()
self._info_bar.hide_all()
self._info_bar.hide()
def _treeviewSelectionChangedCb(self, treeview):
if self.selection.count_selected_rows() == 0 and self.timeline_objects:
......@@ -447,7 +449,7 @@ class EffectProperties(gtk.Expander):
COL_TRACK_EFFECT)
for widget in self._vcontent.get_children():
if type(widget) in [gtk.ScrolledWindow, GstElementSettingsWidget]:
if type(widget) in [Gtk.ScrolledWindow, GstElementSettingsWidget]:
self._vcontent.remove(widget)
element = track_effect
......@@ -470,7 +472,7 @@ class EffectProperties(gtk.Expander):
self._effect_config_ui = None
class TransformationProperties(gtk.Expander):
class TransformationProperties(Gtk.Expander):
"""
Widget for viewing and configuring speed
"""
......@@ -478,7 +480,7 @@ class TransformationProperties(gtk.Expander):
'selection-changed': []}
def __init__(self, app, action_log):
gtk.Expander.__init__(self)
Gtk.Expander.__init__(self)
self.action_log = action_log
self.app = app
self._timeline = None
......@@ -488,7 +490,7 @@ class TransformationProperties(gtk.Expander):
self.set_label(_("Transformation"))
if not "Frei0r" in soft_deps:
self.builder = gtk.Builder()
self.builder = Gtk.Builder()
self.builder.add_from_file(os.path.join(get_ui_dir(),
"cliptransformation.ui"))
......@@ -591,7 +593,7 @@ class TransformationProperties(gtk.Expander):
def _findEffect(self, name):
for track_effect in self._current_tl_obj.get_track_objects():
if isinstance(track_effect, ges.TrackParseLaunchEffect):
if isinstance(track_effect, GES.TrackParseLaunchEffect):
if name in track_effect.get_property("bin-description"):
self.track_effect = track_effect
return track_effect.get_element()
......@@ -599,7 +601,7 @@ class TransformationProperties(gtk.Expander):
def _findOrCreateEffect(self, name):
effect = self._findEffect(name)
if not effect:
effect = ges.TrackParseLaunchEffect(bin_description=name)
effect = GES.TrackParseLaunchEffect(bin_description=name)
self._current_tl_obj.add_track_object(effect)
tracks = self.app.projectManager.current.timeline.get_tracks()
for track in tracks:
......
......@@ -24,8 +24,8 @@ Dialog box displaying the properties of a clip from media library, allowing
to set those properties as the project settings.
"""
import gtk
import gst
from gi.repository import Gtk
from gi.repository import Gst
import os
from gettext import gettext as _
......@@ -65,11 +65,11 @@ class clipmediapropsDialog():
self.is_image = stream.is_image()
if not self.is_image:
self.frame_rate.set_text(
get_value_from_model(frame_rates, gst.Fraction(
get_value_from_model(frame_rates, Gst.Fraction(
stream.get_framerate_num(),
stream.get_framerate_denom())))
self.aspect_ratio.set_text(
get_value_from_model(pixel_aspect_ratios, gst.Fraction(