示例#1
0
文件: idlexMain.py 项目: wm75/idlexl
        def RemoveKeybindings(self):  # SUBCLASS to catch errors
            "Remove the keybindings before they are changed."
            EditorWindow._invalid_keybindings = []
            # Called from idlelib.configdialog.py
            self.mainmenu.default_keydefs = keydefs = idleConf.GetCurrentKeySet()
            for event, keylist in keydefs.items():
                for key in keylist:
                    try:
                        self.text.event_delete(event, key)
                    except Exception as err:
                        print(' Caught event_delete error:', err)
                        print(' For %s, %s' % (event, key))
                        pass

            for extensionName in self.get_standard_extension_names():
                xkeydefs = idleConf.GetExtensionBindings(extensionName)
                if xkeydefs:
                    for event, keylist in xkeydefs.items():
                        for key in keylist:
                            try:
                                self.text.event_delete(event, key)
                            except Exception as err:
                                print(' Caught event_delete error:', err)
                                print(' For %s, %s' % (event, key))
                                pass
示例#2
0
    def transfer_cfg(self, extName, confparse, keys=True):
        """ Transfer the configuration from the extension
            into IDLE's configuration. Returns True if successful. """

        if confparse is None:
            return False

        # copy the user extension configuration in IDLE
        retval = self.copy_options(extName, idleConf.userCfg, confparse)

        if 0:  # DEVELOPERS - this takes a long time to process
            # Report Any keybinding conflicts the user extension may have
            keyset = idleConf.GetCurrentKeySet()
            name_cfg = extName + '_cfgBindings'
            optionlist = confparse.GetOptionList(name_cfg)
            for option in optionlist:
                b = '<<%s>>' % option
                value = confparse.get(name_cfg, option)
                if value == '<Control-Key-l>':
                    continue  # WORKAROUND: skip clear window binding
                for event, binding in list(keyset.items()):
                    if value in binding and event != b and value:
                        print(
                            '\n Warning: [%s] has an event binding conflict with'
                            % name_cfg)
                        print(' ', event, value)

        # idleConf.GetExtensionBindings pulls only from the default configuration.
        # Must transfer bindings to defaultCfg dictionary instead.
        if keys:
            self.copy_options(extName + '_cfgBindings', idleConf.defaultCfg,
                              confparse)

        return retval
示例#3
0
文件: idlexMain.py 项目: wm75/idlexl
def main():

    pythonw_workaround()
    _hotpatch()
    fix_tk86()

    try:
        macosx_workaround()
    except:
        pass  # Tk on OSX should not be this fragile...

    install_idlex_manager()

    extensionManager.load_idlex_extensions()

    # Force a reset on Bindings...
    # Without this, user reconfiguration of the key bindings within IDLE may
    # generate an error on MultiCall unbind.
    import idlelib.mainmenu
    idlelib.mainmenu.default_keydefs = idleConf.GetCurrentKeySet()

    import idlelib.pyshell
    idlelib.pyshell.main()
示例#4
0
        ('_View Last Restart', '<<view-restart>>'),
        ('_Restart Shell', '<<restart-shell>>'),
        None,
        ('_Interrupt Execution', '<<interrupt-execution>>'),
    ]),
    ('debug', [
        ('_Go to File/Line', '<<goto-file-line>>'),
        ('!_Debugger', '<<toggle-debugger>>'),
        ('_Stack Viewer', '<<open-stack-viewer>>'),
        ('!_Auto-open Stack Viewer', '<<toggle-jit-stack-viewer>>'),
    ]),
    ('options', [
        ('Configure _IDLE', '<<open-config-dialog>>'),
        ('_Code Context', '<<toggle-code-context>>'),
    ]),
    ('windows', [
        ('Zoom Height', '<<zoom-height>>'),
    ]),
    ('help', [
        ('_About IDLE', '<<about-idle>>'),
        None,
        ('_IDLE Help', '<<help>>'),
        ('Python _Docs', '<<python-docs>>'),
    ]),
]

if find_spec('turtledemo'):
    menudefs[-1][1].append(('Turtle Demo', '<<open-turtle-demo>>'))

default_keydefs = idleConf.GetCurrentKeySet()