bugGNU Octave - Bugs: bug #37330, desktop() function

 
 

bug #37330: desktop() function

Submitted by:  Guillaume <gyom>
Submitted on:  Tue 11 Sep 2012 02:57:43 PM UTC  
 
Category:  Octave Function Severity:  2 - Minor
Priority:  3 - Low Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  None
Originator Name:  Guillaume Open/Closed:  Closed
Release:  dev Operating System:  Any

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

( Jump to the original submission)

Tue 20 Aug 2013 06:37:34 PM UTC, comment #14: 

Added new function in this changeset (http://hg.savannah.gnu.org/hgweb/octave/rev/5ff843d739fc).  Closing report.

Rik <rik5>
Project Administrator
Sat 17 Aug 2013 03:22:28 AM UTC, comment #13: 

I reviewed your patch and am ready to commit it.  How would you like to be credited?  We usually do "firstname lastname <email@address>".  Would you like to be added to the list of contributors as well?

Rik <rik5>
Project Administrator
Thu 15 Aug 2013 01:14:21 PM UTC, comment #12: 

Please find attached a new version of desktop.m reflecting recent discussion.
Is there a way in Octave to start the GUI from the command line?

(file #28849)

Guillaume <gyom>
Wed 14 Aug 2013 04:13:54 PM UTC, comment #11: 

I just checked in MATLAB: if the GUI is already running, typing "desktop" is a no-hop.
Calling "desktop" with more than one arguments returns an error:

Error using desktop
Too many input arguments.

and only two arguments are accepted:

Error using desktop (line 38)
DESKTOP input argument must be '-inuse' or '-norestore'

Guillaume <gyom>
Wed 14 Aug 2013 03:36:37 PM UTC, comment #10: 

I think we're all in agreement the only thing this function should do in Octave is tell whether the GUI is running for compatibility.

The proposed script that Guillaume attached treats zero args as an error, regardless of if the GUI is running. I'd even say treat more than one arg as an error.

if (nargin != 1)
  print_usage ();
elseif (! strcmpi (varargin{1}, "-inuse"))
  error ("desktop: invalid argument");
endif

Mike Miller <mtmiller>
Project Administrator
Wed 14 Aug 2013 03:20:28 PM UTC, comment #9: 

What should happen if the desktop is already running and you type "desktop"?  Should that be an error, a no-op, or should it start a second desktop?

John W. Eaton <jwe>
Project Administrator
Wed 14 Aug 2013 02:03:02 PM UTC, comment #8: 

I was not sure where the file should be (scripts/general or scripts/ui?) so the attachment is not a changeset but a straight file.
You might also have changed your mind after the recent discussion on the maintainer list regarding on whether to call isguirunning() or not.

(file #28840)

Guillaume <gyom>
Tue 13 Aug 2013 06:51:46 PM UTC, comment #7: 

Sure.  That sounds fine.  If you can prepare a changeset I will commit it.

Rik <rik5>
Project Administrator
Tue 13 Aug 2013 12:23:24 PM UTC, comment #6: 

Thanks. I was not aware of isguirunning(). Is the conclusion that we could add a desktop("-inuse") function that would call isguirunning() in Octave?

Guillaume <gyom>
Mon 29 Jul 2013 07:31:12 PM UTC, comment #5: 

True, it could call isguirunning(). I was going by the OP's example, where desktop -inuse means I can print HTML to the console. Or who knows what other capabilities scripts might infer from it. Might be safer to have the function exist so there's no error, but always return false.

Mike Miller <mtmiller>
Project Administrator
Mon 29 Jul 2013 06:46:24 PM UTC, comment #4: 

I think 'desktop ("-inuse") is closer in equivalency to isguirunning() for Octave since we won't use a Java desktop even if the GUI is running.

Rik <rik5>
Project Administrator
Mon 29 Jul 2013 05:04:11 PM UTC, comment #3: 

I can't find any public reference to this function either. However, from the description it seems that

desktop ("-inuse")

is identical to

usejava ("desktop")

Any other form of calling desktop() would be an error with invalid argument.

Mike Miller <mtmiller>
Project Administrator
Tue 11 Sep 2012 06:11:56 PM UTC, comment #2: 

I couldn't find it on the MathWorks' website as well; that's why I copied the help text.
There is no mention of this function being deprecated though. It is the matlab/general folder and is mentioned in the Contents.m there:

% Controlling the command window.
%   echo          - Display statements during function execution.
%   more          - Control paged output in command window.
%   diary         - Save text of MATLAB session.
%   format        - Set output format.
%   beep          - Produce beep sound.
%   desktop       - Start and query the MATLAB Desktop.
%   preferences   - Bring up MATLAB user settable preferences dialog.

An example of use is the following:

if desktop('-inuse')
  fprintf('<a href="matlab:doSomethingOnClick">message</a>\n');
else
  fprintf('message\n');
end

When not using the desktop, you don't want the HTML code being displayed in your console.

Guillaume <gyom>
Tue 11 Sep 2012 05:40:48 PM UTC, comment #1: 

Has this function been deprecated by Mathworks?  The complete list of functions for 2012A is available at http://www.mathworks.com/help/techdoc/ref/funcalpha.html and I don't find this function.

There is the function workspace() which is maybe related.

Rik <rik5>
Project Administrator
Tue 11 Sep 2012 02:57:43 PM UTC, original submission:  

In MATLAB (at least since 7.4 (R2007a)), there is a desktop() function:

 DESKTOP Start and query the MATLAB Desktop.
    DESKTOP starts the MATLAB Desktop using the configuration
    stored the last time the Desktop was run, or the default
    configuration if no configuration file is present.

    DESKTOP -NORESTORE doesn't restore the configuration from the last
    time the desktop was run.

    USED = DESKTOP('-INUSE') returns whether or not the Desktop is
    currently in use.  It does not start the Desktop.

It could be added to the list of Octave's unimplemented function; but having at least the option desktop('-inuse') to return false would help compatibility, in case the other options are not relevant in the Octave GUI framework.

Guillaume <gyom>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #28849:  desktop.m added by gyom (1KiB - application/vnd.wolfram.mathematica.package)
file #28840:  desktop.m added by gyom (1KiB - application/vnd.wolfram.mathematica.package)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by gyom (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

     

     

    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-08-20 rik5 StatusNeed Info => Fixed
        Open/ClosedOpen => Closed
    2013-08-15 gyom Attached File- => Added desktop.m, #28849
    2013-08-14 gyom Attached File- => Added desktop.m, #28840
    2013-07-29 mtmiller CategoryNone => Octave Function
        Priority5 - Normal => 3 - Low
    2012-09-11 rik5 Severity3 - Normal => 2 - Minor
        StatusNone => Need Info

    Back to the top


    Powered by Savane 3.5