octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Octave/backend interface proposal - Browser


From: BrowseOct
Subject: Re: Octave/backend interface proposal - Browser
Date: Tue, 22 Jan 2008 07:42:23 -0800 (PST)

I'm working on a very limited and different approach to a GUI. Octave is a
STDIN and STDOUT focused product. I'd like a functionalized library using
browser based java scripting as an alternative. (It's crude in this form,
but workable). 
I've needed to use a browser as a front end to html GUIs in Octave with
Stdin and Stdout. Both IE (4+) in windows and Firefox support console
output. This is based on Gunter Born's wscript page. It stops octave in the
process. I still support your scheme, but there is some browser based
interaction that would add a lot to Octave. 

I'm still working the firefox stuff and linux. 


Yes, it's still very crude, but it offers some simple opportunities for easy
development of GUI's with forms and browsers. 

The below example should work... 
In windows octave, a simple line like the following executes a cscript. 
[Status,Output] = System("cscript octave2.js"); 

The cscript returns the wscript.echo entries from the cscript batch file. 

octave2.js

//************************************************
// File:    Form1.js (WSH sample in JScript) 
// Author:  (c) G. Born modified for octave
//
// Using Internet Explorer 4 or 5 to retrieve
// form input
//************************************************
var Text2 = "You entered:\n";

// Launch Internet Explorer, and connect event handler.
var oIE = WScript.CreateObject("InternetExplorer.Application", "IE_");

oIE.Left = 50;           // Window position and other properties
oIE.Top = 100; 
oIE.Height = 100;
oIE.Width = 280;
oIE.MenuBar = 0;         // No menu
oIE.ToolBar = 0;
oIE.StatusBar = 0;
// Commented out because it causes a corrupted window border. 
// oIE.Resizable = 0     // Disable resizing.
oIE.navigate(GetPath() + "Form1.htm");  // Load form.
oIE.Visible = 1;         // Keep visible.

// Important: Wait until IE is ready.
while (oIE.Busy) {WScript.Sleep(200)}  // Suspend 

var ready = false;      // Form is still open.
   
// Wait until the user closes the form using
// the Close button in the upper right corner of the window.
// This sets ready to true in the onclose event.
while (!ready) {WScript.Sleep(500)}  // Suspend 

// Display the data obtained in the event handling procedure.
WScript.Echo(Text2 + "\n" + name + "\n" + age);

// We're ready now. The sample script terminates.
// Here you can add script-specific code.

// Event handler and helper

function IE_OnQuit()
{
    // Event handler is called if IE terminates.
    // This happens if the user clicks the Close button.
    // Retrieve the values.
    name = "Name: " + oIE.Document.ValidForm.fName.value;
    age = "Age: " + oIE.Document.ValidForm.fAge.value;
    ready = true;        // Indicate form is closed.
}

function GetPath()
{
    // Get script path because form (HTML file)
    // must be in the same folder.
    var path = WScript.ScriptFullName;
    path = path.substr(0, path.lastIndexOf("\\") + 1);
    return path;
}

//*** End


and the form which returns to the script on close. 

<form name="ValidForm">
    <p>
        Name: &nbsp;
        <input type="text" size="5" name="fName"> &nbsp;
        Age: &nbsp;
        <input type="text" size="3" name="fAge">
        <br>

        Password: &nbsp; 
        <input type="password" size="12" maxlength="8" name="fPassw">
        &nbsp; &nbsp; 
        <input type="button" name="Button1" value="OK">
        <br>

        <input type="checkbox" name="fPrinter" value="1" checked>
        Printer &nbsp;
        <input type="checkbox" name="fScreen" value="2">
        Screen
        <br>

        Remarks:
        <br> 

        <textarea cols="40" rows="5" name="fRemark">
        </textarea>
    </p>
</form>
</HTML>








Michael Goffioul-2 wrote:
> 
> Hi,
> 
> Following a chat I had with Shai, we though we would need at some
> point in time some kind of interaction between octave and any
> graphics backend (to exchange some information). After some
> discussions, we agreed on a scheme, whose skeleton would
> be something like in the attached files.
> 
> The idea is to define a graphics_backend interface (that the
> actual backend would implement) and attach to a figure the
> backend to which it belongs, which serves as an entry point
> for octave/backend interaction. This scheme should allow
> multiple backends running at the same time.
> 
> Example of possible interaction are:
> - closing a figure window
> - getting font metric information
> - getting drawing canvas size (useful to deal with normalized
> units)
> - other things we didn't think about yet
> 
> For the moment, only a gnuplot backend is defined and will
> be used as default.
> 
> If you're OK with the concept (and the implementation), please
> commit.
> 
> Michael.
> 
> 
Thanks J H

-- 
View this message in context: 
http://www.nabble.com/Octave-backend-interface-proposal-tp14987220p15021428.html
Sent from the Octave - Maintainers mailing list archive at Nabble.com.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]