Ejemplo n.º 1
0
def main_key_handler(win, *args):
    '''' main keyboard and shortcut lisener '''
    # print(args)
    if args[0] == 114 and 'ctrl' in args[3]:  # emulate file Ctrl+R
        emulate_file(emulator_area.emulation_file)

    elif args[0] == 107 and 'ctrl' in args[3]:  # Open folder Ctrl+K
        filemanager.choose_dir(path='.', on_selection=open_project)

    elif args[0] == 111 and 'ctrl' in args[3]:  # Open file Ctrl+O
        filemanager.open_file(path='.', on_selection=add_new_tab)

    elif args[0] == 110 and 'ctrl' in args[3]:  # New file Ctrl+N
        code_place.add_code_tab(tab_type='new_file')

    elif args[0] == 96 and 'ctrl' in args[3]:  # Toggle terminal  Ctrl+`
        from kivystudio.components.codeplace import terminal
        terminal.toggle_state()

    elif args[0] == 45 and 'ctrl' in args[3]:  # Zoom out Ctrl -
        if settings_obj.dpi_scale > 0.8:
            settings_obj.dpi_scale -= 0.1

    elif args[0] == 61 and 'ctrl' in args[3]:  # Zoom in Ctrl +
        if settings_obj.dpi_scale < 1.4:
            settings_obj.dpi_scale += 0.1
Ejemplo n.º 2
0
def open_file(filename=''):
    ''' open a file (existing file) on
        the CodeInput, if filename, it open a 
        new tab for the file, else it opens a filechooser'''
    from kivystudio.assembler import add_new_tab
    if filename:
        add_new_tab([
            filename,
        ])
    else:
        filemanager.open_file(path='/root', on_selection=add_new_tab)
Ejemplo n.º 3
0
def key_down(self, *args):
    if args[0] == 114 and args[3] == ['ctrl']:     # emulate file Ctrl+R
        Clock.schedule_once(lambda dt: emulate_file(emulator_area.emulation_file))

    elif args[0] == 107 and args[3] == ['ctrl']:    # Ctrl K pressed
        pass

    elif args[0] == 111 and args[3] == ['ctrl']:    # open file Ctrl+O
        filemanager.open_file(path='/root',callback=add_new_tab)

    elif args[0] == 110 and args[3] == ['ctrl']:    # new file Ctrl+N
        code_place.add_code_tab(tab_type='new_file')
Ejemplo n.º 4
0
def open_file():
    from kivystudio.assembler import add_new_tab
    filemanager.open_file(path='/root', on_selection=add_new_tab)
Ejemplo n.º 5
0
def open_file():
    from kivystudio.assembler import add_new_tab
    filemanager.open_file(path='/root',callback=add_new_tab)