[pitivi/ges] Allow copying a clip's properties to project settings
- From: Jean-FranÃois Fortin Tam <jfft src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi/ges] Allow copying a clip's properties to project settings
- Date: Tue, 27 Mar 2012 03:59:45 +0000 (UTC)
commit 98cd55ee867779c9cb57195f26b9d4302d023e0b
Author: Matas Brazdeikis <matas brazdeikis lt>
Date: Sun Mar 25 23:11:10 2012 +0100
Allow copying a clip's properties to project settings
data/ui/clipmediaprops.ui | 426 ++++++++++++++++++++++++++++++++++++++
pitivi/dialogs/clipmediaprops.py | 157 ++++++++++++++
pitivi/mainwindow.py | 3 +-
pitivi/medialibrary.py | 22 ++-
pitivi/project.py | 28 +---
pitivi/utils/ui.py | 34 +++-
6 files changed, 640 insertions(+), 30 deletions(-)
---
diff --git a/data/ui/clipmediaprops.ui b/data/ui/clipmediaprops.ui
new file mode 100644
index 0000000..86d4186
--- /dev/null
+++ b/data/ui/clipmediaprops.ui
@@ -0,0 +1,426 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <requires lib="gtk+" version="2.16"/>
+ <object class="GtkDialog" id="Import Settings">
+ <property name="can_focus">False</property>
+ <property name="border_width">5</property>
+ <property name="title" translatable="yes">Clip Properties</property>
+ <property name="type_hint">dialog</property>
+ <child internal-child="vbox">
+ <object class="GtkBox" id="dialog-vbox1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">12</property>
+ <child internal-child="action_area">
+ <object class="GtkButtonBox" id="dialog-action_area1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="button1">
+ <property name="label" translatable="yes">_Cancel</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_underline">True</property>
+ <signal name="clicked" handler="onCancelButtonClicked" swapped="no"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button2">
+ <property name="label" translatable="yes">_Apply to project</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_underline">True</property>
+ <signal name="clicked" handler="onApplyButtonClicked" swapped="no"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkFrame" id="frame1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">none</property>
+ <child>
+ <object class="GtkAlignment" id="alignment1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="left_padding">12</property>
+ <child>
+ <object class="GtkVBox" id="vbox3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkHBox" id="hbox1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkCheckButton" id="checkbutton1">
+ <property name="label" translatable="yes">Size (pixels):</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="xalign">0</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox7">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkLabel" id="size_width">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label">x</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="size_height">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkCheckButton" id="checkbutton2">
+ <property name="label" translatable="yes">Frame rate: </property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="xalign">0</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="frame_rate">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkCheckButton" id="checkbutton3">
+ <property name="label" translatable="yes">Pixel Aspect Ratio:</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="xalign">0</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="aspect_ratio">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes"> Video:</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkFrame" id="frame2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">none</property>
+ <child>
+ <object class="GtkAlignment" id="alignment2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="left_padding">12</property>
+ <child>
+ <object class="GtkVBox" id="vbox4">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkHBox" id="hbox4">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkCheckButton" id="checkbutton4">
+ <property name="label" translatable="yes">Channels:</property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="xalign">0</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="channels">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox5">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkCheckButton" id="checkbutton5">
+ <property name="label" translatable="yes">Sample Rate: </property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="xalign">0</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="sample_rate">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox6">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkCheckButton" id="checkbutton6">
+ <property name="label" translatable="yes">Sample Depth: </property>
+ <property name="use_action_appearance">False</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_action_appearance">False</property>
+ <property name="xalign">0</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="sample_depth">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="label3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Audio:</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="0">button1</action-widget>
+ <action-widget response="0">button2</action-widget>
+ </action-widgets>
+ </object>
+</interface>
diff --git a/pitivi/dialogs/clipmediaprops.py b/pitivi/dialogs/clipmediaprops.py
new file mode 100644
index 0000000..a0af7e1
--- /dev/null
+++ b/pitivi/dialogs/clipmediaprops.py
@@ -0,0 +1,157 @@
+# PiTiVi , Non-linear video editor
+#
+# ui/clipmediaprops.py
+#
+# Copyright (c) 2011, Parthasarathi Susarla <partha collabora co uk>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this program; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+"""
+Dialog box for display the properties of a clip from sources list
+"""
+
+import gtk
+import gst
+import os
+import random
+import string
+
+from pwd import getpwuid
+from datetime import datetime
+from gettext import gettext as _
+from pitivi.configure import get_ui_dir
+from pitivi.utils.ui import model, frame_rates, audio_rates, audio_depths,\
+ audio_channels, get_combo_value, set_combo_value, pixel_aspect_ratios,\
+ get_value_from_model
+from pitivi.preset import AudioPresetManager, VideoPresetManager
+
+
+class clipmediapropsDialog():
+ def __init__(self, project, audio_streams, video_streams):
+ self.project = project
+ self.settings = self.project.getSettings()
+ self.widgets = {}
+ self.resets = {}
+ self._current = None
+ self._createUi()
+ self.audio_streams = audio_streams
+ self.video_streams = video_streams
+
+ def run(self):
+ self.is_audio = len(self.audio_streams) > 0
+ self.is_video = len(self.video_streams) > 0
+ self.is_image = False
+
+ for stream in self.audio_streams:
+ self.channels.set_text(
+ get_value_from_model(audio_channels, stream.get_channels()))
+ self.sample_rate.set_text(
+ get_value_from_model(audio_rates, stream.get_sample_rate()))
+ self.sample_depth.set_text(
+ get_value_from_model(audio_depths, stream.get_depth()))
+
+ for stream in self.video_streams:
+ self.size_width.set_text(str(stream.get_width()))
+ self.size_height.set_text(str(stream.get_height()))
+ self.is_image = stream.get_framerate_num() == 0
+ if not self.is_image:
+ self.frame_rate.set_text(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(stream.get_par_num(),
+ stream.get_par_denom())))
+
+ if not self.is_video:
+ self.frame1.hide()
+ if not self.is_audio:
+ self.frame2.hide()
+ if self.is_image:
+ self.hbox2.hide()
+ self.hbox3.hide()
+ self.label2.set_markup(_("<b>Image:</b>"))
+ self.dialog.run()
+
+ def _createUi(self):
+ builder = gtk.Builder()
+ builder.add_from_file(os.path.join(get_ui_dir(), "clipmediaprops.ui"))
+ builder.connect_signals(self)
+ self.dialog = builder.get_object("Import Settings")
+ self.channels = builder.get_object("channels")
+ self.size_height = builder.get_object("size_height")
+ self.size_width = builder.get_object("size_width")
+ self.frame_rate = builder.get_object("frame_rate")
+ self.aspect_ratio = builder.get_object("aspect_ratio")
+ self.sample_depth = builder.get_object("sample_depth")
+ self.sample_rate = builder.get_object("sample_rate")
+ self.frame1 = builder.get_object("frame1")
+ self.frame2 = builder.get_object("frame2")
+ self.hbox2 = builder.get_object("hbox2")
+ self.hbox3 = builder.get_object("hbox3")
+ self.label2 = builder.get_object("label2")
+ self.checkbutton1 = builder.get_object("checkbutton1")
+ self.checkbutton2 = builder.get_object("checkbutton2")
+ self.checkbutton3 = builder.get_object("checkbutton3")
+ self.checkbutton4 = builder.get_object("checkbutton4")
+ self.checkbutton5 = builder.get_object("checkbutton5")
+ self.checkbutton6 = builder.get_object("checkbutton6")
+
+ def onApplyButtonClicked(self, button):
+
+ if (self.is_video):
+ _width = -1
+ _height = -1
+ _framerate = -1
+ _par = -1
+ video = self.video_streams[0]
+ if (self.checkbutton1.get_active()):
+ _width = video.get_width()
+ _height = video.get_height()
+ if (self.checkbutton2.get_active() and not self.is_image):
+ _framerate = gst.Fraction(video.get_framerate_num(),
+ video.get_framerate_denom())
+ if (self.checkbutton3.get_active() and not self.is_image):
+ _par = gst.Fraction(video.get_par_num(),
+ video.get_par_denom())
+ self.settings.setVideoProperties(_width,
+ _height,
+ _framerate,
+ _par)
+
+ if (self.is_audio):
+ _channels = -1
+ _rate = -1
+ _depth = -1
+ audio = self.audio_streams[0]
+ if (self.checkbutton4.get_active()):
+ _channels = audio.get_channels()
+ if (self.checkbutton5.get_active()):
+ _rate = audio.get_sample_rate()
+ if (self.checkbutton6.get_active()):
+ _depth = audio.get_depth()
+
+ self.settings.setAudioProperties(_channels,
+ _rate,
+ _depth)
+
+ if (self.is_video or self.is_audio):
+ self.project.setSettings(self.settings)
+
+ self.dialog.destroy()
+
+ def onCancelButtonClicked(self, button):
+ self.dialog.destroy()
diff --git a/pitivi/mainwindow.py b/pitivi/mainwindow.py
index 42c95eb..1f49ce6 100644
--- a/pitivi/mainwindow.py
+++ b/pitivi/mainwindow.py
@@ -1002,7 +1002,8 @@ class PitiviMainWindow(gtk.Window, Loggable):
# TODO: this method's signature should be changed:
# project = self.app.current,
# old is never used, and the new is equal to self.app.current.settings
- self.viewer.setDisplayAspectRatio(float(new.videopar * new.videowidth) /\
+ self.viewer.setDisplayAspectRatio(
+ float(new.videopar.num / new.videopar.denom * new.videowidth) /\
float(new.videoheight))
def _sourceListMissingPluginsCb(self, project, uri, factory,
diff --git a/pitivi/medialibrary.py b/pitivi/medialibrary.py
index 81def38..6de5488 100644
--- a/pitivi/medialibrary.py
+++ b/pitivi/medialibrary.py
@@ -40,7 +40,7 @@ from pitivi.configure import get_pixmap_dir
from pitivi.settings import GlobalSettings
from pitivi.mediafilespreviewer import PreviewWidget
from pitivi.dialogs.filelisterrordialog import FileListErrorDialog
-
+from pitivi.dialogs.clipmediaprops import clipmediapropsDialog
from pitivi.utils.ui import beautify_length
from pitivi.utils.misc import PathWalker, quote_uri
from pitivi.utils.signal import SignalGroup, Signallable
@@ -299,15 +299,19 @@ class MediaLibraryWidget(gtk.VBox, Loggable):
image.set_from_stock(gtk.STOCK_REMOVE, gtk.ICON_SIZE_MENU)
self.popup_remitem.set_image(image)
self.popup_playmenuitem = gtk.MenuItem(_("_Preview Clip"))
+ self.popup_clipprop = gtk.MenuItem(_("_Clip properties"))
self.popup_importitem.connect("activate", self._importButtonClickedCb)
self.popup_remitem.connect("activate", self._removeButtonClickedCb)
self.popup_playmenuitem.connect("activate", self._playButtonClickedCb)
+ self.popup_clipprop.connect("activate", self._clipPropButtonClickedCb)
self.popup_importitem.show()
self.popup_remitem.show()
self.popup_playmenuitem.show()
+ self.popup_clipprop.show()
self.popup.append(self.popup_importitem)
self.popup.append(self.popup_remitem)
self.popup.append(self.popup_playmenuitem)
+ self.popup.append(self.popup_clipprop)
# import sources dialogbox
self._importDialog = None
@@ -983,6 +987,19 @@ class MediaLibraryWidget(gtk.VBox, Loggable):
self.debug("Let's play %s", model[paths][COL_URI])
self.emit('play', model[paths][COL_URI])
+ def _clipPropButtonClickedCb(self, unused_widget=None):
+ """ Called when user clicks clip properties button """
+ paths = self.getSelectedPaths()
+ model = self.treeview.get_model()
+ if len(paths) < 1:
+ return
+ paths = paths[0]
+ factory = model[paths][COL_FACTORY]
+ self.debug("Let's import %s", model[paths][COL_URI])
+ d = clipmediapropsDialog(self.app.current,
+ factory.get_audio_streams(), factory.get_video_streams())
+ d.run()
+
def _hideInfoBarClickedCb(self, unused_button):
self._resetErrorList()
@@ -1047,6 +1064,7 @@ class MediaLibraryWidget(gtk.VBox, Loggable):
if view != None and self._rowUnderMouseSelected(view, event):
self.popup_remitem.set_sensitive(True)
self.popup_playmenuitem.set_sensitive(True)
+ self.popup_clipprop.set_sensitive(True)
elif view != None and (not self._nothingUnderMouse(view, event)):
if not event.state & (gtk.gdk.CONTROL_MASK | gtk.gdk.SHIFT_MASK):
self._viewUnselectAll()
@@ -1061,9 +1079,11 @@ class MediaLibraryWidget(gtk.VBox, Loggable):
self._viewSelectPath(self._viewGetPathAtPos(event))
self.popup_remitem.set_sensitive(True)
self.popup_playmenuitem.set_sensitive(True)
+ self.popup_clipprop.set_sensitive(True)
else:
self.popup_remitem.set_sensitive(False)
self.popup_playmenuitem.set_sensitive(False)
+ self.popup_clipprop.set_sensitive(False)
self.popup.popup(None, None, None, event.button, event.time)
diff --git a/pitivi/project.py b/pitivi/project.py
index af381a5..3bf3030 100644
--- a/pitivi/project.py
+++ b/pitivi/project.py
@@ -49,36 +49,10 @@ from pitivi.utils.widgets import FractionWidget
from pitivi.utils.ripple_update_group import RippleUpdateGroup
from pitivi.utils.ui import model, frame_rates, audio_rates, audio_depths,\
audio_channels, beautify_time_delta, get_combo_value, set_combo_value,\
- SPACING
+ pixel_aspect_ratios, display_aspect_ratios, SPACING
from pitivi.preset import AudioPresetManager, DuplicatePresetNameException,\
VideoPresetManager
-# FIXME: are we sure the following tables correct?
-
-pixel_aspect_ratios = model((str, object), (
- (_("Square"), gst.Fraction(1, 1)),
- (_("480p"), gst.Fraction(10, 11)),
- (_("480i"), gst.Fraction(8, 9)),
- (_("480p Wide"), gst.Fraction(40, 33)),
- (_("480i Wide"), gst.Fraction(32, 27)),
- (_("576p"), gst.Fraction(12, 11)),
- (_("576i"), gst.Fraction(16, 15)),
- (_("576p Wide"), gst.Fraction(16, 11)),
- (_("576i Wide"), gst.Fraction(64, 45)),
-))
-
-display_aspect_ratios = model((str, object), (
- (_("Standard (4:3)"), gst.Fraction(4, 3)),
- (_("DV (15:11)"), gst.Fraction(15, 11)),
- (_("DV Widescreen (16:9)"), gst.Fraction(16, 9)),
- (_("Cinema (1.37)"), gst.Fraction(11, 8)),
- (_("Cinema (1.66)"), gst.Fraction(166, 100)),
- (_("Cinema (1.85)"), gst.Fraction(185, 100)),
- (_("Anamorphic (2.35)"), gst.Fraction(235, 100)),
- (_("Anamorphic (2.39)"), gst.Fraction(239, 100)),
- (_("Anamorphic (2.4)"), gst.Fraction(24, 10)),
-))
-
#------------------ Backend classes ------------------------------------------#
class ProjectSettingsChanged(UndoableAction):
diff --git a/pitivi/utils/ui.py b/pitivi/utils/ui.py
index c113318..beaa654 100644
--- a/pitivi/utils/ui.py
+++ b/pitivi/utils/ui.py
@@ -37,7 +37,7 @@ from xml.sax.saxutils import escape
from pitivi.utils.loggable import doLog, ERROR
-# ---------------------- Constants --------------------------------------------#
+# ---------------------- Constants -------------------------------------------#
##
# UI pixels information constants
@@ -354,6 +354,12 @@ def get_combo_value(combo):
return combo.props.model[active][1]
+def get_value_from_model(model, value):
+ for row in model:
+ if (row[1] == value):
+ return row[0]
+ return str(value)
+
#------------------------ encoding datas ----------------------------------------#
# FIXME This should into a special file
frame_rates = model((str, object), (
@@ -392,6 +398,32 @@ audio_channels = model((str, int), (
(_("Stereo"), 2),
(_("Mono"), 1)))
+# FIXME: are we sure the following tables correct?
+
+pixel_aspect_ratios = model((str, object), (
+ (_("Square"), gst.Fraction(1, 1)),
+ (_("480p"), gst.Fraction(10, 11)),
+ (_("480i"), gst.Fraction(8, 9)),
+ (_("480p Wide"), gst.Fraction(40, 33)),
+ (_("480i Wide"), gst.Fraction(32, 27)),
+ (_("576p"), gst.Fraction(12, 11)),
+ (_("576i"), gst.Fraction(16, 15)),
+ (_("576p Wide"), gst.Fraction(16, 11)),
+ (_("576i Wide"), gst.Fraction(64, 45)),
+))
+
+display_aspect_ratios = model((str, object), (
+ (_("Standard (4:3)"), gst.Fraction(4, 3)),
+ (_("DV (15:11)"), gst.Fraction(15, 11)),
+ (_("DV Widescreen (16:9)"), gst.Fraction(16, 9)),
+ (_("Cinema (1.37)"), gst.Fraction(11, 8)),
+ (_("Cinema (1.66)"), gst.Fraction(166, 100)),
+ (_("Cinema (1.85)"), gst.Fraction(185, 100)),
+ (_("Anamorphic (2.35)"), gst.Fraction(235, 100)),
+ (_("Anamorphic (2.39)"), gst.Fraction(239, 100)),
+ (_("Anamorphic (2.4)"), gst.Fraction(24, 10)),
+))
+
# ---------------------- Classes ---------------------------------------------#
class Point(tuple):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]