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 Tue 16 Sep 2014, 03:36
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
GtkDialog - tips
Post new topic   Reply to topic View previous topic :: View next topic
Page 27 of 64 [950 Posts]   Goto page: Previous 1, 2, 3, ..., 25, 26, 27, 28, 29, ..., 62, 63, 64 Next
Author Message
disciple

Joined: 20 May 2006
Posts: 6433
Location: Auckland, New Zealand

PostPosted: Sat 07 Aug 2010, 06:30    Post subject:  

There's this page that was linked to earlier in the thread http://tadeboro.blogspot.com/2009/04/gtkdialog-tutorial-part-2.html

And I was directed to this thread a while back http://www.pclinuxos.com/forum/index.php/topic,59050.0.html
But IIRC the goblinx thread linked to there was actually better... but its gone now Sad

----
No. From what I can see the goblinx page was a series of tutorials not using glade.
http://gigablast.com/get?q=gtkdialog+site:forum.goblinx.com.br&c=main&d=6102992655&cnsp=0
http://gigablast.com/get?q=gtkdialog+site:forum.goblinx.com.br&c=main&d=37972543281&cnsp=0
I'm sure I saw another page somewhere with glade examples...

But I guess what neurino posted might be all you want.

_________________
DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
Back to top
View user's profile Send private message 
zigbert


Joined: 29 Mar 2006
Posts: 5719
Location: Valåmoen, Norway

PostPosted: Sat 07 Aug 2010, 09:52    Post subject:  

An interesting question is; Will gtkdialog allow use of more widgets (like slider, knobs, dynamic image rendering...)?

Another question is about the use of the glade-builder (the user-interface to build guis); Is this so powerful that it can build complex guis, or is it meant for less complex windows/boxes as shown in examples?

A working (tiny) example would be preferable.

What exactly will be the extra dependencies?


Sigmund

_________________
Stardust resources
Back to top
View user's profile Send private message Visit poster's website 
neurino


Joined: 15 Oct 2009
Posts: 360

PostPosted: Sat 07 Aug 2010, 10:21    Post subject:  

zigbert wrote:
is about the use of the glade-builder (the user-interface to build guis); Is this so powerful that it can build complex guis, or is it meant for less complex windows/boxes as shown in examples?


the second option

if you select liblade you'll see a lot of widget / options not available. Morover in my Wary's Glade crashes while using some widgets like the spin button.

It's quick, no more I guess.

About an example I'm not at home now to get some to post.
Anyway it's easier for you to build one by yourself in a minute and make it run like I posted before, I didn't go much more further.

I learned commands to put in signals by your tutorial, like EXIT:sure and others.
Back to top
View user's profile Send private message 
disciple

Joined: 20 May 2006
Posts: 6433
Location: Auckland, New Zealand

PostPosted: Sat 07 Aug 2010, 19:07    Post subject:  

Quote:
What exactly will be the extra dependencies?

Sorry, no, I'm talking nonsense. At the moment there are no extra dependencies as gtkdialog normally depends on libglade.
But it is extremely easy to hack gtkdialog so that it doesn't depend on libglade, which we were discussing because libglade is becoming obsolete. IIRC someone said that gtkdialog is the only program in Puppy that still depends on it... or was there one other program?
So if we start writing gtkdialog+glade programs we just won't have the option of removing glade support.
If glade makes development easier, or allows gtkdialog to do more tricks, go ahead and use it Smile

Quote:
Another question is about the use of the glade-builder (the user-interface to build guis); Is this so powerful that it can build complex guis

Yes, it should be... although I guess I guess maybe you should define what you mean by complex guis Smile

Quote:
An interesting question is; Will gtkdialog allow use of more widgets (like slider, knobs, dynamic image rendering...)?

I guess we either need to experiment and see, or have another look at the gtkdialog source. I think the answer is no, but I'm not certain.

_________________
DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4351

PostPosted: Sun 08 Aug 2010, 01:04    Post subject:  

someone might be able to remove even the libglade dependency and use gtk-builder-convert to convert the .glade files into .ui files that can be used internally by gtk+-2.12 and later. The same options and more should be available through gtkbuilder. There is a vala .ui example here:
http://live.gnome.org/Vala/GTKSample#Loading_User_Interface_from_XML_File

there are examples in the devx in /usr/share/doc/gtkdialog3/examples/ (don't forget to edit the script to change gtkdialog to gtkdialog3 or make a symlink from gtkdialog3 for gtkdialog in /usr/sbin)

(Note: you only have to delete /usr/lib/pkgconfig/libglade-2.0.pc to compile without glade)

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
Patriot


Joined: 15 Jan 2009
Posts: 734

PostPosted: Sun 08 Aug 2010, 09:45    Post subject:  

Hmmm .....

zigbert wrote:
An interesting question is; Will gtkdialog allow use of more widgets (like slider, knobs, dynamic image rendering...)?

Widgets creation/usage is limited to only what is defined/supported internally to gtkdialog. If a widget is not defined, no amount of coaxing will either ...

zigbert wrote:
Another question is about the use of the glade-builder (the user-interface to build guis); Is this so powerful that it can build complex guis, or is it meant for less complex windows/boxes as shown in examples?

Glade-builder is quite powerful and useful. However, IMHO, there are two good enuff reasons to stick with gtkdialog XML constructs:

1. Since gtkdialog widgets set is fixed,you will end up with a much bigger UI script to do exactly the same thing in glade when compared to standard gtkdialog definitions.

2. glade does gives you finer controls over the widgets but unless you are familiar with gtk+ glade constructs then these finer points can be confusing to use. Example, assigning a simple and meaningful exit action is enough to drive first time users to the wall.


Rgds
Back to top
View user's profile Send private message 
neurino


Joined: 15 Oct 2009
Posts: 360

PostPosted: Sun 08 Aug 2010, 11:32    Post subject:  

As I already wrote also libglade-related files are plain XML, just a little more verbose but always easy to read.

What I do is, in the case of a Gmail notifier GUI, create with glade the XML mockup then cut and paste glade code in bash like you normally do with your xml, only I can get a working xml faster...

You guys also say the Glade-builder is powerful but I assert again that using libglade a lot of widgets and options are disabled while are active using, in preferences, the other lib.

So maybe it would be nice to understand how to use Glade-builder without libglade and having all the things enabled.

I tried something but had no luck except with the actions I wrote above using libglade. Maybe you can have better luck.

Last thing the "simple and meaningful exit action" is the only way, at the moment, I got the control over user action so no difference with it...
___________________

A little example attached, don't know if you can view the settings.glade file in Glade since on my Wary 030 spin button widget makes the app crash so I had to add it by hand, after founding one (and only one) sample online.

If someone knows where to find all glade XML tags and attributes...
settings.tar.gz
Description  little example using libglade
gz

 Download 
Filename  settings.tar.gz 
Filesize  2 KB 
Downloaded  292 Time(s) 
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4351

PostPosted: Sun 08 Aug 2010, 15:06    Post subject:  

This is more of a bash trick, but it could be expanded into a full blown menu if other parts of the .desktop files are parsed. Right now it just pulls out all of the executables from the .desktop files so that I don't have to try to figure out where it is in the menu.

Code:
#!/bin/sh
for x in `ls /usr/share/applications/*.desktop`; do I=$I"<item>""`grep "^Exec=" $x |cut -d = -f 2`""</item>"; done
export D="<vbox><combobox><variable>C</variable>"$I"</combobox><button ok></button></vbox>" && eval `gtkdialog3 --program=D` && $C


Here it is with an entry box in case you want to enter it manually
Code:

#!/bin/sh
for x in `ls /usr/share/applications/*.desktop`; do I=$I"<item>""`grep "^Exec=" $x |cut -d = -f 2`""</item>"; done
export D="<vbox><entry editable=\"true\"><variable>E</variable></entry>
<combobox><variable>C</variable>"$I"</combobox><button ok></button></vbox>"
eval `gtkdialog3 --program=D` && [ "$E" == "" ] && $C || $E

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
01micko


Joined: 11 Oct 2008
Posts: 7801
Location: qld

PostPosted: Sun 08 Aug 2010, 22:41    Post subject:  

techno Cool Cool Cool

Do you mind if I add this to my 'tools' page? Full credit to you of course.

I should have made something like this, I use a similar loop to detect browsers and choose the default in Lupu. I don't know how many times I have open either the /root/.jwmrc or /root/icewm/menu file just to look up an executable (and path if needed) Laughing Thanks

Cheers

_________________
Woof Mailing List | keep the faith Cool |
Back to top
View user's profile Send private message Visit poster's website 
technosaurus


Joined: 18 May 2008
Posts: 4351

PostPosted: Mon 09 Aug 2010, 03:05    Post subject:  

By all means.

I was initially planning to build a menu program that could be used with any light weight window manager... lost interest after this part though.

p.s. - it runs a bit faster if the top line has /bin/ash instead of /bin/sh

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4351

PostPosted: Sun 15 Aug 2010, 17:46    Post subject:  

This scripts worked after deleting the ayttm desktop entry that contains / as separators - needs a workaround - my version of gtkdialog doesn't find pixmaps in the standard directories and sh: locate: command not found is emitted from running in rxvt - is there a way to make icons work without hacking the full icon paths

Edit: it wasn't the / in the Name= field... it was " (double quotes) in the Comment= field that caused the problem - .desktop files shouldn't contain quotes anyways AFAIK - I just fixed ayttm.desktop and all is well

the icons should be found if you have puppy 44a or stardust with updatedb and locate commands

This is not by any means a finished product - just a starting point that should be easily tweakable to your liking using other tips from this thread. I have it set up for right-handed touchscreen mode (everything on the right side) but it could still use a lot of formatting for appearance and speed. (ex. for faster start after first run you could write DLG to a file and use it if available)
Code:
#!/bin/ash
# can't use entries with " (double quote) in the comment section maybe others - Ayttm is one example
for x in `ls /usr/share/applications/*.desktop`; do
   EXE="`grep "^Exec=" $x |cut -d = -f 2`"
   CAT="`grep "^Categories=" $x |cut -d = -f 2`"
   NAM="`grep "^Name=" $x |cut -d = -f 2`"
   ICO="`grep "^Icon=" $x |cut -d = -f 2`"
   ##needs full path to icon - will rework later
   COM="`grep "^Comment=" $x |cut -d = -f 2`"
   NEW="<hbox tooltip-text=\"$COM\"><button><label>$NAM</label><input file>$ICO</input><action>$EXE &</action></button></hbox>"
   case $CAT in
      *alculat*|*inance|*heet|ProjectManagement)   BUS=$BUS$NEW;;
      *eskto*|*creensave*|*ccessib*)   DSK=$DSK$NEW;;
      *ocumen*|*ordProcessor|*ebDevelo*)   DOC=$DOC$NEW;;
      *ile*)   FIL=$FIL$NEW;;
      *Game|*olePla*|*imulation|*musement)   FUN=$FUN$NEW;;
      *raphics|*hotography|*resent*|*art)   GFX=$GFX$NEW;;
      *udio*|*ideo*|*layer|*ecorder|*usic|*idi|*ixer|*equencer|*uner|TV|*iskBurning)   MED=$MED$NEW;;
      Dialup|Network|HamRadio|RemoteAccess)   NET=$NET$NEW;;
      X-PersonalUtility|X-Personal|Calendar|ContactManagement)   PER=$PER$NEW;;
      *etup*|PackageManager)   SET=$SET$NEW;;
      *onitor|*ecurity|*ardware*|*ore|*ystem)   SYS=$SYS$NEW;;
      Utility|Viewer|Development|Building|Debugger|IDE|Profiling|Translation|GUIDesigner|Archiving|TerminalEmulator|Shell)   UTL=$UTL$NEW;;
      *nternet|*rowser|*mail|*ews|*essaging|*elephony|*lient|*ransfer|P2P)   WEB=$WEB$NEW;;
      *) MSC=$MSC$NEW;;
   esac
   
done
DLG="<notebook page=\"0\" tab-pos=\"1\" enable-popup=\"true\" labels=\"Business|Desktop|Document|File|Fun|Graphics|Media|Network|Personal|Setup|System|Utility|Web|Miscellaneous\">
<frame Business>$BUS</frame>
<frame Desktop>$DSK</frame>
<frame Document>$DOC</frame>
<frame File>$FIL</frame>
<frame Fun>$FUN</frame>
<frame Graphics>$GFX</frame>
<frame Media>$MED</frame>
<frame Network>$NET</frame>
<frame Personal>$PER</frame>
<frame Setup>$SET</frame>
<frame System>$SYS</frame>
<frame Utility>$UTL</frame>
<frame Web>$WEB</frame>
<frame Misc>$MSC</frame>
</notebook>"

export DLG
gtkdialog3 --program=DLG

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4351

PostPosted: Tue 17 Aug 2010, 20:02    Post subject:  

this is a line of code that will set up your locatedb if needed so that your icons will be found
Code:
[ -f /var/locatedb ] && echo file database detected, skipping updatedb for finding of icons || updatedb --localpaths=/usr


I also reworked the menu script for this (and ability to use a menu file if it exists) if you want an example it is also attached
pgtkmenu.gz
Description 
gz

 Download 
Filename  pgtkmenu.gz 
Filesize  1.2 KB 
Downloaded  353 Time(s) 
findutils-4.2.33-i486.pet
Description  gtkdialog needs findutils - otherwise you may need to specify the full path for icons
pet

 Download 
Filename  findutils-4.2.33-i486.pet 
Filesize  59.84 KB 
Downloaded  303 Time(s) 

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
jpeps

Joined: 31 May 2008
Posts: 3220

PostPosted: Thu 19 Aug 2010, 12:00    Post subject:  

I haven't found much regarding use of variables. For example, how do I:

1. Create or change a new or existing variable from an <action> command?
example: <action>export MyVariable="new value"</action> (doesn't work)

2. Use existing variables, like changing default entry from say a checkbox or button action command.
example: <action>ENTRY1="$NewVal"</action> (doesn't work)

edit: One other thing: I can't get bash functions to work from an action command. (think I tried an example somewhere that didn't work)
function MyFunction() {
rxvt -e echo "Hello World"
}

example <action>MyFunction</action> (doesn't work)


Thanks
Back to top
View user's profile Send private message 
seaside

Joined: 11 Apr 2007
Posts: 886

PostPosted: Thu 19 Aug 2010, 18:36    Post subject:  

jpeps wrote:
I haven't found much regarding use of variables.


jpeps,

You can't make dynamic variables as in Items 1 and 2.
When you invoke a subshell (<action>something<action>), variables created here are not visible to the parent.

The work-around is to make "tmp" files to store variable info.

As far as the function not working - did you "export -f MyFunction"?

Cheers,
s
Back to top
View user's profile Send private message 
jpeps

Joined: 31 May 2008
Posts: 3220

PostPosted: Thu 19 Aug 2010, 21:00    Post subject:  

seaside wrote:


The work-around is to make "tmp" files to store variable info.

That's what I've been doing; thought I might have missed something.
..be nice if a "set" command was included.
Quote:

As far as the function not working - did you "export -f MyFunction"?
,


Ah....that works. Thanks!
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 27 of 64 [950 Posts]   Goto page: Previous 1, 2, 3, ..., 25, 26, 27, 28, 29, ..., 62, 63, 64 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


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