示例#1
0
    def __init__(self, interpreter):
        self.interpreter = interpreter
        self.history_objects = []

        skin = LUIDefaultSkin()
        skin.load()

        region = LUIRegion.make("LUI", base.win)
        handler = LUIInputHandler()
        base.mouseWatcher.attach_new_node(handler)
        region.set_input_handler(handler)

        self.console_frame = LUIFrame(
            parent=region.root,
            pos=(0, 0),
            width=base.win.get_x_size() - 10,
            height=base.win.get_y_size() * 0.75,
            style=LUIFrame.FS_raised,
            #style = LUIFrame.FS_sunken,
            margin=(5, 5, 5, 5),
        )
        console = LUIVerticalLayout(parent=self.console_frame, spacing=3)
        #console.use_dividers = True
        console.margin = (0, 0, 0, 0)
        console.width = self.console_frame.width

        self.history_region = LUIScrollableRegion(margin=0,
                                                  width=console.width - 10)
        console.add(self.history_region)
        self.history = LUIVerticalLayout(
            parent=self.history_region.content_node, spacing=2)
        self.history.margin = (0, 0, 0, 0)
        self.history.width = self.history_region.width

        self.command_line = LUIInputField(width=console.width - 10)
        console.add(self.command_line)
        self.command_line.bind("tab", self.tab)
        self.command_line.bind("enter", self.enter)
        self.command_line.bind("control-c", self.copy)
        self.command_line.bind("control-v", self.paste)
        self.command_line.bind("control-x", self.cut)
        self.command_line.bind("control-u", self.kill_to_start)
        self.command_line.bind("control-k", self.kill_to_end)
        self.command_line.bind("control-l", self.kill_line)
示例#2
0
    def __init__(self, interpreter):
        self.interpreter = interpreter
        self.history_objects = []
        
        skin = LUIDefaultSkin()
        skin.load()

        region = LUIRegion.make("LUI", base.win)
        handler = LUIInputHandler()
        base.mouseWatcher.attach_new_node(handler)
        region.set_input_handler(handler)

        self.console_frame = LUIFrame(parent = region.root,
                                      pos = (0, 0),
                                      width = base.win.get_x_size() - 10,
                                      height = base.win.get_y_size() * 0.75,
                                      style = LUIFrame.FS_raised,
                                      #style = LUIFrame.FS_sunken,
                                      margin = (5, 5, 5, 5),
                                      )
        console = LUIVerticalLayout(parent = self.console_frame, spacing = 3)
        #console.use_dividers = True
        console.margin = (0, 0, 0, 0)
        console.width = self.console_frame.width
        
        self.history_region = LUIScrollableRegion(margin = 0, width = console.width - 10)
        console.add(self.history_region)
        self.history = LUIVerticalLayout(parent = self.history_region.content_node,
                                         spacing = 2)
        self.history.margin = (0, 0, 0, 0)
        self.history.width = self.history_region.width

        self.command_line = LUIInputField(width = console.width - 10)
        console.add(self.command_line)
        self.command_line.bind("tab", self.tab)
        self.command_line.bind("enter", self.enter)
        self.command_line.bind("control-c", self.copy)
        self.command_line.bind("control-v", self.paste)
        self.command_line.bind("control-x", self.cut)
        self.command_line.bind("control-u", self.kill_to_start)
        self.command_line.bind("control-k", self.kill_to_end)
        self.command_line.bind("control-l", self.kill_line)