Home Download Buy Blog Forum Support

Input panel with console output

Input panel with console output

Postby toothrot on Wed Feb 17, 2010 1:25 am

I think it would be useful to be able to create an input panel with an ouput pane like the console,

It doesn't necessarily need to be it's own buffer, maybe just the ability to showInputPanel(*args, console=True) so we can throw a few lines of output there.

It might also be advantageous to be able to set a scratch buffer to occupy that space instead of sharing the regular console output

Anyone else think this might be handy?


- toothrot
toothrot
 
Posts: 28
Joined: Sun Dec 13, 2009 8:20 am

Re: Input panel with console output

Postby EJ12N on Thu Feb 18, 2010 4:04 pm

toothrot wrote:I think it would be useful to be able to create an input panel with an ouput pane like the console,

It doesn't necessarily need to be it's own buffer, maybe just the ability to showInputPanel(*args, console=True) so we can throw a few lines of output there.

It might also be advantageous to be able to set a scratch buffer to occupy that space instead of sharing the regular console output

Anyone else think this might be handy?


- toothrot


You can already have scratch buffers. view.setScratch(True)
EJ12N
 
Posts: 281
Joined: Tue Apr 21, 2009 5:23 pm

Re: Input panel with console output

Postby toothrot on Thu Feb 18, 2010 4:17 pm

I don't think you read my post correctly. ;)

I don't want a regular scratch buffer in the file viewing area...I want to have a scratch buffer in the console area with an input attached

- toothrot
toothrot
 
Posts: 28
Joined: Sun Dec 13, 2009 8:20 am

Re: Input panel with console output

Postby EJ12N on Thu Feb 18, 2010 4:34 pm

toothrot wrote:I don't think you read my post correctly. ;)

I don't want a regular scratch buffer in the file viewing area...I want to have a scratch buffer in the console area with an input attached

- toothrot


Oh... the only way I have gotten stuff to output to console is using stdout/stdin. Like if you do print "hello world" in a python script, the output will show in the console. But +1 on the console=True argument
EJ12N
 
Posts: 281
Joined: Tue Apr 21, 2009 5:23 pm

Re: Input panel with console output

Postby toothrot on Thu Feb 18, 2010 4:44 pm

Thinking more on it, this mode would also be good with making the input a little more persistent...

I guess when it comes down to it what I'd like is the ability to have a custom console, or able to intercept input to the existing console and veto (perhaps by returning False) sending it to the REPL. Our own output could then be directed to the console. In addition to not obscuring the current view for a few lines of output, this would allow custom commands (commands not in python syntax), and a little interaction if desired.
toothrot
 
Posts: 28
Joined: Sun Dec 13, 2009 8:20 am

Re: Input panel with console output

Postby EJ12N on Thu Feb 18, 2010 4:46 pm

This *might* be useful?
Code: Select all
import sublime, sublimeplugin, functools, sys

class testing(sublimeplugin.TextCommand):
   def run(self, view, args):
      window = view.window()
      window.showInputPanel('Type something:','boo',
         functools.partial(self.doConsole, window, view),None,None)

   def doConsole(self, window, view, inputText):
      sys.stdout.write(inputText)
EJ12N
 
Posts: 281
Joined: Tue Apr 21, 2009 5:23 pm

Re: Input panel with console output

Postby toothrot on Thu Feb 18, 2010 4:57 pm

Yes, I know you can write to console a couple different ways, and in fact, if you call windomw.showInputPanel again in the handler for the input , you can't tell that the input panel was ever gone (though it would be nice if this could be avoided with some kind of persistent=True)

The only problem is the console being shown with the input, so it seems that just adding console=True, or otherwise allowing the console to be displayed with the input panel, would make what I'm wanting to do possible
toothrot
 
Posts: 28
Joined: Sun Dec 13, 2009 8:20 am


Return to Ideas and Feature Requests

Who is online

Users browsing this forum: No registered users and 8 guests

cron