[pitivi/1.0] clipproperties: Show infobar when clip has no effects



commit d090088d2fdcd032ee319ea5a969b4f280619cdf
Author: Vibhanshu Vaibhav <ayush vibhanshu gmail com>
Date:   Tue Mar 6 11:02:44 2018 +0530

    clipproperties: Show infobar when clip has no effects
    
    Currently, the effects section of a clip shows nothing if the clip
    has no effects added to it.
    
    To handle this, an infobar has been added to the effects section
    which is visible when a clip has no effects.
    
    https://gitlab.gnome.org/GNOME/pitivi/issues/2126

 pitivi/clipproperties.py | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
---
diff --git a/pitivi/clipproperties.py b/pitivi/clipproperties.py
index 7e22dc11..0a27df65 100644
--- a/pitivi/clipproperties.py
+++ b/pitivi/clipproperties.py
@@ -123,6 +123,14 @@ class EffectProperties(Gtk.Expander, Loggable):
         self.effects_properties_manager = EffectsPropertiesManager(app)
         self.clip_properties = clip_properties
 
+        no_effect_label = Gtk.Label(
+            _("To apply an effect to the clip, drag it from the Effect Library."))
+        no_effect_label.set_line_wrap(True)
+        self.no_effect_infobar = Gtk.InfoBar()
+        fix_infobar(self.no_effect_infobar)
+        self.no_effect_infobar.props.message_type = Gtk.MessageType.OTHER
+        self.no_effect_infobar.get_content_area().add(no_effect_label)
+
         # The toolbar that will go between the list of effects and properties
         buttons_box = Gtk.ButtonBox()
         buttons_box.set_halign(Gtk.Align.END)
@@ -207,6 +215,7 @@ class EffectProperties(Gtk.Expander, Loggable):
         self._infobar.show_all()
 
         # Prepare the main container widgets and lay out everything
+        self._expander_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
         self._vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
         self._vbox.pack_start(self.treeview, expand=False, fill=False, padding=0)
         self._vbox.pack_start(buttons_box, expand=False, fill=False, padding=0)
@@ -216,7 +225,10 @@ class EffectProperties(Gtk.Expander, Loggable):
         separator.set_margin_right(SPACING)
         self._vbox.pack_start(separator, expand=False, fill=False, padding=0)
         self._vbox.show_all()
-        self.add(self._vbox)
+        self._expander_box.pack_start(self.no_effect_infobar, expand=False, fill=False, padding=0)
+        self._expander_box.pack_start(self._vbox, expand=False, fill=False, padding=0)
+        self._expander_box.show_all()
+        self.add(self._expander_box)
         self.hide()
 
         effects_actions_group = Gio.SimpleActionGroup()
@@ -477,6 +489,7 @@ class EffectProperties(Gtk.Expander, Loggable):
             to_append.append(effect_info.description)
             to_append.append(effect)
             self.storemodel.append(to_append)
+        self.no_effect_infobar.set_visible(len(self.storemodel) == 0)
         self._vbox.set_visible(len(self.storemodel) > 0)
 
     def _treeviewSelectionChangedCb(self, unused_treeview):


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]