def __init__(self, master): self.master = master self.lb = select.Select([ select.Heading("Traffic Manipulation"), select.Option("Header Set Patterns", "H", lambda: len(master.options.setheaders), self.setheaders), select.Option("Ignore Patterns", "I", lambda: master.options.ignore_hosts, self.ignore_hosts), select.Option("Replacement Patterns", "R", lambda: len(master.options.replacements), self.replacepatterns), select.Option("Scripts", "S", lambda: master.options.scripts, self.scripts), select.Heading("Interface"), select.Option("Default Display Mode", "M", self.has_default_displaymode, self.default_displaymode), select.Option("Palette", "P", lambda: self.master.palette != palettes.DEFAULT, self.palette), select.Option("Show Host", "w", lambda: master.options.showhost, master.options.toggler("showhost")), select.Heading("Network"), select.Option("No Upstream Certs", "U", lambda: master.options.no_upstream_cert, master.options.toggler("no_upstream_cert")), select.Option("TCP Proxying", "T", lambda: master.options.tcp_hosts, self.tcp_hosts), select.Option("Don't Verify SSL/TLS Certificates", "V", lambda: master.options.ssl_insecure, master.options.toggler("ssl_insecure")), select.Heading("Utility"), select.Option("Anti-Cache", "a", lambda: master.options.anticache, master.options.toggler("anticache")), select.Option("Anti-Compression", "o", lambda: master.options.anticomp, master.options.toggler("anticomp")), select.Option("Kill Extra", "x", lambda: master.options.replay_kill_extra, master.options.toggler("replay_kill_extra")), select.Option("No Refresh", "f", lambda: not master.options.refresh_server_playback, master.options.toggler("refresh_server_playback")), select.Option("Sticky Auth", "A", lambda: master.options.stickyauth, self.sticky_auth), select.Option("Sticky Cookies", "t", lambda: master.options.stickycookie, self.sticky_cookie), ]) title = urwid.Text("Options") title = urwid.Padding(title, align="left", width=("relative", 100)) title = urwid.AttrWrap(title, "heading") w = urwid.Frame(self.lb, header=title) super().__init__(w) self.master.loop.widget.footer.update("") signals.update_settings.connect(self.sig_update_settings) master.options.changed.connect(self.sig_update_settings)
def __init__(self, master): self.master = master low, high = [], [] for k, v in palettes.palettes.items(): if v.high: high.append(k) else: low.append(k) high.sort() low.sort() options = [ select.Heading("High Colour") ] def mkopt(name): return select.Option( i, None, lambda: self.master.options.console_palette == name, lambda: setattr(self.master.options, "console_palette", name) ) for i in high: options.append(mkopt(i)) options.append(select.Heading("Low Colour")) for i in low: options.append(mkopt(i)) options.extend( [ select.Heading("Options"), select.Option( "Transparent", "T", lambda: master.options.console_palette_transparent, master.options.toggler("console_palette_transparent") ) ] ) self.lb = select.Select(options) title = urwid.Text("Palettes") title = urwid.Padding(title, align="left", width=("relative", 100)) title = urwid.AttrWrap(title, "heading") self._w = urwid.Frame( self.lb, header = title ) master.options.changed.connect(self.sig_options_changed)