Debian Codegraph @

files/usr/bin/cinnamon-preview-gtk-theme

raw
1 #!/usr/bin/python3
2
3 """ Preview a Cinnamon gtk theme in a small window
4
5 Usage: cinnamon-preview-gtk-theme theme-name
6 """
7
8 import sys
9 from setproctitle import setproctitle
10
11 import gi
12 gi.require_version("Gtk", "3.0") # noqa
13 from gi.repository import Gtk
14
15 if __name__ == '__main__':
16 setproctitle("cinnamon-preview-gtk-theme")
17 import signal
18 signal.signal(signal.SIGINT, signal.SIG_DFL)
19
20 if len(sys.argv) != 2:
21 print("Usage: cinnamon-preview-gtk-theme theme-name")
22 exit(1)
23 else:
24 theme_name = sys.argv[1]
25 settings = Gtk.Settings.get_default()
26 settings.set_string_property("gtk-theme-name", theme_name, "gtkrc:0")
27
28 window = Gtk.Window()
29
30 vbox = Gtk.VBox()
31 hbox = Gtk.HBox()
32 button = Gtk.Button()
33 check = Gtk.CheckButton()
34 check.set_active(True)
35 radio = Gtk.RadioButton()
36 hbox.pack_start(button, False, False, 2)
37 button.set_label("Button")
38 hbox.pack_start(check, False, False, 2)
39 hbox.pack_start(radio, False, False, 2)
40
41 vbox.pack_start(hbox, False, False, 2)
42
43 window.add(vbox)
44 window.set_default_size(320, 200)
45 window.set_decorated(False)
46 window.show_all()
47
48 window.connect("destroy", Gtk.main_quit)
49 Gtk.main()