Commit 357a8edc authored by Vibhanshu Vaibhav's avatar Vibhanshu Vaibhav Committed by Alexandru Băluț

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.

GNOME/pitivi#2126
parent 3ef7482e
Pipeline #6010 passed with stage
in 12 minutes and 10 seconds
......@@ -128,6 +128,14 @@ class EffectProperties(Gtk.Expander, Loggable):
setup_custom_effect_widgets(self.effects_properties_manager)
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)
......@@ -212,6 +220,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)
......@@ -221,7 +230,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()
......@@ -482,6 +494,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):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment