def main(self, line=1, col=1): loop = urwid.MainLoop(self.view, handle_mouse=False, unhandled_input=self.unhandled_keypress) loop.screen.set_terminal_properties(256) self.loop = loop self.register_palette(pygments_cache.get_style_by_name(self.rc["style"])) self.walker.goto(line, col) self.walker.all_tokens = None while True: try: self.loop.run() except KeyboardInterrupt: self.reset_status(status="YOLO! ") else: break
def run(self, main_display): try: s = pygments_cache.get_style_by_name(self.edit_text.strip()) except pygments.util.ClassNotFound: return "bad sty " main_display.register_palette(s)
def test_get_style_by_name(cache, name, cls): obs = get_style_by_name(name) assert cls is obs
def test_add_custom_style(name, style): add_custom_style(name, style) assert get_style_by_name(name) is style assert name in get_all_styles()