octave-maintainers
[Top][All Lists]
Advanced

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

Re: addproperty: a `XXX' property already exists in the graphics object


From: Michael D Godfrey
Subject: Re: addproperty: a `XXX' property already exists in the graphics object
Date: Fri, 11 Dec 2009 11:22:10 -0800
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.4pre) Gecko/20091014 Fedora/3.0-2.8.b4.fc11 Thunderbird/3.0b4

On 12/11/2009 02:52 AM, Shai Ayal wrote:
So the question what to do about it? I have several suggestions
(listed in approximate order of complexity to implement)
1. turn the error into a warning
2. in the scripts, check if a propertiy exists before trying to add it
3. Make the added properties belong only to a specific object
instance, so when the instance will be deleted, so will all of it's
added properties
4. remove the addproperty command, and predefine all group objects
(this is matlab compatible)

Comments?

Shai
  
First, the present behavior is not appropriate.  Only being able to use
print once is obviously inconvenient.

About the suggestions (by number):

1. Getting a warning for all uses of these plot functions after the
    first, is not reasonable.  (But, of course, better than now.)
2. This is reasonable if the script is, in effect, trying to set a default
    value.  This is true in at least some cases.
    However, it appears that there is something wrong here.  I tried the following:
octave:6> addproperty ("__pixels_per_inch__", gcf, "double", resolution);
octave:7> isfield (figure_properties, "__pixels_per_inch__")
ans = 0
octave:8> figure_properties = get (gcf);
octave:9> isfield (figure_properties, "__pixels_per_inch__")
ans =  1

octave:18> close(1)
octave:19> isfield (figure_properties, "__pixels_per_inch__")
ans =  1
octave:20> plot_demods
title2 = airdata: 1/2 tapering,  a =  1.57, -0.70,  0.00,  b =  0.00,  0.07,  0.06,
octave:21> isfield (figure_properties, "__pixels_per_inch__")
ans =  1
octave:22> figure_properties = get (gcf);
octave:23> isfield (figure_properties, "__pixels_per_inch__")
ans = 0
octave:24> addproperty ("__pixels_per_inch__", gcf, "double", resolution);
error: addproperty: a `__pixels_per_inch__' property already exists in the graphics object
octave:24>
================================================
Thus, even though the print.m code tests for the presence of __pixels_per_inch__
and gets 0, the addproperty fails.  This should be fixed in any case.

3. I am not sure about this.  The properties are within an object instance, I thought.
    As always, scope needs careful thought.


reply via email to

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