Vala and Genie programming

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Message
Author
User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#141 Post by technosaurus »

Since vala shares a lot of syntax with C#, maybe these projects that use gtk# would be a good source of "inspiration"


Banshee (http://banshee-project.org/Main_Page) <-replace pmusic,
Beagle (http://beagle-project.org/Main_Page) <-replace pfind
F-spot (http://f-spot.org/Main_Page)
MonoDevelop (http://www.monodevelop.com/Main_Page)
Tomboy (http://www.gnome.org/projects/tomboy)

or maybe even some of the ones here
http://csharp-source.net/

(btw thanks for pointing me to http://mono-project.com/GtkSharp_TreeView_Tutorial)
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
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#142 Post by MU »

I have completely restructured the pictureviewer.

main.gs is very short again.

You now have additional files like libglade.gs or filebrowser.gs.

They help to keep the code readable.
The tree related filebrowsing methods are now part of the treeclass.
So you do not have to mess around in that code, you simply just use the methods.
The class manages everything automatically.
Just for additional actions, filebrowser.gs is available.
Here you can for example explicitly force to update the file-list in the second tree, when a folder in the first tree was clicked.

I added several comments, so I hope, it is easy to use.
I might add more comments in future, and want to add more methods.
But in the urrent state, it is already a full working template for your own, file tree based programs.

Mark
Attachments
TreeView-Genie-Complex-Dirbrowser04.tar.gz
(51.76 KiB) Downloaded 494 times
Last edited by MU on Sun 03 May 2009, 14:58, edited 2 times in total.
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

User avatar
ttuuxxx
Posts: 11171
Joined: Sat 05 May 2007, 10:00
Location: Ontario Canada,Sydney Australia
Contact:

#143 Post by ttuuxxx »

technosaurus wrote: Banshee (http://banshee-project.org/Main_Page) <-replace pmusic,
Beagle (http://beagle-project.org/Main_Page) <-replace pfind
Have you ever tried to compile Beagle? I have and it gets way blown out of size due to deps, Terrible program, I tried two+ weeks ago when I wanted a Pfind replacement, It looked nice and had great reports, but the size was the downfall, So then I tried Search Monkey and that was perfect 117kb pet and a perfect replacement with better features than Pfind and easy to configure.

Banshee is also nice but uses gstreamer, another large program, BMP is the best replacement for Pmusic thats made with 'C' and its uses winamp2 skins, its about 1/6 the size of banshee and also uses some xmms plugins also. I think the last time I compiled it on 4 series I had it down to 300kb pet.
The only way that banshee could ever make it in with gstreamer, is if we dropped gxine/xinelib for a gstreamer based mediaplayer. Then that could workout to be around the same size.

Good ideas just a bit too large for default puppy.
Hmmmm whats were we talking about here ???
sorry didn't mean to take you off topic.
ttuuxxx
http://audio.online-convert.com/ <-- excellent site
http://samples.mplayerhq.hu/A-codecs/ <-- Codec Test Files
http://html5games.com/ <-- excellent HTML5 games :)

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

#144 Post by 01micko »

Code: Select all

# valac hello.gs 
error: Failed to execute child process "pkg-config" (No such file or directory)
error: Failed to execute child process "pkg-config" (No such file or directory)
error: Failed to execute child process "pkg-config" (No such file or directory)
Compilation failed: 3 error(s), 0 warning(s)
Genie noob here :mrgreen: This is the error I get when I try to compile "Hello World". Also a file is created called "hello.c", which seems perfectly useless! :cry:

What am I doing wrong??? (or what am I missing?)
Puppy Linux Blog - contact me for access

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#145 Post by MU »

you need devx_420.sfs, that has the compiler and pkgconfig.

------------------------------
I attach a new sourcepackage of the treeview.
It now is renamed to "Picturebrowser-0.2" to allow correct versioning with the Picturebrowser binary pet.

I added more methods to access the trees, you can look up how to use them in the example actions in filebrowser.gs.

Mark
Attachments
Picturebrowser-0.2.tar.gz
(35.65 KiB) Downloaded 468 times
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

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

#146 Post by 01micko »

strange then

I am running spup from woof I built... devx is loaded. I'll see if I can compile something else ... maybe my devx is broken :cry:

Yes... devx seems broken.. I'll try in 412
Last edited by 01micko on Mon 04 May 2009, 00:02, edited 1 time in total.
Puppy Linux Blog - contact me for access

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#147 Post by MU »

please type:
gcc

you should see:
gcc: no input files.

If you do not see it, devx is not loaded.
If you see it, you need pkg-config, this would mean it is missing for whatever reason.
I attach it, extract it in /usr/local/bin/.
Mark
Attachments
pkg-config.tar.gz
(30 KiB) Downloaded 426 times
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

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

#148 Post by 01micko »

Nah good. My devx is definitely broken. It says it is loaded on boot mgr, but the gcc command fails. In 412 now will install valide and load devx and try again!
Puppy Linux Blog - contact me for access

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

#149 Post by 01micko »

Oooh.. I like the power! Nice. Working fine now. I was able to compile BK's examples... they look nice!

Bit sad :cry: that my spup devx is busted but that might be fixed by woof beta. :)

Thanks for your help Mark.

EDIT: :lol: My spup devx is fixed now! (it is my OS of choice ATM..fast)
Last edited by 01micko on Tue 05 May 2009, 20:09, edited 1 time in total.
Puppy Linux Blog - contact me for access

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#150 Post by MU »

Picturebrowser 0.3.

A PET is available in the other thread:
http://www.murga-linux.com/puppy/viewtopic.php?t=41919


Here now is the source, it includes a Binary for Windows, and libglade.dll and libxml.dll.
To run it in Windows:
Install:
http://valide.googlecode.com/files/vala-0.7.1.exe
It includes the required Gtk for Windows files.
Then unzip my archive somewhere, and click on Picturebrowser.exe.

To compile, you also had to extract this:
http://dotpups.de/puppy4/dotpups/Progra ... alog32.zip
in: C:\vala-0.7.1

The refinements contain some new methods, and a general cleanup, so it is not only from advantage for windows.

In Windows, the new "autoscaling" is disabled (to fit the picture when you resize the window), because the threads do not work as expected (a known issue).

Update: Pet removed, see next messages for updated version.

Mark
Attachments
picturebrowser03win.jpg
(80.95 KiB) Downloaded 1244 times
Last edited by MU on Tue 05 May 2009, 21:30, edited 1 time in total.
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#151 Post by MU »

I attach picturebrowser v0.4.

Massive internal changes.

The whole treeclass was cleaned up, and is easier to use.
I think it now has reached the "final" structure, so the method names will not change in future.
I just might add some more, or enhance some. what might require more parameters.

Old code:

Code: Select all

    treeclass1 = new treeclass()
    treeclass1.mode = "filebrowser"
    mytree1 = treeclass1.treeview()
    treeclass1.column.set_title("Folders")
    get_scrolledwindow("scrolledwindow1" ).add (mytree1)


    var iter = treeclass2.get_first_iter(mytree2)
        if treeclass2.store.iter_is_valid(iter)
            treeclass2.select_iter(treeclass2, iter)
            tree2_row_click()
New code:

Code: Select all

    tree1 = new treeclass()
    tree1.mode = "filebrowser"
    tree1.init()
    tree1.column.set_title("Folders")
    var sw1 = (ScrolledWindow)get_widget("scrolledwindow1")
    sw1.add(tree1.tree)

    tree2.select_first_item()
    tree2_row_click()
Please note, that also the libglade.gs changed.

old:

Code: Select all

    get_scrolledwindow("scrolledwindow1" ).add (mytree1)
This used a method, that had to be defined "by hand", like this:

Code: Select all

//-- HELPER method: this method returns a SCROLLEDWINDOW ! --

def get_scrolledwindow(name : string) : ScrolledWindow
    b : Gtk.ScrolledWindow*
    var w = xml.get_widget(name)
    b = (ScrolledWindow) w
    return b
This is no longer needed!
You only need these 2 lines:

Code: Select all

    var sw1 = (ScrolledWindow) get_widget("scrolledwindow1")
    sw1.add(tree1.tree)
I think this is one of the enhancements in Vala 0.7.1, if I remember well, it did not work in 0.5.7, so I had written those helper methods.

The Windows binary is included again.

The program no longer uses "Threads" to scale a picture, but a method based on Gdk.Pixbuf.
This works faster, needs less resources (14% cpu-usage instead of 42%), and works in Linux and Windows.

And bookmarks now also work with special characters in the filenames.

A PET for Puppy 4.12 follows later.

Mark
Last edited by MU on Tue 05 May 2009, 20:18, edited 1 time in total.
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#152 Post by MU »

[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#153 Post by MU »

I seperated the code to display the pictures in a own class now.
So it can easily embedded in own programs.
The class even manages to download pictures, that are dropped on the viewer (it uses wget).

I attach the source of a seperate small example application, that is described here:
http://www.murga-linux.com/puppy/viewto ... 769#302769

As no tree is included, this example is extremely short :)


The source for the picturebrowser is not adapted yet.
Mark
Attachments
Class-Pictureview-0.1b.zip
(44.15 KiB) Downloaded 766 times
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#154 Post by MU »

there was a bug in the load_picture() method in the pictureview class.
There 3 methods were called with a leading "picview.", so it did not work, if your instance of the class had a different name.

Uploaded 0.1b.

Mark
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#155 Post by MU »

I updated the pictureviewer class, it can display PDF files now.

On Windows, you also need:
http://dotpups.de/puppy4/dotpups/Progra ... wslibs.zip

http://dotpups.de/puppy4/dotpups/Progra ... wslibs.txt

Mark
Attachments
Class-Pictureview-0.2.zip
(48.82 KiB) Downloaded 648 times
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#156 Post by MU »

new update, see:
http://www.murga-linux.com/puppy/viewto ... 348#303348

Windows binary included again, see previous messages for dependencies on Windows.

Mark
Attachments
Class-Pictureview-0.3.zip
(54.19 KiB) Downloaded 685 times
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#157 Post by MU »

here is a small interface for Mplayer.
The GIT version no longer supports an own grafical interface as far as I see.

So I hacked together this simple "playbar" , it allows to pause or switch fullscreen.
The cursor keys work too, to jump forward/backward.

In jwm, the playbar is covered in fullscreen mode, hit "f" to turn of fullscreen again.


The playbar has no fileselector, so you must pass a movie as commandline argument, or add the "genie-mplayer" script with full path as run-action to rox-filer (set the correct path in that script, too).

In the current state, it is not really recommended for average users, I just post it as small coding example.
Compiled in Puppy 412.

Mark
Attachments
GenieMplayer-0.2.tar.gz
(17.09 KiB) Downloaded 682 times
GenieMplayer.jpg
(32.96 KiB) Downloaded 1370 times
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#158 Post by MU »

the Genie mplayer did not compile in Puppy 4.12, I added some changes, so now it works.
Mark
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

caleb72
Posts: 57
Joined: Fri 15 May 2009, 12:44

#159 Post by caleb72 »

Can anyone play here?

I like developing in Python (Windows refugee) and am wondering if I should have a go at Genie.

I'm very fond of the Python syntax and style which makes me think Genie is the more logical choice for me rather than Vala for example.

I can't really find a huge amount of info - Barry's page with the examples is about all. Just wondering how to go about diving into Genie.

Regards
Caleb

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

#160 Post by Lobster »

am wondering if I should have a go at Genie
Yes. This thread and Barrys page is about all there is in Genie (it is very new)
Valide and Genie are part of the devx for the latest Woof alphas.

Marks examples (go through this thread) and my paltry efforts are a good place to begin.
Genie is faster (being compiled) than Python and works on both Windows and Linux, creating standalone efficient code.

Mark is very supportive and Barry will be providing more work in the future ;)

Be a Pioneer Puppy
Last edited by Lobster on Sat 16 May 2009, 02:04, edited 1 time in total.
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

Post Reply