tazlito rev 133
tazlitobox: GTK box for flavors list, xterm use default colors and clean-up UI
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Sat Jan 23 12:05:55 2010 +0100 (2010-01-23) |
parents | a15b3d5a3ab6 |
children | e2ca73f557c3 |
files | tazlitobox |
line diff
1.1 --- a/tazlitobox Fri Jan 22 23:28:53 2010 +0100 1.2 +++ b/tazlitobox Sat Jan 23 12:05:55 2010 +0100 1.3 @@ -2,7 +2,9 @@ 1.4 # 1.5 # Gtkdialog box for Tazlito - SliTaz Live Tool. 1.6 # 1.7 -VERSION=2.0 1.8 +VERSION=2.2 1.9 + 1.10 +export BIN=$0 1.11 1.12 # Check if user is root. 1.13 check_root() 1.14 @@ -22,18 +24,46 @@ 1.15 cd /home/slitaz 1.16 } 1.17 1.18 +# We need to parse flavors.list for GTK tree. 1.19 +list_flavors() 1.20 +{ 1.21 + tazlito list-flavors | grep ^[a-z] | while read line 1.22 + do 1.23 + info=`echo -n $line | awk '{print $1 " " $2 " " $3}'` 1.24 + printinfo=`echo -n $line | awk '{print $1 "|" $2 "|" $3}'` 1.25 + echo "$printinfo|`echo $line | sed s/\"$info\"//`" 1.26 + done 1.27 +} 1.28 + 1.29 +recharge_list() 1.30 +{ 1.31 + xterm -geometry 90x14 \ 1.32 + -title "list-flavors --recharge" \ 1.33 + -e "tazlito list-flavors --recharge | grep ^[a-z] && sleep 2" 1.34 +} 1.35 + 1.36 +# When using gen-liveflavor, gen-flavor or gen-distro, user can put some 1.37 +# addfiles copied into the rootfs. 1.38 +addfiles_action() 1.39 +{ 1.40 + cd /home/slitaz 1.41 + mkdir -p distro/addfiles/rootfs 1.42 + mkdir -p distro/addfiles/rootcd 1.43 + file-manager distro/addfiles & 1.44 +} 1.45 + 1.46 export HELP=' 1.47 <window title="Tazlito Box - Help" icon-name="media-cdrom"> 1.48 - <vbox> 1.49 - <text use-markup="true"> 1.50 - <label>" 1.51 +<vbox> 1.52 + <text use-markup="true"> 1.53 + <label>" 1.54 <b>Tazlito Box - Help</b>" 1.55 - </label> 1.56 - </text> 1.57 - 1.58 - <frame Overview> 1.59 - <text wrap="true" width-chars="52" use-markup="true"> 1.60 - <label> 1.61 + </label> 1.62 + </text> 1.63 + 1.64 + <frame Overview> 1.65 + <text wrap="true" width-chars="52" use-markup="true"> 1.66 + <label> 1.67 " 1.68 Tazlito Box is a tiny interface to the SliTaz Live Tool aka Tazlito. 1.69 You can simply generate a LiveCD in a few minutes, using your 1.70 @@ -42,36 +72,61 @@ 1.71 packages. Tazlito commands are executed in a XTerm, you can 1.72 press ENTER or the mouse to close the window. 1.73 " 1.74 - </label> 1.75 - </text> 1.76 - </frame> 1.77 - 1.78 - <frame Default paths> 1.79 - <text wrap="true" width-chars="50" use-markup="true"> 1.80 - <label> 1.81 + </label> 1.82 + </text> 1.83 + </frame> 1.84 + 1.85 + <frame Default paths> 1.86 + <text wrap="true" width-chars="50" use-markup="true"> 1.87 + <label> 1.88 " 1.89 Distro : /home/slitaz/distro 1.90 Flavors : /home/slitaz/flavors 1.91 Packages : /home/slitaz/packages 1.92 " 1.93 - </label> 1.94 - </text> 1.95 - </frame> 1.96 - 1.97 - <hbox> 1.98 - <button> 1.99 - <input file icon="exit"></input> 1.100 - <action type="closewindow">HELP</action> 1.101 - </button> 1.102 - </hbox> 1.103 - 1.104 - </vbox> 1.105 + </label> 1.106 + </text> 1.107 + </frame> 1.108 + 1.109 + <hbox> 1.110 + <button> 1.111 + <input file icon="exit"></input> 1.112 + <action type="closewindow">HELP</action> 1.113 + </button> 1.114 + </hbox> 1.115 + 1.116 +</vbox> 1.117 </window> 1.118 ' 1.119 1.120 -# Execute tazlito commands in a XTerm. 1.121 -# tab-pos="GTK_POS_LEFT" 1.122 -export MAIN_DIALOG=' 1.123 +# List all flavors on the mirror. 1.124 +export LIST_FLAVORS_BOX=' 1.125 +<window title="Community flavors list" icon-name="tazlito"> 1.126 +<vbox> 1.127 + <tree> 1.128 + <width>500</width><height>200</height> 1.129 + <variable>COMMUNITY_FLAVOR</variable> 1.130 + <label>Name|ISO|Rootfs|Description</label> 1.131 + <input exported_column="0">$BIN list_flavors</input> 1.132 + </tree> 1.133 + <hbox> 1.134 + <button> 1.135 + <label>Recharge list</label> 1.136 + <input file icon="reload"></input> 1.137 + <action>$BIN recharge_list</action> 1.138 + <action>refresh:COMMUNITY_FLAVOR</action> 1.139 + </button> 1.140 + <button> 1.141 + <label>Exit</label> 1.142 + <input file icon="exit"></input> 1.143 + <action type="closewindow">LIST_FLAVORS_BOX</action> 1.144 + </button> 1.145 + </hbox> 1.146 +</vbox> 1.147 +</window>' 1.148 + 1.149 +# Execute tazlito commands in a XTerm. Notebook: tab-pos="GTK_POS_LEFT" 1.150 +export TAZLITO_BOX=' 1.151 <window title="Tazlito Box" icon-name="media-cdrom"> 1.152 <vbox> 1.153 1.154 @@ -111,19 +166,10 @@ 1.155 </hbox> 1.156 1.157 <hbox> 1.158 - <text use-markup="true"> 1.159 - <label>"<b>ISO image name :</b> "</label> 1.160 - </text> 1.161 - <entry> 1.162 - <default>slitaz</default> 1.163 - <variable>WRITEISO_NAME</variable> 1.164 - </entry> 1.165 - </hbox> 1.166 - <hbox> 1.167 <button> 1.168 <label>Writeiso</label> 1.169 <input file icon="forward"></input> 1.170 - <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x16 -title "writeiso" -e "tazlito writeiso $COMPRESSION $WRITEISO_NAME"</action> 1.171 + <action>xterm -geometry 80x16 -title "writeiso" -e "tazlito writeiso $COMPRESSION"</action> 1.172 </button> 1.173 </hbox> 1.174 </frame> 1.175 @@ -134,7 +180,8 @@ 1.176 " 1.177 Gen Live flavor will create a LiveCD based on all the currently 1.178 installed packages. To build the rootfs and ISO image it will use 1.179 -original SliTaz packages. 1.180 +original SliTaz packages. Some addfiles can be copied before gen 1.181 +distro. 1.182 " 1.183 </label> 1.184 </text> 1.185 @@ -151,17 +198,22 @@ 1.186 1.187 <hbox> 1.188 <button> 1.189 + <label>Addfiles</label> 1.190 + <input file icon="gtk-open"></input> 1.191 + <action>$BIN addfiles_action</action> 1.192 + </button> 1.193 + <button> 1.194 <label>Gen distro</label> 1.195 <input file icon="forward"></input> 1.196 <action>cd /home/slitaz</action> 1.197 <action>sed -i "s/ISO_NAME=.*/ISO_NAME=\"slitaz-$GEN_LIVEFLAVOR_NAME\"/" /etc/tazlito/tazlito.conf</action> 1.198 - <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x16 -title "gen-liveflavor" -e "tazlito gen-liveflavor $GEN_LIVEFLAVOR_NAME && echo -e \"----\nENTER to continue...\" && read close"</action> 1.199 + <action>xterm -geometry 80x16 -title "gen-liveflavor" -e "tazlito gen-liveflavor $GEN_LIVEFLAVOR_NAME && echo -e \"----\nENTER to continue...\" && read close"</action> 1.200 </button> 1.201 <button> 1.202 <label>Clean distro</label> 1.203 <input file icon="edit-clear"></input> 1.204 <action>cd /home/slitaz</action> 1.205 - <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x16 -title "clean-distro" -e "tazlito clean-distro && sleep 1"</action> 1.206 + <action>xterm -geometry 80x16 -title "clean-distro" -e "tazlito clean-distro && sleep 1"</action> 1.207 </button> 1.208 </hbox> 1.209 1.210 @@ -185,18 +237,10 @@ 1.211 <default>core</default> 1.212 <variable>COMMUNITY_FLAVOR</variable> 1.213 </entry> 1.214 - </hbox> 1.215 - 1.216 - <hbox> 1.217 <button> 1.218 <label>List flavors</label> 1.219 <input file icon="media-cdrom"></input> 1.220 - <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x16 -title "list-flavors" -e "tazlito list-flavors && echo -e \"----\nENTER to continue...\" && read close"</action> 1.221 - </button> 1.222 - <button> 1.223 - <label>Recharge list</label> 1.224 - <input file icon="reload"></input> 1.225 - <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x16 -title "list-flavors --recharge" -e "tazlito list-flavors --recharge && echo -e \"----\nENTER to continue...\" && read close"</action> 1.226 + <action type="launch">LIST_FLAVORS_BOX</action> 1.227 </button> 1.228 </hbox> 1.229 1.230 @@ -204,17 +248,17 @@ 1.231 <button> 1.232 <label>Get flavor</label> 1.233 <input file icon="forward"></input> 1.234 - <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x16 -title "get-flavor $COMMUNITY_FLAVOR" -e "tazlito get-flavor $COMMUNITY_FLAVOR && echo -e \"----\nENTER to continue...\" && read close"</action> 1.235 + <action>xterm -geometry 80x16 -title "get-flavor $COMMUNITY_FLAVOR" -e "tazlito get-flavor $COMMUNITY_FLAVOR && echo -e \"----\nENTER to continue...\" && read close"</action> 1.236 </button> 1.237 <button> 1.238 <label>Gen distro</label> 1.239 <input file icon="forward"></input> 1.240 - <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x16 -title "gen-distro" -e "tazlito gen-distro && echo -e \"----\nENTER to continue...\" && read close"</action> 1.241 + <action>xterm -geometry 80x16 -title "gen-distro" -e "tazlito gen-distro && echo -e \"----\nENTER to continue...\" && read close"</action> 1.242 </button> 1.243 <button> 1.244 <label>Clean distro</label> 1.245 <input file icon="edit-clear"></input> 1.246 - <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x16 -title "clean-distro" -e "tazlito clean-distro && sleep 1"</action> 1.247 + <action>xterm -geometry 80x16 -title "clean-distro" -e "tazlito clean-distro && sleep 1"</action> 1.248 </button> 1.249 </hbox> 1.250 </frame> 1.251 @@ -225,7 +269,7 @@ 1.252 <label> 1.253 " 1.254 Gen Flavor will generate a new flavor file based on rootfs in 1.255 -home/slitaz/distro. 1.256 +home/slitaz/distro. All addfiles will be include in the flavor file. 1.257 " 1.258 </label> 1.259 </text> 1.260 @@ -241,9 +285,14 @@ 1.261 </hbox> 1.262 <hbox> 1.263 <button> 1.264 + <label>Addfiles</label> 1.265 + <input file icon="gtk-open"></input> 1.266 + <action>$BIN addfiles_action</action> 1.267 + </button> 1.268 + <button> 1.269 <label>Gen new flavor</label> 1.270 <input file icon="forward"></input> 1.271 - <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x16 -title "gen-flavor $GEN_FLAVOR_NAME" -e "tazlito gen-flavor $GEN_FLAVOR_NAME && echo -e \"----\nENTER to continue...\" && read close"</action> 1.272 + <action>xterm -geometry 80x16 -title "gen-flavor $GEN_FLAVOR_NAME" -e "tazlito gen-flavor $GEN_FLAVOR_NAME && echo -e \"----\nENTER to continue...\" && read close"</action> 1.273 </button> 1.274 </hbox> 1.275 </frame> 1.276 @@ -267,7 +316,7 @@ 1.277 </entry> 1.278 <button> 1.279 <input file icon="accessories-text-editor"></input> 1.280 - <action>leafpad $CONFIG_FILE</action> 1.281 + <action>editor $CONFIG_FILE</action> 1.282 </button> 1.283 </hbox> 1.284 1.285 @@ -281,7 +330,7 @@ 1.286 </entry> 1.287 <button> 1.288 <input file icon="accessories-text-editor"></input> 1.289 - <action>leafpad $PKGS_LIST</action> 1.290 + <action>editor $PKGS_LIST</action> 1.291 </button> 1.292 </hbox> 1.293 1.294 @@ -305,9 +354,15 @@ 1.295 </window> 1.296 ' 1.297 1.298 -# Tazlitobox action 1.299 -check_root 1.300 -cd_flavors 1.301 -gtkdialog --center --program=MAIN_DIALOG 1.302 +case $1 in 1.303 + *_*) 1.304 + # Exec all function called by args (must have an underscore). 1.305 + $1 ;; 1.306 + *) 1.307 + # Tazlitobox action 1.308 + check_root 1.309 + cd_flavors 1.310 + gtkdialog --center --program=TAZLITO_BOX ;; 1.311 +esac 1.312 1.313 exit 0