Hello,

I would like to register as developer to give my codes at free disposal.
I'm registered at SourceForge as "zigggy". 

I attached an update for Sren Haubergs Octave-function
"zenity_progress". I tested it and hope it's bugfree.

Best regards, Siegfried Hille.


## Copyright (C) 2006  Sren Hauberg
## Modified 2012 by Siegfried Hille <siegfried.hi...@gmail.com>
## 
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.
## 
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.
## 
## You should have received a copy of the GNU General Public License
## along with this program; If not, see <http://www.gnu.org/licenses/>.

## -*- texinfo -*-
## @deftypefn  {Function File} @var{h} = zenity_progress(@var{title}, @var{text}, @var{option1}, @var{option2}, @var{option3})
## @deftypefnx {Function File} zenity_progress(@var{h}, @var{progress})
## @deftypefnx {Function File} zenity_progress(@var{h}, @var{progress}, @var{text})
## Displays a graphical progress bar.
## If the first argument is either non-present or a string, a new progress bar is
## created and a handle is returned. If the first argument is a string it will be
## used as the title of the progress bar. The two first optional arguments @var{option1}
## and @var{option2} can be
## @table @samp
## @item auto-close
## The progress bar will be closed when it reaches 100.
## @item pulsate
## The progress bar will pulsate.
## @end table
##
## @var{option3} shows an user-specified icon:
##
## @table @samp
## @item 'icon','path'
## In the left upper corner of the dialog you see the picture given with 'path'. The picture must have icon-size (16x16 pixel)
## @end table
## 
## If the first argument is a handle to a progress bar and the second
## argument is an integer, the progress bar will set its current value
## to the given integer. If the second argument is a string, the text
## of the progress bar will be set to the given string.
## It is possible to pass both an integer and a string to the function
## in one function call.
##
## @seealso{zenity_calendar, zenity_list, zenity_entry, zenity_message,
## zenity_text_info, zenity_file_selection, zenity_notification}
## @end deftypefn

function pid = zenity_progress(varargin)

l = length(varargin);
k = 0;
options = '';

while k<l;
	k=k+1;
	opt = varargin{k};
	switch opt
		case {'autoclose','auto-close','auto'}
			options = sprintf("%s --auto-close", options);
		case {'pulsate','Pulsate'}
  			options = sprintf("%s --pulsate", options);
  		case {'icon','pic','Icon','Pic','ICON'}
  			if k<l; 
  				k=k+1;
  				icon = strtrim(varargin{k});
  				if exist(icon);
  					options = [options ' --window-icon="' icon '"'];
  				end
  			end 
  		otherwise
  			if ischar(opt); 
  				if exist('txt');
  					txt = [txt ' --text="' opt '"'];
  					TXT = [TXT char([10 13]) '#' opt];
  				else	
  					txt = [' --title="' opt '" --width=' num2str(length(opt)*10)];
  					TXT = [char([10 13]) '#' opt];
				end
			end
	end
	if isnumeric(opt) && k==1; 
		handle = opt;
	end
	if isnumeric(opt) && k>1; 
		progress = opt;
	end
	clear opt
end

if exist('handle');
	if exist('progress') == 0; progress =10; end
	out = [num2str(progress) TXT char([10 13])];
	fputs(handle, out);
else	
	pid = popen(["zenity --progress ", options, " ", txt], "w");
end
endfunction
------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Octave-dev mailing list
Octave-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/octave-dev

Reply via email to