On Sat, Feb 18, 2012 at 11:43 AM, Edward K. Ream <[email protected]> wrote: > Rev 4990 of the trunk contains many important simplifications, some > of which I have wanted to do for years.
The next rev will contain at least one more code simplification. g.openWithFileName will now return a single value, a Commander, rather than the tuple (ok,frame). The old way is un-pythonic. This change may cause minor problem for those writing their own code, but imo it should be done now, while everything else is in flux. I'll add unit tests for all affected parts to the code not already covered by a unit test. Also, a new "force" keyword argument to g.openWithFileName will force the creation of a commander. This appears to allow an important collapse in complexity in the c.new code, and other code that inits Leo windows for various reasons. With this change, it looks like g.app.openSettingsFile is really a synonym (except for tracing) for g.openWithFileName. It's probably clearer to get call g.openWithFileName directly, but that's not proven. More importantly, the ill-named g.app.createFrame method is *almost* a synonym for g.openWithFileName. It's likely that the few additional statements at the end of g.app.createFrame can be folded into g.openWithFileName. In that case, the method could disappear entirely, which would be an important conceptual simplification. I said that this method is ill-named because it creates an entire Leo window (aka Commander). Furthermore, there are gui methods of several classes called createFrame that actually *do* create frames. Happily, pylint can disambiguate the methods, so renaming will be relatively safe. Also, unit tests are likely to exercise any code and would complain about an improper renaming. To repeat, these changes may cause short term problems for writers of scripts or plugins. But imo the additional clarity in Leo's startup code is well worth the temporary pain, including the delay in finishing this project. Edward -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/leo-editor?hl=en.
