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 Fri 29 Aug 2014, 14:21
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
Background processing with gtkdialog
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [7 Posts]  
Author Message
matiasbatero


Joined: 11 Oct 2012
Posts: 57
Location: Mar del Plata, Argentina

PostPosted: Sat 02 Nov 2013, 16:05    Post subject:  Background processing with gtkdialog
Subject description: How to make it work?
 

Hi to everyone.

I don't know how to get sub-processes working in background in gtkdialog.

Gtkdialog wait always a command/process finish signal in order to continue rendering the GUI.

I have a example, i want to extract Size, Path and MD5 sum from a file (file-selector widget) and puts results on a TREE widget.

MD5sum is the slow part of this process. Gtkdialog seems paralized until md5sum finish the job.

I want to put results as they are generated.

There is a way to do this??
If not, the only solution is a "waiting splash screen" and wait :S
Back to top
View user's profile Send private message 
don570


Joined: 10 Mar 2010
Posts: 3259
Location: Ontario

PostPosted: Sat 02 Nov 2013, 16:15    Post subject:  

Xdialog has logbox option

http://xdialog.free.fr/doc/box.html

which is useful to show results instantaneously.

Several gtkdialog scripts use it.

________________________________
Back to top
View user's profile Send private message 
zigbert


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

PostPosted: Sun 03 Nov 2013, 07:53    Post subject: Re: Background processing with gtkdialog
Subject description: How to make it work?
 

matiasbatero wrote:
Gtkdialog wait always a command/process finish signal in order to continue rendering the GUI.
Wrong Very Happy
There are (at least) 3 ways to update gui based on external actions.

1.) Add the tag attributes file-monitor="true" auto-refresh="true". See http://code.google.com/p/gtkdialog/wiki/tree

2.) Add an <action> to the <progressbar> widget, and it will execute as the bar reach 100%.

3.) The <timer> widget runs its <action> each sec (or whatever interval set). See http://code.google.com/p/gtkdialog/wiki/timer

A more complex example is found in chapter 4 of Gtkdialog - Tips and tricks
Sigmund

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


Joined: 11 Oct 2012
Posts: 57
Location: Mar del Plata, Argentina

PostPosted: Mon 04 Nov 2013, 21:49    Post subject: Re: Background processing with gtkdialog
Subject description: How to make it work?
 

zigbert wrote:
matiasbatero wrote:
Gtkdialog wait always a command/process finish signal in order to continue rendering the GUI.
Wrong Very Happy
There are (at least) 3 ways to update gui based on external actions.

1.) Add the tag attributes file-monitor="true" auto-refresh="true". See http://code.google.com/p/gtkdialog/wiki/tree

2.) Add an <action> to the <progressbar> widget, and it will execute as the bar reach 100%.

3.) The <timer> widget runs its <action> each sec (or whatever interval set). See http://code.google.com/p/gtkdialog/wiki/timer

A more complex example is found in chapter 4 of Gtkdialog - Tips and tricks
Sigmund


Thanks Zigbert!!! i will do that. Next i'll post my results.
Back to top
View user's profile Send private message 
matiasbatero


Joined: 11 Oct 2012
Posts: 57
Location: Mar del Plata, Argentina

PostPosted: Mon 04 Nov 2013, 21:51    Post subject:  

don570 wrote:
Xdialog has logbox option

http://xdialog.free.fr/doc/box.html

which is useful to show results instantaneously.

Several gtkdialog scripts use it.

________________________________


Thanks!!! Seems that work, but it's not applicable in this case.
Back to top
View user's profile Send private message 
don570


Joined: 10 Mar 2010
Posts: 3259
Location: Ontario

PostPosted: Wed 06 Nov 2013, 20:21    Post subject:  

I wrote this short script to better understand Xdialog --logbox
and running a function in background

As an exercise remove the line ...

[ $A -gt 10 ] && break

and see what chaos occurs Wink


Code:

#!/bin/sh

add_function() {
        rm -f /root/log_file
        A=0
        while true
        do
             let "A=$A+1"
             echo "$A" >> /root/log_file
             [ $A -gt 10  ] && break
             sleep 2
         done
}
export -f add_function


export MAIN_DIALOG='
<vbox border-width="20">
    <button>
    <label>Start</label>
    <action>add_function &</action>
    <action>exit:EXIT</action>
    </button>
</vbox>
'
gtkdialog --program MAIN_DIALOG


export MAIN_DIALOG='
<vbox border-width="20">
      <button>
      <label>log box</label>
      <action>Xdialog --date-stamp --no-cancel --logbox   /root/log_file 0 0 &</action>
      </button>
</vbox>
'

gtkdialog --program MAIN_DIALOG


____________________________________________

Last edited by don570 on Thu 07 Nov 2013, 13:14; edited 1 time in total
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4346

PostPosted: Wed 06 Nov 2013, 22:50    Post subject:  

don570 wrote:
Code:

#!/bin/sh
...
             let "A=$A+1"
A=$((A+1))
https://wiki.ubuntu.com/DashAsBinSh#let

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 1 [7 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.0684s ][ Queries: 12 (0.0044s) ][ GZIP on ]