Hi all,

I've always wanted to display an associated image with a command when
I scroll through the Commands menu (e.g., Firefox logo when the
Commands menu option for launching a browser is selected).  Someone
had asked the same question back in 2007 but I didn't see a
resolution.  After digging through the code in command.py and adding a
bunch of print statements, I finally found a solution that involves
just a one-line change in the code:

From:
item.image   = util.getimage(item.cmd)

To:
item.image   = fxd.childcontent(node, 'image')

This change looks for an image tag in the commands fxd file, where you
would specify the location and name of the image file you want to
display with this command.  For example:

<?xml version="1.0" ?>
<freevo>
    <command title="Do something">
        <cmd>/path/to/myscript.sh</cmd>
        <image>/path/to/logos/mylogo.png</image>
        <stoposd />
        <info>
            <content>Display an image with my command</content>
        </info>
    </command>
</freevo>

In the original statement, it looks like util.getimage is used to
retrieve an image from the location of the command?  Maybe there's
some trick to getting this to work, but I tried placing an image file
in the same directory as my command and util.getimage(item.cmd) just
returned "None".

Anyway, with the simple change above, I can now specify an image for a
command in the same manner as is done for other types of fxd files,
such as those for audio and image items.

Art S R

------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and 
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today. 
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
Freevo-users mailing list
Freevo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freevo-users

Reply via email to