Project

General

Profile

Actions

Bug #4244

closed

Dragging ImageAttribute into Kepler results in not finding the gif

Added by Christopher Brooks over 14 years ago. Updated almost 14 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
build system
Target version:
Start date:
07/13/2009
Due date:
% Done:

0%

Estimated time:
Bugzilla-Id:
4244

Description

Start Kepler
Search for ImageAttribute
Drag in the Image icon.
The following exception appears.

I think this is because ptIIplanetIcon.gif is not being copied?
build-area/settings/ptolemy-includes
is probably the file to edit. I edited it but running "ant run"
or "ant change-to -Dsuite=kepler" does not seem to help.

There is probably a larger problem in that every Ptolemy actor
that uses a resource such as a gif or sound file that is located
in the Ptolemy tree needs to be identified and the build system
updated to properly copy the resource.

Here's the exception:
ptolemy.kernel.util.IllegalActionException: Error evaluating expression: $PTII/ptolemy/vergil/kernel/attributes/ptIIplanetIcon.gif
in .Unnamed1.Image.source
Because:
Cannot read file '/Users/cxh/src/kepler/ptolemy/target/classes/ptolemy/vergil/kernel/attributes/ptIIplanetIcon.gif'
in .Unnamed1.Image.source
Because:
Cannot read file '/Users/cxh/src/kepler/ptolemy/target/classes/ptolemy/vergil/kernel/attributes/ptIIplanetIcon.gif' or '/Users/cxh/src/kepler/ptolemy/target/classes/ptolemy/vergil/kernel/attributes/ptIIplanetIcon.gif'
at ptolemy.data.expr.Variable.validate(Variable.java:1450)
at ptolemy.moml.MoMLParser.endDocument(MoMLParser.java:667)
at com.microstar.xml.XmlParser.doParse(XmlParser.java:162)
at com.microstar.xml.XmlParser.parse(XmlParser.java:132)
at ptolemy.moml.MoMLParser.parse(MoMLParser.java:1398)
at ptolemy.moml.MoMLParser.parse(MoMLParser.java:1370)
at ptolemy.moml.MoMLParser.parse(MoMLParser.java:1526)
at ptolemy.moml.MoMLChangeRequest._execute(MoMLChangeRequest.java:270)
at ptolemy.kernel.util.ChangeRequest.execute(ChangeRequest.java:171)
at ptolemy.kernel.util.NamedObj.executeChangeRequests(NamedObj.java:699)
at ptolemy.kernel.util.NamedObj.requestChange(NamedObj.java:1687)
at ptolemy.actor.CompositeActor.requestChange(CompositeActor.java:1349)
at ptolemy.vergil.basic.EditorDropTarget$DTListener.drop(EditorDropTarget.java:450)
at java.awt.dnd.DropTarget.drop(DropTarget.java:430)
at sun.awt.dnd.SunDropTargetContextPeer.processDropMessage(SunDropTargetContextPeer.java:500)
at sun.awt.dnd.SunDropTargetContextPeer.access$800(SunDropTargetContextPeer.java:53)
at sun.awt.dnd.SunDropTargetContextPeer$EventDispatcher.dispatchDropEvent(SunDropTargetContextPeer.java:812)
at sun.awt.dnd.SunDropTargetContextPeer$EventDispatcher.dispatchEvent(SunDropTargetContextPeer.java:736)
at sun.awt.dnd.SunDropTargetEvent.dispatch(SunDropTargetEvent.java:29)
at java.awt.Component.dispatchEventImpl(Component.java:3926)
at java.awt.Container.dispatchEventImpl(Container.java:2068)
at java.awt.Component.dispatchEvent(Component.java:3903)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4256)
at java.awt.LightweightDispatcher.processDropTargetEvent(Container.java:4007)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3861)
at java.awt.Container.dispatchEventImpl(Container.java:2054)
at java.awt.Window.dispatchEventImpl(Window.java:1801)
at java.awt.Component.dispatchEvent(Component.java:3903)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:269)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:190)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:184)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:176)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

Actions #1

Updated by Christopher Brooks over 14 years ago

Below are some of the actors that call setExpression on $CLASSPATH
or $PTII and presumably include a resource in the actor.

I generated the list with:
adm/bin/ptIItxtfiles >& /tmp/f
cat /tmp/j | xargs grep setExpression > /tmp/e
egrep '(\$CLASSPATH|\$PTII)' /tmp/e

./ptolemy/actor/lib/jai/JAIImageReader.java: fileOrURL.setExpression("$CLASSPATH/doc/img/PtolemyII.jpg");
./ptolemy/actor/lib/javasound/AudioReader.java: .setExpression("$CLASSPATH/ptolemy/actor/lib/javasound/voice.wav");
./ptolemy/actor/lib/javasound/ClipPlayer.java: fileOrURL.setExpression("$PTII/ptolemy/actor/lib/javasound/voice.wav");
./ptolemy/actor/lib/jmf/MovieReader.java: .setExpression("$CLASSPATH/ptolemy/actor/lib/jmf/MrPtolemy.mov");
./ptolemy/actor/lib/security/KeyStoreActor.java: fileOrURL.setExpression("$PTII/ptKeystore");
./ptolemy/data/properties/lattice/PropertyConstraintSolver.java: .setExpression("$CLASSPATH\\trainedConstraints");
./ptolemy/domains/giotto/cgc/CActorBase.java: .setExpression("$PTII/ptolemy/domains/giotto/cgc/demo/task_code.c");
./ptolemy/domains/ptinyos/kernel/PtinyOSDirector.java: tosRoot.setExpression("$PTII/vendors/ptinyos/tinyos-1.x");
./ptolemy/domains/ptinyos/kernel/PtinyOSDirector.java: tosDir.setExpression("$PTII/vendors/ptinyos/tinyos-1.x/tos");
./ptolemy/vergil/actor/lib/MonitorImage.java: .setExpression("$CLASSPATH/ptolemy/vergil/kernel/attributes/ptIIplanetIcon.gif");
./ptolemy/vergil/kernel/attributes/ImageAttribute.java: .setExpression("$PTII/ptolemy/vergil/kernel/attributes/ptIIplanetIcon.gif");
./ptolemy/vergil/pdfrenderer/PDFAttribute.java: source.setExpression("$PTII/ptolemy/vergil/pdfrenderer/sample.pdf");

Chad writes:

We do handle the resources for actors, but we just make assumptions
about where they are located. We treat the ptolemy/ptolemy directory as
a source dir so we don't look for resources there. Since ptolemy has a
different organization than kepler, we need to add exclusions/inclusions
based on the different organization. If the pdf file were in
resources/** then it would be found. In order for it to be found where
it is now, I'd have to add all of the ptolemy source into the classpath,
which I don't really want to do because I want to be able to package
kepler with no source files at all.

The above list is a start, though not all the resources need to be copied.
I'd go with:

./ptolemy/vergil/actor/lib/MonitorImage.java: .setExpression("$CLASSPATH/ptolemy/vergil/kernel/attributes/ptIIplanetIcon.gif");
./ptolemy/actor/lib/security/KeyStoreActor.java: fileOrURL.setExpression("$PTII/ptKeystore");
./ptolemy/vergil/kernel/attributes/ImageAttribute.java: .setExpression("$PTII/ptolemy/vergil/kernel/attributes/ptIIplanetIcon.gif");
./ptolemy/vergil/pdfrenderer/PDFAttribute.java: source.setExpression("$PTII/ptolemy/vergil/pdfrenderer/sample.pdf");
./ptolemy/actor/lib/javasound/AudioReader.java: .setExpression("$CLASSPATH/ptolemy/actor/lib/javasound/voice.wav");
./ptolemy/actor/lib/javasound/ClipPlayer.java: fileOrURL.setExpression("$PTII/ptolemy/actor/lib/javasound/voice.wav");

If JAI and JMF are available in Kepler, then you will need these:

./ptolemy/actor/lib/jai/JAIImageReader.java: fileOrURL.setExpression("$CLASSPATH/doc/img/PtolemyII.jpg");
./ptolemy/actor/lib/jmf/MovieReader.java: .setExpression("$CLASSPATH/ptolemy/actor/lib/jmf/MrPtolemy.mov");

These can be ignored:
./ptolemy/data/properties/lattice/PropertyConstraintSolver.java: .setExpression("$CLASSPATH\\trainedConstraints");
./ptolemy/domains/giotto/cgc/CActorBase.java: .setExpression("$PTII/ptolemy/domains/giotto/cgc/demo/task_code.c");
./ptolemy/domains/ptinyos/kernel/PtinyOSDirector.java: tosRoot.setExpression("$PTII/vendors/ptinyos/tinyos-1.x");
./ptolemy/domains/ptinyos/kernel/PtinyOSDirector.java: tosDir.setExpression("$PTII/vendors/ptinyos/tinyos-1.x/tos");

A larger issue is the Ptolemy II demos that are available from within Kepler.
Some of them access data files that are in the demo directories. These data
files will need to be copied. One way to find out what's missing is
to follow the Ptolemy copyright link and run all the demos.

Actions #2

Updated by Christopher Brooks over 14 years ago

If this is not fixed in 2.0, then these actors should be removed and
any Ptolemy demos that use them removed from Kepler.

Isn't this as simple as adding files to
build-area/settings/ptolemy-include?

"ptolemy/actor/lib/javasound/voice.wav" is in that file, but apparently not
being copied. What is the procedure for having the build system copy
resources to a location that can be accessed at runtime?

Below is a list of demos that use the affected actors

cd ptII/ptolemy/configs/doc
grep .xml completeDemosPtinyKepler.htm | awk -F \" '{print $2}' > /tmp/x

bash-3.2$ grep ImageAttribute `cat /tmp/x` | awk '{print $1}' | sort | uniq
../../domains/continuous/demo/ContinuousInsideDE/ContinuousInsideDE.xml:
../../domains/continuous/demo/LevelCrossingDetector/LevelCrossingDetector.xml:
../../domains/continuous/demo/NewtonsCradle/NewtonsCradle.xml:
../../domains/continuous/demo/Sinusoid/Sinusoid.xml:
../../domains/ct/demo/SinuBouncingBall/SinuBouncingBall.xml:
../../domains/fsm/demo/ChainedTransitions/ChainedTransitions.xml:
../../vergil/kernel/attributes/demo/AnimateVergil/AnimateVergil.xml:
bash-3.2$ grep AudioReader `cat /tmp/x` | awk '{print $1}' | sort | uniq
../../domains/sdf/demo/SynthesizedVoice/SynthesizedVoice.xml:
bash-3.2$ grep ClipPlayer `cat /tmp/x` | awk '{print $1}' | sort | uniq
../../domains/de/demo/RealTimeComposite/RealTimeComposite.xml:
bash-3.2$

Actions #3

Updated by Christopher Brooks almost 14 years ago

Closing.
The problem was that dragging certain actors would fail because
resources associated with the actor were not present.

For example
Search Components -> "Image"
Under Workflow Documentation, drag "Image"

Formerly, this would fail because the gif was not included.
This now works.

I checked other actors listed in this bug and we are good to go
in Kepler-2.0-rc1

Actions #4

Updated by Redmine Admin almost 11 years ago

Original Bugzilla ID was 4244

Actions

Also available in: Atom PDF