- table.pack(me.c_keepalive, newlinep = True, xopt = G.FILL)
- me.c_keepalive.connect('toggled',
- lambda t: me.e_keepalive.set_sensitive\
- (t.get_active()))
- me.e_keepalive = ValidatingEntry(r'^\d+[hms]?$', '', 5)
- me.e_keepalive.set_sensitive(False)
- table.pack(me.e_keepalive, width = 3)
+
+ def tickybox_sensitivity(tickybox, target):
+ tickybox.connect('toggled',
+ lambda t: target.set_sensitive (t.get_active()))
+
+ def optional_entry(label, rx_valid, width):
+ c = G.CheckButton(label)
+ table.pack(c, newlinep = True, xopt = G.FILL)
+ e = ValidatingEntry(rx_valid, '', width)
+ e.set_sensitive(False)
+ tickybox_sensitivity(c, e)
+ table.pack(e, width = 3)
+ return c, e
+
+ me.c_keepalive, me.e_keepalive = \
+ optional_entry('Keepalives', r'^\d+[hms]?$', 5)
+
+ me.c_cork = G.CheckButton('Cork')
+ table.pack(me.c_cork, newlinep = True, width = 4, xopt = G.FILL)
+
+ me.c_mobile = G.CheckButton('Mobile')
+ table.pack(me.c_mobile, newlinep = True, width = 4, xopt = G.FILL)
+
+ me.c_ephem = G.CheckButton('Ephemeral')
+ table.pack(me.c_ephem, newlinep = True, width = 4, xopt = G.FILL)
+
+ me.c_peerkey, me.e_peerkey = \
+ optional_entry('Peer key tag', r'^[^.:\s]+$', 16)
+ me.c_privkey, me.e_privkey = \
+ optional_entry('Private key tag', r'^[^.:\s]+$', 16)
+
+ me.c_knock, me.e_knock = \
+ optional_entry('Knock string', r'^[^:\s]+$', 16)
+