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 Sat 26 Jul 2014, 11:10
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
How to create a tailbox with gtkdialog?
Post new topic   Reply to topic View previous topic :: View next topic
Page 2 of 2 [27 Posts]   Goto page: Previous 1, 2
Author Message
Bert


Joined: 30 Jun 2006
Posts: 915

PostPosted: Sun 23 Feb 2014, 08:04    Post subject:  

From "impossible" to three possibilties Very Happy

The yad code by sfs is working, as are gtklogfileviewer and the Xdialog tailbox.
With yad I cannot get the scrolling-in-reverse. Would have to create a log file and that does not auto-scroll in real time.

The reason why I wanted this to succeed in gtkdialog is I also need to add a custom button to this window. So far, I haven't found how to do this in xdialog.
(yes, I'm a totlal noob in coding) When I want a button "pizza" in gtkdialog, poof! it's there, opening a window "pizzeria" and smelling good Wink

So I'm not against using xdialog. The tailbox is in fact really fast! It's just that I find it hard to understand its iron logic.

Thank you both, Mike and MochiMoppel!

Bert

_________________


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

Joined: 19 Jun 2010
Posts: 2504
Location: Burghaslach, Germany somewhere also known as "Hosla"

PostPosted: Sun 23 Feb 2014, 08:28    Post subject: How to create a tailbox with gtkdialog?
Subject description: take Xdialog or dialog
 

MochiMoppel wrote:
Bert wrote:
Is there a working example of such a "rolling" display someone could point me to?

Unless you insist on gtkdialog, Xdialog is reliable, small and fast:
Code:
xev >> /tmp/xev.log &
Xdialog --tailbox "/tmp/xev.log" 30 100


And this also works as "one-liner" ( without temporary file )
Code:
xev | Xdialog --tailbox "/tmp/xev.log" 30 100


mikeb wrote:
....why reject good alternative tools for the job....
+1
dialog is older so give it a try:
Code:
xev | dialog --tailbox "/tmp/xev.log" 30 100
(works for me, too)

or
Code:
rxvt  -e xev | dialog --tailbox "/tmp/xev.log" 30 100
Question

EDIT
forget it please Laughing Laughing Laughing

Last edited by L18L on Sun 23 Feb 2014, 08:51; edited 1 time in total
Back to top
View user's profile Send private message 
mikeb


Joined: 23 Nov 2006
Posts: 8032

PostPosted: Sun 23 Feb 2014, 08:32    Post subject:  

gtklogfileviewer /tmp/pburn-log Close -center 0 600 350 "Pburn Log"

'Close' is the button name....

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


Joined: 26 Jan 2011
Posts: 329
Location: Japan

PostPosted: Sun 23 Feb 2014, 08:48    Post subject: Re: How to create a tailbox with gtkdialog?
Subject description: take Xdialog or dialog
 

L18L wrote:
And this also works as "one-liner" ( without temporary file )
Code:
xev | Xdialog --tailbox "/tmp/xev.log" 30 100
Very unlikely Laughing
Back to top
View user's profile Send private message 
L18L

Joined: 19 Jun 2010
Posts: 2504
Location: Burghaslach, Germany somewhere also known as "Hosla"

PostPosted: Sun 23 Feb 2014, 08:50    Post subject: Re: How to create a tailbox with gtkdialog?
Subject description: take Xdialog or dialog
 

MochiMoppel wrote:
L18L wrote:
And this also works as "one-liner" ( without temporary file )
Code:
xev | Xdialog --tailbox "/tmp/xev.log" 30 100
Very unlikely Laughing


Yes you are right.
It worked only because the temporary file still existed Embarassed Embarassed Embarassed
Back to top
View user's profile Send private message 
Bert


Joined: 30 Jun 2006
Posts: 915

PostPosted: Sun 23 Feb 2014, 19:39    Post subject:  

Just came home from a family reunion and read the new replies...

Mikeb wrote:
gtklogfileviewer /tmp/pburn-log Close -center 0 600 350 "Pburn Log"

'Close' is the button name....


Yes, I know. The question is: can I either define a new function to this button OR define an "extra-button"? I've really searched through all the xdialog documentation and tried every example, but it is not at all clear another button than the stock "exit/OK/Cancel/Help/Print" can be created.
To stay with my silly example above: I can rename a button to "pizza", but there is no explanation anywhere telling me how to let this button open a new window "pizzeria", instead of doing one of the stock actions (close/cancel, etc..)

I'm deviating from the subject a bit, but I presume brokenman must have had similar questions when he started this thread.

_________________


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


Joined: 23 Nov 2006
Posts: 8032

PostPosted: Sun 23 Feb 2014, 20:21    Post subject:  

hmm think i made a temp miniscript generated which had a follow on action.... I guess though ideally the source could be modded the add a button action.

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


Joined: 26 Jan 2011
Posts: 329
Location: Japan

PostPosted: Mon 24 Feb 2014, 09:06    Post subject:  

Bert wrote:
The question is: can I either define a new function to this button.
No
Quote:
OR define an "extra-button"?
All you can do is add the buttons you already mentioned and a checkbox, but all have predefined functions and return values.
Quote:
I can rename a button to "pizza", but there is no explanation anywhere telling me how to let this button open a new window "pizzeria.
And you could call your pizza cheesecake and it would still be a pizza...
Back to top
View user's profile Send private message 
Bert


Joined: 30 Jun 2006
Posts: 915

PostPosted: Mon 24 Feb 2014, 12:02    Post subject:  

Quote:
And you could call your pizza cheesecake and it would still be a pizza...
Laughing Laughing Laughing

Thank you MochiMoppel

Think I've solved it: by simplifying my script, omitting a warning dialog and using the return value of the Cancel button. ( if [ $? -eq "1" ]; then...action)

Simple, a bit crude maybe, but effective Cool

_________________


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


Joined: 26 Jan 2011
Posts: 329
Location: Japan

PostPosted: Mon 24 Feb 2014, 22:07    Post subject:  

Wait! Here comes your pizza. Thunor provided the ingredients, zigbert the topping and I mixed it all together. It scrolls - sort of. Newest entries at the top, not the tail, so it's a headbox. I don't know if there is a way to turn this into a veritable tailbox. And don't try this with highspeed logs like in the previous xev example. Gtkdialog will choke, unlike Xdialog.

Code:
#!/bin/sh
(for (( c=1; c<=180; c++ ));do
echo `date` >> /tmp/date.log
sleep 1
done)&

export  DIALOG_MAIN='
 <window width-request="300">
    <vbox>
       <vbox>
          <tree headers-visible="false" >
             <variable>txtOutput</variable>
             <height>150</height>
             <input>tac /tmp/date.log</input>
          </tree>
       </vbox>
       <hbox homogeneous="true">
          <button width-request="90">
          <label>Pizza</label>
          <input file stock="gtk-cdrom"></input>
              <action>xmessage "PIZZA!!!"</action>
          </button>
          <button use-stock="true" label="gtk-ok" width-request="90">
              <action>exit:Exit</action>
          </button>
       </hbox>
       <timer interval="1" visible="false">
          <action>refresh:txtOutput</action>
       </timer>
    </vbox>
 </window>
 '
gtkdialog --program=DIALOG_MAIN
Back to top
View user's profile Send private message 
Bert


Joined: 30 Jun 2006
Posts: 915

PostPosted: Tue 25 Feb 2014, 09:16    Post subject:  

Very nice!
(... and creative use of gtk-stock-icons Smile )

I tried it with a wget logfile as input. It didn't choke gtkdialog, but was seriously lagging, so of little use for that purpose. It also had a jerky refreshing, not the smooth scrolling the xdialog tailbox and the gtklogfileviewer have.
Tried "pizza.sh" with the timer and/or "sleep" removed: it then just statically displays the last process.
And I wasn't able either to turn it into a scrolling tailbox.
( a tailbox seems easier for human brains than a headbox..? )

Thanks for your help!

_________________


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


Joined: 10 Mar 2010
Posts: 3212
Location: Ontario

PostPosted: Tue 25 Feb 2014, 20:39    Post subject:  

Zigbert used Xdialog --logbox in his program 'pmirror'
to show the files being copied in real time .
____________________________________________
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 2 of 2 [27 Posts]   Goto page: Previous 1, 2
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.0870s ][ Queries: 12 (0.0046s) ][ GZIP on ]