GtkBasic 003e - small Basic interpreter/IDE - 3300 functions
GtkBasic currently supports Drag'n'Drop for Clists (lists that can display pictures and texts).
I have written some custom functions to simplify this, there is a demo included.
I did not try the drag'n'drop functionality of the native Gtk-functions that GtkBasic supports now.
So I cannot tell, if they are wrapped correctly or not.
However with the Clists you can build very comfortable Drag'n'Drop programs.
GtkBasic will not be in Puppy until we program utilities that make it a "must"
Barry has pointed out, that he wants to keep Dingo (Puppy4) as small as possible, and so just leaves in GtkDialog and Xdialog.
So GtkBasic must be installed in addition, but it certainly soon will be bundled with addons like ezpup.
The size is reasonable: 200 k compressed with upx, or 930 k uncompressed.
Plus some kb for examples or utilities like the file-selection dialog, that is written in GtkBasic.
It just depends on X, Gtk2, and libglade.
Those are usually already in Puppy.
Mark
I have written some custom functions to simplify this, there is a demo included.
I did not try the drag'n'drop functionality of the native Gtk-functions that GtkBasic supports now.
So I cannot tell, if they are wrapped correctly or not.
However with the Clists you can build very comfortable Drag'n'Drop programs.
GtkBasic will not be in Puppy until we program utilities that make it a "must"
Barry has pointed out, that he wants to keep Dingo (Puppy4) as small as possible, and so just leaves in GtkDialog and Xdialog.
So GtkBasic must be installed in addition, but it certainly soon will be bundled with addons like ezpup.
The size is reasonable: 200 k compressed with upx, or 930 k uncompressed.
Plus some kb for examples or utilities like the file-selection dialog, that is written in GtkBasic.
It just depends on X, Gtk2, and libglade.
Those are usually already in Puppy.
Mark
yes, GtkBasic is a standalone-program.
Dotpups.de is down today, here is a mirror:
http://www.puppyfiles.ca/dotpupsde/pupp ... kBasic003/
Mark
Dotpups.de is down today, here is a mirror:
http://www.puppyfiles.ca/dotpupsde/pupp ... kBasic003/
Mark
I updated the Dotpup for Puppy 3 (which was reported to work in Puppy2, too).
And uploaded the sourcecode, too.
New:
Objectdestruction
In the past, the function gtk_destroyobject() did not work.
I now rewrote the internal reference-handling of the objects.
GtkBasic allows to handle 1000 Gtk-widgets at once.
If you need more, you first must destroy older ones, or you application crashes.
I could add support for more, but that increases memory-usage.
Tell me, when you need more.
IMPORTANT:
If you have an old application, that crashes now, please tell me.
I then will repackage it.
It will be sufficient, to remove lines using
gtk_destroyobject()
I had added that for tests in the past, but it had no function.
Now this could crash your app, if those objects still are needed.
For debugging I added:
gtk_dumpobjects()
This shows a list of all objects you created, and the length of the internal reference-list.
So you can see, if you properly destroyed objects.
I also added some new functions to handle mouseclicks better.
gtk_createobject("singleclickbutton","buttontest",0,0)
or:
gtk_createobject("singleclickbutton_with_label","buttontest","Hello",0)
or
gtk_createobject("singleclickeventbox","buttontest",0,0)
This creates a button, where signalhandling is not added to libglade.
You can assign a new signaldetection like this:
gtk_singleclick("buttontest" )
When this button now is clicked, you can detect this in the mainloop.
To be able to avoid confusion with the standard (libglade) eventmessages, this function returns the widgetname modifed.
The returnvalue for the widget now has a leading "single-".
So to detect it, you would write:
if widget = "single-buttontest" then
This application makes use of it:
http://murga-linux.com/puppy/viewtopic. ... 389#174389
Mark
And uploaded the sourcecode, too.
New:
Objectdestruction
In the past, the function gtk_destroyobject() did not work.
I now rewrote the internal reference-handling of the objects.
GtkBasic allows to handle 1000 Gtk-widgets at once.
If you need more, you first must destroy older ones, or you application crashes.
I could add support for more, but that increases memory-usage.
Tell me, when you need more.
IMPORTANT:
If you have an old application, that crashes now, please tell me.
I then will repackage it.
It will be sufficient, to remove lines using
gtk_destroyobject()
I had added that for tests in the past, but it had no function.
Now this could crash your app, if those objects still are needed.
For debugging I added:
gtk_dumpobjects()
This shows a list of all objects you created, and the length of the internal reference-list.
So you can see, if you properly destroyed objects.
I also added some new functions to handle mouseclicks better.
gtk_createobject("singleclickbutton","buttontest",0,0)
or:
gtk_createobject("singleclickbutton_with_label","buttontest","Hello",0)
or
gtk_createobject("singleclickeventbox","buttontest",0,0)
This creates a button, where signalhandling is not added to libglade.
You can assign a new signaldetection like this:
gtk_singleclick("buttontest" )
When this button now is clicked, you can detect this in the mainloop.
To be able to avoid confusion with the standard (libglade) eventmessages, this function returns the widgetname modifed.
The returnvalue for the widget now has a leading "single-".
So to detect it, you would write:
if widget = "single-buttontest" then
This application makes use of it:
http://murga-linux.com/puppy/viewtopic. ... 389#174389
Mark
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]
might be a corrupted download.
Please try this mirror:
http://puppyfiles.ca/dotpupsde/puppy3/d ... ic-003.pup
Mark
Please try this mirror:
http://puppyfiles.ca/dotpupsde/puppy3/d ... ic-003.pup
Mark
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]
Mark,
Using the latest gtkbasic, downloaded last week, I encounter a glitch with clists. The program is a menu editor that uses two clists and reads the icons that match the menu and applications from the normal locations in puppy 4.0. I can drag & drop from one clist to the other ok but if I drag a file from rox the program crashes hard with [Internal error] Memory error (SIGSEGV). It seems to be related to the type of image used for the icons. To verify it I modified the demo that comes with gtkbasic so it uses a png instead of the xpm images and it crashed in the same way. That png was created with mtpaint. When I used another png selected at random it did not crash. Very strange. I seem to recall that the latest gtkbasic was modified for drag and drop with xfe. Could this glitch be related to that?
I would be interested in any suggested fixes that I could try here.
Vern
Using the latest gtkbasic, downloaded last week, I encounter a glitch with clists. The program is a menu editor that uses two clists and reads the icons that match the menu and applications from the normal locations in puppy 4.0. I can drag & drop from one clist to the other ok but if I drag a file from rox the program crashes hard with [Internal error] Memory error (SIGSEGV). It seems to be related to the type of image used for the icons. To verify it I modified the demo that comes with gtkbasic so it uses a png instead of the xpm images and it crashed in the same way. That png was created with mtpaint. When I used another png selected at random it did not crash. Very strange. I seem to recall that the latest gtkbasic was modified for drag and drop with xfe. Could this glitch be related to that?
I would be interested in any suggested fixes that I could try here.
Vern
Updated to 003d, compiled with less dependencies, tested in Puppy 4, Puppy 3, Puppy 2.12 (Muppy007), Muppy0084beta2.
You also need Puppybasic 2.6, as it includes an important function-library:
http://murga-linux.com/puppy/viewtopic.php?t=11090
I do not bundle both, as Puppybasic uses less memory, so it should be used for small scripts instead of Gtkbasic.
Clists now can return multiple selections:
alist = gtk_get_list_selections("mylist1")
this returns a list with the numbers of the selected rows.
There is no example available yet, it will come in the next update of the GtkBasic-Filer:
http://www.murga-linux.com/puppy/viewtopic.php?t=32575
Mark
You also need Puppybasic 2.6, as it includes an important function-library:
http://murga-linux.com/puppy/viewtopic.php?t=11090
I do not bundle both, as Puppybasic uses less memory, so it should be used for small scripts instead of Gtkbasic.
Clists now can return multiple selections:
alist = gtk_get_list_selections("mylist1")
this returns a list with the numbers of the selected rows.
There is no example available yet, it will come in the next update of the GtkBasic-Filer:
http://www.murga-linux.com/puppy/viewtopic.php?t=32575
Mark
Last edited by MU on Sun 31 Aug 2008, 13:23, edited 1 time in total.
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]
upgraded to version 003e
Changes:
- fixed handling of clists with multiple selections
- fixed errors with drag'n'drop in clists
- keypresses now are sent to the mainloop
(see the updated Textview demo for examplecode)
- xwin_readdir( thefolder , hidden )
thefolder isa fldername
hidden is 0 or 1
Example:
this will print lines like:
size
type (1=file, 2=dir, 3=char device, 4=blockdevice, 5=fifo, 6= broken link)
link target for links
link references
date time
uid
gid
user
group
permissions
It is pretty fast
Mark
Changes:
- fixed handling of clists with multiple selections
- fixed errors with drag'n'drop in clists
- keypresses now are sent to the mainloop
(see the updated Textview demo for examplecode)
- xwin_readdir( thefolder , hidden )
thefolder isa fldername
hidden is 0 or 1
Example:
Code: Select all
#!/usr/bin/gtkbasic003
f="/root"
'f="/usr/lib"
a,b=xwin_readdir(f , "1")
for n=0 to count(a)-1
print a[n]
print b[n]
next
a,b=xwin_readdir(f , "0")
for n=0 to count(a)-1
print a[n]
print b[n]
next
Code: Select all
sphere.xpm
1072 6 /usr/local/GTB-Filer/resource/sphere.xpm 1 17.08.2008 01:49 0 0 root root rw-r--r--
spot
1024 2 3 18.08.2008 06:34 502 502 spot spot rwxr-xr-x
test
1024 2 5 30.08.2008 17:43 0 0 root root rwxr-xr-x
type (1=file, 2=dir, 3=char device, 4=blockdevice, 5=fifo, 6= broken link)
link target for links
link references
date time
uid
gid
user
group
permissions
It is pretty fast
Mark
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]
Updated 003e
Added this function:
gtk_clist_define_cols(2)
Use any number you like.
Run it before:
gtk_createobject("GtkBasicList" , "mylist1", "window1" , "scrolledwindow1")
Now that list has more than one title.
I realized this as optional function, to keep old code working.
You now should be able to use the standard functions, e.g. to set column titles.
If not, let me know.
I'm away from mnday to wednesday, so have no time to write an extended demo.
To find out, how you can get the result from multiple selected lines, plese examine Muppy-Filer 0.2:
http://murga-linux.com/puppy/viewtopic.php?t=32575
Mark
Added this function:
gtk_clist_define_cols(2)
Use any number you like.
Run it before:
gtk_createobject("GtkBasicList" , "mylist1", "window1" , "scrolledwindow1")
Now that list has more than one title.
I realized this as optional function, to keep old code working.
You now should be able to use the standard functions, e.g. to set column titles.
If not, let me know.
I'm away from mnday to wednesday, so have no time to write an extended demo.
To find out, how you can get the result from multiple selected lines, plese examine Muppy-Filer 0.2:
http://murga-linux.com/puppy/viewtopic.php?t=32575
Mark
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]
Mark, I'm just playing in puppy 4.1alpha7 and I have a problem with the multifilechooser
It crashes when I hit the Apply button.
I originally noticed this because GTB-StructrEd does not load files.
I have installed puppybasic-2.6.
Code: Select all
# ./GBdialog-multifilechooser 'open file' '/usr/local/Gtkbasic-003/dialog-multifilechooser' '*' '1' '1'
(gtkbasic003:7724): GLib-GObject-WARNING **: gsignal.c:1669: signal `event' is invalid for instance `0x8d8eee0'
[Internal error]
Memory error (SIGSEGV)
gtk() in file "GBdialog-multifilechooser", line 115:
> mylist = gtk("gtk_file_chooser_get_filenames" , chooser[mode] , 0,0,0,0,0)
#
I originally noticed this because GTB-StructrEd does not load files.
I have installed puppybasic-2.6.
Will
contribute: [url=http://www.puppylinux.org]community website[/url], [url=http://tinyurl.com/6c3nm6]screenshots[/url], [url=http://tinyurl.com/6j2gbz]puplets[/url], [url=http://tinyurl.com/57gykn]wiki[/url], [url=http://tinyurl.com/5dgr83]rss[/url]
contribute: [url=http://www.puppylinux.org]community website[/url], [url=http://tinyurl.com/6c3nm6]screenshots[/url], [url=http://tinyurl.com/6j2gbz]puplets[/url], [url=http://tinyurl.com/57gykn]wiki[/url], [url=http://tinyurl.com/5dgr83]rss[/url]