LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 02-22-2012, 06:05 PM   #1
wargus
Member
 
Registered: Mar 2010
Location: Switzerland
Distribution: Slackware
Posts: 98

Rep: Reputation: 23
Question dialog --radiolist with list from file to choose not working


Hello,

I am trying to write a dialog UI for a script I use to save me from typing infinite commands each time. Now I don't get this part of it to work:

There is a directory with several files. I create a list which contains *.gds files only, and I print only the name of them to the list.

Code:
ls -al $DIR | grep .gds | gawk -F ' ' '{print $9} > $LIST
I want to select one file at a time from this list, so I use the
Code:
dialog --radiolist
option. I think I've understood everything written in the manpage about dialog, but this isn't explained there. I've tried to number each line so I get a tag for each file to select, I've added the off/on statement for default setting of the radiobutton, I've tried several things with the --file option... I've checked how others do it (pkgtool, sbopkg and such scripts which use dialog together with lists) but I don't get it (it's too complex there for me to figure out). I've checked the format of the input file to dialog in the remove part of pkgtool and tried like this, no success.

I still think it's a formatting problem of my list.
Any ideas how this should be done?

Thank you

Last edited by wargus; 02-22-2012 at 06:53 PM. Reason: typo
 
Old 02-22-2012, 06:14 PM   #2
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
For the radiolist option, it should something as such:
Code:
dialog --backtitle "Test" --radiolist "Select option:" 15 35 3 \
 1 "Test 1" off \
 2 "Test 2" on \
 3 "Test 3" off
I broke it up into sections to better understand. The 15 and 35 are height and width, respectively, the first 3 is how many options in your radio list, and then you can probably figure the rest out.

Cheers,

Josh
 
1 members found this post helpful.
Old 02-22-2012, 06:46 PM   #3
wargus
Member
 
Registered: Mar 2010
Location: Switzerland
Distribution: Slackware
Posts: 98

Original Poster
Rep: Reputation: 23
OK, I tried it out again and put following to a file

Code:
 1 "Test 1" off \
 2 "Test 2" on \
 3 "Test 3" off
then with

Code:
dialog --backtitle "Test" --radiolist "Select option:" 15 35 3 \
 --file $OPTIONS_FILE
and it works it also works after I rewrote my create_list( )
Seems I tried too long last night and messed up something with my list and the format was not proper. I should go to sleep earlier

Thank you very much, I should have figured out myself

 
Old 02-22-2012, 11:21 PM   #4
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Honestly, I would have gone another route, but hey, if that works, and you understand it, then by all means use it. Cheers though on figuring it out!

Josh
 
Old 02-23-2012, 03:30 AM   #5
wargus
Member
 
Registered: Mar 2010
Location: Switzerland
Distribution: Slackware
Posts: 98

Original Poster
Rep: Reputation: 23
Could you please enlighten me


 
Old 02-23-2012, 05:04 AM   #6
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Sure thing. I am leaving to go home soon from work, so sometime later on I will get on and explain by what I mean.

Cheers!
 
Old 02-24-2012, 06:05 AM   #7
PDock
Member
 
Registered: Aug 2004
Distribution: Slack10 & curr. tried numerous
Posts: 189

Rep: Reputation: 37
Hi wargus. Here is an old post of mine which seems on topic with your concept: http://www.linuxquestions.org/questi...ove%5D-378279/

Care to post your final script here.
ppd
 
1 members found this post helpful.
Old 02-24-2012, 01:08 PM   #8
wargus
Member
 
Registered: Mar 2010
Location: Switzerland
Distribution: Slackware
Posts: 98

Original Poster
Rep: Reputation: 23
Hi PDock

well I simply try to create a UI for a script which generates a 3D view from a gds-file (microchip layout). The command needs many arguments each time and it's annoying to type them every time. Additional to the gds-file it needs two special files, depending on the technology used in the gds. So I make the user chose it one by one, but I don't like the --fselect dialog so I was to list the content of a directory and pass it to the --radiolist dialog. At the end I messed up the format of the input file.

I am teaching myself shell scripting and any input from other scripts is welcome, to learn and steal a bit Mostly, big scripts are not easily readable for me because of the many nested variables they contain and the lack of in-script documentation.
 
Old 02-25-2012, 05:50 AM   #9
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,153

Rep: Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856
Instead of writing your options to a tmp file why not use a variable like this
Code:
 echo $DIALOGDATA|xargs dialog --separate-output --checklist "Select Tags To Change" 0 0 0
This is a snippet from a cdripping script that needs a variable length checklist, $DIALOGDATA contains the options for each check button ( 1 "Test 1" off ... in your example above .
P.S.
quotes should be escaped like so
Code:
DIALOGDATA="1 \"Test 1\" off 2 \"Test 2\" on 3 \"Test 3\" off"
 
1 members found this post helpful.
Old 02-25-2012, 02:58 PM   #10
wargus
Member
 
Registered: Mar 2010
Location: Switzerland
Distribution: Slackware
Posts: 98

Original Poster
Rep: Reputation: 23
Thank you KH for the input, I need to learn about xargs anyway earlier or later...


 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] PHP: list directory, choose a file, change its name szboardstretcher Programming 6 03-21-2011 12:25 PM
[SOLVED] "dialog --radiolist" distorted in Ubuntu-10.04 virtual machine axay_singh Programming 4 08-17-2010 02:06 AM
how to display text file contents in Xdialog's radiolist or menubox kkpal Linux - Newbie 0 09-09-2008 02:18 AM
Clear The Run Aplication Dialog List? RHEL Red Hat 2 07-01-2007 11:53 PM
List partiton with dialog command zael Programming 0 04-02-2004 02:55 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 02:19 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration