-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmy_prefs1.py
58 lines (42 loc) · 1.53 KB
/
my_prefs1.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
from hack_ui import MyUI_Hack
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, Gdk, GLib
from gi.repository import Vte
AVAILABLE = ['MyPrefs1']
import terminatorlib.plugin as plugin
from terminatorlib.terminal import PrefsEditor
class MyPrefs1(plugin.MenuItem, MyUI_Hack):
capabilities = ['terminal_menu']
def __init__(self):
print('--MyPrefs1 __init__')
# plugin.MenuItem.__init__(self)
# super(MyPrefs, self).__init__()
super().__init__()
self.ui = None
self.setup_prefs()
def callback(self, menuitems, menu, terminal):
item = Gtk.CheckMenuItem(' - MyPrefs1')
menuitems.append(item)
# print('MyPrefs1 __init__..')
def show_my_ui(self):
if self.ui:
return self.ui
# ------ new ui
vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=10)
self.my_ui = vbox
label = Gtk.Label(label="Prefs for " + self.__class__.__name__)
input = Gtk.Entry(text='world')
button = Gtk.Button(label="test")
def on_btn_click(button):
print('--button click:', input.get_text())
button.connect("clicked", on_btn_click)
# Add the new widgets to the vbox
vbox.pack_start(label, False, False, 0)
vbox.pack_start(input, False, False, 0)
vbox.pack_start(button, False, False, 0)
vbox.set_margin_top(20)
vbox.set_margin_bottom(20)
vbox.set_margin_start(15)
vbox.set_margin_end(15)
return vbox