def __init__(self, window, background=None): Frame.__init__(self, window, background=background) self.instances_part = Frame(self, width=500) self.instances_part.pack(side=LEFT, fill=BOTH, expand=1) self.instance_schema = InstanceSchema(self.instances_part, window, background='#fff0b3') self.instance_schema.pack(fill=BOTH, expand=1) self.console_part = Frame(self) self.console_part.pack(side=RIGHT, fill=BOTH, expand=1) self.entry = Entry(self.console_part) self.entry.pack(fill=BOTH) self.entry.bind("<Return>", self.entry_callback) scrollbar = Scrollbar(self.console_part) scrollbar.pack(side=RIGHT, fill=Y) self.text_box = Text(self.console_part, wrap='word', height=8, yscrollcommand=scrollbar.set) self.text_box.pack(fill=BOTH, expand=1) scrollbar.config(command=self.text_box.yview) self.console = Console(sys.stdout, sys.stderr, window.workspace)
def test_console(self): console = Console(sys.stdout, sys.stderr, './') self.assertNotEqual(console, None) console.eval_command("TEST_VAR=\"TEST_VALUE\"") print_result = console.eval_command("print(TEST_VAR)") self.assertEqual("TEST_VALUE\n", print_result) console.eval_command("from front.edge import Edge") console.eval_command("test_edge = Edge(None, None)") console.refresh_instance_list() self.assertEqual(True, "Edge" in console.instances) console.flush_console() self.assertEqual(False, "Edge" in console.instances)
def __init__(self, frame, workspace, background): Canvas.__init__(self, frame, background=background, scrollregion=(0,0,1000,1000)) self.module_list = list() self.edge_list = list() self.bind("<Double-Button-1>", self.double_click) self.bind("<ButtonPress-1>", self.select_instance) self.bind("<B1-Motion>", self.drag_move) self.bind("<ButtonRelease-1>", self.end_drag) self.bind("<ButtonRelease-3>", self.popup) self.workspace = workspace self.inspect_console = Console(sys.stdout, sys.stderr, workspace) self.load_existing_modules() self.selected_module = None self.module_to_delete = None self.schema_scrollbar() self.menu = Menu(self, tearoff=0) self.menu.add_command(label="Delete", command=self.delete_module)