Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Tue 25 Jun 2019, 03:57
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Unsorted
Picturelist-widget for scripts
Moderators: deshlab, Flash, GuestToo, Ian, JohnMurga, Lobster
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [9 Posts]  
Author Message
MU


Joined: 24 Aug 2005
Posts: 13647
Location: Karlsruhe, Germany

PostPosted: Fri 21 Apr 2006, 01:21    Post subject:  Picturelist-widget for scripts  



This is a small program, you can call from a shellscript.

Here are 2 extended examples, a picturebrowser with inbuilt fileselector, and a "Application-launcher":







It uses 4 configurationfiles.

config.rc has some global options, like Windowtitle and position:
Code:
width°°°600
height°°°400
x°°°20
y°°°100
title°°°Demo-list
buttonsright°°°1
buttonsrighttext°°°bottom
buttonsbottom°°°1
buttonsbottomtext°°°right
cellwidth°°°120
cellheight°°°60
cell1title°°°picture
cell2title°°°image#location
defaulttext°°°helptext.txt
textheight°°°40


Special note 1:
You must replace spaces " " with "#", or it will not work.

Special note 2:
buttonsbottom°°°1
can be 1 or 0.
1 uses buttons at bottom, 0 does not.

Same with
buttonsright°°°1

buttonbottomtext°°°right
and
buttonsrighttext°°°bottom
can be bottom or right.
My Desktop-backgroundsetter has the Buttontexts under the pictures.


Here is an example of buttons.rc:
Code:
reload
icons/mini-turn.xpm
reload°°°./demo.sh#-nogui
help
icons/mini-question.xpm
man
edit#in#TheGimp
icons/gimp.xpm
gimp
quit
icons/mini-cross.xpm
exit


Each button has 3 lines:
the text
the location of a picture
the command to run.
The command will be executed with the path/name of the selected picture in the list as parameter.

There are 3 internal commands:
exit - closes the application
reload - runs a script that can update list.rc , and then the list is reloaded.
reloadf - Opens a fileselectotr, where you can choose a folder. Then it runs the script after °°° with the chosen folder as parameter.

list.rc
Code:
/usr/share/pixmaps/ballorange24.xpm
an#pbdbgspace#icon
/usr/share/pixmaps/bckgnd1.xpm
another


So each list-entry has 2 lines:
the location of a picture, and a descriptive text.
In this file spaces must be replaced with "#pbdbgspace#"!

If you want to display additional text, when an item is clicked, each entry needs 3 lines:
list.rc
Code:
Menudemo-files/abiword.jpg
Wordprocessing
Menudemo-files/1.txt
Menudemo-files/mtpaint.jpg
Graficsprocessing
Menudemo-files/2.txt


Here is a complete example-script, ain't that short?
Code:
#!/bin/bash

## set the path, so that we don't need absolute paths for all rcfiles

cd /usr/local/Gtk-picturelist-widget


## list.rc contains the entries displayed in the picturelist.
## an entry consists of 2 lines: the location of the file
## and a descriptive text

## create a new list

rm -f rc-files/list.rc
touch rc-files/list.rc


## fill it with some entries

ls /usr/share/pixmaps/*.xpm | while read a
do
echo $a >> rc-files/list.rc
echo $a >> rc-files/list.rc
done

## when this script is called by "list" to update list.rc , the we don't want to start list again

if [ "$1" != "-nogui" ];then
./list rc-files/config.rc rc-files/buttons.rc rc-files/list.rc
fi



Download: (48 kb)
http://dotpups.de/dotpups/Programming/Gtk-picturelist-widget.pup

Mark

Last edited by MU on Wed 14 Jun 2006, 09:55; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website 
MU


Joined: 24 Aug 2005
Posts: 13647
Location: Karlsruhe, Germany

PostPosted: Sat 22 Apr 2006, 00:51    Post subject:  

Update.

- 3 examples
- inbuilt Folder-selection
- you can now use buttons at the right and at bottom at the same time.

The binary is 20 kb in size.

Mark
Back to top
View user's profile Send private message Visit poster's website 
MU


Joined: 24 Aug 2005
Posts: 13647
Location: Karlsruhe, Germany

PostPosted: Sat 22 Apr 2006, 10:50    Post subject:  

Uploaded an update, priramily stability-bugfixes.

Mark
Back to top
View user's profile Send private message Visit poster's website 
MU


Joined: 24 Aug 2005
Posts: 13647
Location: Karlsruhe, Germany

PostPosted: Wed 14 Jun 2006, 09:50    Post subject:  

Update.
I added a optional textarea.
When you click on an entry in the list, a correspondig textfile is displayed.

Screenshot:


Mark
Back to top
View user's profile Send private message Visit poster's website 
MU


Joined: 24 Aug 2005
Posts: 13647
Location: Karlsruhe, Germany

PostPosted: Wed 30 Aug 2006, 07:43    Post subject:  

version 04 is available with source in this dotpup:
http://www.murga.org/~puppy/viewtopic.php?p=66028#66028

Now uses Gtk2.
Has the textwidget from the 3D-controlCenter rewritten for Gtk2. Updates the text now also if you click a button, not only by selecting something in the list.

If you click a button, the corresponding program will no longer run automatically in background, so that the app waits with refreshing the textwidget until the external program was closed.
Disadvantage: the window is not redrawn until the external program closes.
So use that only if required, else run it with "&" from the config-file.
Then everything behaves as before.

Next I will alter, that you must no longer put "#" instead of " " in the configs; code for that is in my newsticker already.

Nice would be a second list or even tree on the left, to allow to build KDE "kcontrol"-style Configuration Centers.

Mark
Back to top
View user's profile Send private message Visit poster's website 
MU


Joined: 24 Aug 2005
Posts: 13647
Location: Karlsruhe, Germany

PostPosted: Thu 31 Aug 2006, 12:01    Post subject:  

MU wrote:

Next I will alter, that you must no longer put "#" instead of " " in the configs; code for that is in my newsticker already.


Done. As there also was a bug with updating the textarea, this will be no new release, only a bugfix for 04.

Mark
Back to top
View user's profile Send private message Visit poster's website 
MU


Joined: 24 Aug 2005
Posts: 13647
Location: Karlsruhe, Germany

PostPosted: Fri 01 Sep 2006, 16:04    Post subject:  

I made a last change to V04.
in config.rc, no longer "°°°" is used as seperator, but "---".
This reduces potential unicode-problems.
And the textview-widget has a shadow now.

Mark
Back to top
View user's profile Send private message Visit poster's website 
MU


Joined: 24 Aug 2005
Posts: 13647
Location: Karlsruhe, Germany

PostPosted: Fri 08 Sep 2006, 18:42    Post subject:  

Updated Gtklist04MU again, there was a bug when passing the listparameters to scripts when reloading the lists.
I removed the source from the Gtk-Themechooser-dotpup, instead I added it to the new WizardMaker:
http://www.murga.org/~puppy/viewtopic.php?p=67774#67774

Mark
Back to top
View user's profile Send private message Visit poster's website 
MU


Joined: 24 Aug 2005
Posts: 13647
Location: Karlsruhe, Germany

PostPosted: Sun 10 Sep 2006, 00:48    Post subject:  

I made some major changes to Gtklist04MU.

The fileselection was removed completely, as it had several bugs, and you are more flexible using the one from Xdialog.

Fixed passing wrong values when none was selected.
Fixed that you could not directly start programs in background without a wrapperscript.

Added better automatic layout.

You now can deactivate the list AND the textfield, to create buttonbars.

The wizard now can be "remote-controlled" to reload the list and the textfield.
This is done by a new option in config.rc, where you can set something like
update---myupdater.sh

myupdater.sh then looks simply like this:
Code:
#!/bin/bash
sleep 1


If you run it, the wizard will detect it in the processlist, what triggers the reload.

More information in the new WizardMaker.

Mark
Back to top
View user's profile Send private message Visit poster's website 
Display posts from previous:   Sort by:   
Page 1 of 1 [9 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Unsorted
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0577s ][ Queries: 11 (0.0098s) ][ GZIP on ]