GtkDialog - tips

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Message
Author
jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#581 Post by jpeps »

I'm sure I must be doing something wrong, but when importing a file to the "list" widget and selecting an item, it wasn't linking with the widget "variable"

User avatar
smokey01
Posts: 2813
Joined: Sat 30 Dec 2006, 23:15
Location: South Australia :-(
Contact:

#582 Post by smokey01 »

Is there any way to set a background colour or image in a gtkdialog window?

Thanks

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#583 Post by 01micko »

smokey01 wrote:Is there any way to set a background colour or image in a gtkdialog window?

Thanks
Not image as far as I know but any background colour is possible..

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
Slideshow was a silly little app I wrote ages ago, but that code should give you the gist of it, obviously the COLOUR variable must be set, it can be any defined colour or in the #000000 format

HTH
Puppy Linux Blog - contact me for access

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#584 Post by jpeps »

seaside wrote:
jpeps wrote:Is there any way to add a filter to gtk-open "fileselect" for specific filetypes?
Jpeps,

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.
TCL-TK works nicely. I got sick of sloppy work-arounds.
Attachments
petch.png
(19.35 KiB) Downloaded 1143 times

disciple
Posts: 6984
Joined: Sun 21 May 2006, 01:46
Location: Auckland, New Zealand

#585 Post by disciple »

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

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#586 Post by jpeps »

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.
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).

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

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#587 Post by jpeps »

thunar just added fileselect filters :D


http://murga-linux.com/puppy/viewtopic. ... &start=218

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

with Xdialog

#588 Post by jpeps »

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)
Attachments
logbox.png
(61.83 KiB) Downloaded 998 times

User avatar
8-bit
Posts: 3406
Joined: Wed 04 Apr 2007, 03:37
Location: Oregon

#589 Post by 8-bit »

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.

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#590 Post by jpeps »

8-bit wrote:jeps,
Do you care to share that script so others can check it out?
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.

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

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#591 Post by technosaurus »

there is an example of how to parse all of the puppy repos (from the files in $HOME/.packages) in my jwm_tools pet
http://www.murga-linux.com/puppy/viewtopic.php?t=70804

the jwm_install_menu_create script builds an install menu for all of the supported repos (puppy2,3,4,5 quirky and wary) in ~2s in a format mirroring the program menu (if only all of linux were that intuitive) ... anyhow modding it for gtkdialog would be pretty straightforward if anyone wants to speed it up (using only shell it is 15x faster than the similar purposed C program, jwm-xdgmenu ... or rather the script that calls it, fixmenus)

I understand about the "stepping on toes", there have been several enhancements that never make it (or at least haven't yet) into ppm... even a few total/partial rewrites The code seems to be overly complex and can be finnicky (as programs 10 yrs in the making tend to be... corner cases and such), so I understand the caution & not wanting to break other chunks.
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].

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#592 Post by jpeps »

Here's a look with builtins RED, installed BLUE. Notice any potential clobbering issues here? :)

Edit: updated to show target files for links that are getting clobbered. The pet in the example was clobbering built-in links, leaving orphaned target libs of no use. Also, installing new target libs without clobbering the links would be useless. The 'install noclobber' button brings up the install list in an editor with "?" in front of clobbered files. Removing the "?" installs the file.
Attachments
logbox.png
(63.96 KiB) Downloaded 968 times

User avatar
8-bit
Posts: 3406
Joined: Wed 04 Apr 2007, 03:37
Location: Oregon

#593 Post by 8-bit »

Since I do not have the benefit of having your (jpeps) PETCheck, I rename the downloaded PET with a "tar.gz" extension and open it to see what files the PET contains.
I suppose I could write a script to take those files and do a check to see if they exist in my install of Puppy and act accordingly.

That is basically what PETCheck does with the option to not install some of the files.

If I added all the files I wanted to keep from installing PETs to the /root/.packages/builtin_files directory, it would most likely become huge.

But if I did that, would those files be safe guarded from removal by an uninstall of a PET?

User avatar
8-bit
Posts: 3406
Joined: Wed 04 Apr 2007, 03:37
Location: Oregon

#594 Post by 8-bit »

I tried putting the files in a PET into /root/.packages/builtin_files and then installing the same pet.
I then tried removing the PET using Puppy Package Manager.
And I found that files listed as built in are not safe from removal!
So evidently, no files in Puppy are safe from being removed!
The only solution I can see is to back up your pupsave frequently so you have a backup just in case.

Actually, there are two other solutions.
One is called a Remaster.

The other is a rewrite of Puppy Package manager to look at the built in files and not remove any that are there.

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#595 Post by jpeps »

8-bit wrote:I tried putting the files in a PET into /root/.packages/builtin_files and then installing the same pet.
I then tried removing the PET using Puppy Package Manager.
And I found that files listed as built in are not safe from removal!
Hi 8-bit,

It's best not to touch the built-ins; it's a constant. The NoClobber install in PetCheck simply gives the option not to include the builtins in the installed package. Since they're not included in the installed package, they won't be deleted.

BTW; this is really getting OT...initially, I was only demoing the fileselect and then the color options for the logbox.

maybe better:
http://murga-linux.com/puppy/viewtopic.php?t=70582

edit: guess it was a good idea not to list an app using updated gtkdialog
until gtkdialog4 is established.

User avatar
8-bit
Posts: 3406
Joined: Wed 04 Apr 2007, 03:37
Location: Oregon

#596 Post by 8-bit »

Moderator,
Would it be possible to move a few posts, mine included http://murga-linux.com/puppy/viewtopic. ... 419#559419 and the following one over to the thread here.

It seems they fit better there.
Thanks

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#597 Post by technosaurus »

here is a little script that will generate a folder full of 1x1 pixmaps for each color in rgb.txt
Its nice to be able to browse them in alphabetical order in rox with thumbnails and large icons turned on.

Code: Select all

#!/bin/sh
[ ! -d colors ] && mkdir colors
for x in `cat /usr/X11R7/lib/X11/rgb.txt|grep -v Xorg|cut -f3|tr " " "_"`; do
echo '/* XPM */
static char *'${x}'_xpm[] = {
"1 1 1 1",
"0	c '${x//_/ }'",
"0"
};' >colors/${x}.xpm
done
Attachments
colors.tar.bz2
here is a tarball of all the pixmaps
it is actually quite small for having 659 images
(6.68 KiB) Downloaded 357 times
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].

User avatar
zigbert
Posts: 6621
Joined: Wed 29 Mar 2006, 18:13
Location: Valåmoen, Norway
Contact:

#598 Post by zigbert »

Some cleanups in the main post today

User avatar
8-bit
Posts: 3406
Joined: Wed 04 Apr 2007, 03:37
Location: Oregon

#599 Post by 8-bit »

technosaurus wrote:here is a little script that will generate a folder full of 1x1 pixmaps for each color in rgb.txt
Its nice to be able to browse them in alphabetical order in rox with thumbnails and large icons turned on.

Code: Select all

#!/bin/sh
[ ! -d colors ] && mkdir colors
for x in `cat /usr/X11R7/lib/X11/rgb.txt|grep -v Xorg|cut -f3|tr " " "_"`; do
echo '/* XPM */
static char *'${x}'_xpm[] = {
"1 1 1 1",
"0	c '${x//_/ }'",
"0"
};' >colors/${x}.xpm
done
I run Puppy Lucid 520 and I do not have the file "/usr/X11R7/lib/X11/rgb.txt".
So I am unable to use your script.

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#600 Post by technosaurus »

you should have a rgb.txt _somewhere_
I don't do *buntu, so its based on T2 location
but it is probably /usr/lib/X11/rgb.txt
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].

Post Reply