[pitivi] Provide a custom UI for frei0r-filter-alphaspot
- From: Alexandru Băluț <alexbalut src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] Provide a custom UI for frei0r-filter-alphaspot
- Date: Wed, 11 Oct 2017 22:16:56 +0000 (UTC)
commit 4787953fd10be0d14a431f00c21af6210b846b1d
Author: Michał Górny <mgorny gentoo org>
Date: Fri Sep 29 17:57:10 2017 +0200
Provide a custom UI for frei0r-filter-alphaspot
data/ui/customwidgets/frei0r-filter-alphaspot.ui | 618 ++++++++++++++++++++++
pitivi/utils/custom_effect_widgets.py | 132 +++++
2 files changed, 750 insertions(+), 0 deletions(-)
---
diff --git a/data/ui/customwidgets/frei0r-filter-alphaspot.ui
b/data/ui/customwidgets/frei0r-filter-alphaspot.ui
new file mode 100644
index 0000000..9814a25
--- /dev/null
+++ b/data/ui/customwidgets/frei0r-filter-alphaspot.ui
@@ -0,0 +1,618 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.20.0 -->
+<interface>
+ <requires lib="gtk+" version="3.0"/>
+ <object class="GtkAdjustment" id="adjustment_max">
+ <property name="upper">1</property>
+ <property name="value">1</property>
+ <property name="step_increment">0.01</property>
+ <property name="page_increment">0.10000000000000001</property>
+ </object>
+ <object class="GtkAdjustment" id="adjustment_min">
+ <property name="upper">1</property>
+ <property name="step_increment">0.01</property>
+ <property name="page_increment">0.10000000000000001</property>
+ </object>
+ <object class="GtkAdjustment" id="adjustment_position-x">
+ <property name="upper">1</property>
+ <property name="value">0.5</property>
+ <property name="step_increment">0.01</property>
+ <property name="page_increment">0.10000000000000001</property>
+ </object>
+ <object class="GtkAdjustment" id="adjustment_position-y">
+ <property name="upper">1</property>
+ <property name="value">0.5</property>
+ <property name="step_increment">0.01</property>
+ <property name="page_increment">0.10000000000000001</property>
+ </object>
+ <object class="GtkAdjustment" id="adjustment_size-x">
+ <property name="lower">0.01</property>
+ <property name="upper">1</property>
+ <property name="value">0.10000000000000001</property>
+ <property name="step_increment">0.01</property>
+ <property name="page_increment">0.10000000000000001</property>
+ </object>
+ <object class="GtkAdjustment" id="adjustment_size-y">
+ <property name="lower">0.01</property>
+ <property name="upper">1</property>
+ <property name="value">0.10000000000000001</property>
+ <property name="step_increment">0.01</property>
+ <property name="page_increment">0.10000000000000001</property>
+ </object>
+ <object class="GtkAdjustment" id="adjustment_tilt">
+ <property name="upper">1</property>
+ <property name="step_increment">0.01</property>
+ <property name="page_increment">0.10000000000000001</property>
+ </object>
+ <object class="GtkAdjustment" id="adjustment_transition-width">
+ <property name="upper">1</property>
+ <property name="value">0.20000000000000001</property>
+ <property name="step_increment">0.01</property>
+ <property name="page_increment">0.10000000000000001</property>
+ </object>
+ <object class="GtkImage" id="image1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">edit-clear-all-symbolic</property>
+ </object>
+ <object class="GtkImage" id="image10">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">edit-clear-all-symbolic</property>
+ </object>
+ <object class="GtkImage" id="image2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">edit-clear-all-symbolic</property>
+ </object>
+ <object class="GtkImage" id="image3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">edit-clear-all-symbolic</property>
+ </object>
+ <object class="GtkImage" id="image4">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">edit-clear-all-symbolic</property>
+ </object>
+ <object class="GtkImage" id="image6">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">edit-clear-all-symbolic</property>
+ </object>
+ <object class="GtkImage" id="image7">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">edit-clear-all-symbolic</property>
+ </object>
+ <object class="GtkImage" id="image9">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">edit-clear-all-symbolic</property>
+ </object>
+ <object class="GtkGrid" id="base_table">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="border_width">12</property>
+ <property name="row_spacing">8</property>
+ <property name="column_spacing">6</property>
+ <child>
+ <object class="GtkButton" id="frei0r-filter-alphaspot::position-x::reset">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="image">image1</property>
+ <property name="relief">none</property>
+ <property name="image_position">top</property>
+ </object>
+ <packing>
+ <property name="left_attach">4</property>
+ <property name="top_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="frei0r-filter-alphaspot::position-y::reset">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="image">image2</property>
+ <property name="relief">none</property>
+ <property name="image_position">top</property>
+ </object>
+ <packing>
+ <property name="left_attach">4</property>
+ <property name="top_attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="frei0r-filter-alphaspot::size-x::reset">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="image">image3</property>
+ <property name="relief">none</property>
+ <property name="image_position">top</property>
+ </object>
+ <packing>
+ <property name="left_attach">4</property>
+ <property name="top_attach">5</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="frei0r-filter-alphaspot::size-y::reset">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="image">image4</property>
+ <property name="relief">none</property>
+ <property name="image_position">top</property>
+ </object>
+ <packing>
+ <property name="left_attach">4</property>
+ <property name="top_attach">6</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkScale" id="frei0r-filter-alphaspot::position-x">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="adjustment">adjustment_position-x</property>
+ <property name="restrict_to_fill_level">False</property>
+ <property name="fill_level">1</property>
+ <property name="round_digits">2</property>
+ <property name="digits">2</property>
+ <property name="value_pos">left</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">3</property>
+ <property name="width">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkScale" id="frei0r-filter-alphaspot::position-y">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="adjustment">adjustment_position-y</property>
+ <property name="restrict_to_fill_level">False</property>
+ <property name="fill_level">1</property>
+ <property name="round_digits">2</property>
+ <property name="digits">2</property>
+ <property name="value_pos">left</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">4</property>
+ <property name="width">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkScale" id="frei0r-filter-alphaspot::size-x">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="adjustment">adjustment_size-x</property>
+ <property name="restrict_to_fill_level">False</property>
+ <property name="fill_level">1</property>
+ <property name="round_digits">2</property>
+ <property name="digits">2</property>
+ <property name="value_pos">left</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">5</property>
+ <property name="width">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkScale" id="frei0r-filter-alphaspot::size-y">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="adjustment">adjustment_size-y</property>
+ <property name="restrict_to_fill_level">False</property>
+ <property name="fill_level">1</property>
+ <property name="round_digits">2</property>
+ <property name="digits">2</property>
+ <property name="value_pos">left</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">6</property>
+ <property name="width">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToggleButton" id="frei0r-filter-alphaspot::position-x::keyframe">
+ <property name="label" translatable="yes">◇</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="relief">none</property>
+ <property name="image_position">top</property>
+ </object>
+ <packing>
+ <property name="left_attach">3</property>
+ <property name="top_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToggleButton" id="frei0r-filter-alphaspot::position-y::keyframe">
+ <property name="label" translatable="yes">◇</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="relief">none</property>
+ </object>
+ <packing>
+ <property name="left_attach">3</property>
+ <property name="top_attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToggleButton" id="frei0r-filter-alphaspot::size-x::keyframe">
+ <property name="label" translatable="yes">◇</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="relief">none</property>
+ </object>
+ <packing>
+ <property name="left_attach">3</property>
+ <property name="top_attach">5</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToggleButton" id="frei0r-filter-alphaspot::size-y::keyframe">
+ <property name="label" translatable="yes">◇</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="relief">none</property>
+ </object>
+ <packing>
+ <property name="left_attach">3</property>
+ <property name="top_attach">6</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSeparator" id="separator2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="margin_right">328</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">2</property>
+ <property name="width">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="frei0r-filter-alphaspot::shape">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="width">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Shape:</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">x</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">y</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">width</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">5</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">height</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">6</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Operation:</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBox" id="frei0r-filter-alphaspot::operation">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="width">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">tilt</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">7</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">trans. width</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">8</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">min alpha</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">9</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">max alpha</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">10</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkScale" id="frei0r-filter-alphaspot::tilt">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="adjustment">adjustment_tilt</property>
+ <property name="restrict_to_fill_level">False</property>
+ <property name="fill_level">1</property>
+ <property name="round_digits">2</property>
+ <property name="digits">2</property>
+ <property name="value_pos">left</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">7</property>
+ <property name="width">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkScale" id="frei0r-filter-alphaspot::transition-width">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="adjustment">adjustment_transition-width</property>
+ <property name="restrict_to_fill_level">False</property>
+ <property name="fill_level">1</property>
+ <property name="round_digits">2</property>
+ <property name="digits">2</property>
+ <property name="value_pos">left</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">8</property>
+ <property name="width">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkScale" id="frei0r-filter-alphaspot::min">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="adjustment">adjustment_min</property>
+ <property name="restrict_to_fill_level">False</property>
+ <property name="fill_level">1</property>
+ <property name="round_digits">2</property>
+ <property name="digits">2</property>
+ <property name="value_pos">left</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">9</property>
+ <property name="width">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkScale" id="frei0r-filter-alphaspot::max">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="adjustment">adjustment_max</property>
+ <property name="restrict_to_fill_level">False</property>
+ <property name="fill_level">1</property>
+ <property name="round_digits">2</property>
+ <property name="digits">2</property>
+ <property name="value_pos">left</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">10</property>
+ <property name="width">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToggleButton" id="frei0r-filter-alphaspot::transition-width::keyframe">
+ <property name="label" translatable="yes">◇</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="relief">none</property>
+ </object>
+ <packing>
+ <property name="left_attach">3</property>
+ <property name="top_attach">8</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToggleButton" id="frei0r-filter-alphaspot::tilt::keyframe">
+ <property name="label" translatable="yes">◇</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="relief">none</property>
+ </object>
+ <packing>
+ <property name="left_attach">3</property>
+ <property name="top_attach">7</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToggleButton" id="frei0r-filter-alphaspot::min::keyframe">
+ <property name="label" translatable="yes">◇</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="relief">none</property>
+ </object>
+ <packing>
+ <property name="left_attach">3</property>
+ <property name="top_attach">9</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToggleButton" id="frei0r-filter-alphaspot::max::keyframe">
+ <property name="label" translatable="yes">◇</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="relief">none</property>
+ </object>
+ <packing>
+ <property name="left_attach">3</property>
+ <property name="top_attach">10</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="frei0r-filter-alphaspot::tilt::reset">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="image">image6</property>
+ <property name="relief">none</property>
+ <property name="image_position">top</property>
+ </object>
+ <packing>
+ <property name="left_attach">4</property>
+ <property name="top_attach">7</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="frei0r-filter-alphaspot::transition-width::reset">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="image">image7</property>
+ <property name="relief">none</property>
+ <property name="image_position">top</property>
+ </object>
+ <packing>
+ <property name="left_attach">4</property>
+ <property name="top_attach">8</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="frei0r-filter-alphaspot::max::reset">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="image">image9</property>
+ <property name="relief">none</property>
+ <property name="image_position">top</property>
+ </object>
+ <packing>
+ <property name="left_attach">4</property>
+ <property name="top_attach">10</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="frei0r-filter-alphaspot::min::reset">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="image">image10</property>
+ <property name="relief">none</property>
+ <property name="image_position">top</property>
+ </object>
+ <packing>
+ <property name="left_attach">4</property>
+ <property name="top_attach">9</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+</interface>
diff --git a/pitivi/utils/custom_effect_widgets.py b/pitivi/utils/custom_effect_widgets.py
index 50801ea..7a8286a 100644
--- a/pitivi/utils/custom_effect_widgets.py
+++ b/pitivi/utils/custom_effect_widgets.py
@@ -26,6 +26,7 @@ from gi.repository import Gtk
from pitivi import configure
from pitivi.utils.loggable import Loggable
+from pitivi.utils.ui import model
from pitivi.utils.widgets import ColorPickerButton
@@ -53,6 +54,8 @@ def create_custom_prop_widget_cb(unused_effect_prop_manager, effect_widget, effe
effect_name = effect.get_property("bin-description")
if effect_name == "alpha":
return create_custom_alpha_prop_widget(effect_widget, effect, prop, prop_value)
+ elif effect_name == "frei0r-filter-alphaspot":
+ return create_custom_alphaspot_prop_widget(effect_widget, effect, prop, prop_value)
def create_custom_widget_cb(effect_prop_manager, effect_widget, effect):
@@ -67,6 +70,9 @@ def create_custom_widget_cb(effect_prop_manager, effect_widget, effect):
elif effect_name == "frei0r-filter-3-point-color-balance":
widget = create_3point_color_balance_widget(effect_prop_manager, effect_widget, effect)
return widget
+ elif effect_name == "frei0r-filter-alphaspot":
+ widget = create_alphaspot_widget(effect_prop_manager, effect_widget, effect)
+ return widget
# Check if there is a UI file available as a glade file
# Assuming a GtkGrid called base_table exists
@@ -339,3 +345,129 @@ def create_3point_color_balance_widget(effect_prop_manager, element_setting_widg
highlights_wheel.set_color(0, 0, 1)
return color_balance_grid
+
+
+def create_alphaspot_widget(effect_prop_manager, element_setting_widget, element):
+ """Creates the UI for the `alpha` effect."""
+ builder = setup_from_ui_file(element_setting_widget, os.path.join(CUSTOM_WIDGETS_DIR,
"frei0r-filter-alphaspot.ui"))
+
+ # Shape picker
+
+ shape_picker = builder.get_object("frei0r-filter-alphaspot::shape")
+ shape_list = model((str, float), [
+ # ouch...
+ ("rectangle", 0.0),
+ ("ellipse", 0.26),
+ ("triangle", 0.51),
+ ("diamond shape", 0.76),
+ ])
+ shape_picker.set_model(shape_list)
+ shape_text_renderer = Gtk.CellRendererText()
+ shape_picker.pack_start(shape_text_renderer, 0)
+ shape_picker.add_attribute(shape_text_renderer, "text", 0)
+
+ def get_current_shape():
+ """Gets the shape index used by the effect."""
+ res, flid = element.get_child_property("shape")
+ assert res
+ for index, vals in reversed(list(enumerate(shape_list))):
+ if flid >= vals[1]:
+ return index
+ assert False
+
+ shape_picker.set_active(get_current_shape())
+
+ def shape_picker_value_changed_cb(unused):
+ """Handles the selection of shape via combobox."""
+ v = shape_list[shape_picker.get_active()][1]
+
+ from pitivi.undo.timeline import CommitTimelineFinalizingAction
+ pipeline = effect_prop_manager.app.project_manager.current_project.pipeline
+ action_log = effect_prop_manager.app.action_log
+ with action_log.started("Effect property change",
+ finalizing_action=CommitTimelineFinalizingAction(pipeline),
+ toplevel=True):
+ element.set_child_property("shape", v)
+
+ shape_picker.connect("changed", shape_picker_value_changed_cb)
+
+ # Operation picker
+
+ op_picker = builder.get_object("frei0r-filter-alphaspot::operation")
+ op_list = model((str, float), [
+ # ouch...
+ ("write on clear", 0.0),
+ ("max", 0.21),
+ ("min", 0.41),
+ ("add", 0.61),
+ ("subtract", 0.81),
+ ])
+ op_picker.set_model(op_list)
+ op_text_renderer = Gtk.CellRendererText()
+ op_picker.pack_start(op_text_renderer, 0)
+ op_picker.add_attribute(op_text_renderer, "text", 0)
+
+ def get_current_op():
+ """Gets the op index used by the effect."""
+ res, flid = element.get_child_property("operation")
+ assert res
+ for index, vals in reversed(list(enumerate(op_list))):
+ if flid >= vals[1]:
+ return index
+ assert False
+
+ op_picker.set_active(get_current_op())
+
+ def op_picker_value_changed_cb(unused):
+ """Handles the selection of op via combobox."""
+ v = op_list[op_picker.get_active()][1]
+
+ from pitivi.undo.timeline import CommitTimelineFinalizingAction
+ pipeline = effect_prop_manager.app.project_manager.current_project.pipeline
+ action_log = effect_prop_manager.app.action_log
+ with action_log.started("Effect property change",
+ finalizing_action=CommitTimelineFinalizingAction(pipeline),
+ toplevel=True):
+ element.set_child_property("operation", v)
+
+ op_picker.connect("changed", op_picker_value_changed_cb)
+
+ def property_changed_cb(unused_effect, gst_element, pspec):
+ """Handles the change of a GObject property."""
+ if gst_element.get_control_binding(pspec.name):
+ Loggable().log("%s controlled, not displaying value", pspec.name)
+ return
+
+ widget = element_setting_widget.properties.get(pspec)
+ if not widget:
+ return
+
+ res, value = element_setting_widget.element.get_child_property(pspec.name)
+ assert res
+
+ if pspec.name in ("shape",):
+ shape_picker.set_active(get_current_shape())
+ widget.block_signals()
+ try:
+ widget.setWidgetValue(value)
+ finally:
+ widget.unblock_signals()
+ elif pspec.name in ("operation",):
+ op_picker.set_active(get_current_op())
+ widget.block_signals()
+ try:
+ widget.setWidgetValue(value)
+ finally:
+ widget.unblock_signals()
+ else:
+ widget.setWidgetValue(value)
+
+ element.connect("deep-notify", property_changed_cb)
+
+ return builder.get_object("base_table")
+
+
+def create_custom_alphaspot_prop_widget(unused_element_setting_widget, unused_element, unused_prop,
unused_prop_value):
+ """Not implemented yet."""
+ # In the auto-generated UI, replace a property widget with a custom one
+ return None
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]