Learning gtkDialog (pmenu project)

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Message
Author
afishe2000
Posts: 37
Joined: Fri 29 Jan 2010, 16:09

#16 Post by afishe2000 »

Oops,

Updated the first post to pmenu-2.0.2.

Had some of the button icons backwards.

afishe2000
Posts: 37
Joined: Fri 29 Jan 2010, 16:09

Refreshing a pixmap image using a button.

#17 Post by afishe2000 »

As I mentioned, the more I learn the less I seem to know.

I'm using to following code to try to have the pixmap change from speaker on image to the speaker off image by pushing the corresponding button.

The popup button then would open a new dialog and show that same image.

Obviously it isn't working as I'd envisioned.

Everyone has been so helpful, I feel like I just keep running into the wall every time I turn the corner...

Code: Select all


#!/bin/bash

echo 1 >/tmp/file_name

get_Pic() {
	path="/usr/local/lib/X11/mini-icons/"	
	if [ $(cat /tmp/file_name) = 1 ]; then
		file="mini-speaker.xpm";
	else
		file="mini-speaker-off.xpm";
	fi
	echo $path$file
}
export -f get_Pic

export NEW_DIALOG="
  <vbox>
  <pixmap>
   <input file>$(get_Pic)</input>
 </pixmap>
  <text>
		<input>get_Pic</input>
	</text>
	</vbox> 
"

export MAIN_DIALOG="
<vbox>
    <pixmap>
      <variable>PIC</variable>
      <input file>$(get_Pic)</input>
    </pixmap> 
    <text>
      <variable>NAME</variable>
			<input>get_Pic</input>
		</text>     
  <hbox>
    <button>
      <label>Pop-up</label>
      <action type=\"launch\">NEW_DIALOG</action>
    </button>
 		<button>
			<input file>\"/usr/local/lib/X11/mini-icons/mini-speaker.xpm\"</input>
			<action>\"echo 1 >/tmp/file_name\"</action>
			<action>Refresh:NAME</action>
			<action>Refresh:PIC</action>
		</button> 
		<button>
			<input file>\"/usr/local/lib/X11/mini-icons/mini-speaker-off.xpm\"</input>
			<action>\"echo 2 >/tmp/file_name\"</action>
			<action>Refresh:NAME</action>
			<action>Refresh:PIC</action>
		</button>
    <button ok></button>
  </hbox>
</vbox>
"
gtkdialog3 --program=MAIN_DIALOG

unset MAIN_DIALOG
unset NEW_DIALOG
unset get_Pic

rm /tmp/file_name


seaside
Posts: 934
Joined: Thu 12 Apr 2007, 00:19

Re: Refreshing a pixmap image using a button.

#18 Post by seaside »

afishe2000 wrote: I'm using to following code to try to have the pixmap change from speaker on image to the speaker off image by pushing the corresponding button.
afishe2000,

You might be able to do something with "flip-flops" (see section 10 of the Gtkdialog Tips below)
http://murga-linux.com/puppy/viewtopic.php?t=38608

Perhaps something where the image is made invisible -
<button visible="false"> and is toggled on and off.

Cheers,
s

big_bass
Posts: 1740
Joined: Mon 13 Aug 2007, 12:21

#19 Post by big_bass »

jemimah
Personally, I think the startup item editor should be a separate program from pmenu. Otherwise I'm confused what to call it on the menu.


well I did a chainsaw hack of afishe2000's pmenu2
I removed only the desktop editor and made it a stand alone app called
desktop_view_edit

so nothing gets touched in pmenu


*I didnt "package" it since I use TXZ format and this way anyone could test it
add the icon and desktop of your choice



@Hey afishe2000 great coding !

Joe
Attachments
desktop_view_edit.tar.gz
(1.75 KiB) Downloaded 533 times
desktop_edit.png
(40.55 KiB) Downloaded 1798 times

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

nice job

#20 Post by vovchik »

Dear afishe2000 and big_bass,

Both your little apps are useful. Thanks.

With kind regards,
vovchik

User avatar
jemimah
Posts: 4307
Joined: Wed 26 Aug 2009, 19:56
Location: Tampa, FL
Contact:

#21 Post by jemimah »

This latest Pmenu is really quite nice. I've added it to Puppeee 4.4 and I'm hoping Barry will add it to woof soon.

afishe2000
Posts: 37
Joined: Fri 29 Jan 2010, 16:09

#22 Post by afishe2000 »

Thanks to all for the kind words.

It is fairly amazing what can be done with gtkDialog considering it's limitations.

big_bass
Posts: 1740
Joined: Mon 13 Aug 2007, 12:21

#23 Post by big_bass »

Hey afishe2000

well I made another small edit and added the Exec=
to see the code used to launch the desktop with

*I added an icon this time and desktop so it could be packaged
for another version (I use a TXZ format)

the reason I hacked out this part of the code is because it can be re used
for other apps the way you set up the reading of the comments is very clever :D




Joe
Attachments
desktop-edit2.png
(43.5 KiB) Downloaded 1991 times
desktop_view2.tar.gz
(20.85 KiB) Downloaded 549 times

afishe2000
Posts: 37
Joined: Fri 29 Jan 2010, 16:09

#24 Post by afishe2000 »

See the first post for more details...

pmenu-3.0.0.pet

The pet for 3.0.0 REQUIRES /usr/bin/switch2 from gtk-theme-switch-i386.pet.

Jeff

User avatar
jemimah
Posts: 4307
Joined: Wed 26 Aug 2009, 19:56
Location: Tampa, FL
Contact:

#25 Post by jemimah »

After I run pmenu, depending on what gtk theme I was using, the gtk menus are messed up - the highlight color doesn't show.

Do you have any idea if it can be fixed? Otherwise, it's brilliant.

afishe2000
Posts: 37
Joined: Fri 29 Jan 2010, 16:09

#26 Post by afishe2000 »

Hum,

That's not good, trying to recreate it...

afishe2000
Posts: 37
Joined: Fri 29 Jan 2010, 16:09

#27 Post by afishe2000 »

jemimah,

Ah, found the issue - seems to happen to the right click menus.

Looking to see if zigbert's code causes the same problem?

Just wondering if it's a gtk-theme-switch problem or if I implemented his technique incorrectly.

Thanks,

Jeff

afishe2000
Posts: 37
Joined: Fri 29 Jan 2010, 16:09

#28 Post by afishe2000 »

Ok,

After further research I cannot recreate the problem.

I'm switching between the Brushed and Clearlooks themes using CHThemes.

Brushed looks perfect.

Clearlooks has white highlight text and is hard to read when you use the right click menus. (That is what I thought the problem was.)

This is a problem on my machine with the theme straight out of the box un-modified.

Maybe you can post a screenshot of the problem.

Unless you are talking about "Atom", "Barbee", "Celeron"... themes.

Jeff

User avatar
jemimah
Posts: 4307
Joined: Wed 26 Aug 2009, 19:56
Location: Tampa, FL
Contact:

#29 Post by jemimah »

I have the problem with both Brushed and Faraway. (No problem with IceWM themes).
It is a problem with the right click menus - you can't tell what item you're hovering over.

A screenshot would just look like a menu with nothing highlighted.

afishe2000
Posts: 37
Joined: Fri 29 Jan 2010, 16:09

#30 Post by afishe2000 »

Here are two screen shots.

Is this what we are talking about?
Attachments
Clearlooks.png
(15.67 KiB) Downloaded 1770 times
Brushed.png
(40.22 KiB) Downloaded 1770 times

User avatar
jemimah
Posts: 4307
Joined: Wed 26 Aug 2009, 19:56
Location: Tampa, FL
Contact:

#31 Post by jemimah »

Both of those are working. When it breaks, there is no highlight at all.

I'll play with it again when I get home from work.

User avatar
jemimah
Posts: 4307
Joined: Wed 26 Aug 2009, 19:56
Location: Tampa, FL
Contact:

#32 Post by jemimah »

The problem seems to only affect ROX. And maybe it's only ROX-2.10 from Puppeee4.4 and Fluppy05.

afishe2000
Posts: 37
Joined: Fri 29 Jan 2010, 16:09

#33 Post by afishe2000 »

Downloaded a fresh copy of 4.4 beta 1 and put in on my SD card.

Running Rox as my desktop and Icewm as my windows manager.

Still can't recreate the problem.

If we can't figure it out, I'll revert back to 2.0.1 version without the icons, add the Exec data and develop from there.

Jeff

User avatar
jemimah
Posts: 4307
Joined: Wed 26 Aug 2009, 19:56
Location: Tampa, FL
Contact:

#34 Post by jemimah »

I'll try it on a fresh install later today. Maybe it's only my dev box - it does get hosed up from time to time. :)

afishe2000
Posts: 37
Joined: Fri 29 Jan 2010, 16:09

#35 Post by afishe2000 »

Ok,

Finally able to duplicate the problem, and it's a weird one.

I'm using a fresh full install of Puppeee 4.4 beta 2.

Change your theme to Brushed.

Open Chrome and Geany and test the menus work normally.

Open pmenu and select a program from either list so the icon shows.

While pmenu is still open test the menus on Chrome and Greany. (Should function normally)

Close pmenu and check the menus again. (No highlighting for the menu system)

Close and reopen Chrome and Greany and check the menus again. (Should function normally)

You can also fix the problem by re-applying the theme.

Doesn't seem to effect Firefox, still checking other programs.

May take some research to figure this one out....

Jeff

Post Reply