From e33a83c1b534e97b14c30f29cfbd13697b00bc5b Mon Sep 17 00:00:00 2001 From: F5OEO Date: Mon, 12 Sep 2016 12:36:09 +0000 Subject: [PATCH] Add items to menu --- scripts/install_button | 107 ++++++++++++++++++++++++++++ scripts/install_display.fr | 107 ++++++++++++++++++++++++++++ scripts/langfr.sh | 34 ++++++++- scripts/langgb.sh | 34 ++++++++- scripts/menu.sh | 142 ++++++++++++++++++++++++++++++++++++- 5 files changed, 419 insertions(+), 5 deletions(-) create mode 100644 scripts/install_button create mode 100644 scripts/install_display.fr diff --git a/scripts/install_button b/scripts/install_button new file mode 100644 index 0000000..03d9506 --- /dev/null +++ b/scripts/install_button @@ -0,0 +1,107 @@ +# ~/.bashrc: executed by bash(1) for non-login shells. +# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) +# for examples + +# If not running interactively, don't do anything +[ -z "$PS1" ] && return + +# don't put duplicate lines or lines starting with space in the history. +# See bash(1) for more options +HISTCONTROL=ignoreboth + +# append to the history file, don't overwrite it +shopt -s histappend + +# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) +HISTSIZE=1000 +HISTFILESIZE=2000 + +# check the window size after each command and, if necessary, +# update the values of LINES and COLUMNS. +shopt -s checkwinsize + +# If set, the pattern "**" used in a pathname expansion context will +# match all files and zero or more directories and subdirectories. +#shopt -s globstar + +# make less more friendly for non-text input files, see lesspipe(1) +#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" + +# set variable identifying the chroot you work in (used in the prompt below) +if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then + debian_chroot=$(cat /etc/debian_chroot) +fi + +# set a fancy prompt (non-color, unless we know we "want" color) +case "$TERM" in + xterm-color) color_prompt=yes;; +esac + +# uncomment for a colored prompt, if the terminal has the capability; turned +# off by default to not distract the user: the focus in a terminal window +# should be on the output of commands, not on the prompt +force_color_prompt=yes + +if [ -n "$force_color_prompt" ]; then + if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then + # We have color support; assume it's compliant with Ecma-48 + # (ISO/IEC-6429). (Lack of such support is extremely rare, and such + # a case would tend to support setf rather than setaf.) + color_prompt=yes + else + color_prompt= + fi +fi + +if [ "$color_prompt" = yes ]; then + PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\] \[\033[01;34m\]\w \$\[\033[00m\] ' +else + PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' +fi +unset color_prompt force_color_prompt + +# If this is an xterm set the title to user@host:dir +case "$TERM" in +xterm*|rxvt*) + PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" + ;; +*) + ;; +esac + +# enable color support of ls and also add handy aliases +if [ -x /usr/bin/dircolors ]; then + test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" + alias ls='ls --color=auto' + #alias dir='dir --color=auto' + #alias vdir='vdir --color=auto' + + alias grep='grep --color=auto' + alias fgrep='fgrep --color=auto' + alias egrep='egrep --color=auto' +fi + +# some more ls aliases +#alias ll='ls -l' +#alias la='ls -A' +#alias l='ls -CF' + +# Alias definitions. +# You may want to put all your additions into a separate file like +# ~/.bash_aliases, instead of adding them here directly. +# See /usr/share/doc/bash-doc/examples in the bash-doc package. + +if [ -f ~/.bash_aliases ]; then + . ~/.bash_aliases +fi + +# enable programmable completion features (you don't need to enable +# this, if it's already enabled in /etc/bash.bashrc and /etc/profile +# sources /etc/bash.bashrc). +if [ -f /etc/bash_completion ] && ! shopt -oq posix; then + . /etc/bash_completion +fi + + + ./rpidatv/scripts/rpibutton.sh + diff --git a/scripts/install_display.fr b/scripts/install_display.fr new file mode 100644 index 0000000..07fc44f --- /dev/null +++ b/scripts/install_display.fr @@ -0,0 +1,107 @@ +# ~/.bashrc: executed by bash(1) for non-login shells. +# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) +# for examples + +# If not running interactively, don't do anything +[ -z "$PS1" ] && return + +# don't put duplicate lines or lines starting with space in the history. +# See bash(1) for more options +HISTCONTROL=ignoreboth + +# append to the history file, don't overwrite it +shopt -s histappend + +# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) +HISTSIZE=1000 +HISTFILESIZE=2000 + +# check the window size after each command and, if necessary, +# update the values of LINES and COLUMNS. +shopt -s checkwinsize + +# If set, the pattern "**" used in a pathname expansion context will +# match all files and zero or more directories and subdirectories. +#shopt -s globstar + +# make less more friendly for non-text input files, see lesspipe(1) +#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" + +# set variable identifying the chroot you work in (used in the prompt below) +if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then + debian_chroot=$(cat /etc/debian_chroot) +fi + +# set a fancy prompt (non-color, unless we know we "want" color) +case "$TERM" in + xterm-color) color_prompt=yes;; +esac + +# uncomment for a colored prompt, if the terminal has the capability; turned +# off by default to not distract the user: the focus in a terminal window +# should be on the output of commands, not on the prompt +force_color_prompt=yes + +if [ -n "$force_color_prompt" ]; then + if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then + # We have color support; assume it's compliant with Ecma-48 + # (ISO/IEC-6429). (Lack of such support is extremely rare, and such + # a case would tend to support setf rather than setaf.) + color_prompt=yes + else + color_prompt= + fi +fi + +if [ "$color_prompt" = yes ]; then + PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\] \[\033[01;34m\]\w \$\[\033[00m\] ' +else + PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' +fi +unset color_prompt force_color_prompt + +# If this is an xterm set the title to user@host:dir +case "$TERM" in +xterm*|rxvt*) + PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" + ;; +*) + ;; +esac + +# enable color support of ls and also add handy aliases +if [ -x /usr/bin/dircolors ]; then + test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" + alias ls='ls --color=auto' + #alias dir='dir --color=auto' + #alias vdir='vdir --color=auto' + + alias grep='grep --color=auto' + alias fgrep='fgrep --color=auto' + alias egrep='egrep --color=auto' +fi + +# some more ls aliases +#alias ll='ls -l' +#alias la='ls -A' +#alias l='ls -CF' + +# Alias definitions. +# You may want to put all your additions into a separate file like +# ~/.bash_aliases, instead of adding them here directly. +# See /usr/share/doc/bash-doc/examples in the bash-doc package. + +if [ -f ~/.bash_aliases ]; then + . ~/.bash_aliases +fi + +# enable programmable completion features (you don't need to enable +# this, if it's already enabled in /etc/bash.bashrc and /etc/profile +# sources /etc/bash.bashrc). +if [ -f /etc/bash_completion ] && ! shopt -oq posix; then + . /etc/bash_completion +fi + + + ./rpidatv/bin/rpidatvgui + diff --git a/scripts/langfr.sh b/scripts/langfr.sh index fe31ca7..34c8669 100644 --- a/scripts/langfr.sh +++ b/scripts/langfr.sh @@ -18,6 +18,9 @@ StrInputSetupIPTSINTitle="Configuration adresse IP" StrCallContext="Paramètrage indicatif" StrCallTitle="Indicatif" +StrLocatorContext="Paramètrage Locator" +StrLocatorTitle="Locator" + ######## OUTPUT MENU ##################### StrOutputSetupTitle="Mode de sortie" StrOutputSetupContext="Choix de la sortie" @@ -51,15 +54,42 @@ StrOutputSR="Configure le débit symbole" StrOutputFEC="choix du FEC" StrOutputMode="Configure le mode de sortie" +StrPIDSetup="Configure les PID" +StrPIDSetupTitle="Configuration PID" +StrPIDSetupContext="PID PMT (1000 par exemple)" + + ######### STATUS ########## StrStatusTitle="En transmission" +######### SYSTEM SETUP ####### +StrSystemTitle="Configure le système" +StrSystemContext="Choix:" +StrAutostartMenu="Démarrage automatique" +StrDisplayMenu="Ecran" +StrIPMenu="Adresse IP" + +StrAutostartSetupTitle="Configure le démarrage" +StrAutostartSetupContext="Choix:" +AutostartSetupConsole="Menu console(ce menu)" +AutostartSetupDisplay="Graphique(avec ecran tactile)" +AutostartSetupButton="Boutons poussoires" + +StrDisplaySetupTitle="Configure un ecran tactile" +StrDisplaySetupContext="Choix:" +DisplaySetupTontec="Ecran Tontec 3,5 pouces" +DisplaySetupHDMI="HDMI tactile" +DisplaySetupRpiLCD="Rpi LCD" + +StrIPSetupTitle="Configure en IP Statique" +StrIPSetupContext="Exemple: 192.168.1.60" + ######## MAIN MENU ######### -StrMainMenuTitle="RpiDATV GUI Version 1.2 (F5OEO Evariste)" +StrMainMenuTitle="RpiDATV GUI Version 2.0 (F5OEO Evariste)" StrMainMenuSource="Selection de la source" StrMainMenuOutput="Selection de la sortie" StrMainMenuCall="Configure la station" - +StrMainMenuSystem="Configuration système" StrMainMenuExitTitle="Sortie" StrMainMenuExitContext="Merci d'avoir utilisé RpiDATV..73's de F5OEO(evaristec@gmail.com)" diff --git a/scripts/langgb.sh b/scripts/langgb.sh index 479551f..40524c2 100644 --- a/scripts/langgb.sh +++ b/scripts/langgb.sh @@ -18,6 +18,9 @@ StrInputSetupIPTSINTitle="Setup IP address" StrCallContext="CALL Setup" StrCallTitle="CALL" +StrLocatorContext="Locator Setup" +StrLocatorTitle="Locator" + ######## OUTPUT MENU ##################### StrOutputSetupTitle="Output type" StrOutputSetupContext="Press down/up arrows to move, space to select" @@ -51,15 +54,42 @@ StrOutputSR="Symbol Rate Setup" StrOutputFEC="FEC Setup" StrOutputMode="Output Mode" +StrPIDSetup="PID setup" +StrPIDSetupTitle="PID setup" +StrPIDSetupContext="PID PMT (512 for example)" + + ######### STATUS ########## StrStatusTitle="Transmitting" +######### SYSTEM SETUP ####### +StrSystemTitle="System setup" +StrSystemContext="Choice:" +StrAutostartMenu="Automatic startup" +StrDisplayMenu="Display type" +StrIPMenu="IP Address" + +StrAutostartSetupTitle="Autostart setup" +StrAutostartSetupContext="Choice:" +AutostartSetupConsole="Console menu" +AutostartSetupDisplay="Display with touchscreen" +AutostartSetupButton="Push buttons" + +StrDisplaySetupTitle="Touchscreen setup" +StrDisplaySetupContext="Choice:" +DisplaySetupTontec="Tontec 3,5 inches" +DisplaySetupHDMI="HDMI touchscreen" +DisplaySetupRpiLCD="Rpi LCD" + +StrIPSetupTitle="Setup a static IP" +StrIPSetupContext="Example: 192.168.1.60" + ######## MAIN MENU ######### -StrMainMenuTitle="RpiDATV GUI Version 1.2 (F5OEO Evariste)" +StrMainMenuTitle="RpiDATV GUI Version 2.0 (F5OEO Evariste)" StrMainMenuSource="Source select" StrMainMenuOutput="Output select" StrMainMenuCall="Station call setup" - +StrMainMenuSystem="System setup" StrMainMenuExitTitle="Exit" StrMainMenuExitContext="Thanks to use RpiDATV... 73's de F5OEO(evaristec@gmail.com)" diff --git a/scripts/menu.sh b/scripts/menu.sh index ce0dae2..74baf6f 100755 --- a/scripts/menu.sh +++ b/scripts/menu.sh @@ -201,6 +201,13 @@ CALL=$(whiptail --inputbox "$StrCallContext" 8 78 $CALL --title "$StrCallTitle" if [ $? -eq 0 ]; then set_config_var call "$CALL" $CONFIGFILE fi + +CALL=$(get_config_var locator $CONFIGFILE) +CALL=$(whiptail --inputbox "$StrLocatorContext" 8 78 $CALL --title "$StrLocatorTitle" 3>&1 1>&2 2>&3) +if [ $? -eq 0 ]; then +set_config_var locator "$CALL" $CONFIGFILE +fi + } @@ -390,16 +397,34 @@ if [ $? -eq 0 ]; then fi } +do_PID_setup() +{ +PID=$(get_config_var pidstart $CONFIGFILE) +PID=$(whiptail --inputbox "$StrPIDSetupContext" 8 78 $PID --title "$StrPIDSetupTitle" 3>&1 1>&2 2>&3) +if [ $? -eq 0 ]; then +set_config_var pidstart "$PID" $CONFIGFILE +set_config_var pidpmt "$PID" $CONFIGFILE +#PID Video is PMT+1 +let PID=PID+1 +set_config_var pidvideo "$PID" $CONFIGFILE +#PID Audiop is PMT+1 +let PID=PID+1 +set_config_var pidaudio "$PID" $CONFIGFILE +fi +} + do_output_setup() { menuchoice=$(whiptail --title "$StrOutputTitle" --menu "$StrOutputContext" 16 78 5 \ "1 SymbolRate" "$StrOutputSR" \ "2 FEC" "$StrOutputFEC" \ "3 Output mode" "$StrOutputMode" \ + "4 PID" "$StrPIDSetup" \ 3>&2 2>&1 1>&3) case "$menuchoice" in 1\ *) do_symbolrate_setup ;; 2\ *) do_fec_setup ;; 3\ *) do_output_setup_mode ;; + 4\ *) do_PID_setup ;; esac } @@ -465,6 +490,119 @@ do_receive() do_receive_status } +do_autostart_setup() +{ +MODE_STARTUP=$(get_config_var startup $CONFIGFILE) +case "$MODE_STARTUP" in + Console) + Radio1=ON + Radio2=OFF + Radio3=OFF + ;; + Display) + Radio1=OFF + Radio2=ON + Radio3=OFF + ;; + Button) + Radio1=OFF + Radio2=OFF + Radio3=ON + ;; + *) + Radio1=ON + Radio2=OFF + Radio3=OFF + +esac + +chstartup=$(whiptail --title "$StrAutostartSetupTitle" --radiolist \ + "$StrAutostartSetupContext" 20 78 8 \ + "Console" "$AutostartSetupConsole" $Radio1 \ + "Display" "$AutostartSetupDisplay" $Radio2 \ + "Button" "$AutostartSetupButton" $Radio3 \ + 3>&2 2>&1 1>&3) + +if [ $? -eq 0 ]; then + + case "$chstartup" in + Console) cp ./install_bashrc /home/pi/.bashrc >/dev/null 2>/dev/null;; + Display) cp ./install_display.fr /home/pi/.bashrc >/dev/null 2>/dev/null;; + Button) cp ./install_button /home/pi/.bashrc >/dev/null 2>/dev/null;; + + esac + set_config_var startup "$chstartup" $CONFIGFILE +fi +} + +do_display_setup() +{ +MODE_DISPLAY=$(get_config_var display $CONFIGFILE) +case "$MODE_DISPLAY" in + Tontec35) + Radio1=ON + Radio2=OFF + Radio3=OFF + ;; + HDMITouch) + Radio1=OFF + Radio2=ON + Radio3=OFF + ;; + RpiLCD) + Radio1=OFF + Radio2=OFF + Radio3=ON + ;; + *) + Radio1=ON + Radio2=OFF + Radio3=OFF + +esac + +chdisplay=$(whiptail --title "$StrDisplaySetupTitle" --radiolist \ + "$StrDisplaySetupContext" 20 78 8 \ + "Tontec35" "$DisplaySetupTontec" $Radio1 \ + "HDMITouch" "$DisplaySetupHDMI" $Radio2 \ + "RpiLCD" "$DisplaySetupRpiLCD" $Radio3 \ + 3>&2 2>&1 1>&3) + +if [ $? -eq 0 ]; then + + case "$chdisplay" in + Tontec35) ;; + HDMITouch) ;; + RpiLCD) ;; + + esac + set_config_var display "$chdisplay" $CONFIGFILE +fi +} + +do_IP_setup() +{ +STATICIP=$(get_config_var staticip $CONFIGFILE) +STATICIP=$(whiptail --inputbox "$StrIPSetupContext" 8 78 $STATICIP --title "$StrIPSetupTitle" 3>&1 1>&2 2>&3) +if [ $? -eq 0 ]; then +set_config_var staticip "$STATICIP" $CONFIGFILE +fi +} + +do_system_setup() +{ +menuchoice=$(whiptail --title "$StrSystemTitle" --menu "$StrSystemContext" 16 78 5 \ + "1 Autostart" "$StrAutostartMenu" \ + "2 Display" "$StrDisplayMenu" \ + "3 IP" "$StrIPMenu" \ + 3>&2 2>&1 1>&3) + case "$menuchoice" in + 1\ *) do_autostart_setup ;; + 2\ *) do_display_setup ;; + 3\ *) do_IP_setup ;; + esac +} + OnStartup() { CALL=$(get_config_var call $CONFIGFILE) @@ -508,12 +646,13 @@ INFO=$CALL":"$MODE_INPUT"-->"$MODE_OUTPUT"("$SYMBOLRATEK"KSymbol FEC "$FECNUM"/" #do_status #do_display_on #"1 Transmission" "Demarre la transmission"\ - menuchoice=$(whiptail --title "$StrMainMenuTitle" --menu "$INFO" 16 82 5 \ + menuchoice=$(whiptail --title "$StrMainMenuTitle" --menu "$INFO" 16 82 6 \ "0 Transmit" "Go transmit" \ "1 Source" "$StrMainMenuSource" \ "2 Sortie" "$StrMainMenuOutput" \ "3 Station" "$StrMainMenuCall" \ "4 Receive" "Receive via rtlsdr" \ + "5 System" "$StrMainMenuSystem" \ 3>&2 2>&1 1>&3) case "$menuchoice" in @@ -522,6 +661,7 @@ INFO=$CALL":"$MODE_INPUT"-->"$MODE_OUTPUT"("$SYMBOLRATEK"KSymbol FEC "$FECNUM"/" 2\ *) do_output_setup ;; 3\ *) do_station_setup ;; 4\ *) do_receive ;; + 5\ *) do_system_setup ;; *) whiptail --title "$StrMainMenuExitTitle" --msgbox "$StrMainMenuExitContext" 8 78