Ejemplo n.º 1
0
def handle_key_press(widget, event):
    keyname = gtk.gdk.keyval_name(event.keyval)
    if keyname == 'Return':
        text = window.get_input() 
        if text == None:
            text = ''
        output.print_input(text)
        window.clear_input()

        global history_index
        history_index = 0

        if text != '':
            result = ui_interface.enter(text)
        #assert result != None
            if result != []:
                if isinstance(result, list):
                    output.print_outputs(result)
                else:
                    output.print_output(result)

        window.refresh()

    elif keyname == 'F5':
        window.refresh()

    elif keyname == 'Up':
        new_command_str = previous_command(processor.environment.history)
        window.set_input(new_command_str)
        window.cursor_to_end()
        # return True to stop default action of switching widget focus
        return True

    elif keyname == 'Down':
        new_command_str = next_command(processor.environment.history)
        window.set_input(new_command_str)
        window.cursor_to_end()
        # return True to stop default action of switching widget focus
        return True

    elif keyname == 'Tab':
        input = window.get_input();
        completed = completion.complete(input)
        if completed:
            window.set_input(completed)
            window.cursor_to_end()
        return True
Ejemplo n.º 2
0
# (C) Rich Smith 2014
# [email protected]

import os
from view import ui
from control import access, output, processor
from apps import *

name = "Fluidic"
version = "0.4.0"

if __name__ == '__main__':

    path = access.interpret_path("~")
    os.chdir(path)

    output.clear()
    output.welcome()

    ls_output = processor.process('ls');
    output.print_outputs(ls_output)
    

    ui.setup()