[wingide-users] script to toggle vertical tools <=> editor split

Michael Foord fuzzyman at voidspace.org.uk
Fri Jul 17 04:01:15 MDT 2009


Jonathan March wrote:
> Since I still have only one monitor, I have found myself going back 
> and forth between a left-right editor split, and a single editor panel 
> with the vertical tools panel, using 3 different key bindings. The 
> following script defines a new command vertical-toggle, to do this. It 
> can be bound to a single key.
Yup - I really like this.

Thanks

Michael

>
> import wingapi
>
> def vertical_toggle():
>     'toggle: left-right editor split, vs one editor plus vertical tools'
>     # If editor is split, unsplit it and show the vertical tools panel.
>     # Otherwise, hide the vertical tools and split the editor left-right
>     # Assumes default windowing policy (combined toolbox & editor 
> windows.)
>     app = wingapi.gApplication
>     app.ExecuteCommand('focus-current-editor')
>     state = app.GetVisualState(style='tools-and-editors')
>     ed_states = state['windows'][0]['view']['primary_view_state']\
>               ['primary_view_state']['editor_states']
>     split = not isinstance(ed_states,dict)
>     if split:
>         app.ExecuteCommand('unsplit', action='current')
>         app.ExecuteCommand('show-vertical-tools')
>     else:
>         app.ExecuteCommand('hide-vertical-tools')
>         app.ExecuteCommand('split-horizontally')
>
> ------------------------------------------------------------------------
>
> _________________________________________________
> Wing IDE users list
> http://wingware.com/lists/wingide


-- 
http://www.ironpythoninaction.com/



More information about the wingide-users mailing list