Beispiel #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
Beispiel #2
0
 def check_settings(self):
     from kivystudio.settings import settings_obj
     auto_save = settings_obj.auto_save
     auto_emulate = settings_obj.auto_emulate
     if auto_save:
         self.parent.parent.save_file(auto_save=True)
     if auto_emulate:
         from kivystudio.parser import emulate_file
         from kivystudio.components.emulator_area import get_emulator_area
         if get_emulator_area().emulation_file == self.parent.filename:
             emulate_file(self.parent.filename)
Beispiel #3
0
 def check_settings(self):
     # import kivystudio app to not confuse it with current emulating app
     from kivystudio import get_kivystudio_app
     app = get_kivystudio_app()
     auto_save = app.user_settings.get('file-settings')['auto_save']
     auto_emulate = app.user_settings.get(
         'emulator-settings')['auto_emulate']
     if auto_save:
         self.parent.parent.save_file(auto_save=True)
     if auto_emulate:
         from kivystudio.parser import emulate_file
         from kivystudio.components.emulator_area import emulator_area
         if emulator_area().emulation_file == self.parent.filename:
             emulate_file(self.parent.filename)
Beispiel #4
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')