The pyzo_in_leo plugin now creates *all* of pyzo's docks, including a new Editors dock. This is a huge milestone in the project.
A new, simple, strategy was the key. In another post I said: QQQ I shall replace start_pyzo_in_leo with the following functions in the plugin: - pyzo_start: a copy of pyzo.start, with as few changes as possible. It will call: - pyzo_main_ctor: a copy of pyzo's MainWindow.__init__.py,which will call: - pyzo_main_populate: a copy of pyzo's MainWindow._populate. QQQ Similarly, I the added a menu_build_menus function. It is a modification of the buildMenus function in pyzo/core/menu.py. It took only about two hours to do this. I started with the original code, and either a) disabled code or b) replaced code by another function that modified pyzo's operation for Leo. I was careful to implement the strategy so that *all statements, including imports, happen in exactly the same sequence as in pyzo.start and its helpers*. This means that buglets can not happen. Everything just works. *Timeline* I started this phase at about 13:00 this afternoon: Rev dbe7a3a: 14:49: A major milestone. Much of pyzo embeds properly into Leo! Rev a580964: 16:50: Monkey-patched QMainWindow.closeEvent. Leo ends properly. After a break for dinner: Rev 1622790: 19:21: Pyzo menus are now submenus of a top-level Pyzo menu. Rev e203ecf: 19:39: Disabled pyzo's bindings. Rev b557db3: 19:52: Added Editors tab About 30 minutes separated these three revs. *Modifying pyzo* Once startup was solid, it was a snap to change pyzo's operation. main_window_populate contains all the changes. Various new helper functions encapsulate the changes: 1. Disable pyzo keystrokes by monkey-patching KeyMapper.setShortcut to a do-nothing: g.funcToMethod(setShortcut, pyzo.keyMapper.__class__) 2. Put all pyzo menus into a submenu of a new top-level Pyzo menu: menu_build_menus(c) 3. Create *all* pyzo docks, ignoring pyzo.config: load_all_docks(c) 4. Create a new Editors dock: make_dock(c, 'Editors', pyzo.editors) A slight bit of cleverness. In several places the *functions* bind "self" to c.frame.top, which is an instance of Leo's DynamicWindow class, which is a QMainWindow. *Remaining work* The pyzo and Leo docks are largely separate. Somehow they must be taught to work together smoothly. This is no small matter. Pyzo's configuration code lies behind much of the pyzo docks. pyzo.config must be bent to Leo's will. It will take some doing. *Summary* The pyzo_in_leo plugin creates *all* of pyzo's docks, including a new Editors dock. Pyzo docks know little or nothing about Leo, and vice versa. The strategy of emulating pyzo's startup code *in the same order *was a complete success. Everything just worked. This concludes phase two of the pyzo in Leo project. Much work remains. Edward -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To unsubscribe from this group and stop receiving emails from it, send an email to leo-editor+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/leo-editor/7127ce06-4d93-45c9-9ef3-ca0cd5c88d01%40googlegroups.com.