bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using leading blank instead of periods.


From: Michael D. Setzer II
Subject: Re: Using leading blank instead of periods.
Date: Wed, 19 Dec 2012 01:25:00 +1000

On 18 Dec 2012 at 6:38, Peter Hansson wrote:

Date sent:              Tue, 18 Dec 2012 06:38:14 -0800 (PST)
From:                   Peter Hansson <address@hidden>
Send reply to:          Peter Hansson <address@hidden>
Subject:                Re: Using leading blank instead of periods.
To:                     "Michael D. Setzer II" <address@hidden>,
        "address@hidden" <address@hidden>

> Hi Michael,
>
> Thank you for all your input. The idea of using a leading space to get rid of 
> the hotkey
> feature is a nice workaround and certainly something that can be used until 
> such
> time where Dialog will (hopefully) have a switch that can turn off the hotkey 
> feature.
>
>
>
> I've put together this example to show what I mean regarding those other 
> issues:
>
> #!/bin/bash
>
> mytmp="/tmp/diatmp"
> rm $mytmp
>
> echo "\" internal/house/customers/abc\""             "\"online        
> 2012-06-12   Some description, long, long, stops here\"" >> $mytmp
> echo "\" internal/house/customers/abcdefgh\""        "\"online        
> 2012-06-12   Some description, long, long, stops here\"" >> $mytmp
> echo "\" internal/offsite/customers/abc\""           "\"unknown       
> 2012-06-12   Some description, long, long, stops here\"" >> $mytmp
> echo "\" external/house/customers/abcd\""            "\"offline       
> 2012-06-12   Some description, long, long, stops here\"" >> $mytmp
> echo "\" external/house/customers/abcde\""           "\"offline       
> 2012-06-12   Some description, long, long, stops here\"" >> $mytmp
> echo "\" external/house/customers/abcdef\""          "\"offline       
> 2012-06-12   Some description, long, long, stops here\"" >> $mytmp
> echo "\" external/house/customers/abcdefg\""         "\"offline       
> 2012-06-12   Some description, long, long, stops here\"" >> $mytmp
> echo "\" external/house/customers/abcdefgh\""        "\"offline       
> 2012-06-12   Some description, long, long, stops here\"" >> $mytmp
> echo "\" external/house/customers/abcdefghi\""       "\"maintenance   
> 2012-06-12   Some description, long, long, stops here\"" >> $mytmp
> echo "\" external/house/customers/abcdefghij\""      "\"offline       
> 2012-06-12   Some description, long, long, stops here\"" >> $mytmp
> echo "\" external/house/customers/abcdefghijk\""     "\"offline       
> 2012-06-12   Some description, long, long, stops here\"" >> $mytmp
>
> dialog --clear --backtitle "Node Management" --title "Nodes" "$@"  
> --no-collapse \
>         --menu "  NODENAME                                STATE          TIME 
>    DESC" \
>            0 0 0  \
>           --file $mytmp
> # end
>
>
> First off all you'll notice that the tag-text gets chopped. This leaves the 
> user in a situation where he cannot
> distinguish between the items on the list. Secondly note how I cannot really 
> place the column header. I'm not
> too fond of the idea of having the table header as the first item on the 
> list. For one thing it will quickly scroll
> off the list.
>
> I would think I can get around the placing-of-the-header issue if I knew the 
> user's terminal would be exactly x
> columns. I'm sure there's a way I can force that. However the chopping of the 
> tag-text is worse.
>
> I haven't tested this with a radiolist widget. I suppose Dialog's chopping 
> algorithm applies to both types
> of widgets (radiolist and menu).
>
> One solution I can think of would be to measure the terminal width before 
> Dialog is called and then use that
> to manually chop off from the description text BEFORE I even feed it into 
> Dialog. This way Dialog's chopping
> algorithm would never kick in. All I want is for chopping to always happen 
> from the right hand side only.
>
> But is is quite a lot of workarounds for something that - IMHO - should be a 
> common case. However with your
> help I'm beginning to see solutions/workarounds rather than 
> this-can-never-be-done-and-I'm-giving-up.  :-)
>
> Cheers

I took your sample, and made some changes with my script. Since
it all seemed to be the same date, I moved it to the first lines as a
heading. Also, what kind of terminal are you displaying this in.
Under gnome-terminal, I was able to use
gnome-terminal --geometry=132x24
to make the screen wider to display the text, but you might be
using a terminal window that doesn't allow this option. I've also
used putty in the past with settings of fonts to get more.


#!/bin/bash
echo "dialog --clear --backtitle \"Node Management\" --title \"Nodes 
address@hidden"  --no-collapse --radiolist \"text\" 0 0 0 \\" >testdialog
echo \" TEXT OPTION\" \"Status as of 20120-06-12\" "off" \\ >>testdialog
#for a in `ls | grep -v \ | grep -v \&`
#do
#  echo \" $a\" \"Status\" "off" \\  >>testdialog
#done
echo "\" internal/house/customers/abc\""             "\"online        Some 
description, long, long, stops here\"" off \\>> testdialog
echo "\" internal/house/customers/abcdefgh\""        "\"online        Some 
description, long, long, stops here\"" off \\>> testdialog
echo "\" internal/offsite/customers/abc\""           "\"unknown       Some 
description, long, long, stops here\"" off \\>> testdialog
echo "\" external/house/customers/abcd\""            "\"offline       Some 
description, long, long, stops here\"" off \\>> testdialog
echo "\" external/house/customers/abcde\""           "\"offline       Some 
description, long, long, stops here\"" off \\>> testdialog
echo "\" external/house/customers/abcdef\""          "\"offline       Some 
description, long, long, stops here\"" off \\>> testdialog
echo "\" external/house/customers/abcdefg\""         "\"offline       Some 
description, long, long, stops here\"" off \\>> testdialog
echo "\" external/house/customers/abcdefgh\""        "\"offline       Some 
description, long, long, stops here\"" off \\>> testdialog
echo "\" external/house/customers/abcdefghi\""       "\"maintenance   Some 
description, long, long, stops here\"" off \\>> testdialog
echo "\" external/house/customers/abcdefghij\""      "\"offline       Some 
description, long, long, stops here\"" off \\>> testdialog
echo "\" external/house/customers/abcdefghijk\""     "\"offline       Some 
description, long, long, stops here\"" off \\>> testdialog
echo "2>result.out" >>testdialog
gedit testdialog
./testdialog
gedit result.out
./testdialog
gedit result.out

>
> Peter
>
>
>
>
>
> ----- Original Message -----
> > From: Michael D. Setzer II <address@hidden>
> > To: Peter Hansson <address@hidden>; address@hidden
> > Cc:
> > Sent: Tuesday, December 18, 2012 2:24 PM
> > Subject: Using leading blank instead of periods.
> >
> > Using quotes around text allows for a leading blank that gets rid of
> > the highlighting, but still loses the space.
> >
> > #!/bin/bash
> > echo "dialog --radiolist \"text\" 0 0 0 \\"
> >> testdialog
> > echo \" TEXT OPTION\" \"COL1 COL2 COL3\"
> > "off" \\ >>testdialog
> > for a in `ls | grep -v \ | grep -v \&`
> > do
> >   echo \" $a\" \"col1 col2 col3\"
> > "off" \\  >>testdialog
> > done
> > echo "2>result.out" >>testdialog
> > gedit testdialog
> > ./testdialog
> > gedit result.out
> >
> > +----------------------------------------------------------+
> >   Michael D. Setzer II -  Computer Science Instructor     
> >   Guam Community College  Computer Center                 
> >   mailto:address@hidden                          
> >   mailto:address@hidden
> >   http://www.guam.net/home/mikes
> >   Guam - Where America's Day Begins                       
> >   G4L Disk Imaging Project maintainer
> >   http://sourceforge.net/projects/g4l/
> > +----------------------------------------------------------+
> >
> > http://setiathome.berkeley.edu (Original)
> > Number of Seti Units Returned:  19,471
> > Processing time:  32 years, 290 days, 12 hours, 58 minutes
> > (Total Hours: 287,489)
> >
> > address@hidden CREDITS
> > SETI        13471758.391615   |   EINSTEIN     9375439.209852
> > ROSETTA      5601813.107505   |   ABC         15592097.439004
> >


+----------------------------------------------------------+
  Michael D. Setzer II -  Computer Science Instructor
  Guam Community College  Computer Center
  mailto:address@hidden
  mailto:address@hidden
  http://www.guam.net/home/mikes
  Guam - Where America's Day Begins
  G4L Disk Imaging Project maintainer
  http://sourceforge.net/projects/g4l/
+----------------------------------------------------------+

http://setiathome.berkeley.edu (Original)
Number of Seti Units Returned:  19,471
Processing time:  32 years, 290 days, 12 hours, 58 minutes
(Total Hours: 287,489)

address@hidden CREDITS
SETI        13471758.391615   |   EINSTEIN     9375439.209852
ROSETTA      5601813.107505   |   ABC         15592097.439004




reply via email to

[Prev in Thread] Current Thread [Next in Thread]