<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Hi all,<br>
<br>
Just in case it can help someone else, here is the code I hacked
this morning to get a proper export menu on my figures.<br>
It really is a hack and should probably work only on my machine
(linux 64 bits, X window, ImageMagick) and with my current figure
layout:<br>
<br>
//////////////////////////////////////////////////////////<br>
<br>
// New menu<br>
h = uimenu(demo_fp, ...<br>
"label" , gettext("File"));<br>
<br>
// Export entry<br>
uimenu(h, ...<br>
"label" , gettext("Export Figure (Hack)"), ...<br>
"callback" , "exportHack();", ...<br>
"tag" , "export_menu");<br>
<br>
<br>
function exportHack()<br>
// Export figure with uicontrols to png using X server &
import (imagemagick)<br>
// Horrible hack the should only work on my machine (linux
64bits.<br>
// get around bug
<a class="moz-txt-link-freetext" href="http://bugzilla.scilab.org/show_bug.cgi?id=14836">http://bugzilla.scilab.org/show_bug.cgi?id=14836</a>
<a class="moz-txt-link-freetext" href="https://bugzilla.scilab.org/show_bug.cgi?id=14502">https://bugzilla.scilab.org/show_bug.cgi?id=14502</a><br>
h=gcbo;<br>
//current figure name<br>
figname=h.parent.parent.figure_name;<br>
//getting X server id for current window<br>
ret=unix_g("xwininfo -int -name " +""""+figname+"""");<br>
//hackish, depends directly on the syntax of xwininfo outputs<br>
tok=tokens(ret(2),':');<br>
tok=tokens(tok(3)," ")<br>
winid=tok(1);//X server windows id, as a string<br>
<br>
// File save dialog parameters<br>
file_mask=["*.png"];<br>
boxTitle="Export";<br>
//If previous filename is present, use it to start the dialog
in the corresponding directory<br>
if h.userdata~="" then<br>
dir=h.userdata;<br>
else<br>
dir=pwd();<br>
end<br>
dir<br>
PathFileName=uiputfile(file_mask,dir,boxTitle);<br>
// LD_LIBRARY_PATH required to get around bug:
<a class="moz-txt-link-freetext" href="http://bugzilla.scilab.org/show_bug.cgi?id=14143">http://bugzilla.scilab.org/show_bug.cgi?id=14143</a><br>
unix_s("LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/:$LD_LIBRARY_PATH
; import -window "+winid +" "+PathFileName)<br>
// keep savec filename for future reference.<br>
h.userdata=PathFileName;<br>
endfunction<br>
<br>
//////////////////////////////////////////////////////////<br>
<br>
<br>
Hope it helps,<br>
<br>
Antoine<br>
<br>
Le 04/11/2016 à 23:46, Philipp Mühlmann a écrit :<br>
</div>
<blockquote
cite="mid:CACf7ODt2-U6e4MrHbAae_4GuRA35W6LWg4B2CCFdc_CZOnmKRQ@mail.gmail.com"
type="cite">
<div dir="ltr">
<div>
<div>
<div>pittywise driver() does also not brings the
solution<br>
<br>
</div>
interstingly playing with usecanvas() made it possible to
only show pushbuttons in a figure.<br>
</div>
<br>
e.g.:<br>
</div>
<div>usecanvas(%T);<br>
</div>
<pre style="font-family:monospaced;font-style:normal"><span style="color:rgb(0,0,0)">f</span><span style="color:rgb(92,92,92)">=</span><span style="color:rgb(50,185,185)">figure</span><span style="color:rgb(74,85,219)">(</span><span style="color:rgb(74,85,219)">)</span><span style="color:rgb(0,0,0)">;</span>
<span style="color:rgb(50,185,185)">plot2d</span><span style="color:rgb(74,85,219)">(</span><span style="color:rgb(74,85,219)">)</span><span style="color:rgb(0,0,0)">;</span>
<span style="color:rgb(0,0,0)">h</span><span style="color:rgb(92,92,92)">=</span><span style="color:rgb(50,185,185)">uicontrol</span><span style="color:rgb(74,85,219)">(</span><span style="color:rgb(0,0,0)">f</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(188,143,143)">'</span><span style="color:rgb(188,143,143)">unit</span><span style="color:rgb(188,143,143)">'</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(188,143,143)">'</span><span style="color:rgb(188,143,143)">normalized</span><span style="color:rgb(188,143,143)">'</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(188,143,143)">"</span><span style="color:rgb(188,143,143)">style</span><span style="color:rgb(188,143,143)">"</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(188,143,143)">"</span><span style="color:rgb(188,143,143)">pushbutton</span><span style="color:rgb(188,143,143)">"</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(188,143,143)">"</span><span style="color:rgb(188,143,143)">string</span><span style="color:rgb(188,143,143)">"</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(188,143,143)">"</span><span style="color:rgb(188,143,143)">pushbutton</span><span style="color:rgb(188,143,143)">"</span><span style="color:rgb(0,0,0)">,</span> <span style="color:rgb(188,143,143)">'</span><span style="color:rgb(188,143,143)">Position</span><span style="color:rgb(188,143,143)">'</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(74,85,219)">[</span><span style="color:rgb(188,143,143)">0.1</span><span style="color:rgb(0,0,0)">,</span> <span style="color:rgb(188,143,143)">0.7</span><span style="color:rgb(0,0,0)">,</span> <span style="color:rgb(188,143,143)">0.2</span><span style="color:rgb(0,0,0)">,</span> <span style="color:rgb(188,143,143)">0.1</span><span style="color:rgb(74,85,219)">]</span><span style="color:rgb(74,85,219)">)</span><span style="color:rgb(0,0,0)">;</span>
<span style="color:rgb(0,0,0)">h</span><span style="color:rgb(92,92,92)">=</span><span style="color:rgb(50,185,185)">uicontrol</span><span style="color:rgb(74,85,219)">(</span><span style="color:rgb(0,0,0)">f</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(188,143,143)">'</span><span style="color:rgb(188,143,143)">unit</span><span style="color:rgb(188,143,143)">'</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(188,143,143)">'</span><span style="color:rgb(188,143,143)">normalized</span><span style="color:rgb(188,143,143)">'</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(188,143,143)">"</span><span style="color:rgb(188,143,143)">style</span><span style="color:rgb(188,143,143)">"</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(188,143,143)">"</span><span style="color:rgb(188,143,143)">frame</span><span style="color:rgb(188,143,143)">"</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(188,143,143)">"</span><span style="color:rgb(188,143,143)">string</span><span style="color:rgb(188,143,143)">"</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(188,143,143)">"</span><span style="color:rgb(188,143,143)">frame</span><span style="color:rgb(188,143,143)">"</span><span style="color:rgb(0,0,0)">,</span> <span style="color:rgb(188,143,143)">'</span><span style="color:rgb(188,143,143)">Position</span><span style="color:rgb(188,143,143)">'</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(74,85,219)">[</span><span style="color:rgb(188,143,143)">0.1</span><span style="color:rgb(0,0,0)">,</span> <span style="color:rgb(188,143,143)">0.5</span><span style="color:rgb(0,0,0)">,</span> <span style="color:rgb(188,143,143)">0.2</span><span style="color:rgb(0,0,0)">,</span> <span style="color:rgb(188,143,143)">0.1</span><span style="color:rgb(74,85,219)">]</span><span style="color:rgb(74,85,219)">)</span><span style="color:rgb(0,0,0)">;</span></pre>
<div><br>
but expoting this figure as a image file resulted in having
the know style.<br>
</div>
no pushbuttons rendered, only the figure of plot2d().....(also
not the frame)<br>
<br>
<br>
<br>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">2016-11-04 1:50 GMT+01:00 Philipp
Mühlmann <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:p.muehlmann@gmail.com" target="_blank">p.muehlmann@gmail.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div>
<div>
<div>
<div>
<div>
<div>
<div>it seems that:<br>
<br>
</div>
exportUI() only recognizes figure handles (and
axes) for the export.<br>
<br>
</div>
since pushbuttons etc. are not figure handles
they are not exported?<br>
<br>
</div>
<br>
</div>
e.g.: handles.mypushbotton.style = "pushbutton" <br>
<br>
...should be maybe "figure", "frame" or "axes" to be
recognized by exportUI().<br>
<br>
</div>
Seems to be the same with "printfigure()"<br>
<br>
<br>
<br>
<br>
</div>
sidequestion:<br>
<br>
</div>
Is it possible to export content of a xml-file to an
figure/image?<br>
<div>
<div>
<div>
<div><br>
</div>
<div>If so one could maybe use:<br>
<br>
<pre style="font-family:monospaced;font-style:normal"><span style="color:rgb(50,185,185)"> saveGui</span><span style="color:rgb(74,85,219)">(</span><span style="color:rgb(174,92,176);text-decoration:underline">gcf</span><span style="color:rgb(74,85,219)">(</span><span style="color:rgb(74,85,219)">)</span><span style="color:rgb(0,0,0)">,</span> <span style="color:rgb(188,143,143)">'</span><span style="color:rgb(188,143,143)">screenshot.xml</span><span style="color:rgb(188,143,143)">'</span><span style="color:rgb(74,85,219)">)</span><span style="color:rgb(0,0,0)">;</span></pre>
and than convert the content of the xml file into
an image?<br>
<br>
<br>
</div>
<div><br>
</div>
<div>
<div>
<div><br>
<div><br>
<br>
<div><br>
<br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="HOEnZb">
<div class="h5">
<div class="gmail_extra"><br>
<div class="gmail_quote">2016-11-03 23:08 GMT+01:00
Philipp Mühlmann <span dir="ltr"><<a
moz-do-not-send="true"
href="mailto:p.muehlmann@gmail.com"
target="_blank">p.muehlmann@gmail.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div>
<div>
<div>Dear all,<br>
<br>
</div>
searching a little how GUI's can be
"screenshotted" in Matlab gave me following:<br>
<br>
</div>
Request on a Matlab forum, see: <br>
</div>
<br>
<a moz-do-not-send="true"
href="https://de.mathworks.com/matlabcentral/newsreader/view_thread/146264"
target="_blank">https://de.mathworks.com/matla<wbr>bcentral/newsreader/view_threa<wbr>d/146264</a><br>
<br>
<div>[...] " In order to show users without
atlab on their desktop the output, i want to
create a export function."<br>
</div>
<div><br>
This could be the reason for having the
oppertunity of screenshotting a GUI.<br>
</div>
<div><br>
</div>
<div>Anyways:<br>
<br>
</div>
<div>to me it seems that following is needed to
do the trick:<br>
<br>
[name,path,index] = uiputfile<br>
saveas(guifigurehandle,[path name]);<br>
</div>
<div>
<div><br>
</div>
<div>while "saveas" calls "print"<br>
</div>
<div>see "ocatave" code: <a
moz-do-not-send="true"
href="https://fossies.org/dox/octave-4.0.3/saveas_8m_source.html"
target="_blank">https://fossies.org/dox/octave<wbr>-4.0.3/saveas_8m_source.html</a><br>
<br>
</div>
<div>The print.m code is than way beyond my
code understanding.<br>
</div>
<div>see "ocatave" code: <a
moz-do-not-send="true"
href="https://fossies.org/dox/octave-4.0.3/print_8m_source.html"
target="_blank">https://fossies.org/dox/octave<wbr>-4.0.3/print_8m_source.html</a><br>
<br>
</div>
<div><br>
</div>
<div>best regards,<br>
</div>
<div>Phil<br>
</div>
<div><br>
<br>
<br>
<br>
<br>
</div>
</div>
</div>
<div class="gmail_extra">
<div>
<div class="m_5555793096277834075h5"><br>
<div class="gmail_quote">2016-11-02 23:07
GMT+01:00 Rafael Guerra <span dir="ltr"><<a
moz-do-not-send="true"
href="mailto:jrafaelbguerra@hotmail.com"
target="_blank">jrafaelbguerra@hotmail.com</a>></span>:<br>
<blockquote class="gmail_quote"
style="margin:0 0 0 .8ex;border-left:1px
#ccc solid;padding-left:1ex">Hi Antoine,<br>
<br>
I do not have an answer but a question,
if you will.<br>
Why is it important for you to export
the whole shebang from Scilab?<br>
<br>
For the regular figures the export
functions work fine and generate
high-resolution post-script files.<br>
For the GUI figures, using external
screen capture software does not seem to
me to be a big handicap, but I might be
wrong and I therefore raise the
question.<br>
<br>
Thanks and regards,<br>
Rafael<br>
<div
class="m_5555793096277834075m_4348594392778442626HOEnZb">
<div
class="m_5555793096277834075m_4348594392778442626h5"><br>
<br>
-----Original Message-----<br>
From: users [mailto:<a
moz-do-not-send="true"
href="mailto:users-bounces@lists.scilab.org"
target="_blank">users-bounces@lists.sc<wbr>ilab.org</a>]
On Behalf Of Antoine Monmayrant<br>
Sent: Tuesday, November 01, 2016
9:41 PM<br>
To: Users mailing list for Scilab
<<a moz-do-not-send="true"
href="mailto:users@lists.scilab.org"
target="_blank">users@lists.scilab.org</a>><br>
Subject: [Scilab-users] Exporting
figures containing uicontrols to any
format<br>
<br>
Hi everyone,<br>
<br>
After a long fight to build fancy
graphics with uicontrols to demo
some physics, I am now stuck because
of bug 14502 ( <a
moz-do-not-send="true"
href="https://bugzilla.scilab.org/show_bug.cgi?id=14502"
rel="noreferrer" target="_blank">https://bugzilla.scilab.org/sh<wbr>ow_bug.cgi?id=14502</a>
).<br>
Basically, I have no way to export
my figure to any format (ie no
exportUI(gcf()) and no
xs2something).<br>
As any of you ever managed to export
a figure with uicontrols where both
the plots and the uicontrols are
well rendered?<br>
<br>
Antoine<br>
<br>
PS: for a bit of context, try the
following:<br>
<br>
1) Demos->GUI->Uicontrols 2
//(or any with uicontrols)<br>
2) h=gcf();xs2svg(h, 'h.svg'); // or
any other format<br>
3) open h.svg, it's empty<br>
<br>
______________________________<wbr>_________________<br>
users mailing list<br>
<a moz-do-not-send="true"
href="mailto:users@lists.scilab.org"
target="_blank">users@lists.scilab.org</a><br>
<a moz-do-not-send="true"
href="http://lists.scilab.org/mailman/listinfo/users"
rel="noreferrer" target="_blank">http://lists.scilab.org/mailma<wbr>n/listinfo/users</a><br>
______________________________<wbr>_________________<br>
users mailing list<br>
<a moz-do-not-send="true"
href="mailto:users@lists.scilab.org"
target="_blank">users@lists.scilab.org</a><br>
<a moz-do-not-send="true"
href="http://lists.scilab.org/mailman/listinfo/users"
rel="noreferrer" target="_blank">http://lists.scilab.org/mailma<wbr>n/listinfo/users</a><br>
</div>
</div>
</blockquote>
</div>
<br>
<br clear="all">
<br>
</div>
</div>
<span>-- <br>
<div
class="m_5555793096277834075m_4348594392778442626gmail_signature"
data-smartmail="gmail_signature">
<div dir="ltr">
<div>In Kanada is' ka' na' da. Sonst wär'
Kanada Jemanda.</div>
<div><br>
</div>
<div>There we have the salad.</div>
</div>
</div>
</span></div>
</blockquote>
</div>
<br>
<br clear="all">
<br>
-- <br>
<div class="m_5555793096277834075gmail_signature"
data-smartmail="gmail_signature">
<div dir="ltr">
<div>In Kanada is' ka' na' da. Sonst wär' Kanada
Jemanda.</div>
<div><br>
</div>
<div>There we have the salad.</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
<br clear="all">
<br>
-- <br>
<div class="gmail_signature" data-smartmail="gmail_signature">
<div dir="ltr">
<div>In Kanada is' ka' na' da. Sonst wär' Kanada Jemanda.</div>
<div><br>
</div>
<div>There we have the salad.</div>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>
<a class="moz-txt-link-freetext" href="http://lists.scilab.org/mailman/listinfo/users">http://lists.scilab.org/mailman/listinfo/users</a>
</pre>
</blockquote>
<br>
<p><br>
</p>
<pre class="moz-signature" cols="72">--
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
Antoine Monmayrant LAAS - CNRS
7 avenue du Colonel Roche
BP 54200
31031 TOULOUSE Cedex 4
FRANCE
Tel:+33 5 61 33 64 59
email : <a class="moz-txt-link-abbreviated" href="mailto:antoine.monmayrant@laas.fr">antoine.monmayrant@laas.fr</a>
permanent email : <a class="moz-txt-link-abbreviated" href="mailto:antoine.monmayrant@polytechnique.org">antoine.monmayrant@polytechnique.org</a>
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
</pre>
</body>
</html>