GtkDialog - tips
-
- Posts: 17
- Joined: Sun 14 Apr 2013, 10:34
- DocSalvage
- Posts: 11
- Joined: Sat 30 Jun 2012, 18:59
- Location: Tallahassee, FL, USA
- Contact:
Hyperlinks
I'm working on an awk program that converts Zim pages to GtkDialogs for checklists and such so it needs to have functional hyperlinks.
I've learned that the Pango markup "<span><a>..." formats the hypertext just fine but taking action on the click is the problem. I've made it work by wrapping the GtkDialog <text> widget in its own <hbox> which is, in turn, wrapped in an <hbox > for the entire line of text. Conceptually, the code looks something like...
Very much a work in progress, but maybe this will help others trying to use hyperlinks.
I've learned that the Pango markup "<span><a>..." formats the hypertext just fine but taking action on the click is the problem. I've made it work by wrapping the GtkDialog <text> widget in its own <hbox> which is, in turn, wrapped in an <hbox > for the entire line of text. Conceptually, the code looks something like...
Code: Select all
<hbox>
<hbox>
<text>
<label>"<span>non-link-text</span>"</label>
</text>
</hbox>
<hbox>
<text>
<label>"<span><a href="...">link-text</a></span>"</label>
<action signal="button-press-event">...</action>
</text>
</hbox>
<hbox>
<text>
<label>"<span>non-link-text</span>"</label>
</text>
</hbox>
</hbox>
[i][color=blue]DocSalvager (a.k.a. DocSalvage)[/color][/i]
[url]http://www.docsalvage.info[/url], [url]http://www.softwarerevisions.net[/url]
[url]http://www.docsalvage.info[/url], [url]http://www.softwarerevisions.net[/url]
- mister_electronico
- Posts: 969
- Joined: Sun 20 Jan 2008, 20:20
- Location: Asturias_ España
- Contact:
One cuestion.
Why don't work this program, and how I can get work.
#! /bin/bash
export CHOOSER
export MAIN_DIALOG='
<vbox>
<chooser>
<height>500</height><width>600</width>
<variable>CHOOSER</variable>
</chooser>
<hbox>
<button help></button>
<button ok></button>
</hbox>
</vbox>
'
gtkdialog --program=MAIN_DIALOG
exec mplayer CHOOSER
I was searching everywhere and I can't see how choose one file and open with some application program, like this example or if I want open file by Menubar.
Thanks for any help.
#! /bin/bash
export CHOOSER
export MAIN_DIALOG='
<vbox>
<chooser>
<height>500</height><width>600</width>
<variable>CHOOSER</variable>
</chooser>
<hbox>
<button help></button>
<button ok></button>
</hbox>
</vbox>
'
gtkdialog --program=MAIN_DIALOG
exec mplayer CHOOSER
I was searching everywhere and I can't see how choose one file and open with some application program, like this example or if I want open file by Menubar.
Thanks for any help.
- mister_electronico
- Posts: 969
- Joined: Sun 20 Jan 2008, 20:20
- Location: Asturias_ España
- Contact:
No work.
Thanks zigbert for answering but don't work.
The problem with the variable CHOOSER inside of GTKDIALOG is local variable, I not know how export variable outside of GTKDIALOG.
The only way I met is :
But I think is not very elegant.
Anyway Thanks for you reply.
The problem with the variable CHOOSER inside of GTKDIALOG is local variable, I not know how export variable outside of GTKDIALOG.
The only way I met is :
Code: Select all
#! /bin/bash
export MAIN_DIALOG='
<vbox>
<chooser>
<height>500</height><width>600</width>
<variable>CHOOSER</variable>
</chooser>
<hbox>
<button ok>
<action>"echo $CHOOSER > /tmp/tmp"</action>
<action>exit:Exit</action>
</button>
</hbox>
</vbox>
'
gtkdialog --program=MAIN_DIALOG
A=$(cat /tmp/tmp)
echo "$A"
exec mplayer $A
Anyway Thanks for you reply.
Making it a function works
Code: Select all
#! /bin/bash
CHOSEN(){
mplayer $CHOOSER
}
export -f CHOSEN
export MAIN_DIALOG='
<vbox>
<chooser>
<height>500</height><width>600</width>
<variable>CHOOSER</variable>
</chooser>
<hbox>
<button ok>
<action>CHOSEN</action>
<action>exit:Exit</action>
</button>
</hbox>
</vbox>
'
gtkdialog --program=MAIN_DIALOG
[b]Carolina:[/b] [url=http://smokey01.com/carolina/pages/recent-repo.html]Recent Repository Additions[/url]
[img]https://dl.dropboxusercontent.com/s/ahfade8q4def1lq/signbot.gif[/img]
[img]https://dl.dropboxusercontent.com/s/ahfade8q4def1lq/signbot.gif[/img]
- mister_electronico
- Posts: 969
- Joined: Sun 20 Jan 2008, 20:20
- Location: Asturias_ España
- Contact:
Works...
Amazing Geoffrey! Works.
When call to the variable trough function works.
Have a problem when you try to choose mplayer file in other partition or hard drive.
Thanks for teaching this way
When call to the variable trough function works.
Have a problem when you try to choose mplayer file in other partition or hard drive.
Thanks for teaching this way
You can also do it this way-
This runs the gtkdialog program between the backtics and then evaluates (sets the variables for further use)
Cheers,
s
Code: Select all
eval `gtkdialog --program=MAIN_DIALOG`
This runs the gtkdialog program between the backtics and then evaluates (sets the variables for further use)
Cheers,
s
- mister_electronico
- Posts: 969
- Joined: Sun 20 Jan 2008, 20:20
- Location: Asturias_ España
- Contact:
Thanks seaside
Thanks seaside... works perfect.
I check it in the first program, and work perfect and I can open one mplayer file well, even if the file is in other partition or other hardrive.
So thanks for teaching this way too.
Good teachers in this Forum.
I check it in the first program, and work perfect and I can open one mplayer file well, even if the file is in other partition or other hardrive.
So thanks for teaching this way too.
Good teachers in this Forum.
-
- Posts: 3
- Joined: Wed 29 May 2013, 18:02
Multiple defaults in tree
Hello,
Does anyone know of a way set multiple defaults in the tree widget? I see a selected-row tag but that only sets a single default. Does anyone know of how to do this? Thanks in advance!
John
Does anyone know of a way set multiple defaults in the tree widget? I see a selected-row tag but that only sets a single default. Does anyone know of how to do this? Thanks in advance!
John
-
- Posts: 3
- Joined: Wed 29 May 2013, 18:02
gtkdialog changing shell variable
Hello,
I have been trying to figure out how to change a bash variable value within gtkdialog. That is, I load a config file to set my variables within gtkdialog. However, i would like to change the variable value based on user input. When i change the value with an action, it doesn't change the value on exit (it stays the same). I think the action function is kicking off a sub shell, changig the variable there, then returning back to the main shell. If that is correct, any way to change the parent shell variable value without using files for storage?
Thanks,
John
I have been trying to figure out how to change a bash variable value within gtkdialog. That is, I load a config file to set my variables within gtkdialog. However, i would like to change the variable value based on user input. When i change the value with an action, it doesn't change the value on exit (it stays the same). I think the action function is kicking off a sub shell, changig the variable there, then returning back to the main shell. If that is correct, any way to change the parent shell variable value without using files for storage?
Thanks,
John
list/tree/table with checkbox
Hey guys,
is there any option to have checkboxes within a gtkdialog tree/list/table? I would like to select multiple items.
Input is optained from a textfile:
monitor1|true|option1
monitor2|false|option2
monitor3|true|option3
Output is written to a textfile.
Thanks & regards,
box579.
is there any option to have checkboxes within a gtkdialog tree/list/table? I would like to select multiple items.
Input is optained from a textfile:
monitor1|true|option1
monitor2|false|option2
monitor3|true|option3
Output is written to a textfile.
Thanks & regards,
box579.
- ASRI éducation
- Posts: 3197
- Joined: Sat 09 May 2009, 12:10
- Location: France
- Contact:
Hello !
I'm trying to create a GUI (GTK) and I need help.
I use the combobox option and I do not want the user could edit the items offered (so that he can choose only in the list of items proposed by the script).
Currently, my combobox like this:
My question: is it possible to prevent the publishing of the items proposed by the combobox?
Cordialement,
I'm trying to create a GUI (GTK) and I need help.
I use the combobox option and I do not want the user could edit the items offered (so that he can choose only in the list of items proposed by the script).
Currently, my combobox like this:
Code: Select all
<vbox>
<text><label>Live Support</label></text>
<combobox width-request=\""$COMBOBOX_WIDTH"\" tooltip-text=\" Select the live support \">
<variable>CheckLiveSupport</variable>
$LIVE_SUPPORT_ITEMS
</combobox>
</vbox>
Cordialement,
Hi ASRI education,
to prevent users from editing your items use <comboboxtext> instead of <combobox>. See below, for specs read this:
http://code.google.com/p/gtkdialog/wiki/comboboxtext
BR, box579.
to prevent users from editing your items use <comboboxtext> instead of <combobox>. See below, for specs read this:
http://code.google.com/p/gtkdialog/wiki/comboboxtext
Code: Select all
<vbox>
<text><label>Live Support</label></text>
<comboboxtext width-request=\""$COMBOBOX_WIDTH"\" tooltip-text=\" Select the live support \">
<variable>CheckLiveSupport</variable>
$LIVE_SUPPORT_ITEMS
</comboboxtext>
</vbox>
- ASRI éducation
- Posts: 3197
- Joined: Sat 09 May 2009, 12:10
- Location: France
- Contact:
This is exactly what I needed.box579 wrote:Hi ASRI education,
to prevent users from editing your items use <comboboxtext> instead of <combobox>. See below, for specs read this:
http://code.google.com/p/gtkdialog/wiki/comboboxtext
BR, box579.Code: Select all
<vbox> <text><label>Live Support</label></text> <comboboxtext width-request=""$COMBOBOX_WIDTH"" tooltip-text=" Select the live support "> <variable>CheckLiveSupport</variable> $LIVE_SUPPORT_ITEMS </comboboxtext> </vbox>
A big thank you!
- ASRI éducation
- Posts: 3197
- Joined: Sat 09 May 2009, 12:10
- Location: France
- Contact:
@ zigbert
May be, it could be interesting to add this info in the first message.
Cordialement,
May be, it could be interesting to add this info in the first message.
Cordialement,
ASRI éducation wrote:Hello !
I'm trying to create a GUI (GTK) and I need help.
I use the combobox option and I do not want the user could edit the items offered (so that he can choose only in the list of items proposed by the script).
Currently, my combobox like this:My question: is it possible to prevent the publishing of the items proposed by the combobox?Code: Select all
<vbox> <text><label>Live Support</label></text> <combobox width-request=""$COMBOBOX_WIDTH"" tooltip-text=" Select the live support "> <variable>CheckLiveSupport</variable> $LIVE_SUPPORT_ITEMS </combobox> </vbox>
Cordialement,
box579 wrote:Hi ASRI education,
to prevent users from editing your items use <comboboxtext> instead of <combobox>. See below, for specs read this:
http://code.google.com/p/gtkdialog/wiki/comboboxtext
BR, box579.Code: Select all
<vbox> <text><label>Live Support</label></text> <comboboxtext width-request=""$COMBOBOX_WIDTH"" tooltip-text=" Select the live support "> <variable>CheckLiveSupport</variable> $LIVE_SUPPORT_ITEMS </comboboxtext> </vbox>
ASRI éducation wrote:This is exactly what I needed.
Nested expanders
Does anyone did it before?
Nested expanders - can be used for 'tree-view' of folders.
Hack on a hack pushed by another hack, but works beautifully!
Ok, so who's gonna write a routine that recursively parses directory tree and dynamically builds a GUI?
Not me - no way!
Greetings!
Nested expanders - can be used for 'tree-view' of folders.
Hack on a hack pushed by another hack, but works beautifully!
Ok, so who's gonna write a routine that recursively parses directory tree and dynamically builds a GUI?
Not me - no way!
Code: Select all
#!/bin/bash
# Pure Mess v1.0 ;)
# Nested expanders example by SFR'2013
# Tricky as hell (chaos with vbox/hbox and alignment), but works like a charm!
# Requires Gtkdialog >= 0.8.1
file_select () {
xmessage --center "'$@' has been selected..."
}
export -f file_select
export MAIN='
<window title="Recursive expander">
<vbox spacing="0">
<expander label="directory 1" space-fill="false" space-expand="false">
<vbox spacing="0">
<hbox>
<text space-fill="false" space-expand="false"><label>" "</label></text>
<vbox spacing="0">
<expander label="directory 2" space-fill="false" space-expand="false">
<vbox spacing="0">
<hbox>
<text space-fill="false" space-expand="false"><label>" "</label></text>
<vbox spacing="0">
<expander label="dir3" space-fill="false" space-expand="false">
<vbox spacing="0">
<hbox>
<text space-fill="false" space-expand="false"><label>" "</label></text>
<button relief="2" space-fill="false" space-expand="false">
<label>bla bla 1</label>
<action>file_select bla bla 1</action>
</button>
<text space-fill="true" space-expand="true"><label>" "</label></text>
</hbox>
<hbox>
<text space-fill="false" space-expand="false"><label>" "</label></text>
<button relief="2" space-fill="false" space-expand="false">
<label>bla bla 2</label>
<action>file_select bla bla 2</action>
</button>
<text space-fill="true" space-expand="true"><label>" "</label></text>
</hbox>
</vbox>
</expander>
</vbox>
<text space-fill="true" space-expand="true"><label>" "</label></text>
</hbox>
<hbox>
<text space-fill="false" space-expand="false"><label>" "</label></text>
<button relief="2" space-fill="false" space-expand="false">
<label>somefile1 in dir2</label>
<action>file_select somefile1</action>
</button>
<text space-fill="true" space-expand="true"><label>" "</label></text>
</hbox>
<hbox>
<text space-fill="false" space-expand="false"><label>" "</label></text>
<button relief="2" space-fill="false" space-expand="false">
<label>somefile2 in dir2</label>
<action>file_select somefile2</action>
</button>
<text space-fill="true" space-expand="true"><label>" "</label></text>
</hbox>
<hbox>
<text space-fill="false" space-expand="false"><label>" "</label></text>
<button relief="2" space-fill="false" space-expand="false">
<label>and one more file in dir2</label>
<action>file_select one more file</action>
</button>
<text space-fill="true" space-expand="true"><label>" "</label></text>
</hbox>
</vbox>
</expander>
<hbox>
<button relief="2" space-fill="false" space-expand="false">
<label>File in directory 1</label>
<action>file_select file from first dir</action>
</button>
<text space-fill="true" space-expand="true"><label>" "</label></text>
</hbox>
</vbox>
<text space-fill="true" space-expand="true"><label>" "</label></text>
</hbox>
</vbox>
</expander>
</vbox>
</window>
'
gtkdialog -cp MAIN
- Attachments
-
- Screenshot.png
- (8.43 KiB) Downloaded 1101 times
[color=red][size=75][O]bdurate [R]ules [D]estroy [E]nthusiastic [R]ebels => [C]reative [H]umans [A]lways [O]pen [S]ource[/size][/color]
[b][color=green]Omnia mea mecum porto.[/color][/b]
[b][color=green]Omnia mea mecum porto.[/color][/b]