Hi Steve,
Thanks for taking a look, I added this as a known limitation
to http://ptolemy.eecs.berkeley.edu/ptolemyII/ptII5.0/

The limitations page also has a patched version of
BasicGraphFrame.java from the Ptolemy II 5.0 tree available for
download.

Your patch below is against version 1.103 in the CVS head, which
has many whitespace changes when compared to the file that
was released with Ptolemy II 5.0.

I'll take a look at the other bug later.

_Christopher


--------

    I think it's my fault... I've checked in a fix.
    
    Basically: The mechanism for has changed slightly in version 5.0: it now
    uses the class mechanism for keeping track of the user library.
    The user library is a class and when vergil loads it instantiates a
    single
    instance of the class.  In this case, the actor was being saved in the
    instance, but
    not in the class, meaning that it was not being saved back to the file.
    
    If you download the source, you can patch the code:
    ===================================================================
    RCS file: /home/cvs/ptII/ptolemy/vergil/basic/BasicGraphFrame.java,v
    retrieving revision 1.103
    diff -r1.103 BasicGraphFrame.java
    1238c1238
    <             CompositeEntity library = (CompositeEntity) configuration
    ---
    >             CompositeEntity libraryInstance = (CompositeEntity)
    configuration
    1241c1241
    <             if (library == null) {
    ---
    >             if (libraryInstance == null) {
    1248c1248,1256
    <             configuration.openModel(library);
    ---
    >             // Note that the library in the configuration is an
    >             // instance of another model.  We have to go get the
    >             // original model to make sure that the change propagates
    >             // back to the file from which the library is loaded from.
    >             Tableau libraryTableau =
    configuration.openModel(libraryInstance);
    >             PtolemyEffigy libraryEffigy =
    >                 (PtolemyEffigy)libraryTableau.getContainer();
    >             CompositeEntity library =
    >                 (CompositeEntity)libraryEffigy.getModel();
    
    
    Alternatively, you can right click on the user library and "open" it...
    Then paste
    whatever you want in.
    
    On a related note, while trying this out, I ran across a nasty bug I
    haven't seen before:
    If you have an unnamed composite actor it's name is the empty string.
    If you use the dotted notation
    to access something inside it (e.g., the _location attribute), then it's
    name is "._location"
    unfortunately, names that begin with a dot are 'special' and are
    interpreted relative to the toplevel.
    You can see this problem if you open a new model, do graph -> Save Model
    in Library to save to the library,
    and then try to drag it in the library.  Vergil tries to reference it's
    _location attribute, but
    fails because of the above.
    
    Steve
    
    > -----Original Message-----
    > From: [EMAIL PROTECTED] 
    > [mailto:[EMAIL PROTECTED] On 
    > Behalf Of Edward A. Lee
    > Sent: Monday, August 08, 2005 12:07 PM
    > To: Reilly, Timothy (MN17)
    > Cc: ptolemy-hackers@eecs.berkeley.edu
    > Subject: Re: another question on libraries
    > 
    > 
    > Indeed there seems to be a bug here...
    > When I do "Save Actor In Library" on an actor, I get the 
    > library file opened ( ~/.ptolemyII/UserLibrary.xml), but the 
    > actor is not in it.  Strangely, the actor is in the 
    > UserLibrary in the actor library menu.  But why aren't these 
    > two the same thing?
    > 
    > I'll look into it, unless anyone else knows offhand what's up...
    > 
    > Edward
    > 
    > 
    > At 01:30 PM 8/4/2005 -0700, Reilly, Timothy (MN17) wrote:
    > 
    > >I have spent a lot of time with this library stuff the last two days 
    > >and I am pretty confused.
    > >
    > >
    > >
    > >I use utilities composite actor on a sheet.  I change the name of 
    > >composite actor to radar_if.  I then open a new sheet and 
    > open my model 
    > >of radar_if, the guts of the radar_if composite model.  I 
    > copy what is 
    > >in this sheet, look inside the composite actor radar_if, and 
    > paste what 
    > >was in the radar_if model into the inside of the composite actor 
    > >radar_if.  I then close the sheet with the model of radar_if , close 
    > >the sheet of the composite actor radar_if.  I now have a 
    > sheet with a 
    > >compsite actor radar_if, all the right ports and names, and 
    > >additionally the composite actor is in the userlibrary.  So far so 
    > >good.  For good measure I save the new composite actor as 
    > >radar_ifcomposite.  I then highlight the composite actor and 
    > click save 
    > >actor to library, it says the actor is already in the library.  The 
    > >timestamp on userlibrary is usually within a minute of all 
    > of this.  I 
    > >shut down Ptolemy, restart and the library I just made is 
    > not visible, 
    > >and if I load the library UserLibrary.xml  in my directory 
    > >(C:\Documents and Settings\E223049\.ptolemyII) it is empty.  
    > It looks 
    > >like
    > >this:
    > >
    > >
    > >
    > ><entity name="UserLibrary" class="ptolemy.moml.EntityLibrary"/
    > >
    > >
    > >
    > >It is like the UserLibrary does not actually get written, 
    > although some 

    > >write happens because the timestamps are about right.  What is
    > >going on?  Please _h_e_l_p me with this.  I guess I can just
    > >load my composite actor separately.  That is starting to look
    > >pretty good to me.
    > >
    > >
    > >
    > >Thanks,
    > >
    > >
    > >
    > >Tim
    > 
    > ------------
    > Edward A. Lee
    > Professor, Chair of the EE Division, Associate Chair of EECS
    > 231 Cory Hall, UC Berkeley, Berkeley, CA 94720
    > phone: 510-642-0253 or 510-642-0455, fax: 510-642-2845 
    > [EMAIL PROTECTED], http://ptolemy.eecs.berkeley.edu/~eal  
    > 
    > 
    > --------------------------------------------------------------
    > --------------
    > Posted to the ptolemy-hackers mailing list.  Please send 
    > administrative mail for this list to: 
    > [EMAIL PROTECTED]
    > 
    > 
    
    
    _______________________________________________
    Ptolemy maillist  -  [EMAIL PROTECTED]
    http://chess.eecs.berkeley.edu/ptolemy/listinfo/ptolemy
--------

----------------------------------------------------------------------------
Posted to the ptolemy-hackers mailing list.  Please send administrative
mail for this list to: [EMAIL PROTECTED]

Reply via email to