slitaz-dev-tools rev 62

Add tazyad (README devels :-) yad will be used to replace gtkdialog
author Christophe Lincoln <pankso@slitaz.org>
date Wed Apr 06 00:58:18 2011 +0200 (2011-04-06)
parents 607faa239e26
children 7c1765f8e1e6
files tazyad/README tazyad/TODO tazyad/tazyad
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/tazyad/README	Wed Apr 06 00:58:18 2011 +0200
     1.3 @@ -0,0 +1,47 @@
     1.4 +Yad on SliTaz
     1.5 +================================================================================
     1.6 +
     1.7 +
     1.8 +Yad is the new prefered way to create GUI boxes for SliTaz desktop. We use
     1.9 +Yad GTK boxes for all user and administrator interfaces that can't be handled
    1.10 +by TazPanel (admin panel) or TazDE (desktop environment). Both are powered
    1.11 +by CGI scripts and use xHTML 5 and CSS 3 for the UI. Yad is a powerfull tool
    1.12 +witch support latest GTK actions and goodies. With our original GTKdialog
    1.13 +scripts some nice features was missing like for example --notification or
    1.14 +ENTER for event (with gtkdialog one must press a button).
    1.15 +
    1.16 +If you motivated to code, please have a look at the TODO file and continue
    1.17 +reading :-)
    1.18 +
    1.19 +
    1.20 +Coding guidlines
    1.21 +----------------
    1.22 +Use a function and a function_main for main= variable to keep datas,
    1.23 +that way we can have yad boxes commands separated from shell script.
    1.24 +Here is a structure example:
    1.25 +
    1.26 +# function_main
    1.27 +# function_other
    1.28 +# function
    1.29 +
    1.30 +Use gettext to have a translated application and forget echo. Use 'case'
    1.31 +as most as possible, it is the faster way to handle or parse commands
    1.32 +and options. Use fgrep when possible.
    1.33 +
    1.34 +To start you will find a template script called tazyad, copy it and start
    1.35 +coding from that :-). Tazyad is commented to help you getting started.
    1.36 +You can also have a look to tazpkg-notify who was the first official Yad
    1.37 +script for SliTaz.
    1.38 +
    1.39 +
    1.40 +Missing stuff
    1.41 +-------------
    1.42 +I'm member og Yad Google group and will mail them about SliTaz using Yad
    1.43 +and these missing features. Yad is a small projetc but the maintainer seems
    1.44 +a very nice guy who listen th his users :-)
    1.45 +
    1.46 +	* It would be nice to have an --exit or --kill option for notification
    1.47 +	* Not way to have a custom icon for custom button
    1.48 +
    1.49 +
    1.50 +================================================================================
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/tazyad/TODO	Wed Apr 06 00:58:18 2011 +0200
     2.3 @@ -0,0 +1,10 @@
     2.4 +
     2.5 +
     2.6 +	* desktopbox will be splitted into TazDE (planned for 5.0) for autostart
     2.7 +	  and Yad for logoutbox to replace 'desktopbox --logout' other function
     2.8 +	  are no more needed since user can add icon on desktop via LXpanel menu.
     2.9 +	  
    2.10 +	* subox to repplace existing GTKdialog subox
    2.11 +
    2.12 +	* Improve tazpkg-notify
    2.13 +	
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/tazyad/tazyad	Wed Apr 06 00:58:18 2011 +0200
     3.3 @@ -0,0 +1,55 @@
     3.4 +#!/bin/sh
     3.5 +#
     3.6 +# Yad on SliTaz - Create simple GUI boxes using Ash shell scripts.
     3.7 +#
     3.8 +# Copyright (C) 2011 SliTaz GNU/Linux - GNU gpl v2
     3.9 +#
    3.10 +# Authors : Name Firstname <mail@example.com>
    3.11 +#
    3.12 +
    3.13 +# Main GUI box function with pure Yad spec
    3.14 +skel_main() {
    3.15 +	yad --entry $opts \
    3.16 +		--width=400 \
    3.17 +		--image="slitaz-menu" \
    3.18 +		--image-on-top \
    3.19 +		--button="Button:2" \
    3.20 +		--button="gtk-ok:0" \
    3.21 +		--button="gtk-close:1" \
    3.22 +		--text="Choose action:" \
    3.23 +		--entry-text="install" "remove" "list" "upgrade"
    3.24 +}
    3.25 +
    3.26 +# This is a function, usually the same name than the command if script
    3.27 +# have multiple commands an options.
    3.28 +skel() {
    3.29 +	# Store box results
    3.30 +	main=`skel_main`
    3.31 +	ret=$?
    3.32 +	# Deal with --button values
    3.33 +	case $ret in
    3.34 +		1) exit 0 ;;
    3.35 +		2) echo "Additonal button action" && exit 0 ;;
    3.36 +		*) continue ;;
    3.37 +	esac
    3.38 +	# Deal with $main values
    3.39 +	case $main in
    3.40 +		install) echo "Main var: $main" ;;
    3.41 +		remove) echo "Main var: $main" ;;
    3.42 +		*) echo "Main var: $main" ;;
    3.43 +	esac
    3.44 +}
    3.45 +
    3.46 +#
    3.47 +# Script commands
    3.48 +#
    3.49 +
    3.50 +case "$1" in
    3.51 +	usage)
    3.52 +		echo "Usage: `basename $0` [command]" ;;
    3.53 +	*) 
    3.54 +		skel ;;
    3.55 +esac
    3.56 +
    3.57 +exit 0
    3.58 +