212
212
def getAllAudioEffects(self):
214
@returns: the list off available audio effects elements
214
@return: the list of available audio effects elements
216
216
return self.audio_effects
218
218
def getAllVideoEffects(self):
220
@returns: the list off available video effects elements
220
@return: the list of available video effects elements
222
222
return self.video_effects
227
227
def getFactoryFromName(self, name):
229
@ivar name: Factory name.
229
@param name: Factory name.
230
230
@type name: C{str}
231
@returns: The l{Effect} corresponding to the name
232
@raises: KeyError if the name doesn't exist
231
@return: The l{Effect} corresponding to the name or None
234
233
return self._effect_factories_dict.get(name)
236
235
def _getEffectDescripton(self, element_factory):
238
@ivar element_factory: The element factory
237
@param element_factory: The element factory
239
238
@type element_factory: L{Gst.ElementFactory}
240
@returns: A human description C{str} for the effect
239
@return: A human description C{str} for the effect
242
241
return element_factory.get_description()
244
243
def _getEffectCategories(self, effect_name):
246
@ivar effect_name: the name of the effect for wich we want the category
245
@param effect_name: the name of the effect for wich we want the category
247
246
@type effect_name: L{str}
248
@returns: A C{list} of name C{str} of categories corresponding the effect
247
@return: A C{list} of name C{str} of categories corresponding the effect
275
274
def _getEffectName(self, element_factory):
277
@ivar element_factory: The element factory
276
@param element_factory: The element factory
278
277
@type element_factory: L{Gst.ElementFactory}
279
@returns: A human readable name C{str} for the effect
278
@return: A human readable name C{str} for the effect
281
280
#TODO check if it is the good way to make it translatable
282
281
#And to filter actually!
290
289
def getVideoCategories(self, aware=True):
292
@ivar aware: C{True} if you want it to return only categories on which
293
there are effects on the system, else C{False}
291
@param aware: C{True} if you want it to return only categories on which
292
there are effects on the system, else C{False}
294
293
@type aware: C{bool}
295
@returns: All video effect categories names C{str} that are available
296
on the system if it has been filled earlier, if it hasen't it will
297
just return all categories
294
@return: All video effect categories names C{str} that are available
295
on the system if it has been filled earlier, if it hasen't it will
296
just return all categories
299
298
if not self._video_categories or not aware:
300
299
for categorie in self._video_categories_effects[1:]:
311
310
def getAudioCategories(self, aware=True):
313
@ivar aware: C{True} if you want it to return only categories on
314
whichs there are effects on the system, else C{False}
312
@param aware: C{True} if you want it to return only categories on
313
which there are effects on the system, else C{False}
315
314
@type aware: C{bool}
316
@returns: All audio effect categories names C{str}
315
@return: All audio effect categories names C{str}
318
317
if not self._audio_categories or not aware:
319
318
for categorie in self._audio_categories_effects[1:]:
371
370
class EffectListWidget(Gtk.VBox, Loggable):
372
371
""" Widget for listing effects """
374
def __init__(self, instance, uiman):
373
def __init__(self, instance, unused_uiman):
375
374
Gtk.VBox.__init__(self)
376
375
Loggable.__init__(self)
384
383
builder.add_from_file(os.path.join(get_ui_dir(), "effectslibrary.ui"))
385
384
builder.connect_signals(self)
386
385
toolbar = builder.get_object("effectslibrary_toolbar")
387
toolbar.get_style_context().add_class("inline-toolbar")
386
toolbar.get_style_context().add_class(Gtk.STYLE_CLASS_INLINE_TOOLBAR)
388
387
self.video_togglebutton = builder.get_object("video_togglebutton")
389
388
self.audio_togglebutton = builder.get_object("audio_togglebutton")
390
389
self.categoriesWidget = builder.get_object("categories")
394
393
self.storemodel = Gtk.ListStore(str, str, int, object, object, str, GdkPixbuf.Pixbuf)
396
self.view = Gtk.TreeView(self.storemodel)
395
self.view = Gtk.TreeView(model=self.storemodel)
397
396
self.view.props.headers_visible = False
398
397
self.view.get_selection().set_mode(Gtk.SelectionMode.SINGLE)
457
456
toolbar.show_all()
460
def view_description_cell_data_func(column, cell, model, iter_, data):
459
def view_description_cell_data_func(unused_column, cell, model, iter_, unused_data):
462
460
name, desc = model.get(iter_, COL_NAME_TEXT, COL_DESC_TEXT)
463
461
escape = GLib.markup_escape_text
464
462
cell.props.markup = "<b>%s</b>\n%s" % (escape(name),
510
508
Gtk.drag_set_icon_pixbuf(context, pixbuf, 0, 0)
512
def _dndDragEndCb(self, unused_view, context):
510
def _dndDragEndCb(self, unused_view, unused_context):
513
511
self.info("Drag operation ended")
515
def _dndDragDataGetCb(self, unused_view, context, data, info, timestamp):
513
def _dndDragDataGetCb(self, unused_view, unused_context, data, unused_info, unused_timestamp):
516
514
data.set_uris([self.getSelectedItems()])
518
516
def _rowUnderMouseSelected(self, view, event):
524
522
selection.count_selected_rows() > 0
527
def _enterPressEventCb(self, view, event=None):
525
def _enterPressEventCb(self, unused_view, unused_event=None):
528
526
factory_name = self.getSelectedItems()
529
527
if factory_name is not None:
530
528
self.app.gui.clipconfig.effect_expander.addEffectToCurrentSelection(factory_name)
576
574
self.populate_categories_widget()
577
575
self.modelFilter.refilter()
579
def _categoryChangedCb(self, combobox):
577
def _categoryChangedCb(self, unused_combobox):
580
578
self.modelFilter.refilter()
582
def _searchEntryChangedCb(self, entry):
580
def _searchEntryChangedCb(self, unused_entry):
583
581
self.modelFilter.refilter()
585
583
def _searchEntryIconClickedCb(self, entry, unused, unused1):
586
584
entry.set_text("")
588
def _setRowVisible(self, model, iter, data):
586
def _setRowVisible(self, model, iter, unused_data):
589
587
if self._effectType == model.get_value(iter, COL_EFFECT_TYPE):
590
588
if model.get_value(iter, COL_EFFECT_CATEGORIES) is None:
619
617
self.app = instance
621
619
def getEffectConfigurationUI(self, effect):
623
Permit to get a configuration GUI for the effect
624
@param effect: The effect for which we want the configuration UI
625
@type effect: C{Gst.Element}
620
"""Permit to get a configuration GUI for the effect
622
@param effect: The effect for which we want the configuration UI
623
@type effect: C{Gst.Element}
628
625
if effect not in self.cache_dict:
629
#Here we should handle special effects configuration UI
630
effect_set_ui = GstElementSettingsWidget()
631
effect_set_ui.setElement(effect, ignore=PROPS_TO_IGNORE,
632
default_btn=True, use_element_props=True)
633
nb_rows = effect_set_ui.get_children()[0].get_property('n-rows')
634
effect_configuration_ui = Gtk.ScrolledWindow()
635
effect_configuration_ui.add_with_viewport(effect_set_ui)
636
effect_configuration_ui.set_policy(Gtk.PolicyType.AUTOMATIC,
637
Gtk.PolicyType.AUTOMATIC)
638
self.cache_dict[effect] = effect_configuration_ui
639
self._connectAllWidgetCbs(effect_set_ui, effect)
640
self._postConfiguration(effect, effect_set_ui)
642
effect_set_ui = self._getUiToSetEffect(effect)
644
self._current_effect_setting_ui = effect_set_ui
626
# Here we should handle special effects configuration UI
627
effect_settings_widget = GstElementSettingsWidget()
628
effect_settings_widget.setElement(effect, ignore=PROPS_TO_IGNORE,
629
default_btn=True, use_element_props=True)
630
scrolled_window = Gtk.ScrolledWindow()
631
scrolled_window.add_with_viewport(effect_settings_widget)
632
scrolled_window.set_policy(Gtk.PolicyType.AUTOMATIC,
633
Gtk.PolicyType.AUTOMATIC)
634
self.cache_dict[effect] = scrolled_window
635
self._connectAllWidgetCallbacks(effect_settings_widget, effect)
636
self._postConfiguration(effect, effect_settings_widget)
638
self._current_effect_setting_ui = self._getUiToSetEffect(effect)
645
639
element = self._current_effect_setting_ui.element
646
640
for prop in element.list_children_properties():
647
641
self._current_element_values[prop.name] = element.get_child_property(prop.name)
666
660
effect_set_ui = self.cache_dict[effect].get_children()[0].get_children()[0]
668
662
effect_set_ui = self.cache_dict[effect]
670
663
return effect_set_ui
672
def _connectAllWidgetCbs(self, effect_configuration_ui, effect):
673
for prop, widget in effect_configuration_ui.properties.iteritems():
665
def _connectAllWidgetCallbacks(self, effect_settings_widget, unused_effect):
666
for prop, widget in effect_settings_widget.properties.iteritems():
674
667
widget.connectValueChanged(self._onValueChangedCb, widget, prop)
676
def _onSetDefaultCb(self, widget, dynamic):
669
def _onSetDefaultCb(self, unused_widget, dynamic):
677
670
dynamic.setWidgetToDefault()
679
def _onValueChangedCb(self, widget, dynamic, prop):
672
def _onValueChangedCb(self, unused_widget, dynamic, prop):
680
673
value = dynamic.getWidgetValue()
682
675
#FIXME Workaround in order to make aspectratiocrop working