(OLD) (ARCHIVED) Puppy Linux Discussion Forum Forum Index (OLD) (ARCHIVED) Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info

This forum can also be accessed as http://oldforum.puppylinux.com
It is now read-only and serves only as archives.

Please register over the NEW forum
https://forum.puppylinux.com
and continue your work there. Thank you.

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups    
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Thu 01 Oct 2020, 14:19
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
GtkDialog - tips
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies. View previous topic :: View next topic
Page 100 of 101 [1505 Posts]   Goto page: Previous 1, 2, 3, ..., 98, 99, 100, 101 Next
Author Message
lxgr

Joined: 28 Apr 2020
Posts: 2

PostPosted: Tue 28 Apr 2020, 13:02    Post subject: Re: Hbox alignment  

Moose On The Loose wrote:
lxgr wrote:
Hey, does someone know how to align a a hbox on the left and not at the right of a window?
Would be nice to know.


I would try:
Code:

<hbox xalign="0">

Changing the "0" to see what it does.

there is also a width-request="123" thing


Doesn't work with h/vbox
Just with text and pixmap etc. ...

But I got what I want via another way
Back to top
View user's profile Send private message 
UncleScrooge


Joined: 07 Apr 2020
Posts: 104
Location: Norway

PostPosted: Wed 29 Apr 2020, 12:42    Post subject:  

Hi guys,

is there any IDE for GTKDialog. like GLADE for GTK+?

coz I'm a slob.........
Back to top
View user's profile Send private message 
UncleScrooge


Joined: 07 Apr 2020
Posts: 104
Location: Norway

PostPosted: Fri 01 May 2020, 13:14    Post subject:  

Hi again
total newbie in GTK_dialog

I have two comboboxtext widgets, and I need to enable the second one only if choice 3 or choice 4 of the first combo are selected. disable combo2 in the other cases

Code:
<comboboxtext>
   <variable>firstCombo</variable>
   <item>choice 1</item>      ## disable second combo
   <item>choice 2</item>      ## disable second combo
   <item>choice 3</item>      ## enable second combo   
   <item>choice 4</item>      ## enable second combo
</comboboxtext>
<comboboxtext>
   <variable>secondCombo</variable>
   <sensitive>false</sensitive>
   <item>choice 1</item>
   <item>choice 2</item>
   <item>choice 3</item>
   <item>choice 4</item>
</comboboxtext>


how do I do that?
Back to top
View user's profile Send private message 
SFR


Joined: 26 Oct 2011
Posts: 1802

PostPosted: Fri 01 May 2020, 13:53    Post subject:  

UncleScrooge wrote:
is there any IDE for GTKDialog. like GLADE for GTK+?

I'm not aware of any.

UncleScrooge wrote:
I have two comboboxtext widgets, and I need to enable the second one only if choice 3 or choice 4 of the first combo are selected. disable combo2 in the other cases
[...]
how do I do that?

Like this:
Code:
#!/bin/sh

echo '
<vbox>

<comboboxtext>
   <variable>firstCombo</variable>
   <item>choice 1</item>
   <item>choice 2</item>
   <item>choice 3</item> 
   <item>choice 4</item>
   <action condition="command_is_true( [ \"$firstCombo\" = \"choice 1\" ] || [ \"$firstCombo\" = \"choice 2\" ] && echo true )">disable:secondCombo</action>
   <action condition="command_is_true( [ \"$firstCombo\" = \"choice 3\" ] || [ \"$firstCombo\" = \"choice 4\" ] && echo true )">enable:secondCombo</action>
</comboboxtext>
<comboboxtext>
   <variable>secondCombo</variable>
   <sensitive>false</sensitive>
   <item>choice 1</item>
   <item>choice 2</item>
   <item>choice 3</item>
   <item>choice 4</item>
</comboboxtext>

</vbox>
' | gtkdialog -s

It's not very convenient, but I don't know any other way to do it.

Greetings!

_________________
[O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource
Omnia mea mecum porto.
Back to top
View user's profile Send private message 
UncleScrooge


Joined: 07 Apr 2020
Posts: 104
Location: Norway

PostPosted: Fri 01 May 2020, 15:10    Post subject:  

@SFR

cheers mate and happy mayday
Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 2084
Location: Japan

PostPosted: Fri 01 May 2020, 21:59    Post subject:  

SFR wrote:
It's not very convenient, but I don't know any other way to do it.
I don't know any other way either Crying or Very sad This can become pretty nasty when there are more than just 2 items to trigger an enabled second box.

Maybe using a regex can bring some relief:
Code:
<action condition="command_is_true( [[ $firstCombo =~ (choice 3|choice 4) ]] || echo true )">disable:secondCombo</action>
<action condition="command_is_true( [[ $firstCombo =~ (choice 3|choice 4) ]] && echo true )">enable:secondCombo</action>
More item labels could be added to (choice 3|choice 4) and unique parts of the labels would be sufficient, so for the demo code (3|4) would do.
Back to top
View user's profile Send private message 
UncleScrooge


Joined: 07 Apr 2020
Posts: 104
Location: Norway

PostPosted: Sun 03 May 2020, 02:01    Post subject:  

@ SFR and MochiMoppel

thnx guys
following your hints I am actually creating a pyramidal block of functions handling different cases for a set of different widgets and their desired intreactions.
thus I'll end up in the dialog config file with a lot of:

Code:
<action condition="command_is_true(testCondition $widgetVar "RuleN" arg1 arg2 ... argN)">command_or_function</action>


that hopefully will keep the dialog config structure kinda more readable, while in the code function(s) one can see the logic behind the command firing condition.
Back to top
View user's profile Send private message 
UncleScrooge


Joined: 07 Apr 2020
Posts: 104
Location: Norway

PostPosted: Wed 06 May 2020, 02:06    Post subject: Again on combotext widget  

Hi guys,

is it possible to dynamically add/delete items in a combotext widget at runtime?

at the moment, since I use a separate .conf file to define the GUI, what I am doing is to have a function which modifies the GUI.conf file, then kills the gtkdialog process, refreshes the MAIN_DIALOG variable with the updated GUI.conf and re-launches the GUI.
which to me looks like a very ugly way to do the job (not to mention that the dead GUI shadow hangs in the desktop background hovering like a zombie, so if I have to repeat the process several times I end up with an army of gloomy zombies in the background)

And btw, is there any way to send signals from the code to the GUI so it can exit nicely instead of terminating it by "kill $pidof_GTKDialog" (which causes the hovering zombie problem above)?
so summarizing:

  1. can the items in the comboboxtext be added/deleted at runtime? if yes how?
  2. can the script send signals to the live GTKDialog? if yes, how?


thnx for the patience

PS: on question 1: I thought the comboboxtext <input> or <input file> directive would do the job (it works fine for the text widget for instance, although I have to use "cat filename" as command in the <input> directive), but here it seems to do nothing, or I just misinterpreted the concept of this directive
Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 2084
Location: Japan

PostPosted: Wed 06 May 2020, 03:43    Post subject: Re: Again on combotext widget  

UncleScrooge wrote:
is it possible to dynamically add/delete items in a combotext widget at runtime?

Yes.
Code:
#!/bin/bash
echo 'choice 1
choice 2
choice 3
choice 4' > /tmp/itemlist

echo '
<vbox>
<comboboxtext>
   <variable>firstCombo</variable>
   <input file>/tmp/itemlist</input>
</comboboxtext>
<button label="Remove last item">
   <action>echo "$(head -n-1 /tmp/itemlist)" > /tmp/itemlist</action>
   <action>refresh:firstCombo</action>
</button>
<button label="Add item blabla">
   <action>echo blabla >> /tmp/itemlist</action>
   <action>refresh:firstCombo</action>
</button>
</vbox>
 ' | gtkdialog -s


Quote:
can the script send signals to the live GTKDialog? if yes, how?

What script? And what is wrong with the kill command? If you do it right and kill the parent and not the child you shouldn't see zombies. I'm also not sure what you mean by conf file (external GUI file, gtkdialog include file or a bash sourced file?). In principle you can edit external files from within the GUI, then restart the GUI with the new values that you wrote to the conf file. A simple demo showing what you try to achieve would be helpful.
Back to top
View user's profile Send private message 
UncleScrooge


Joined: 07 Apr 2020
Posts: 104
Location: Norway

PostPosted: Wed 06 May 2020, 10:49    Post subject:  

@ MochiMoppel

your code example made me go back to my script and... I am a moron, Looks like I forgot a dot in the input file path ....
Back to top
View user's profile Send private message 
UncleScrooge


Joined: 07 Apr 2020
Posts: 104
Location: Norway

PostPosted: Thu 07 May 2020, 05:00    Post subject: Re: Again on combotext widget  

deleted by me: irrelevant
Last edited by UncleScrooge on Fri 08 May 2020, 02:13; edited 1 time in total
Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 2084
Location: Japan

PostPosted: Thu 07 May 2020, 06:04    Post subject: Re: Again on combotext widget  

UncleScrooge wrote:
here is my final goal:
Accessing your linked site doesn't make the diagram more readable but at least it provides a valuable tip how to process a can of Coca Cola properly.

Quote:
I am sorry if all these sounds like dumb gibberish
Not exactly gibberish but this doesn't mean that it makes sense to me, especially the red block. How does your blue script call external functions? By source command? And how would the MAIN_GUI then access the same functions? And why and how would the red functions and not the blue script kill the GUI? The more I look at the diagram the more questions pop up. Without a demo I don't understand this. Maybe someone else does.
diagram.jpg
Description 
jpg

 Download 
Filename  diagram.jpg 
Filesize  106.54 KB 
Downloaded  123 Time(s) 
Back to top
View user's profile Send private message 
UncleScrooge


Joined: 07 Apr 2020
Posts: 104
Location: Norway

PostPosted: Thu 07 May 2020, 08:39    Post subject: Re: Again on combotext widget  

MochiMoppel wrote:
......


sorry to have bothered you. just forget it
Back to top
View user's profile Send private message 
wiak

Joined: 11 Dec 2007
Posts: 2075
Location: not Bulgaria

PostPosted: Tue 26 May 2020, 18:33    Post subject: Re: Again on combotext widget  

UncleScrooge wrote:
And btw, is there any way to send signals from the code to the GUI so it can exit nicely instead of terminating it by "kill $pidof_GTKDialog" (which causes the hovering zombie problem above)?


I can't give you an answer to the above per se, but just agreeing that gtkdialog-based scripts, used to often have problems with zombies hanging around after use (and still does if you don't take care to clean up processes sometimes). I remember working on that issue in some of my own programs in the early days, but too long ago to remember details of solutions I adopted (nowadays I tend to just use the 'pattern' that worked so I don't need to think about it).

It certainly is important to keep control of process ids in shell scripts that fork child processes generally, so that is definitely the case with gtkdialog since it is being run as a child of the main script process and having variables exported to it. I remember that the main issue often occurred if the window decoration X box was used to close the dialog gui rather than the 'Close' button - for that one, I believe I use shell 'trap' to notice the abrupt interrupt, which runs a function to make sure all running processes involved get cleaned up correctly. Sorry for no details - just a confirmation that it was/can-be a common issue.

As for which widgets <input> works with, you can generally find that out from Gtkdialog reference. 01micko has an online version for Puppy:

http://01micko.com/reference/

A more accurate understanding can be obtained if you know C - just look at the source code, which is 'sometimes' commented.

wiak

_________________
WeeDogLinux forum: https://weedoglinux.rockedge.org/viewforum.php?f=4
Tiny Linux Blog: https://www.tinylinux.info/
Check Firmware: http://murga-linux.com/puppy/viewtopic.php?p=1022797
Back to top
View user's profile Send private message 
smokey01


Joined: 30 Dec 2006
Posts: 2820
Location: South Australia :-(

PostPosted: Tue 02 Jun 2020, 07:58    Post subject:  

Is there a way to make a functional progress bar that actually shows progress and not just activity?

I would like to be able to have a progress bar that shows the progress of a function with a number of different commands.

function() {
command 1
command 2
command 3
}
export -f function

_________________
Software <-> Distros <-> Tips <-> Newsletters
Back to top
View user's profile Send private message Visit poster's website 
Display posts from previous:   Sort by:   
Page 100 of 101 [1505 Posts]   Goto page: Previous 1, 2, 3, ..., 98, 99, 100, 101 Next
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies. 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.4614s ][ Queries: 12 (0.3675s) ][ GZIP on ]