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 Thu 19 Sep 2019, 08:35
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
GtkDialog - tips
Post new topic   Reply to topic View previous topic :: View next topic
Page 99 of 99 [1475 Posts]   Goto page: Previous 1, 2, 3, ..., 97, 98, 99
Author Message
MochiMoppel


Joined: 26 Jan 2011
Posts: 1897
Location: Japan

PostPosted: Mon 12 Aug 2019, 22:50    Post subject:  

misko_2083 wrote:
I would try next: Smile
Code:
 step=$(( 100 / cnt )).$(( (100 * 100 / cnt) % 100 ))

1.78
I wouldn't Laughing
Remember that you would still have to add these values up. In bash? Good luck!

I find my approach much easier. Besides: The progressbar doesn't seem to care about fractions. Non-numeric characters after an integer are ignored. It doesn't matter if you echo a value of 1 or 1.99999 or even 1blabla, the bar will always show exactly 1% .
Back to top
View user's profile Send private message 
TwoPuppies


Joined: 29 Dec 2010
Posts: 77
Location: Melbourne, Australia

PostPosted: Tue 13 Aug 2019, 00:46    Post subject:  

MochiMoppel wrote:
Change step=$((100/cnt)) to step=$((100000/cnt))
and
echo $bar to echo $((bar/1000))

This worked as expected. The Progress Bar continued all the way to the end before the window closed. Thanks MochiMoppel.

misko_2083 wrote:
I would try next: Smile
Code:
step=$(( 100 / cnt )).$(( (100 * 100 / cnt) % 100 ))

This caused the Progress Bar to freeze after only one Package was installed. No more Packages installed after that.

_________________
What you really need is two puppies:
Puppy Linux, and the sort with four legs and a tail.

Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1897
Location: Japan

PostPosted: Tue 13 Aug 2019, 03:53    Post subject:  

TwoPuppies wrote:
This worked as expected.

Back to top
View user's profile Send private message 
misko_2083


Joined: 08 Nov 2016
Posts: 81

PostPosted: Tue 13 Aug 2019, 04:48    Post subject:  

MochiMoppel wrote:
misko_2083 wrote:
I would try next: Smile
Code:
 step=$(( 100 / cnt )).$(( (100 * 100 / cnt) % 100 ))

1.78
I wouldn't Laughing
Remember that you would still have to add these values up. In bash? Good luck!

I find my approach much easier. Besides: The progressbar doesn't seem to care about fractions. Non-numeric characters after an integer are ignored. It doesn't matter if you echo a value of 1 or 1.99999 or even 1blabla, the bar will always show exactly 1% .

I know, just forgot to mention that I used the pure bash calculator.
I saved && made executable this script https://github.com/bluebat/.bash/blob/master/bashbc.sh
Code:

    IFS=$'\n'
    array=($PACKAGELIST)
    cnt=${#array[@]}

    step=$(( 100 / cnt )).$(( (100 * 100 / cnt) % 100 ))
    bar=$step
    for ((c=0;c<$cnt;c++));do
        file=${array[$c]}
        echo $bar                #progress indicator (MUST be number)
        echo $file               #text within progress bar (MUST NOT start with number)
       # set the path to bashbc.sh here !
        bar=$(scale=2 bashbc.sh $bar+$step)        #increase progress indicator
    done;
    echo 100 


The calculator script works like this
Code:
bashbc.sh 2.555+6.335
8.89
scale=2 bashbc.sh 2*(3/7)
0.84

Maybe not so precise but good enough for a progress bar.
Back to top
View user's profile Send private message 
recobayu


Joined: 15 Sep 2010
Posts: 353
Location: indonesia

PostPosted: Sat 14 Sep 2019, 13:34    Post subject:  

I have 20 button inside of scrollable vbox. When I use down arrow keyboard to move from one button to another button below that, after some button, the button not appear. Butwhen I usemoise to scroll down, it is select on that button. How to make the button always seen when we use down arrow keyboard? Just like tree. Is it possible? Thank you.
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 99 of 99 [1475 Posts]   Goto page: Previous 1, 2, 3, ..., 97, 98, 99
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.1563s ][ Queries: 12 (0.0735s) ][ GZIP on ]