Protege Script Tab - Minor Issue

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Protege Script Tab - Minor Issue

Scott L Holmes
Windows XP
Protege 3.1
Plugin 2.6
Ruby
 
While running scripts that take a little time to perform, I'd like to be able to output to the console periodically as the script is executing. For instance, while running a series of tests, I'd print to the console as each test executes (along with status). The current release of the Script Tab appears to be capturing the prints to sysout and displays it all at once at the end of the script. After looking at the source for the plugin, I can understand why this behavior.
 
So, I'd like to make a request to add a method to the ScriptConsole class that allows the hosted script to request a refresh/repaint.
 
As an aside, after digging around, I thought I should be able to do something along these lines:

  sleep 2
  $scriptConsole.captureSystemOut false
  $scriptConsole.println 'hey1'
  $scriptConsole.captureSystemOut true

  sleep 2
  $scriptConsole.captureSystemOut false
  $scriptConsole.println 'hey2'
  $scriptConsole.captureSystemOut true

Basically, sleep just ties up the computer for a couple of seconds and then I attempt to release the capture - even forcing a repaint with println but the behavior is the same as described above. I get hey1 and hey2 at the exact same time.

Scott

Reply | Threaded
Open this post in threaded view
|

Re: Protege Script Tab - Minor Issue

Olivier Dameron
Hello Scott,

On Fri, 17 Mar 2006 12:54:33 -0500, "Scott L Holmes" <[hidden email]> wrote:

> While running scripts that take a little time to perform, I'd like to be
> able to output to the console periodically as the script is executing. For
> instance, while running a series of tests, I'd print to the console as each
> test executes (along with status). The current release of the Script Tab
> appears to be capturing the prints to sysout and displays it all at once at
> the end of the script. After looking at the source for the plugin, I can
> understand why this behavior.
>
> So, I'd like to make a request to add a method to the ScriptConsole class
> that allows the hosted script to request a refresh/repaint.

Definitely a good idea.
I will look at it on Thursday.

Is that what your captureSystemOut function bellow is meant to do?

>
> As an aside, after digging around, I thought I should be able to do
> something along these lines:
>
>   sleep 2
>   $scriptConsole.captureSystemOut false
>   $scriptConsole.println 'hey1'
>   $scriptConsole.captureSystemOut true
>
>   sleep 2
>   $scriptConsole.captureSystemOut false
>   $scriptConsole.println 'hey2'
>   $scriptConsole.captureSystemOut true
>
> Basically, sleep just ties up the computer for a couple of seconds and then
> I attempt to release the capture - even forcing a repaint with println but
> the behavior is the same as described above. I get hey1 and hey2 at the
> exact same time.

whereas ther should be a 2 seconds delay (if captureSystemOut worked, that is), right?

Cheers,
Olivier

-------------------------------------------------------------------------
To unsubscribe go to http://protege.stanford.edu/community/subscribe.html

Reply | Threaded
Open this post in threaded view
|

Re: Protege Script Tab - Minor Issue

Scott L Holmes
Olivier wrote "Is that what your captureSystemOut function bellow is meant to do?"
 
I got that from your Javadocs. I figured it was worth a shot. So yeah.
 
2 second delay
Stop capturing sysout
Your source says
 
 public void println() {
  print("\n");
  text.repaint();
 }

So by doing a $scriptConsole.println 'hey1', I was hoping that the console textbox would refresh/update but didn't.
Then followed by a recapture so nothing else would break.
 
But Olivier, in the end, I re-wrote the console found here:
 
in Ruby. I will post soon as a Ruby sample (using Swing) at the wiki. Subrahmanyam writes to his console by appending to a Swing TextArea. In Ruby it looks like:
 
my_console << some_text
 
So I like it very much!
 
Scott
 
On 3/21/06, Olivier Dameron <[hidden email]> wrote:
Hello Scott,

On Fri, 17 Mar 2006 12:54:33 -0500, "Scott L Holmes" <[hidden email]> wrote:

> While running scripts that take a little time to perform, I'd like to be
> able to output to the console periodically as the script is executing. For
> instance, while running a series of tests, I'd print to the console as each
> test executes (along with status). The current release of the Script Tab
> appears to be capturing the prints to sysout and displays it all at once at
> the end of the script. After looking at the source for the plugin, I can
> understand why this behavior.
>
> So, I'd like to make a request to add a method to the ScriptConsole class
> that allows the hosted script to request a refresh/repaint.

Definitely a good idea.
I will look at it on Thursday.

Is that what your captureSystemOut function bellow is meant to do?

>
> As an aside, after digging around, I thought I should be able to do
> something along these lines:
>
>   sleep 2
>   $scriptConsole.captureSystemOut false
>   $scriptConsole.println 'hey1'
>   $scriptConsole.captureSystemOut true
>
>   sleep 2
>   $scriptConsole.captureSystemOut false
>   $scriptConsole.println 'hey2'
>   $scriptConsole.captureSystemOut true
>
> Basically, sleep just ties up the computer for a couple of seconds and then
> I attempt to release the capture - even forcing a repaint with println but
> the behavior is the same as described above. I get hey1 and hey2 at the
> exact same time.

whereas ther should be a 2 seconds delay (if captureSystemOut worked, that is), right?

Cheers,
Olivier

-------------------------------------------------------------------------
To unsubscribe go to http://protege.stanford.edu/community/subscribe.html