[wingide-users] script to toggle vertical tools <=> editor split
Lakshman Prasad
scorpion032 at gmail.com
Tue Jul 21 12:22:18 MDT 2009
I have been using Ctrl-f12 split and un-split manually. This should be
helpful.
Is there a similar script for non-default windowing scheme. The one with
text editor separated from the tools window.
Thanks.
On Mon, Jul 20, 2009 at 8:13 PM, Wingware Support <support at wingware.com>wrote:
> 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.
>>
>> 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')
>>
>
> Here's a simpler version that doesn't depend on the internals of the states
> (which may change over time, albeit in a semi-controlled way):
>
> def toggle_vertical_split():
> """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).
> Thanks to Jonathan March for this script."""
> app = wingapi.gApplication
> app.ExecuteCommand('focus-current-editor')
> if app.CommandAvailable('unsplit'):
> app.ExecuteCommand('unsplit', action='current')
> app.ExecuteCommand('show-vertical-tools')
> else:
> app.ExecuteCommand('hide-vertical-tools')
> app.ExecuteCommand('split-horizontally')
>
> I've added this to our scripts/editor_extensions.py example file, with
> Jonathan's permission, but figured I'd follow up here also.
>
> Thanks!
>
> --
>
> Stephan Deibel
> Wingware | Python IDE
> Advancing Software Development
>
> www.wingware.com
>
>
> _________________________________________________
> Wing IDE users list
> http://wingware.com/lists/wingide
>
--
Regards,
Lakshman
becomingguru.com
lakshmanprasad.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/wingide-users/attachments/20090721/b26e19c0/attachment.html
More information about the wingide-users
mailing list