Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Tue 02 Sep 2014, 03:48
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
How to do a config file for radiobuttons?
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [4 Posts]  
Author Message
oldyeller


Joined: 15 Nov 2011
Posts: 781
Location: Mishawaka IN

PostPosted: Sun 31 Aug 2014, 13:42    Post subject:  How to do a config file for radiobuttons?  

Hello Everyone,

I have tried to use a config file to set the radiobuttons that person hits. what I have so far saves the last used radiobutton, but It also goes back to the very first one in the list behind the scenes.

Pentateuch is the first one. When one hits let say History-1 and than reopens the program History-1 is still marked, but it is Pentateuch that is still showing up in the searching window. Here is the code for main .settings and func.

MAIN

Code:

#!/bin/sh
#Bible Word Search copyright 2014
#by David Cannon

#------------------------------------------------------------------------------
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the #GNU General Public License
# for more details. <http://www.gnu.org/licenses/>.
#General Public License as published by the Free Software
# Foundation version 2.

#------------------------------------------------------------------------------


if [ "`which gtkdialog4`" ]; then
 GTKDIALOG=gtkdialog4
elif [ "`which gtkdialog3`" ]; then
 GTKDIALOG=gtkdialog3
else
 GTKDIALOG=gtkdialog
fi

export mytitle="Word Search"
export version=1.0
export WORKDIR="/usr/local/Search"
export TMP="/usr/local/Search/tmp"

. $HOME/.settingsrc

#define title-bar icon
[ ! -h /usr/share/icons/hicolor/48x48/apps/find.svg ] && \
ln -sf $WORKDIR/icons/find.svg /usr/share/icons/hicolor/48x48/apps && \
gtk-update-icon-cache -f -i /usr/share/icons/hicolor 2>/dev/null


#define special font for SEARCH and GUI frames
[ "$FONTNAME" = "" ] && FONTNAME="$i"
[ "$FONT_SIZE" = "" ] && FONT_SIZE="$M"
echo "style \"specialsize\"
{
  font_name=\"$FONTNAME $FONT_SIZE\"
}
widget \"*\" style \"specialsize\"
class \"*\" style \"specialsize\"

style \"specialframe\"
{
  font_name=\"Sans bold 12\"
  fg[NORMAL]=\"grey40\"
}
widget \"*.GtkFrame.GtkLabel\" style \"specialframe\"
class \"*.GtkFrame.GtkLabel\" style \"specialframe\"" > "$WORKDIR/gtkrc_special"

export GTK2_RC_FILES="$WORKDIR/gtkrc_special:${HOME}/.gtkrc-2.0"

COMBOLIST=""
for M in {12..18}
do
 COMBOLIST="$COMBOLIST<item>$M</item>"
done

NAME_ARRAY=("Dejavu Sans" "Droid Sans" "Droid Sans Mono" "Droid Serif" "Gruppo" "Kelly Slab" "MONO" "Nimbus Roman No9 L" "Nimbus Sans L" "Play" "Sans" "Serif")
COMBOLIST2=""
for i in "${NAME_ARRAY[@]}"
do
  COMBOLIST2="$COMBOLIST2<item>$i</item>"
done

#Main dlg
export MAIN_DIALOG='
<window title="'"$mytitle $version"'" resizable="true" icon-name="find" window-position="1">
  <hbox space-expand="true" space-fill="true">
   <hbox space-expand="true" space-fill="true">
    <frame '$(gettext "RESULTS")'>
    <vbox space-expand="true" space-fill="true"> 
     <edit editable="false" justification="3" indent="" left-margin="12" right-margin="12" wrap-mode="2">
      <variable>RESULTS</variable>
       <height>600</height>
       <width>670</width>
       <input file>'"$WORKDIR"'/results</input>
     </edit>
    </vbox>
    </frame>
   </hbox>
     
     <vbox space-expand="true" space-fill="true">
     <text height-request="1"><label>""</label></text>
  <vbox scrollable="true" height="200" space-expand="true" space-fill="true">
  <frame KJV>
  <text height-request="15"><label>"Old Testament"</label></text>
   <radiobutton tooltip-text="Genesis-Deuteronomy">
   <variable>VAR1</variable>
   <label>Pentateuch</label>
   <default>'"$VAR1"'</default>
   <action>echo Pentateuch > '"$WORKDIR"'/biblename</action>
   <action>echo Pentateuch > '"$WORKDIR"'/book</action>
   <action>refresh:SEARCHING</action>
   </radiobutton>
   <radiobutton tooltip-text="Joshua-Ruth">
   <variable>VAR2</variable>
   <label>History 1</label>
   <default>'"$VAR2"'</default>
   <action>echo History-1 > '"$WORKDIR"'/biblename</action>
   <action>echo History-1 > '"$WORKDIR"'/book</action>
   <action>refresh:SEARCHING</action>
   </radiobutton>
   <radiobutton tooltip-text="1Samuel-2Chronicales">
   <variable>VAR3</variable>
   <label>Kings</label>
   <default>'"$VAR3"'</default>
   <action>echo Kings > '"$WORKDIR"'/biblename</action>
   <action>echo Kings > '"$WORKDIR"'/book</action>
   <action>refresh:SEARCHING</action>
   </radiobutton>
   <radiobutton tooltip-text="Ezra-Esther">
   <variable>VAR4</variable>
   <label>History 2</label>
   <default>'"$VAR4"'</default>
   <action>echo History-2 > '"$WORKDIR"'/biblename</action>
   <action>echo History-2 > '"$WORKDIR"'/book</action>
   <action>refresh:SEARCHING</action>
   </radiobutton>
   <radiobutton tooltip-text="Job-Song of Solomon">
   <variable>VAR5</variable>
   <label>Wisdom</label>
   <default>'"$VAR5"'</default>
   <action>echo Wisdom > '"$WORKDIR"'/biblename</action>
   <action>echo Wisdom > '"$WORKDIR"'/book</action>
   <action>refresh:SEARCHING</action>
   </radiobutton>
   <radiobutton tooltip-text="Isaiah-Daniel">
   <variable>VAR6</variable>
   <label>Major Prophets</label>
   <default>'"$VAR6"'</default>
   <action>echo MajorProphets > '"$WORKDIR"'/biblename</action>
   <action>echo MajorProphets > '"$WORKDIR"'/book</action>
   <action>refresh:SEARCHING</action>
   </radiobutton>
   <radiobutton tooltip-text="Hosea-Micah">
   <variable>VAR7</variable>
   <label>Minor Prophets 1</label>
   <default>'"$VAR7"'</default>
   <action>echo MinorProphets1 > '"$WORKDIR"'/biblename</action>
   <action>echo MinorProphets1 > '"$WORKDIR"'/book</action>
   <action>refresh:SEARCHING</action>
   </radiobutton>
   <radiobutton tooltip-text="Nahum-Malachi">
   <variable>VAR8</variable>
   <label>Minor Prophets 2</label>
   <default>'"$VAR8"'</default>
   <action>echo MinorProphets2 > '"$WORKDIR"'/biblename</action>
   <action>echo MinorProphets2 > '"$WORKDIR"'/book</action>
   <action>refresh:SEARCHING</action>
   </radiobutton>
   <text height-request="15"><label>"New Testament"</label></text>
   <radiobutton tooltip-text="Matthew-John">
   <variable>VAR9</variable>
   <label>Gospels</label>
   <default>'"$VAR9"'</default>
   <action>echo Gospels > '"$WORKDIR"'/biblename</action>
   <action>echo Gospels > '"$WORKDIR"'/book</action>
   <action>refresh:SEARCHING</action>
   </radiobutton>
   <radiobutton tooltip-text="Acts">
   <variable>VAR10</variable>
   <label>History</label>
   <default>'"$VAR10"'</default>
   <action>echo Acts > '"$WORKDIR"'/biblename</action>
   <action>echo Acts > '"$WORKDIR"'/book</action>
   <action>refresh:SEARCHING</action>
   </radiobutton>
   <radiobutton tooltip-text="Romans-Colossians">
   <variable>VAR11</variable>
   <label>Pauls Letters 1</label>
   <default>'"$VAR11"'</default>
   <action>echo PaulsLetters1 > '"$WORKDIR"'/biblename</action>
   <action>echo PaulsLetters1 > '"$WORKDIR"'/book</action>
   <action>refresh:SEARCHING</action>
   </radiobutton>
   <radiobutton tooltip-text="1 Thessalonians-Hebrews">
   <variable>VAR12</variable>
   <label>Pauls Letters 2</label>
   <default>'"$VAR12"'</default>
   <action>echo PaulsLetters2 > '"$WORKDIR"'/biblename</action>
   <action>echo PaulsLetters2 > '"$WORKDIR"'/book</action>
   <action>refresh:SEARCHING</action>
   </radiobutton>
   <radiobutton tooltip-text="James-Jude">
   <variable>VAR13</variable>
   <label>General Letters</label>
   <default>'"$VAR13"'</default>
   <action>echo GeneralLetters > '"$WORKDIR"'/biblename</action>
   <action>echo GeneralLetters > '"$WORKDIR"'/book</action>
   <action>refresh:SEARCHING</action>
   </radiobutton>
   <radiobutton tooltip-text="Revelation">
   <variable>VAR14</variable>
   <label>Revelation</label>
   <default>'"$VAR14"'</default>
   <action>echo Revelation > '"$WORKDIR"'/biblename</action>
   <action>echo Revelation > '"$WORKDIR"'/book</action>
   <action>refresh:SEARCHING</action>
   </radiobutton>
   </frame>
  </vbox>
 
  <frame Searching>
  <entry has-focus="true" width-request="218" wrap-width="0">
      <variable>SEARCHING</variable>
     <input file>'"$WORKDIR"'/book</input>
   </entry>
  </frame>
 
    <text height-request="3"><label>""</label></text>
   <frame Search Type>
   <radiobutton tooltip-text="Search for just this word">
   <variable>VAR35</variable>
   <label>Search for whole words</label>
   <default>'"$VAR35"'</default>
   <action>echo -w > '"$WORKDIR"'/options</action>
   </radiobutton>
   <radiobutton tooltip-text="Search for all instances of this word">
   <variable>VAR36</variable>
   <label>Search for all instances</label>
   <default>'"$VAR36"'</default>
   <action>echo -i > '"$WORKDIR"'/options</action>
   </radiobutton>
   </frame>
   
    <frame Search>
    <entry has-focus="true" width-request="218" wrap-width="0">
      <variable>SEARCH</variable>
     <input file>'"$TMP"'/name</input>
   <output file>'"$TMP"'/name</output>
   <action signal="activate">clear:RESULTS</action>
   <action signal="activate">save:SEARCH</action>
   <action signal="activate">. '"$WORKDIR"'/func &</action>
   <action signal="activate">refresh:RESULTS</action>
   </entry>
    </frame>   
   
    <frame>
 <text><label>"Font:"</label></text>
    <comboboxentry width-request="218">
      <variable>i</variable>
      <default>Dejavu Sans</default>
     '"$COMBOLIST2"'
     </comboboxentry>
     <comboboxentry width-request="100">
      <variable>M</variable>
      <default>12</default>
     '"$COMBOLIST"'
     </comboboxentry>
     <text height-request="3"><label>""</label></text>
     <hbox homogeneous="true">
     <button tooltip-text="Press Ok to change font and fontsize">
    <label>OK</label>
    <action>'$WORKDIR'/search &</action>
   <action>exit:quit_now</action>
   </button>
   <button tooltip-text="Save search results in wordprocessor">
    <label>Save</label>
    <action>defaultwordprocessor '$WORKDIR'/results &</action>
   </button>
   <button>
  <label>Exit</label>
  <input file stock="gtk-quit"></input>
  <action type="exit">quit_now</action>
   </button>
   </hbox>
   </frame>
    </vbox>
   </hbox>
<action signal="hide">exit:Exit</action>
</window>'

$GTKDIALOG -p MAIN_DIALOG > $HOME/.settingsrc
unset MAIN_DIALOG
exit 0 


FUNC
Code:

#!/bin/sh

BIBLENAME=`cat $WORKDIR/biblename`
[ "$BIBLENAME" = "" ] && BIBLENAME="Pentateuch" && echo "Pentateuch" > "$WORKDIR"/biblename

if [ "$BIBLENAME" = "Pentateuch" ]; then
  SEARCHPATH="/usr/local/Search/kjv/Pentateuch"
elif [ "$BIBLENAME" = "History-1" ]; then
  SEARCHPATH="/usr/local/Search/kjv/History"
elif [ "$BIBLENAME" = "Kings" ]; then
  SEARCHPATH="/usr/local/Search/kjv/Kings"
elif [ "$BIBLENAME" = "History-2" ]; then
  SEARCHPATH="/usr/local/Search/kjv/History2"
elif [ "$BIBLENAME" = "Wisdom" ]; then
  SEARCHPATH="/usr/local/Search/kjv/Wisdom"
elif [ "$BIBLENAME" = "MajorProphets" ]; then
  SEARCHPATH="/usr/local/Search/kjv/MajorProphets"
elif [ "$BIBLENAME" = "MinorProphets1" ]; then
  SEARCHPATH="/usr/local/Search/kjv/MinorProphets1"
elif [ "$BIBLENAME" = "MinorProphets2" ]; then
  SEARCHPATH="/usr/local/Search/kjv/MinorProphets2"
elif [ "$BIBLENAME" = "Gospels" ]; then
  SEARCHPATH="/usr/local/Search/kjv/Gospels"
elif [ "$BIBLENAME" = "Acts" ]; then
  SEARCHPATH="/usr/local/Search/kjv/Acts" 
elif [ "$BIBLENAME" = "PaulsLetters1" ]; then
  SEARCHPATH="/usr/local/Search/kjv/PaulsLetters1"
elif [ "$BIBLENAME" = "PaulsLetters2" ]; then
  SEARCHPATH="/usr/local/Search/kjv/PaulsLetters2"
elif [ "$BIBLENAME" = "GeneralLetters" ]; then
  SEARCHPATH="/usr/local/Search/kjv/GeneralLetters" 
elif [ "$BIBLENAME" = "Revelation" ]; then
  SEARCHPATH="/usr/local/Search/kjv/Revelation"                   
fi

SOURCEDIR=`dirname $SEARCHPATH`

NAME=`cat $TMP/name`

O=`cat $WORKDIR/options`

grep $O -R "$NAME" "$SEARCHPATH" | sort | pr -dn | sed -e 's|'$SOURCEDIR/'||g' > $WORKDIR/results
[ "`cat $WORKDIR/results`" = "" ] && Xdialog --title " " --infobox "\n     ""'$NAME'"" not found!     \n" 0 0 4000 && exit
#defaultwordprocessor $WORKDIR/results
#End


.SETTINGS
Code:

VAR1="false"
VAR10="false"
VAR11="false"
VAR12="false"
VAR13="false"
VAR14="false"
VAR2="true"
VAR3="false"
VAR35="false"
VAR36="true"
VAR4="false"
VAR5="false"
VAR6="false"
VAR7="false"
VAR8="false"
VAR9="false"


Any help would be great Thanks
Back to top
View user's profile Send private message 
zigbert


Joined: 29 Mar 2006
Posts: 5699
Location: Valåmoen, Norway

PostPosted: Sun 31 Aug 2014, 14:53    Post subject:  

I don't know if it is the complete answer, but
Code:
<action>echo History-1 > '"$WORKDIR"'/book</action>
should be
Code:
<action if true>echo History-1 > '"$WORKDIR"'/book</action>

_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
oldyeller


Joined: 15 Nov 2011
Posts: 781
Location: Mishawaka IN

PostPosted: Sun 31 Aug 2014, 15:40    Post subject:  

zigbert wrote:
I don't know if it is the complete answer, but
Code:
<action>echo History-1 > '"$WORKDIR"'/book</action>
should be
Code:
<action if true>echo History-1 > '"$WORKDIR"'/book</action>


I tried this, But it erased my config file and would not open.
Back to top
View user's profile Send private message 
zigbert


Joined: 29 Mar 2006
Posts: 5699
Location: Valåmoen, Norway

PostPosted: Yesterday, at 11:10    Post subject:  

sorry, should be
Code:
<action>if true echo History-1 > '"$WORKDIR"'/book</action>

_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
Display posts from previous:   Sort by:   
Page 1 of 1 [4 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

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 vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1031s ][ Queries: 11 (0.0061s) ][ GZIP on ]