File Menus and Toolbar Code review
Presenter: John
Participants: Grant, Jacob, Mikeal, Heikki, Dan, Andi, Katie, Bryan, Reid
Note taker: Philippe
Background
- Tried to solve perf issues with dynamic children
- The reason dynamic children exist were to allow Parcels to modify the menus. However, needs in Chandler today are quite different today, so dynamic children aren't really buying us anything. Instead I implemented a simpler, but more flexible mechanism that better matches our current needs.
- Blocks are the persisted state of a widget. Blocks implement instantiateWidget to create a widget and wxSynchronizeWidget to make the state of the widget match the values saved in the block
- The new code is half the size of the old at approximately 500 lines
MenusAndToolbars.py
- Exposed wxWidget's private wxToolBarTool as a public class
- Added some new APIs in wxWidgets to simplify the wxPython code in MenusAndToolbars.py
- Menu is a subclass of MenuItem 'cause menus can be nested (so a Menu is essentially a MenuItem)
- wxMenu is a subclass of wx.Menu (of course) and wxBaseContainer
- wxBaseContainer handles how to insert/remove items in the menu and toolbar
- overrides : is a global that contains a dynamic list of persisted MenuItems or ToolbarToos that can be used (though be careful not to leave things dangling in there...)
- wxQuickEntry is a special case of the search control
- We have new methods to remove items, get the old items, etc... much more compact than the old ones
Plugins.py
- New wxPluginMenu class (deriving from wxMenu reviewed here above)
Advantage to this refectoring effort
- Dirty less items when switching views (better performance)
- Code much simpler and easier to maintain
--
PhilippeBossut - 24 May 2007