[pitivi] effects: Display the human names in the list of effects of a clip
- From: Thibault Saunier <tsaunier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] effects: Display the human names in the list of effects of a clip
- Date: Wed, 24 Sep 2014 17:07:22 +0000 (UTC)
commit d9e89f8cb105076e2f52169b90f9abd17caa0a44
Author: Alexandru Băluț <alexandru balut gmail com>
Date: Tue May 20 22:45:30 2014 +0200
effects: Display the human names in the list of effects of a clip
To be consistent with how we display the effect factories in the
Effect Library.
pitivi/application.py | 5 ++-
pitivi/clipproperties.py | 40 +++++++++++++++++--------------
pitivi/effects.py | 57 +++++++++++++++++----------------------------
3 files changed, 47 insertions(+), 55 deletions(-)
---
diff --git a/pitivi/application.py b/pitivi/application.py
index a2d9863..a09b4fd 100644
--- a/pitivi/application.py
+++ b/pitivi/application.py
@@ -28,7 +28,7 @@ from gi.repository import GdkX11
from gi.repository import Gio
from gi.repository import Gtk
-from pitivi.effects import EffectsHandler
+from pitivi.effects import EffectsManager
from pitivi.configure import VERSION, RELEASES_URL
from pitivi.settings import GlobalSettings
from pitivi.utils.threads import ThreadMaster
@@ -48,6 +48,7 @@ class Pitivi(Gtk.Application, Loggable):
"""
Pitivi's application.
+ @type effects: L{EffectsManager}
@ivar gui: The main window of the app.
@type gui: L{PitiviMainWindow}
@ivar project_manager: The project manager object used in the application
@@ -96,7 +97,7 @@ class Pitivi(Gtk.Application, Loggable):
self.info('starting up')
self.settings = GlobalSettings()
self.threads = ThreadMaster()
- self.effects = EffectsHandler()
+ self.effects = EffectsManager()
self.system = getSystem()
self.action_log.connect("commit", self._actionLogCommit)
diff --git a/pitivi/clipproperties.py b/pitivi/clipproperties.py
index 3e9a500..f2e911c 100644
--- a/pitivi/clipproperties.py
+++ b/pitivi/clipproperties.py
@@ -42,9 +42,10 @@ from pitivi.effects import AUDIO_EFFECT, VIDEO_EFFECT, HIDDEN_EFFECTS, \
(COL_ACTIVATED,
COL_TYPE,
+ COL_BIN_DESCRIPTION_TEXT,
COL_NAME_TEXT,
COL_DESC_TEXT,
- COL_TRACK_EFFECT) = list(range(5))
+ COL_TRACK_EFFECT) = list(range(6))
class ClipPropertiesError(Exception):
@@ -178,7 +179,7 @@ class EffectProperties(Gtk.Expander, Loggable):
Gtk.PolicyType.AUTOMATIC)
self.treeview_scrollwin.set_shadow_type(Gtk.ShadowType.ETCHED_IN)
- self.storemodel = Gtk.ListStore(bool, str, str, str, object)
+ self.storemodel = Gtk.ListStore(bool, str, str, str, str, object)
self.treeview = Gtk.TreeView(model=self.storemodel)
self.treeview_scrollwin.add(self.treeview)
self.treeview.set_property("has_tooltip", True)
@@ -375,7 +376,9 @@ class EffectProperties(Gtk.Expander, Loggable):
return False
view.set_tooltip_row(tooltip, path)
- tooltip.set_text(self.storemodel.get_value(tree_iter, COL_DESC_TEXT))
+ description = self.storemodel.get_value(tree_iter, COL_DESC_TEXT)
+ bin_description = self.storemodel.get_value(tree_iter, COL_BIN_DESCRIPTION_TEXT)
+ tooltip.set_text("%s\n%s" % (bin_description, description))
return True
def updateAll(self):
@@ -397,21 +400,22 @@ class EffectProperties(Gtk.Expander, Loggable):
obj = self.clips[0]
for effect in obj.get_top_effects():
- if effect.props.bin_description not in HIDDEN_EFFECTS:
- asset = self.app.effects.getFactoryFromName(
- effect.props.bin_description)
- to_append = [effect.props.active]
- track_type = effect.get_track_type()
- if track_type == GES.TrackType.AUDIO:
- to_append.append("Audio")
- elif track_type == GES.TrackType.VIDEO:
- to_append.append("Video")
-
- to_append.append(effect.props.bin_description)
- to_append.append(asset.description)
- to_append.append(effect)
-
- self.storemodel.append(to_append)
+ if effect.props.bin_description in HIDDEN_EFFECTS:
+ continue
+ asset = self.app.effects.getFactoryFromName(
+ effect.props.bin_description)
+ to_append = [effect.props.active]
+ track_type = effect.get_track_type()
+ if track_type == GES.TrackType.AUDIO:
+ to_append.append("Audio")
+ elif track_type == GES.TrackType.VIDEO:
+ to_append.append("Video")
+ to_append.append(effect.props.bin_description)
+ effect_factory = self.app.effects.getFactoryFromName(effect.props.bin_description)
+ to_append.append(effect_factory.human_name)
+ to_append.append(asset.description)
+ to_append.append(effect)
+ self.storemodel.append(to_append)
def _setEffectDragable(self):
self.show()
diff --git a/pitivi/effects.py b/pitivi/effects.py
index 74ec821..cd12cd3 100644
--- a/pitivi/effects.py
+++ b/pitivi/effects.py
@@ -70,33 +70,25 @@ BLACKLISTED_PLUGINS = ["ldaspa"]
ICON_WIDTH = 48 + 2 * 6 # 48 pixels, plus a margin on each side
-class Effect():
+class EffectFactory():
"""
Factories that applies an effect on a stream
"""
- def __init__(self, effect, media_type, categories=[_("Uncategorized")],
+ def __init__(self, effect_name, media_type, categories=[_("Uncategorized")],
human_name="", description="", icon=None):
- self.effectname = effect
+ self.effec_tname = effect_name
self.media_type = media_type
self.categories = categories
self.description = description
self.human_name = human_name
self._icon = icon
- def getHumanName(self):
- return self.human_name
- def getDescription(self):
- return self.description
-
- def getCategories(self):
- return self.categories
-
-
-class EffectsHandler(object):
+class EffectsManager(object):
"""
- Handles all the effects
+ Groups effects.
"""
+
def __init__(self):
object.__init__(self)
self._pixdir = os.path.join(get_pixmap_dir(), "effects")
@@ -182,8 +174,8 @@ class EffectsHandler(object):
go trough the list of element factories and
add them to the correct list filtering if necessary
"""
- factlist = Gst.Registry.get().get_feature_list(Gst.ElementFactory)
- for element_factory in factlist:
+ factories = Gst.Registry.get().get_feature_list(Gst.ElementFactory)
+ for element_factory in factories:
klass = element_factory.get_klass()
name = element_factory.get_name()
@@ -202,10 +194,11 @@ class EffectsHandler(object):
HIDDEN_EFFECTS.append(name)
continue
- effect = Effect(name, media_type,
- self._getEffectCategories(name),
- self._getEffectName(element_factory),
- self._getEffectDescripton(element_factory))
+ effect = EffectFactory(name,
+ media_type,
+ categories=self._getEffectCategories(name),
+ human_name=self._getEffectName(element_factory),
+ description=self._getEffectDescripton(element_factory))
self._addEffectToDic(name, effect)
def getAllAudioEffects(self):
@@ -225,9 +218,9 @@ class EffectsHandler(object):
def getFactoryFromName(self, name):
"""
- @param name: Factory name.
+ @param name: The bin_description of the effect.
@type name: C{str}
- @return: The l{Effect} corresponding to the name or None
+ @return: The l{EffectFactory} corresponding to the name or None
"""
return self._effect_factories_dict.get(name)
@@ -325,14 +318,6 @@ class EffectsHandler(object):
audio_categories = property(getAudioCategories)
- def getAllCategories(self):
- """
- @return: All effect categories names C{str}
- """
- effects_categories = []
- return effects_categories.extended(self.video_categories).extended(
- self.audio_categories)
-
def getEffectIcon(self, effect_name):
effect_name = effect_name + ".png"
icon = None
@@ -470,11 +455,13 @@ class EffectListWidget(Gtk.VBox, Loggable):
for element in elements:
name = element.get_name()
if name not in HIDDEN_EFFECTS:
- effect = self.app.effects.getFactoryFromName(name)
- self.storemodel.append([effect.getHumanName(),
- effect.getDescription(), effectType,
- effect.getCategories(),
- effect, name,
+ effect_factory = self.app.effects.getFactoryFromName(name)
+ self.storemodel.append([effect_factory.human_name,
+ effect_factory.description,
+ effectType,
+ effect_factory.categories,
+ effect_factory,
+ name,
self.app.effects.getEffectIcon(name)])
self.storemodel.set_sort_column_id(COL_NAME_TEXT, Gtk.SortType.ASCENDING)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]