[pitivi: 1/16] Simplified encodingdialog.beautify_factoryname()
- From: Thibault Saunier <tsaunier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi: 1/16] Simplified encodingdialog.beautify_factoryname()
- Date: Tue, 7 Jun 2011 16:26:50 +0000 (UTC)
commit db02c8c56dc9599b7ed37560a67c4b10967d0c3d
Author: Alex BÄ?luÈ? <alexandru balut gmail com>
Date: Tue May 24 11:24:52 2011 +0200
Simplified encodingdialog.beautify_factoryname()
pitivi/ui/encodingdialog.py | 27 ++++++++++++++-------------
1 files changed, 14 insertions(+), 13 deletions(-)
---
diff --git a/pitivi/ui/encodingdialog.py b/pitivi/ui/encodingdialog.py
index 3dfaab3..b7649b7 100644
--- a/pitivi/ui/encodingdialog.py
+++ b/pitivi/ui/encodingdialog.py
@@ -20,7 +20,7 @@
# Boston, MA 02110-1301, USA.
"""
-Encoding dialog
+Render dialog
"""
import os
@@ -45,20 +45,15 @@ from pitivi.ui.common import\
set_combo_value
def beautify_factoryname(factory):
+ """Returns a nice name for the specified gst.ElementFactory instance."""
# only replace lowercase versions of "format", "video", "audio"
# otherwise they might be part of a trademark name
- words = ["Muxer", "muxer", "Encoder", "encoder",
+ words_to_remove = ["Muxer", "muxer", "Encoder", "encoder",
"format", "video", "audio", "instead"]
name = factory.get_longname()
- for word in words:
+ for word in words_to_remove:
name = name.replace(word, "")
- parts = name.split(" ")
- ret = " ".join(p.strip() for p in parts).strip()
-
- return ret
-
-def filter_recommended(muxers):
- return [m for m in muxers if m.get_rank() > 0]
+ return " ".join(word for word in name.split())
def extension_for_muxer(muxer):
"""Returns the file extension appropriate for the specified muxer."""
@@ -93,11 +88,15 @@ def extension_for_muxer(muxer):
return exts.get(muxer)
def factorylist(factories):
- """ Given a sequence of factories, returns a gtk.ListStore()
- of sorted, beautified factory names """
+ """Create a gtk.ListStore() of sorted, beautified factory names.
+
+ @param factories: The factories available for creating the list.
+ @type factories: A sequence of gst.ElementFactory instances.
+ """
columns = (str, object)
data = [(beautify_factoryname(factory), factory)
- for factory in filter_recommended(factories)]
+ for factory in factories
+ if factory.get_rank() > 0]
data.sort(key=lambda x: x[0])
return model(columns, data)
@@ -197,6 +196,7 @@ class EncodingDialog(Renderer, Loggable):
self.fileentry.set_text(name)
def _muxerComboChangedCb(self, muxer_combo):
+ """Handle the changing of the container format combobox."""
muxer = get_combo_value(muxer_combo).get_name()
self.settings.setEncoders(muxer=muxer)
@@ -254,6 +254,7 @@ class EncodingDialog(Renderer, Loggable):
dialog.window.run()
def _projectSettingsDestroyCb(self, dialog):
+ """Handle the destruction of the ProjectSettingsDialog."""
self._displaySettings()
def _frameRateComboChangedCb(self, combo):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]