1
+
import os
2
+
3
+
from gi.repository import Gtk
4
+
5
+
from .i18n import _
6
+
from .config import SCRIPT_DIR
7
+
# from .plugin_loader import ALL_PLUGINS
8
+
from .plugin_loader import (
9
+
THEME_PLUGINS, ICONS_PLUGINS, IMPORT_PLUGINS, EXPORT_PLUGINS,
10
+
)
11
+
12
+
13
+
class PluginInfo(Gtk.ListBoxRow):
14
+
15
+
def __init__(self, plugin):
16
+
super().__init__()
17
+
self.box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
18
+
self.add(self.box)
19
+
20
+
plugin_name = Gtk.Label()
21
+
plugin_name.set_markup("<b>{}</b>".format(plugin.display_name or plugin.name))
22
+
plugin_name.set_halign(Gtk.Align.START)
23
+
self.box.add(plugin_name)
24
+
25
+
for attr in ('about_text', 'description',):
26
+
value = getattr(plugin, attr, None)
27
+
if value:
28
+
about = Gtk.Label(value)
29
+
about.set_halign(Gtk.Align.START)
30
+
about.set_line_wrap(True)
31
+
self.box.add(about)
32
+
33
+
for link_info in plugin.about_links or []:
34
+
link = Gtk.LinkButton.new_with_label(
35
+
link_info['url'],
36
+
link_info['name']
37
+
)
38
+
link.set_hexpand(False)
39
+
# link.set_halign(Gtk.Align.CENTER)
40
+
link.set_halign(Gtk.Align.START)
41
+
self.box.add(link)
42
+
43
+
44
+
def show_about(parent_window):
45
+
path = os.path.join(SCRIPT_DIR, 'about.ui')
46
+
builder = Gtk.Builder.new_from_file(path)
47
+
48
+
about_window = builder.get_object("about")
49
+
about_window.set_transient_for(parent_window)
50
+
about_window.set_title("About Themix GUI / Oomox")
51
+
about_window.set_wmclass("oomox", "Oomox")
52
+
about_window.set_role("Oomox-About")
53
+
about_window.show()
54
+
plugins_box = builder.get_object("plugins_box")
55
+
56
+
def update_listbox_header(row, before):
57
+
if before and not row.get_header():
58
+
separator = Gtk.Separator(orientation=Gtk.Orientation.HORIZONTAL)
59
+
separator.set_margin_top(4)
60
+
separator.set_margin_bottom(8)
61
+
row.set_header(separator)
62
+
63
+
for title, plugin_list in (
64
+
(_('Theme Plugins'), THEME_PLUGINS, ),
65
+
(_('Icon Plugins'), ICONS_PLUGINS, ),
66
+
(_('Import Plugins'), IMPORT_PLUGINS, ),
67
+
(_('Export Plugins'), EXPORT_PLUGINS, ),
68
+
):
69
+
section_label = Gtk.Label(title)
70
+
section_label.set_margin_top(8)
71
+
section_label.set_margin_bottom(4)
72
+
plugins_box.add(section_label)
73
+
listbox = Gtk.ListBox()
74
+
listbox.set_selection_mode(Gtk.SelectionMode.NONE)
75
+
listbox.set_header_func(update_listbox_header)
76
+
plugins_box.add(listbox)
77
+
for plugin in plugin_list.values():
78
+
listbox.add(PluginInfo(plugin))
79
+
80
+
plugins_box.show_all()
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4