Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

KDE File Dialog for SL

Dale Glass
Evil Scripter
Join date: 12 Feb 2006
Posts: 252
10-11-2006 16:45
This is a hack that adds a file open dialog to SL. Only works for images so far, but that can be fixed.

Full explanation on my blog, and here's the source. Consider it to be GPL licensed.

I'll be improving this further :-)
Dale Glass
Evil Scripter
Join date: 12 Feb 2006
Posts: 252
10-11-2006 17:10
Usage:

First, to compile this you need a compiler and the headers for the APR library.

Now, compile it, then edit the secondlife script, and add:
CODE

LD_PRELOAD=/path/to/upload_hook.so


right before this line:
CODE

LD_LIBRARY_PATH="`pwd`"/lib:"${LD_LIBRARY_PATH}" bin/do-not-directly-run-secondlife-bin $@ 2>&1 | (tee lastrun.log || cat)


You also need to put sl_upload.sh in your home directory and make it executable.
Millions Brewster
Registered User
Join date: 31 Mar 2006
Posts: 3
10-11-2006 17:35
Thanks for the work!

for anyone else running ubuntu without kde, here's how I got this to run:

install build-essential (duh)
install libapr0-dev (contains header files that this script uses)
install kdebase-bin (for kdialog)
install imagemagick (for convert)

add the following line to the secondlife script: export LD_PRELOAD=/full/path/to/upload_hook.so
make sl_upload.sh executable

Causes my SL client to freeze for several seconds when I try to upload, though. This may be the SL clients fault, which I'm leaning towards.
Dale Glass
Evil Scripter
Join date: 12 Feb 2006
Posts: 252
10-11-2006 17:59
From: Millions Brewster
Thanks for the work!
Causes my SL client to freeze for several seconds when I try to upload, though. This may be the SL clients fault, which I'm leaning towards.


That's normal. What it does is intercept the attempt to open the file, and show a dialog. So SL will remain frozen until the script ends running. The delay after upload you're seeing is probably due to convert.
Kel Hartunian
Reformed Solipsist
Join date: 6 May 2006
Posts: 28
10-11-2006 18:08
Millions beat me to the punch about the build dependencies for this one.

For Gnome-based distro users who don't want to use KDE dependencies (kdebase-bin was going to be ~23 megabyte download for me on Ubuntu 6.10 beta), the following works quite well. Might run a bit quicker than invoking kdialog in a Gnome environment too.

GPL, of course, as it descends from Dale's code.

sl_upload.sh:
CODE

file=$1
echo File: $1
selected=`zenity --title="Choose a file to upload..." --file-selection --directory="~"`
echo Selected: ${selected}

rm -f "${file}"
convert "${selected}" "${file}"


You'll have to install zenity if your distro hasn't installed it by default.
_____________________
Kel Hartunian
Reformed Solipsist
Join date: 6 May 2006
Posts: 28
10-11-2006 18:39
With further testing of this on the Upload Image dialog, I've noticed something. If anyone else hasn't seen this, I'll assume it's a consequence of my Zenity substitution:

When uploading an image, I have to select the file twice:

Once to generate the nice preview window for SL where you put in the name and description.

Again after hitting the "Upload (L$10)" button, presumably to actually upload the file.

It's a bit tricky if you accidentally pick the wrong file that second time around. ;)
_____________________
Dale Glass
Evil Scripter
Join date: 12 Feb 2006
Posts: 252
10-11-2006 19:14
From: Kel Hartunian
With further testing of this on the Upload Image dialog, I've noticed something. If anyone else hasn't seen this, I'll assume it's a consequence of my Zenity substitution:

When uploading an image, I have to select the file twice:


Actually, that's a bug due to lack of testing ^_^;;

This is rather raw still. I'm working on improvements, such as support for zenity, and handling of sounds and animations. I've already got a script that will convert sounds to the format SL likes.

BTW, does the Linux client have bulk uploads? And where does it expect that data?
Dale Glass
Evil Scripter
Join date: 12 Feb 2006
Posts: 252
New version released!
10-12-2006 05:01
Ok, I released a new version.
Here's the source.

This version also handles sounds (sox required), and .bhv files (not tested). It fixes the problem with the dialog showing up multiple times, supports Zenity, and is easier to install. Just run 'make', and do what it says.
Zi Ree
Mrrrew!
Join date: 25 Feb 2006
Posts: 723
10-12-2006 06:37
Dale, next time I see you in-world I want to kiss you! :D

Brilliant!
_____________________
Zi!

(SuSE Linux 10.2, Kernel 2.6.13-15, AMD64 3200+, 2GB RAM, NVidia GeForce 7800GS 512MB (AGP), KDE 3.5.5, Second Life 1.13.1 (6) alpha soon beta thingie)

Blog: http://ziree.wordpress.com/ - QAvimator: http://qavimator.org

Second Life Linux Users Group IRC Channel: irc.freenode.org #secondlifelug
Dale Glass
Evil Scripter
Join date: 12 Feb 2006
Posts: 252
10-12-2006 06:46
From: Zi Ree
Dale, next time I see you in-world I want to kiss you! :D

Well, I'm at Luskwood right now ;)

From: Zi Ree
Brilliant!

Good to know people like it :)
Dale Glass
Evil Scripter
Join date: 12 Feb 2006
Posts: 252
10-12-2006 15:37
New version released.

This one should be friendlier, and if kdialog is used, will remember the last directory chosen for each file type. Full changelog
_____________________
Current projects:
TrustNet
Read my blog for news about them.