GtkDialog - tips
where to find window icons
I can't seem to get a window icon to appear on my apps. Can some tell me where the icon image files needs to be located to work on a dialog as below.
<window title=\"NASViewer\" icon-name=\"NASviewer16.xpm\">
I've tried the full path as well and that didn't work.
Thanks!
<window title=\"NASViewer\" icon-name=\"NASviewer16.xpm\">
I've tried the full path as well and that didn't work.
Thanks!
- thunor
- Posts: 350
- Joined: Thu 14 Oct 2010, 15:24
- Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
- Contact:
You create a shell script to construct a Gtkdialog XML-like structure which is stored within a shell variable that's passed to the gtkdialog binary. The variable names that Gtkdialog exports to the shell are those that you've instructed it to use e.g. <variable>LABEL1</variable> (widgets containing multiple items also export additional variables with an "_ALL" suffix on exit). Recently I found within an example a Gtkdialog exported shell variable named BUTTON which holds the mouse button id (if applicable) that triggered an action, but I'm not aware of anything else (I searched the code for "setenv" and "putenv"). Therefore other than MAIN_DIALOG, the <variable> names that you store within the XML and BUTTON that Gtkdialog may export, what else is there to conflict with? If you give me an example I can assist you with it.8-bit wrote:When one is writing a gtkdialog script, there seems to be no reference one can refer to as to words that are reserved for gtkdialog.
A list of those words would be nice so one knows not to use them as variables or other areas where they might conflict with reserved words.
Good idea or bad?
Dave_G wrote:I've just started coding with gtkdialog and have to agree 100% with 8-bit.
Unfortunately this lack of documentation is not unique to gtkdialog, it seems
to be pretty common in the Linux world.
A very big stumbling block for newbies like myself.
Dave.
- Widget Reference - it's not completely populated but it's a good start.
- GTK+ 2 Reference Manual for the GtkEntry Widget - the <entry> widget within Gtkdialog (the GTK+ read/write properties are the Gtkdialog tag attributes).
- Use the GTK+ 2 Reference Manual to find other properties for other widgets or use Gtkdialog's Widget Reference which already includes the links.
- There's a very useful Widget Construction section with links to GTK+ widget properties (tag attributes) within the main post of the Gtkdialog Development thread.
- The same post includes a list of comprehensive examples for the newly added or extended widgets.
- You can browse the original but recently updated examples within the repository or you can checkout the source code; examples included.
- There's a Documentation section on the project page.
Regards,
Thunor
- thunor
- Posts: 350
- Joined: Thu 14 Oct 2010, 15:24
- Location: Minas Tirith, in the Pelennor Fields fighting the Easterlings
- Contact:
Issue 8 within the issue tracker (zigberts issues) has a request for "supporting <item stock=gtk-open>coloumn1|coloumn2</item> from an input file". I came across an example named 09.03-tree_icon_columns that supports <input stock_column="0"> which accepts a stock_id as the first column (icon_column="0" also works for theme icons). Therefore the ability to input stock or theme icons into tree rows from a file already exists and you can do it like this:
Regards,
Thunor
Code: Select all
#!/bin/sh
GTKDIALOG=gtkdialog
function inputfile() {
echo "gtk-open | | gtk-open | 2
gtk-about | | gtk-about | 2
gtk-add | | gtk-add | 2
gtk-apply | | gtk-apply | 2
gtk-bold | | gtk-bold | 2
gtk-cancel | | gtk-cancel | 2
gtk-cdrom | | gtk-cdrom | 2
gtk-clear | | gtk-clear | 2
gtk-close | | gtk-close | 2
gtk-color-picker | | gtk-color-picker | 2
gtk-convert | | gtk-convert | 2 " > inputfile
ifs="$IFS"
IFS=
echo $(<inputfile)
IFS="$ifs"
}; export -f inputfile
export MAIN_DIALOG='
<vbox>
<frame Stock icons from file via input command>
<tree>
<variable>TREE1</variable>
<label>0 | 1 | 2</label>
<height>300</height><width>250</width>
<input stock_column="0">inputfile</input>
</tree>
</frame>
<button ok></button>
</vbox>
'
$GTKDIALOG --program=MAIN_DIALOG
Thunor
- technosaurus
- Posts: 4853
- Joined: Mon 19 May 2008, 01:24
- Location: Blue Springs, MO
- Contact:
Jwm will automatically look for an icon with the _same_ name as your program in its icon path (name.png or name.xpm) ... no 16, case must match etc...just make a symlink without the description of size etc... most wm's do the same.
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].
thunor,
Speaking of examples, what is it with an included example in gtkdialog/examples/09.12-tree-one-column
It is written with an incorrect path to gtkdialog and even though the executable property is set on it, it shows the same as a text file would and not an executable script.
It looks like it is supposed to populate itself with files from the working directory, but does not.
Is it a "fix it yourself" example?
I am just curious as to what it is supposed to display.
Also!! Thank you for the references of documentation for gtkdialog.
It all helps as does this offering by seaside.
Speaking of examples, what is it with an included example in gtkdialog/examples/09.12-tree-one-column
It is written with an incorrect path to gtkdialog and even though the executable property is set on it, it shows the same as a text file would and not an executable script.
It looks like it is supposed to populate itself with files from the working directory, but does not.
Is it a "fix it yourself" example?
I am just curious as to what it is supposed to display.
Also!! Thank you for the references of documentation for gtkdialog.
It all helps as does this offering by seaside.
Jpeps,jpeps wrote:Is there any way to add a filter to gtk-open "fileselect" for specific filetypes?
I have not seen any way, although there is the "complete" function, but I don't think it's available.
You could perhaps call Zenity/Yad or maybe Xdialog (not sure about Xdialog) with a "yad --file-selection --file-filter" option.
Regards,
s
EDIT: I suppose you could also do a "ls *.jpg" action to a tmpfile and then pick from there.
Not image as far as I know but any background colour is possible..smokey01 wrote:Is there any way to set a background colour or image in a gtkdialog window?
Thanks
it's a case of running a unique gtk+ theme for that app.
Code: Select all
echo "style "slideshow"
{
bg[NORMAL] = "$COLOUR"
}
class "*" style "slideshow"" > /tmp/gtkrc
export GTK2_RC_FILES=/tmp/gtkrc:/root/.gtkrc-2.0
HTH
Puppy Linux Blog - contact me for access
TCL-TK works nicely. I got sick of sloppy work-arounds.seaside wrote:Jpeps,jpeps wrote:Is there any way to add a filter to gtk-open "fileselect" for specific filetypes?
I have not seen any way, although there is the "complete" function, but I don't think it's available.
You could perhaps call Zenity/Yad or maybe Xdialog (not sure about Xdialog) with a "yad --file-selection --file-filter" option.
Regards,
s
EDIT: I suppose you could also do a "ls *.jpg" action to a tmpfile and then pick from there.
- Attachments
-
- petch.png
- (19.35 KiB) Downloaded 1143 times
What about gnocl? Because it would be much nicer to have GTK dialogues etc, as this is the standard for everything in Puppy.
Do you know a good gtkdialog program? Please post a link here
Classic Puppy quotes
ROOT FOREVER
GTK2 FOREVER
Classic Puppy quotes
ROOT FOREVER
GTK2 FOREVER
That's why I was trying to use Gtkdialog3. Seems like GTK has LOTS of bindings in many languages. Gnocl is one of them (which I don't know much about).disciple wrote:What about gnocl? Because it would be much nicer to have GTK dialogues etc, as this is the standard for everything in Puppy.
Some things I'd be looking for:
Good run-time interaction for widgets; basic properties (like filters, etc); variables I can use for selected items of widgets (lists, etc); active community of developers/extensive documentation. I google searched for a tcltk combobox that a user can update (try this for gtkdialog3):
Code: Select all
#!/usr/bin/env wish
set ff [frame .f]
set label [label $ff.label -text "Name:" ]
set name [ttk::combobox $ff.name -textvariable name]
set addButton [button $ff.addButton -text "+" -width 1 \
-command [list addNameToComboBox $name]]
set removeButton [button $ff.removeButton -text "-" -width 1 \
-command [list removeNameFromComboBox $name]]
grid $label $name
grid $ff.addButton -row 0 -column 2 -sticky w
grid $ff.removeButton -row 0 -column 3 -sticky sw -padx 5
pack $ff -side top -fill both -expand true
proc addNameToComboBox {name} {
set values [$name cget -values]
set current_value [$name get]
if {$current_value ni $values} {
lappend values $current_value
$name configure -values $values
}
}
proc removeNameFromComboBox {name} {
set values [$name cget -values]
set current_value [$name get]
if {$current_value in $values} {
set i [lsearch -exact $values $current_value]
set values [lreplace $values $i $i]
$name configure -values $values
}
}
- Attachments
-
- combobox-tcltk.png
- (9.61 KiB) Downloaded 1095 times
with Xdialog
Here's a combo I found with Xdialog's logbox, which allows text colors. This example shows (potentially) clobbered files in red. (think I'll put the builtins in another color).
(Thunor's fileselect filter got me inspired to experiment a bit)
(Thunor's fileselect filter got me inspired to experiment a bit)
- Attachments
-
- logbox.png
- (61.83 KiB) Downloaded 998 times
jeps,
Do you care to share that script so others can check it out?
It looks interesting and what with installation or removal of a pet package that contains library files that already exist, it would be good to not have those libraries trashed on uninstalling a pet.
And for some reason unknown to us, the library files are not part of /root/.packages/builtin.
That means if a pet is uninstalled that contained library files that already exist they would be removed.
That is not a good thing at all.
Also, if a library file is used by more than one installed PET, and installed by it, uninstalling one PET can break another.
Do you care to share that script so others can check it out?
It looks interesting and what with installation or removal of a pet package that contains library files that already exist, it would be good to not have those libraries trashed on uninstalling a pet.
And for some reason unknown to us, the library files are not part of /root/.packages/builtin.
That means if a pet is uninstalled that contained library files that already exist they would be removed.
That is not a good thing at all.
Also, if a library file is used by more than one installed PET, and installed by it, uninstalling one PET can break another.
I'm having fun making lots of changes. For basic use, probably a cut back version would be suitable. Generating the initial builtin list takes about 9M.. I like it to prioritize (in color! ), but most users just need to see what's installed*. I've always used my own installers/uninstallers, but don't want to step on anyone's toes.8-bit wrote:jeps,
Do you care to share that script so others can check it out?
The other problem is that I'm using Thunor's latest gtkdialog3 with the fileselect filters.
* second thought..most users do NOT want to see what's installed