Register
It is currently Thu Apr 24, 2014 12:12 am

Need Help with zenity GUI Menu or any GUI Menu


All times are UTC - 6 hours


Post new topic Reply to topic  [ 2 posts ] 
Author Message
 PostPosted: Sun Jun 29, 2008 6:29 pm   

Joined: Sun Jun 29, 2008 6:16 pm
Posts: 1
OK, I very, very, very new at this and don't know what I doing. I'm really trying so try to be kind :). Here is what I'm trying to do. I have this script that I'm working on.

Code:
#!/bin/sh

# this is my first menu script.
# I'm tring to get Zenity to work with it So I can have a full GUI Menu
if [ $(whoami) != "root" ] ; then
      zenity --error \
          --text="Please Run This as Root"
exit 1
fi



clear;
        echo "Hello, What would you like me to install for you? "
       
        sleep 1
       
# GUI Menu I am Tring to get to work
#zenity --height=600 --width=800 \
#         --title="Install Menu" \
#         --text="Pick your Poison" \
#         --list \
#         --checklist \
#         --column="Pick This" \
#    --column="#" \
#    --column="Program" \
#         --column="Action" \
#          "False" "1" "Backgrounds" "(These are a colection from the all over the internet)" \
#          "False" "2" "Backgrounds" "(These are a colection from http://wallpapers-n-etc.com)" \
#          "False" "3" "icons" "(This will install some extra icon sets from gnome-look)" \
#          "False" "4" "Video setup" "(This will install DVD Playback Codecs and Players)" \
#          "False" "5" "themes" "(This will add some Extra Themes for gnome)" \
#          "False" "6" "compiz fusion" "(This will install Compiz Fusion from Fedora Repo)" \
#          "False" "7" "awn" "(This will install the AWN Dock)" \
         







#The Menu
        echo "..........................."
        echo "...........MENU............"
        echo
        echo "1 Backgrounds 1" "(These are a colection from the all over the internet)"
   echo "2 Backgrounds 2" "(These are a colection from http://wallpapers-n-etc.com)"
        echo "3 icons"  "(This will install some extra icon sets from gnome-look)"
#        echo "4 Video setup"  "(This will install DVD Playback Codecs and Players)"
#Still working on this
        echo "5 themes"  "(This will add some Extra Themes for gnome)"
        echo "6 compiz fusion"  "(This will install Compiz Fusion from Fedora Repo)"
        echo "7 awn"  "(This will install the AWN Dock)"

#Execute Menu Choice       
        read choice
      
        while [[ $choice != 0 ]]
        do
           case $choice in
             1)  clear;
       rpm -Uvh 'http://192.168.2.4/downloads/nfbackgrounds-1-1.fc9.noarch.rpm'
       P=nfbackgrounds
       rpm -qa "$P" > tl
       my_size=$( wc -l < t1 )
       echo "Checking install status"
       if [[ $( rpm -qa $P ) =~ ${P} ]]
       then
       zenity --info \
                --text="Backgrounds were installed.  Right click on desktop to change Background"
       else
         zenity --error \
             --text="Backgrounds Were not installed"
       fi
       rm t1               
                 ;;
        2)  clear;
       rpm -Uvh 'http://192.168.2.3/downloads/nfbackground2-1-1.fc9.noarch.rpm'
       P=nfbackgrounds2
       rpm -qa "$P" > t1
       my_size=$( wc -l < t1 )
       echo "Checking install status"
       if [[ $( rpm -qa $P ) =~ ${P} ]]
       then
       zenity --info \
                --text="Backgrounds were installed.  Right click on desktop to change Background"
       else
         zenity --error \
             --text="Backgrounds Were not installed"
       fi
       rm t1               
       ;;
             3)  clear;
       yum -y install wget
       wget 192.168.2.4/downloads/nficons.tar.gz
       tar zxvf nficons.tar.gz -C /usr/share/icons
       rm nficons.tar.gz
                 ;;
             4)  clear;
                 su -c 'rpm -i http://rpm.livna.org/livna-release-8.rpm'
       wget 192.168.2.4/downloads/dvdplayback.sh
       sh dvdplayback.sh
       rm dvdplayback.sh
                 ;;
             5)  clear;
       yum -y install wget
                 wget 192.168.2.4/downloads/nfthemesf8.tar.gz
                 tar zxvf nfthemesf8.tar.gz -C /usr/share/themes
       rm nfthemesf8.tar.gz
       ;;
             6)  clear;
                 yum -y install ccsm emerald-themes compizconfig-backend-kconfig compizconfig-backend-gconf fusion-icon* emerald compiz-fusion compiz-fusion-gnome libcompizconfig compiz-gnome compiz-bcop compiz compizconfig-python compiz-fusion-extras compiz-fusion-extras-gnome compiz-kde
       P=compiz-fusion-gnome
       rpm -qa "$P" > t1
       my_size=$( wc -l < t1 )
       echo "Checking install status"
       if [[ $( rpm -qa $P ) =~ ${P} ]]
       then
       zenity --info \
                --text="compiz fusion was installed."
       else
         zenity --error \
             --text="compiz fusion was not installed"
       fi
       rm t1
                 ;;
             7)  clear;
                 yum -y install avant-window-navigator awn-extras
                 P=avant-window-navigator
       rpm -qa "$P" > t1
       my_size=$( wc -l < t1 )
       echo "Checking install status"
       if [[ $( rpm -qa $P ) =~ ${P} ]]
       then
       zenity --info \
                --text="avant-window-navigator was installed."
       else
         zenity --error \
             --text="avant-window-navigator was not installed"
       rm tl
       fi
       ;;
             *)  clear;
                 echo "You have entered an invalid option!"
                 ;;
           esac

#Menu Loop
        echo "..........................."
        echo "...........MENU............"
        echo
        echo "1 Backgrounds 1" "(These are a colection from the all over the internet)"
   echo "2 Backgrounds 2" "(These are a colection from http://wallpapers-n-etc.com)"
        echo "3 icons"  "(This will install some extra icon sets from gnome-look)"
#        echo "4 Video setup"  "(This will install DVD Playback Codecs and Players)"
        echo "5 themes"  "(This will add some Extra Themes for gnome)"
        echo "6 compiz fusion"  "(This will install Compiz Fusion from Fedora Repo)"
        echo "7 awn"  "(This will install the AWN Dock)"

         read choice
      done


Now what I'm trying to get working is the Zenity Menu. If I take the away the #'s the menu comes up the way I want it to. But my problem is how do I get it to run the commands that I have listed here 1-7? This is where I'm stuck. Hope I'm making sense and someone can help. If i run the script as is It work fine but it has to loop back after one command. I want it to have a GUI and be able to select more then one item to install at a time.
Thanks in advance for the help.


Top
 Profile WWW  
 PostPosted: Mon Jun 30, 2008 11:23 am   

Joined: Tue Apr 01, 2008 10:19 am
Posts: 49
I believe zenity generates either a return code or environment variable you can use for this. Check the manpage.


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot] and 3 guests


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 post attachments in this forum

Jump to:  


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP