Fix error when no select option

This commit is contained in:
q3aql 2021-07-07 12:14:26 +02:00
parent 09b8eb3f3c
commit f68e76c37a
2 changed files with 188 additions and 168 deletions

View File

@ -44,50 +44,55 @@ while [ ${showMenu} -eq 0 ] ; do
color_selected=$(zenity --width=260 --height=520 --list --title "zenidrv-g203-lightsync ${VERSION} ($M_DATE)" \ color_selected=$(zenity --width=260 --height=520 --list --title "zenidrv-g203-lightsync ${VERSION} ($M_DATE)" \
--window-icon=${iconPath} --column "Select color from list :" "Black" "White" "Red" "Lime" "Blue" "Yellow" "Cyan" "Magenta" \ --window-icon=${iconPath} --column "Select color from list :" "Black" "White" "Red" "Lime" "Blue" "Yellow" "Cyan" "Magenta" \
"Silver" "Gray" "Maroon" "Olive" "Green" "Purple" "Teal" "Navy" ) "Silver" "Gray" "Maroon" "Olive" "Green" "Purple" "Teal" "Navy" )
if [ "${color_selected}" == "Black" ] ; then canceled=$?
color_apply="000000" if [ ${canceled} -eq 0 ] ; then
elif [ "${color_selected}" == "White" ] ; then if [ "${color_selected}" == "Black" ] ; then
color_apply="FFFFFF" color_apply="000000"
elif [ "${color_selected}" == "Red" ] ; then elif [ "${color_selected}" == "White" ] ; then
color_apply="FF0000" color_apply="FFFFFF"
elif [ "${color_selected}" == "Lime" ] ; then elif [ "${color_selected}" == "Red" ] ; then
color_apply="00FF00" color_apply="FF0000"
elif [ "${color_selected}" == "Blue" ] ; then elif [ "${color_selected}" == "Lime" ] ; then
color_apply="0000FF" color_apply="00FF00"
elif [ "${color_selected}" == "Yellow" ] ; then elif [ "${color_selected}" == "Blue" ] ; then
color_apply="FFFF00" color_apply="0000FF"
elif [ "${color_selected}" == "Cyan" ] ; then elif [ "${color_selected}" == "Yellow" ] ; then
color_apply="00FFFF" color_apply="FFFF00"
elif [ "${color_selected}" == "Magenta" ] ; then elif [ "${color_selected}" == "Cyan" ] ; then
color_apply="FF00FF" color_apply="00FFFF"
elif [ "${color_selected}" == "Silver" ] ; then elif [ "${color_selected}" == "Magenta" ] ; then
color_apply="C0C0C0" color_apply="FF00FF"
elif [ "${color_selected}" == "Gray" ] ; then elif [ "${color_selected}" == "Silver" ] ; then
color_apply="808080" color_apply="C0C0C0"
elif [ "${color_selected}" == "Maroon" ] ; then elif [ "${color_selected}" == "Gray" ] ; then
color_apply="800000" color_apply="808080"
elif [ "${color_selected}" == "Olive" ] ; then elif [ "${color_selected}" == "Maroon" ] ; then
color_apply="808000" color_apply="800000"
elif [ "${color_selected}" == "Green" ] ; then elif [ "${color_selected}" == "Olive" ] ; then
color_apply="008000" color_apply="808000"
elif [ "${color_selected}" == "Purple" ] ; then elif [ "${color_selected}" == "Green" ] ; then
color_apply="800080" color_apply="008000"
elif [ "${color_selected}" == "Teal" ] ; then elif [ "${color_selected}" == "Purple" ] ; then
color_apply="008080" color_apply="800080"
elif [ "${color_selected}" == "Navy" ] ; then elif [ "${color_selected}" == "Teal" ] ; then
color_apply="000080" color_apply="008080"
fi elif [ "${color_selected}" == "Navy" ] ; then
sleep 2 | zenity --progress --title "zenidrv-g203-lightsync ${VERSION} (${M_DATE})" --text "Applying Solid effect" \ color_apply="000080"
--window-icon=${iconPath} --pulsate --no-cancel --auto-close fi
g203-led.py lightsync solid "${color_apply}" sleep 2 | zenity --progress --title "zenidrv-g203-lightsync ${VERSION} (${M_DATE})" --text "Applying Solid effect" \
device_error=$? --window-icon=${iconPath} --pulsate --no-cancel --auto-close
if [ ${device_error} -eq 0 ] ; then g203-led.py lightsync solid "${color_apply}"
echo > /dev/null device_error=$?
if [ ${device_error} -eq 0 ] ; then
echo > /dev/null
else
zenity --title "zenidrv-g203-lightsync ${VERSION} ($M_DATE)" --error --window-icon=${iconPath} --width=280 \
--text "Device not found or connected"
fi
color_apply="none"
else else
zenity --title "zenidrv-g203-lightsync ${VERSION} ($M_DATE)" --error --window-icon=${iconPath} --width=280 \ color_apply="none"
--text "Device not found or connected"
fi fi
color_apply="none"
elif [ "${opcion}" == "Cycle" ] ; then elif [ "${opcion}" == "Cycle" ] ; then
sleep 2 | zenity --progress --title "zenidrv-g203-lightsync ${VERSION} (${M_DATE})" --text "Applying Cycle effect" \ sleep 2 | zenity --progress --title "zenidrv-g203-lightsync ${VERSION} (${M_DATE})" --text "Applying Cycle effect" \
--window-icon=${iconPath} --pulsate --no-cancel --auto-close --window-icon=${iconPath} --pulsate --no-cancel --auto-close
@ -103,50 +108,55 @@ while [ ${showMenu} -eq 0 ] ; do
color_selected=$(zenity --width=260 --height=520 --list --title "zenidrv-g203-lightsync ${VERSION} ($M_DATE)" \ color_selected=$(zenity --width=260 --height=520 --list --title "zenidrv-g203-lightsync ${VERSION} ($M_DATE)" \
--window-icon=${iconPath} --column "Select color from list :" "Black" "White" "Red" "Lime" "Blue" "Yellow" "Cyan" "Magenta" \ --window-icon=${iconPath} --column "Select color from list :" "Black" "White" "Red" "Lime" "Blue" "Yellow" "Cyan" "Magenta" \
"Silver" "Gray" "Maroon" "Olive" "Green" "Purple" "Teal" "Navy" ) "Silver" "Gray" "Maroon" "Olive" "Green" "Purple" "Teal" "Navy" )
if [ "${color_selected}" == "Black" ] ; then canceled=$?
color_apply="000000" if [ ${canceled} -eq 0 ] ; then
elif [ "${color_selected}" == "White" ] ; then if [ "${color_selected}" == "Black" ] ; then
color_apply="FFFFFF" color_apply="000000"
elif [ "${color_selected}" == "Red" ] ; then elif [ "${color_selected}" == "White" ] ; then
color_apply="FF0000" color_apply="FFFFFF"
elif [ "${color_selected}" == "Lime" ] ; then elif [ "${color_selected}" == "Red" ] ; then
color_apply="00FF00" color_apply="FF0000"
elif [ "${color_selected}" == "Blue" ] ; then elif [ "${color_selected}" == "Lime" ] ; then
color_apply="0000FF" color_apply="00FF00"
elif [ "${color_selected}" == "Yellow" ] ; then elif [ "${color_selected}" == "Blue" ] ; then
color_apply="FFFF00" color_apply="0000FF"
elif [ "${color_selected}" == "Cyan" ] ; then elif [ "${color_selected}" == "Yellow" ] ; then
color_apply="00FFFF" color_apply="FFFF00"
elif [ "${color_selected}" == "Magenta" ] ; then elif [ "${color_selected}" == "Cyan" ] ; then
color_apply="FF00FF" color_apply="00FFFF"
elif [ "${color_selected}" == "Silver" ] ; then elif [ "${color_selected}" == "Magenta" ] ; then
color_apply="C0C0C0" color_apply="FF00FF"
elif [ "${color_selected}" == "Gray" ] ; then elif [ "${color_selected}" == "Silver" ] ; then
color_apply="808080" color_apply="C0C0C0"
elif [ "${color_selected}" == "Maroon" ] ; then elif [ "${color_selected}" == "Gray" ] ; then
color_apply="800000" color_apply="808080"
elif [ "${color_selected}" == "Olive" ] ; then elif [ "${color_selected}" == "Maroon" ] ; then
color_apply="808000" color_apply="800000"
elif [ "${color_selected}" == "Green" ] ; then elif [ "${color_selected}" == "Olive" ] ; then
color_apply="008000" color_apply="808000"
elif [ "${color_selected}" == "Purple" ] ; then elif [ "${color_selected}" == "Green" ] ; then
color_apply="800080" color_apply="008000"
elif [ "${color_selected}" == "Teal" ] ; then elif [ "${color_selected}" == "Purple" ] ; then
color_apply="008080" color_apply="800080"
elif [ "${color_selected}" == "Navy" ] ; then elif [ "${color_selected}" == "Teal" ] ; then
color_apply="000080" color_apply="008080"
fi elif [ "${color_selected}" == "Navy" ] ; then
sleep 2 | zenity --progress --title "zenidrv-g203-lightsync ${VERSION} (${M_DATE})" --text "Applying Breathe effect" \ color_apply="000080"
--window-icon=${iconPath} --pulsate --no-cancel --auto-close fi
g203-led.py lightsync breathe "${color_apply}" sleep 2 | zenity --progress --title "zenidrv-g203-lightsync ${VERSION} (${M_DATE})" --text "Applying Breathe effect" \
device_error=$? --window-icon=${iconPath} --pulsate --no-cancel --auto-close
if [ ${device_error} -eq 0 ] ; then g203-led.py lightsync breathe "${color_apply}"
echo > /dev/null device_error=$?
if [ ${device_error} -eq 0 ] ; then
echo > /dev/null
else
zenity --title "zenidrv-g203-lightsync ${VERSION} ($M_DATE)" --error --window-icon=${iconPath} --width=280 \
--text "Device not found or connected"
fi
color_apply="none"
else else
zenity --title "zenidrv-g203-lightsync ${VERSION} ($M_DATE)" --error --window-icon=${iconPath} --width=280 \ color_apply="none"
--text "Device not found or connected"
fi fi
color_apply="none"
elif [ "${opcion}" == "Wave" ] ; then elif [ "${opcion}" == "Wave" ] ; then
sleep 2 | zenity --progress --title "zenidrv-g203-lightsync ${VERSION} (${M_DATE})" --text "Applying Wave effect" \ sleep 2 | zenity --progress --title "zenidrv-g203-lightsync ${VERSION} (${M_DATE})" --text "Applying Wave effect" \
--window-icon=${iconPath} --pulsate --no-cancel --auto-close --window-icon=${iconPath} --pulsate --no-cancel --auto-close

View File

@ -43,50 +43,55 @@ while [ ${showMenu} -eq 0 ] ; do
color_selected=$(zenity --width=260 --height=520 --list --title "zenidrv-g203-lightsync ${VERSION} ($M_DATE)" \ color_selected=$(zenity --width=260 --height=520 --list --title "zenidrv-g203-lightsync ${VERSION} ($M_DATE)" \
--window-icon=${iconPath} --column "Select color from list :" "Black" "White" "Red" "Lime" "Blue" "Yellow" "Cyan" "Magenta" \ --window-icon=${iconPath} --column "Select color from list :" "Black" "White" "Red" "Lime" "Blue" "Yellow" "Cyan" "Magenta" \
"Silver" "Gray" "Maroon" "Olive" "Green" "Purple" "Teal" "Navy" ) "Silver" "Gray" "Maroon" "Olive" "Green" "Purple" "Teal" "Navy" )
if [ "${color_selected}" == "Black" ] ; then canceled=$?
color_apply="000000" if [ ${canceled} -eq 0 ] ; then
elif [ "${color_selected}" == "White" ] ; then if [ "${color_selected}" == "Black" ] ; then
color_apply="FFFFFF" color_apply="000000"
elif [ "${color_selected}" == "Red" ] ; then elif [ "${color_selected}" == "White" ] ; then
color_apply="FF0000" color_apply="FFFFFF"
elif [ "${color_selected}" == "Lime" ] ; then elif [ "${color_selected}" == "Red" ] ; then
color_apply="00FF00" color_apply="FF0000"
elif [ "${color_selected}" == "Blue" ] ; then elif [ "${color_selected}" == "Lime" ] ; then
color_apply="0000FF" color_apply="00FF00"
elif [ "${color_selected}" == "Yellow" ] ; then elif [ "${color_selected}" == "Blue" ] ; then
color_apply="FFFF00" color_apply="0000FF"
elif [ "${color_selected}" == "Cyan" ] ; then elif [ "${color_selected}" == "Yellow" ] ; then
color_apply="00FFFF" color_apply="FFFF00"
elif [ "${color_selected}" == "Magenta" ] ; then elif [ "${color_selected}" == "Cyan" ] ; then
color_apply="FF00FF" color_apply="00FFFF"
elif [ "${color_selected}" == "Silver" ] ; then elif [ "${color_selected}" == "Magenta" ] ; then
color_apply="C0C0C0" color_apply="FF00FF"
elif [ "${color_selected}" == "Gray" ] ; then elif [ "${color_selected}" == "Silver" ] ; then
color_apply="808080" color_apply="C0C0C0"
elif [ "${color_selected}" == "Maroon" ] ; then elif [ "${color_selected}" == "Gray" ] ; then
color_apply="800000" color_apply="808080"
elif [ "${color_selected}" == "Olive" ] ; then elif [ "${color_selected}" == "Maroon" ] ; then
color_apply="808000" color_apply="800000"
elif [ "${color_selected}" == "Green" ] ; then elif [ "${color_selected}" == "Olive" ] ; then
color_apply="008000" color_apply="808000"
elif [ "${color_selected}" == "Purple" ] ; then elif [ "${color_selected}" == "Green" ] ; then
color_apply="800080" color_apply="008000"
elif [ "${color_selected}" == "Teal" ] ; then elif [ "${color_selected}" == "Purple" ] ; then
color_apply="008080" color_apply="800080"
elif [ "${color_selected}" == "Navy" ] ; then elif [ "${color_selected}" == "Teal" ] ; then
color_apply="000080" color_apply="008080"
fi elif [ "${color_selected}" == "Navy" ] ; then
sleep 2 | zenity --progress --title "zenidrv-g203-prodigy ${VERSION} (${M_DATE})" --text "Applying Solid effect" \ color_apply="000080"
--window-icon=${iconPath} --pulsate --no-cancel --auto-close fi
g203-led.py solid "${color_apply}" sleep 2 | zenity --progress --title "zenidrv-g203-prodigy ${VERSION} (${M_DATE})" --text "Applying Solid effect" \
device_error=$? --window-icon=${iconPath} --pulsate --no-cancel --auto-close
if [ ${device_error} -eq 0 ] ; then g203-led.py solid "${color_apply}"
echo > /dev/null device_error=$?
if [ ${device_error} -eq 0 ] ; then
echo > /dev/null
else
zenity --title "zenidrv-g203-prodigy ${VERSION} ($M_DATE)" --error --window-icon=${iconPath} --width=280 \
--text "Device not found or connected"
fi
color_apply="none"
else else
zenity --title "zenidrv-g203-prodigy ${VERSION} ($M_DATE)" --error --window-icon=${iconPath} --width=280 \ color_apply="none"
--text "Device not found or connected"
fi fi
color_apply="none"
elif [ "${opcion}" == "Cycle" ] ; then elif [ "${opcion}" == "Cycle" ] ; then
sleep 2 | zenity --progress --title "zenidrv-g203-prodigy ${VERSION} (${M_DATE})" --text "Applying Cycle effect" \ sleep 2 | zenity --progress --title "zenidrv-g203-prodigy ${VERSION} (${M_DATE})" --text "Applying Cycle effect" \
--window-icon=${iconPath} --pulsate --no-cancel --auto-close --window-icon=${iconPath} --pulsate --no-cancel --auto-close
@ -102,50 +107,55 @@ while [ ${showMenu} -eq 0 ] ; do
color_selected=$(zenity --width=260 --height=520 --list --title "zenidrv-g203-lightsync ${VERSION} ($M_DATE)" \ color_selected=$(zenity --width=260 --height=520 --list --title "zenidrv-g203-lightsync ${VERSION} ($M_DATE)" \
--window-icon=${iconPath} --column "Select color from list :" "Black" "White" "Red" "Lime" "Blue" "Yellow" "Cyan" "Magenta" \ --window-icon=${iconPath} --column "Select color from list :" "Black" "White" "Red" "Lime" "Blue" "Yellow" "Cyan" "Magenta" \
"Silver" "Gray" "Maroon" "Olive" "Green" "Purple" "Teal" "Navy" ) "Silver" "Gray" "Maroon" "Olive" "Green" "Purple" "Teal" "Navy" )
if [ "${color_selected}" == "Black" ] ; then canceled=$?
color_apply="000000" if [ ${canceled} -eq 0 ] ; then
elif [ "${color_selected}" == "White" ] ; then if [ "${color_selected}" == "Black" ] ; then
color_apply="FFFFFF" color_apply="000000"
elif [ "${color_selected}" == "Red" ] ; then elif [ "${color_selected}" == "White" ] ; then
color_apply="FF0000" color_apply="FFFFFF"
elif [ "${color_selected}" == "Lime" ] ; then elif [ "${color_selected}" == "Red" ] ; then
color_apply="00FF00" color_apply="FF0000"
elif [ "${color_selected}" == "Blue" ] ; then elif [ "${color_selected}" == "Lime" ] ; then
color_apply="0000FF" color_apply="00FF00"
elif [ "${color_selected}" == "Yellow" ] ; then elif [ "${color_selected}" == "Blue" ] ; then
color_apply="FFFF00" color_apply="0000FF"
elif [ "${color_selected}" == "Cyan" ] ; then elif [ "${color_selected}" == "Yellow" ] ; then
color_apply="00FFFF" color_apply="FFFF00"
elif [ "${color_selected}" == "Magenta" ] ; then elif [ "${color_selected}" == "Cyan" ] ; then
color_apply="FF00FF" color_apply="00FFFF"
elif [ "${color_selected}" == "Silver" ] ; then elif [ "${color_selected}" == "Magenta" ] ; then
color_apply="C0C0C0" color_apply="FF00FF"
elif [ "${color_selected}" == "Gray" ] ; then elif [ "${color_selected}" == "Silver" ] ; then
color_apply="808080" color_apply="C0C0C0"
elif [ "${color_selected}" == "Maroon" ] ; then elif [ "${color_selected}" == "Gray" ] ; then
color_apply="800000" color_apply="808080"
elif [ "${color_selected}" == "Olive" ] ; then elif [ "${color_selected}" == "Maroon" ] ; then
color_apply="808000" color_apply="800000"
elif [ "${color_selected}" == "Green" ] ; then elif [ "${color_selected}" == "Olive" ] ; then
color_apply="008000" color_apply="808000"
elif [ "${color_selected}" == "Purple" ] ; then elif [ "${color_selected}" == "Green" ] ; then
color_apply="800080" color_apply="008000"
elif [ "${color_selected}" == "Teal" ] ; then elif [ "${color_selected}" == "Purple" ] ; then
color_apply="008080" color_apply="800080"
elif [ "${color_selected}" == "Navy" ] ; then elif [ "${color_selected}" == "Teal" ] ; then
color_apply="000080" color_apply="008080"
fi elif [ "${color_selected}" == "Navy" ] ; then
sleep 2 | zenity --progress --title "zenidrv-g203-prodigy ${VERSION} (${M_DATE})" --text "Applying Breathe effect" \ color_apply="000080"
--window-icon=${iconPath} --pulsate --no-cancel --auto-close fi
g203-led.py breathe "${color_apply}" sleep 2 | zenity --progress --title "zenidrv-g203-prodigy ${VERSION} (${M_DATE})" --text "Applying Breathe effect" \
device_error=$? --window-icon=${iconPath} --pulsate --no-cancel --auto-close
if [ ${device_error} -eq 0 ] ; then g203-led.py breathe "${color_apply}"
echo > /dev/null device_error=$?
if [ ${device_error} -eq 0 ] ; then
echo > /dev/null
else
zenity --title "zenidrv-g203-prodigy ${VERSION} ($M_DATE)" --error --window-icon=${iconPath} --width=280 \
--text "Device not found or connected"
fi
color_apply="none"
else else
zenity --title "zenidrv-g203-prodigy ${VERSION} ($M_DATE)" --error --window-icon=${iconPath} --width=280 \ color_apply="none"
--text "Device not found or connected"
fi fi
color_apply="none"
elif [ "${opcion}" == "Intro (On)" ] ; then elif [ "${opcion}" == "Intro (On)" ] ; then
sleep 2 | zenity --progress --title "zenidrv-g203-prodigy ${VERSION} (${M_DATE})" --text "Enabling startup effect" \ sleep 2 | zenity --progress --title "zenidrv-g203-prodigy ${VERSION} (${M_DATE})" --text "Enabling startup effect" \
--window-icon=${iconPath} --pulsate --no-cancel --auto-close --window-icon=${iconPath} --pulsate --no-cancel --auto-close