Hi, This is just a side-topic. I just tried to hack commands.py to get a nice M-Mode view for developing m projects. (not to confuse with project mode, this might be M pane mode). It should look like this: left pane 50%, M mode, current file right pane 50%, T-SQL Preview mode, current project bottom pane 15%, error pane No line numbers in T-SQL, thats just show-off mode. Hacking the commands.py was no great success for me :( (couldn't find T-SQL output or 3 pane mode for mgraph to steal code i also don't know enough python to work around the set of parameters etc.) Anyone else knows an already existing shortcut or is willing to share a solution? Msdn about iPad: http://msdn.microsoft.com/en-us/library/dd861732(VS.85).aspxhttp://msdn.microsoft.com/en-us/library/dd861727(VS.85).aspxRegards, Elger
Performing my Final Project, looking into codename "Oslo". | | Elger [Centric] | Hi Elger, I took a quick stab at this, using commands that already pretty much do what you want. It's minimally tested (meaning, I tried the correct case and it worked, so here it is :-) You could polish it up a bit if you wanted to, and assign a key gesture to it.
@Metadata.CommandExecuted('Microsoft.Intellipad.BufferView', 'Customer.MyMLayout', None) def MyMLayout(target, sender, args): from Microsoft.Intellipad.Shell import NamedCommands
# Display the file-open dialog or open uri given in args (not tested) Common.OpenBuffer(sender, args)
# wait for buffer to open and switch into M mode Common.DrainDispatcher()
#This command is available if thetarget viewis in M mode. Otherwise(say, open-file cancel and # no M file already in view), this is a no-op NamedCommands.FromName('Microsoft.M.TSqlPreview').Execute(None, target)
# Activate the errorview Common.ActivateErrorListBuffer(True)
The splits are by default 50%, and the error list takes 20% across the bottom (see Common.py ActivateBufferInAuxiliaryBufferView). You probably won't get the behavior you want if you have other splits open, but there are examples for closing splits in Commands.py and Common.py if you want to fix this up more to your liking. Rummage around through the python files in the Settings directory (or, depending on your ipad version, inside the various Components directories) for more examples. Thanks for using ipad! Lynn (ipad team) - Proposed As Answer byKraig BrockschmidtMSFT, ModeratorSaturday, August 08, 2009 3:25 AM
- Marked As Answer byElger [Centric] Monday, August 10, 2009 10:05 AM
-
| | Lynn G | Thanks :) I was wondering if my python was so horrible that it didn't work. It turned out my editor adds tabs instead of spaces. That now explains the "unexpected indent" error i got each time ipad tried to read my code. With some tweaks and hacks i got it working. Thanks! Here is an updated version of MyMLayout with work-in-progress comments (for may ctp)
@Metadata.CommandExecuted('{Microsoft.Intellipad}BufferView', '{Microsoft.Intellipad}MyMLayout', 'Ctrl+Shift+M')
def MyMLayout(target, sender, args):
from Microsoft.Intellipad.Shell import NamedCommands
from Microsoft.Intellipad.Host import HostWindow
# Open a file / project... Not needed here yet, i just open all files in one sweep by hand.
# Common.OpenBuffer(sender, args)
# there should be an openfiles in project command.
# then you can view the first file in the project and do your M things.
# Common.OpenFilesInActiveView(["generic.m]", sender) (dont know how to pass this collection yet)
#ofh = OpenFileHelper(Core.FileDialogFilter)
#OpenFilesInActiveView(ofh.GetFiles(), sender)
# wait for buffer to open and switch into M mode
# Common.DrainDispatcher() NN anymore
# This command is available if the target view is in M mode. Otherwise (say, open-file cancel and
# no M file already in view), this is a no-op
NamedCommands.FromName('{Microsoft.M}TSqlPreview').Execute(None, target)
#begin show errors (with garble comments)
#NamedCommands.FromName('{Microsoft.Intellipad}ShowErrorList').Execute(None, sender)
#@Metadata.CommandExecuted('{Microsoft.Intellipad.Host}HostWindow', '{Microsoft.Intellipad}ShowErrorList', 'Ctrl+Shift+E')
#def ShowErrorList(target, sender, args):
#hostWindow = Core.Host.TopLevelWindows[0]
#hostWindow.activeView
hostWindow = HostWindow.GetHostWindowForBufferView(sender)
errorBuffer = Common.GetOrCreateErrorBuffer()
view = Common.GetView(hostWindow, errorBuffer)
if view is not None:
Common.SetActiveView(view)
return
view = hostWindow.ShowInRoot(errorBuffer, System.Windows.Controls.Orientation.Vertical, 20.0)
view.Mode = Common.Core.ComponentDomain.GetExportedObject[System.Object]('{Microsoft.Intellipad}ListMode')
#end show errors
# focus the M window
Common.SetActiveView(sender)
Performing my Final Project, looking into codename "Oslo". - Edited byElger [Centric] Monday, August 10, 2009 10:04 AMadded ctp
- Marked As Answer byElger [Centric] Monday, August 10, 2009 10:05 AM
-
| | Elger [Centric] | Thanks for your post--I'll find some answers from the product team for you.
.Kraig | | Kraig Brockschmidt | Hi Elger, I took a quick stab at this, using commands that already pretty much do what you want. It's minimally tested (meaning, I tried the correct case and it worked, so here it is :-) You could polish it up a bit if you wanted to, and assign a key gesture to it.
@Metadata.CommandExecuted('Microsoft.Intellipad.BufferView', 'Customer.MyMLayout', None) def MyMLayout(target, sender, args): from Microsoft.Intellipad.Shell import NamedCommands
# Display the file-open dialog or open uri given in args (not tested) Common.OpenBuffer(sender, args)
# wait for buffer to open and switch into M mode Common.DrainDispatcher()
#This command is available if thetarget viewis in M mode. Otherwise(say, open-file cancel and # no M file already in view), this is a no-op NamedCommands.FromName('Microsoft.M.TSqlPreview').Execute(None, target)
# Activate the errorview Common.ActivateErrorListBuffer(True)
The splits are by default 50%, and the error list takes 20% across the bottom (see Common.py ActivateBufferInAuxiliaryBufferView). You probably won't get the behavior you want if you have other splits open, but there are examples for closing splits in Commands.py and Common.py if you want to fix this up more to your liking. Rummage around through the python files in the Settings directory (or, depending on your ipad version, inside the various Components directories) for more examples. Thanks for using ipad! Lynn (ipad team) - Proposed As Answer byKraig BrockschmidtMSFT, ModeratorSaturday, August 08, 2009 3:25 AM
- Marked As Answer byElger [Centric] Monday, August 10, 2009 10:05 AM
-
| | Lynn G | Thanks :) I was wondering if my python was so horrible that it didn't work. It turned out my editor adds tabs instead of spaces. That now explains the "unexpected indent" error i got each time ipad tried to read my code. With some tweaks and hacks i got it working. Thanks! Here is an updated version of MyMLayout with work-in-progress comments (for may ctp)
@Metadata.CommandExecuted('{Microsoft.Intellipad}BufferView', '{Microsoft.Intellipad}MyMLayout', 'Ctrl+Shift+M')
def MyMLayout(target, sender, args):
from Microsoft.Intellipad.Shell import NamedCommands
from Microsoft.Intellipad.Host import HostWindow
# Open a file / project... Not needed here yet, i just open all files in one sweep by hand.
# Common.OpenBuffer(sender, args)
# there should be an openfiles in project command.
# then you can view the first file in the project and do your M things.
# Common.OpenFilesInActiveView(["generic.m]", sender) (dont know how to pass this collection yet)
#ofh = OpenFileHelper(Core.FileDialogFilter)
#OpenFilesInActiveView(ofh.GetFiles(), sender)
# wait for buffer to open and switch into M mode
# Common.DrainDispatcher() NN anymore
# This command is available if the target view is in M mode. Otherwise (say, open-file cancel and
# no M file already in view), this is a no-op
NamedCommands.FromName('{Microsoft.M}TSqlPreview').Execute(None, target)
#begin show errors (with garble comments)
#NamedCommands.FromName('{Microsoft.Intellipad}ShowErrorList').Execute(None, sender)
#@Metadata.CommandExecuted('{Microsoft.Intellipad.Host}HostWindow', '{Microsoft.Intellipad}ShowErrorList', 'Ctrl+Shift+E')
#def ShowErrorList(target, sender, args):
#hostWindow = Core.Host.TopLevelWindows[0]
#hostWindow.activeView
hostWindow = HostWindow.GetHostWindowForBufferView(sender)
errorBuffer = Common.GetOrCreateErrorBuffer()
view = Common.GetView(hostWindow, errorBuffer)
if view is not None:
Common.SetActiveView(view)
return
view = hostWindow.ShowInRoot(errorBuffer, System.Windows.Controls.Orientation.Vertical, 20.0)
view.Mode = Common.Core.ComponentDomain.GetExportedObject[System.Object]('{Microsoft.Intellipad}ListMode')
#end show errors
# focus the M window
Common.SetActiveView(sender)
Performing my Final Project, looking into codename "Oslo". - Edited byElger [Centric] Monday, August 10, 2009 10:04 AMadded ctp
- Marked As Answer byElger [Centric] Monday, August 10, 2009 10:05 AM
-
| | Elger [Centric] |
|