Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Wed 22 Oct 2014, 06:04
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
PopMenu utility for multi. popup menus from a simple script.
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 1 of 1 Posts_count  
Author Message
sunburnt


Joined: 08 Jun 2005
Posts: 5037
Location: Arizona, U.S.A.

PostPosted: Wed 21 Apr 2010, 21:24    Post_subject:  PopMenu utility for multi. popup menus from a simple script.  

I`m fairly proud of this. I thought of putting it in "Cutting Edge", but here seems better.
Many thanks to zigbert for the direction to make it possible and many others for all the help.

A data script can contain and run many different popmenus. There can be many data scripts.
The script has event action functions, the popmenu button items list, and 7 variables ( so far...).
Many of these popmenu groups of data can be in the one script allowing many different menus.
The script runs another script with the shell code and the gtkdialog code for the popmenu.
The data script variables do: Center Screen, Dock Left or Right, and Show Over the main GUI,
TreeBox text Header or not, and Window Decorated ( border and title bar ) or not.
There`s 4 other variables: popW, popH, and offX, offY. This is all that`s needed to control it.
Here`s a section of the data script that defines one popmenu:
Code:
DM1)
ROX() { echo ROX
} ; export -f ROX
Mount() { echo Mount
} ; export -f Mount
Exit_App() { echo Exit_App.
} ; export -f Exit_App
Exit_Menu() { echo Exit_Menu
} ; export -f Exit_Menu
 
MENU_ITEMS='
ROX
Mount
Exit_App
'
#WINDECO=true
WINDECO=false
POSITION=over
#POSITION=dock
#POSITION=center
HEADER=
popW=102
popH=188
offX=10         # for "over" offset positioning
offY=29
;;

Could be a start on making gtkdialog really usable.
Compared to wrestling with the gtkdialog code, this is really simple!

### Usage: (popmenu file: /path/file) (popmenu ID) [calling app. Xwin. title] [context item]
popmenu_b-1.zip
Description  Zip file contains 2 files, unzip them in: /root/my-applications/bin
The data script can be anywhere, the popmenu.gtk3 script must be in the path.
zip

 Download 
Filename  popmenu_b-1.zip 
Filesize  2.46 KB 
Downloaded  233 Time(s) 

Edited_times_total
Back to top
View user's profile Send_private_message 
8-bit


Joined: 03 Apr 2007
Posts: 3382
Location: Oregon

PostPosted: Wed 21 Apr 2010, 22:56    Post_subject:  

I put both files in the zip in /root/my-applications/bin.
When I ran popmenu, I got a popup menu with only one entry.
That was Exit Menu.
The remaining selections were not displayed in the menu.
Back to top
View user's profile Send_private_message 
sunburnt


Joined: 08 Jun 2005
Posts: 5037
Location: Arizona, U.S.A.

PostPosted: Wed 21 Apr 2010, 23:13    Post_subject:  

Did you read the top of either script for the Usage example?
PopMenu requires at least 1 argument usually ( but doesn`t have to ), and can take up to 3.
Also you may notice that it`s the data script that you run with arguments, not popmenu.gtk
Back to top
View user's profile Send_private_message 
8-bit


Joined: 03 Apr 2007
Posts: 3382
Location: Oregon

PostPosted: Thu 22 Apr 2010, 01:41    Post_subject:  

OK, I jumped the gun on that.
What you are saying then is if I create a program and have the functions I want to use in popmenu, I can call it with my program by using a routine like clkMENU in the driveman script.
I understand that the routines one would want to use must be included in the popup script.

Am I correct in this assumption?

I am not going into the particulars here, but I assume that is how it would work.
Back to top
View user's profile Send_private_message 
sunburnt


Joined: 08 Jun 2005
Posts: 5037
Location: Arizona, U.S.A.

PostPosted: Thu 22 Apr 2010, 15:44    Post_subject:  

Having the functions in the PopMenu data script makes them available because the script popmenu.gtk is run in the same shell: . popmenu.gtk3 $1 $2 $3
You can have the functions in a separate file if you include the file at the beginning of the data script like this:
. (your file)
Or this:
source (your file)
Or you can call them directly with your command like this:
(your file) (function name)
This is how I do it in driveman.gtk3
driveman.gtk3 executes the functions in driveman. Example: driveman btnMNT /dev/sda1
But popmenu.gtk3 has the functions and variables passed to it when it`s run by the data script.
So the functions could be a function library or your own function file or in the data script. T.

I`m going to have the data script do info. reporting of the popmenus that it contains.
Back to top
View user's profile Send_private_message 
Display_posts:   Sort by:   
Page 1 of 1 Posts_count  
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Off-Topic Area » Programming
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0485s ][ Queries: 12 (0.0035s) ][ GZIP on ]