[pitivi] prefs: Add button to open plugin directory
- From: Alexandru Băluț <alexbalut src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] prefs: Add button to open plugin directory
- Date: Tue, 19 Mar 2019 10:52:02 +0000 (UTC)
commit d870f290815014a420bd585d1d0f17aa57f5f775
Author: Elias Entrup <elias-git flump de>
Date: Wed Mar 13 13:51:45 2019 +0100
prefs: Add button to open plugin directory
Add a button to the plugin box to open the user/sytem plugin
directory.
https://gitlab.gnome.org/GNOME/pitivi/issues/2092
pitivi/dialogs/prefs.py | 34 ++++++++++++++++++++++++++--------
pitivi/pluginmanager.py | 6 ++++++
2 files changed, 32 insertions(+), 8 deletions(-)
---
diff --git a/pitivi/dialogs/prefs.py b/pitivi/dialogs/prefs.py
index 4aced8f1..87a036ab 100644
--- a/pitivi/dialogs/prefs.py
+++ b/pitivi/dialogs/prefs.py
@@ -694,6 +694,7 @@ class PluginsBox(Gtk.ListBox):
self.bind_model(self.list_store, self._create_widget_func, None)
self.props.margin = PADDING * 3
+ self.props.margin_top = 0
# Activate the plugins' switches for plugins that are already loaded.
loaded_plugins = self.app.plugin_manager.engine.get_loaded_plugins()
@@ -755,26 +756,43 @@ class PluginsBox(Gtk.ListBox):
else:
previous_type = None
if previous_type != current_type:
- self._set_header(row, str(current_type))
+ self._set_header(row, current_type)
- def _set_header(self, row, group_title):
+ def _set_header(self, row, group):
+ group_title = str(group)
header = Gtk.Label()
header.set_use_markup(True)
header.set_markup("<b>%s</b>" % group_title)
- header.props.margin_top = PADDING * 3
- header.props.margin_bottom = PADDING
- header.props.margin_left = PADDING * 2
- header.props.margin_right = PADDING * 2
- header.props.xalign = 0
+ header.props.valign = Gtk.Align.CENTER
+ header.props.halign = Gtk.Align.START
alter_style_class("group_title", header, "font-size: small;")
header.get_style_context().add_class("group_title")
+
+ button = Gtk.Button.new()
+ button.props.valign = Gtk.Align.CENTER
+ button.props.relief = Gtk.ReliefStyle.NONE
+ button.add(Gtk.Image.new_from_icon_name("folder-open-symbolic", 1))
+ button.connect("clicked", self.__location_clicked_cb, group.get_dir())
+
+ inner_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
+ inner_box.set_halign(Gtk.Align.FILL)
+ inner_box.props.margin_top = PADDING * 3
+ inner_box.props.margin_bottom = PADDING
+ inner_box.props.margin_right = PADDING * 2
+ inner_box.pack_start(header, True, True, 0)
+ inner_box.pack_start(button, False, False, 0)
+
box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
- box.add(header)
+ box.add(inner_box)
box.get_style_context().add_class("background")
box.show_all()
row.set_header(box)
+ def __location_clicked_cb(self, unused_button, directory):
+ uri = GLib.filename_to_uri(directory, None)
+ Gio.AppInfo.launch_default_for_uri(uri, None)
+
class PluginPreferencesPage(Gtk.ScrolledWindow):
"""The page that displays the list of available plugins."""
diff --git a/pitivi/pluginmanager.py b/pitivi/pluginmanager.py
index c517d511..66642f30 100644
--- a/pitivi/pluginmanager.py
+++ b/pitivi/pluginmanager.py
@@ -53,6 +53,12 @@ class PluginType(IntEnum):
elif self.value == PluginType.SYSTEM:
return _("System plugins")
+ def get_dir(self):
+ if self.value == PluginType.USER:
+ return get_user_plugins_dir()
+ elif self.value == PluginType.SYSTEM:
+ return get_plugins_dir()
+
class PluginManager(Loggable):
"""Pitivi Plugin Manager to handle a set of plugins.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]