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 Sun 21 Dec 2014, 19:23
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 Posts_count  
Author Message
matiasbatero


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

PostPosted: Sat 02 Nov 2013, 16:05    Post_subject:  Background processing with gtkdialog
Sub_title: 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: 3437
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: 5814
Location: Valåmoen, Norway

PostPosted: Sun 03 Nov 2013, 07:53    Post_subject: Re: Background processing with gtkdialog
Sub_title: 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_website 
matiasbatero


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

PostPosted: Mon 04 Nov 2013, 21:49    Post_subject: Re: Background processing with gtkdialog
Sub_title: 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: 60
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: 3437
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


____________________________________________

Edited_time_total
Back to top
View user's profile Send_private_message 
technosaurus


Joined: 18 May 2008
Posts: 4424

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:   Sort by:   
Page 1 of 1 Posts_count  
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Off-Topic Area » Programming
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0691s ][ Queries: 12 (0.0045s) ][ GZIP on ]