def __init__(self, label, menu, container): self.label = label add_child(self, self.label) menu.menu_button = self self.menu = menu self.container = container self.is_open = False add_listener(self.menu, "close", self.on_menu_close)
def add_window(self, window, **params): add_listener(window, "window_move_start", self.on_window_move_start) add_listener(window, "window_focus", self.on_window_focus) add_listener(window, "maximize", self.on_window_maximize) add_listener(window, "close", self.on_window_close) add_listener(window, "window_resize_start", self.on_window_resize_start) add_child(self.board, window, **params) fire_event(self, Event("add_window", window=window))
def __init__(self): self.vbox = VBox() self.label = Text("Go to step:") add_child(self.vbox, self.label) self.text_field = TextField() add_listener(self.text_field, "keypress", self.on_keypress) add_child(self.vbox, self.text_field, stretch="x") self.border = Border(self.vbox) add_child(self, self.border) add_listener_once(get_root(), "click", lambda e: self.close())
def __init__(self, cache, container): self.cache = cache self.container = container self.files = self.cache.get_code_files_lite() self.vbox = VBox() self.label = Text("Go to file:") add_child(self.vbox, self.label) self.text_field = TextField() add_listener(self.text_field, "keypress", self.on_keypress) add_child(self.vbox, self.text_field, stretch="x") self.border = Border(self.vbox) add_child(self, self.border) self.file_menu = Menu() add_listener_once(get_root(), "click", lambda e: self.close())
def __init__(self, cache, navigator, container): self.snapshot = None self.cache = cache self.nav = navigator self.container = container self.code_lines_pane = CodeLinesPane(self.cache) self.scroll_view = ScrollView(self.code_lines_pane, line_numbers=True) self.vbox = VBox() self.toolbar = HBox() self.init_menu() add_child(self.toolbar, self.file_menu_button) self.hits_button = Text(sstring(" Show hits ", [BG_BLUE])) add_listener(self.hits_button, "click", self.hits_button_clicked) add_child(self.toolbar, self.hits_button) add_child(self.vbox, self.toolbar) add_child(self.vbox, self.scroll_view, stretch="both") add_child(self, self.vbox)
def __init__(self, title, window): style = [REVERSED] self.style = style self.title = title self.window = window self.title_label = Text(sstring(self.title, style)) self.hbox = HBox() # self.min_button = Text(sstring("-", style)) self.max_button = Text(sstring("❑", style)) self.space = Text(sstring(" ", style)) self.close_button = Text(sstring("X", style)) add_child(self.hbox, Text("╭")) add_child(self.hbox, self.title_label, stretch="x") # add_child(self.hbox, self.min_button) add_child(self.hbox, self.max_button) add_child(self.hbox, self.space) add_child(self.hbox, self.close_button) add_child(self.hbox, Text("╮")) add_child(self, self.hbox) add_listener(self.title_label, "mousedown", self.on_start_move) # add_listener(self.min_button, "click", self.on_min_button_click) add_listener(self.max_button, "click", self.on_max_button_click) add_listener(self.close_button, "click", self.on_close_button_click)
def __init__(self, cache, value_cache): self.cache = cache self.value_cache = value_cache self.snapshot = None self.vbox = VBox() self.locals_tree = Tree("Locals") self.globals_tree = Tree("Globals") self.expanded_paths = set() add_child(self.vbox, self.locals_tree) add_child(self.vbox, self.globals_tree) add_listener(self.locals_tree, "expand", self.on_expand) add_listener(self.locals_tree, "collapse", self.on_expand) add_listener(self.globals_tree, "expand", self.on_expand) add_listener(self.globals_tree, "collapse", self.on_expand) # add_child(self, self.vbox) self.scroll_view = ScrollView(self.vbox) add_child(self, self.scroll_view)
def add_menu(self, label, menu): add_listener(menu, "next", self.on_menu_next) add_listener(menu, "previous", self.on_menu_previous) menu_button = MenuButton(label, menu, self.menu_container) add_listener(menu_button, "open", self.on_menu_button_open) add_child(self.box, menu_button)
def add_item(self, menu_item): add_child(self.vbox, menu_item) add_listener(menu_item, "select", self.on_menu_item_select) if self.highlighted == len(self.vbox.children) - 1: menu_item.set_highlighted(True)