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
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#261 Post by MU »

Nico,

replace:

Code: Select all

        //destroy += exit_clicked
        delete_event += exit_program
Then at bottom, you must change the exit function:

Code: Select all

    //-- MU- this is called by the menu item --
    def private exit_clicked ()
        exit_program()
        
        
    def private exit_program ():bool
        if document_modified is true
            var messagedialog = new MessageDialog (this, Gtk.DialogFlags.DESTROY_WITH_PARENT | Gtk.DialogFlags.MODAL, Gtk.MessageType.QUESTION, Gtk.ButtonsType.YES_NO, ("The file is unregistered, do you want to save it ?"))
            messagedialog.run()
            if (messagedialog.run () == ResponseType.YES)
                save_clicked ()
                Gtk.main_quit()
                messagedialog.destroy()
            else if (messagedialog.run () == ResponseType.NO)
                Gtk.main_quit()
                messagedialog.destroy()
        else
            Gtk.main_quit()
        
        return false
Like this when a "delete" of the window is requested, your exit function is called, before the window is destroyed.

If have made two functions of it, because the "delete_event" requires a boolean return value, but the menu item to quit does not.

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

nikobordx
Posts: 84
Joined: Sat 23 May 2009, 09:08
Location: Bordeaux, France

#262 Post by nikobordx »

Hi Mark,

Thank you, it work correctly.

Next step: print support !

Nicolas.
Attachments
texteditor.gs.tar.gz
(3.47 KiB) Downloaded 333 times

User avatar
droope
Posts: 801
Joined: Fri 01 Aug 2008, 00:17
Location: Uruguay, Mercedes

#263 Post by droope »

Hi

I get this while running valaide:

valide: symbol lookup error: /usr/lib/libvalide-0.0.so: undefined symbol: g_dgettext


Any clues?

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

#264 Post by MU »

droope, which Puppy?
Please look if you have:
libgtksourceview-2.0.so.0.0.0

If not, then install:
http://ftp.nluug.nl/ftp/pub/os/Linux/di ... -2.4.2.pet

http://ftp.nluug.nl/ftp/pub/os/Linux/di ... -2.4.2.pet

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:

#265 Post by MU »

I tried to compile the texteditor in Puppy 4.20, what failed because some symbols miss.

So I installed the newer Glib 2.20 (full) from ttuuxx:
http://www.murga-linux.com/puppy/viewtopic.php?t=39736

Then it compiles fine.
If you encounter problems and instabilities in Puppy 4.x with Valaprograms, I really do recommend that upgrade.
The PET is only 2.8 MB.
This also will enable you to run other modern programs, that usually fail because of the missing libgio.so.

Valaide now runs "native" using "valide", it is not required to use my additional libs that are invoked by my custom startscript "validestart".

I run Puppy 4.20 in virtualbox and encountered no instabilities yet, but I did not test it over a longer period.
So please give us feedback, if you can confirm the successfull upgrade or not.
Mark
Last edited by MU on Mon 01 Jun 2009, 02:28, edited 2 times 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:

#266 Post by MU »

01micko wrote:I'm in upup alpha9 at the moment.... I can try plenty of others!
edit:
/usr/local/bin/mplayer-pupwebtv

Replace "gmplayer" with "mplayer".
There is a gmplayer executable, but it does not start, because a default skin is missing.

I had installed the "gnome-mplayer" with petget (upup-476).

You can test like this:
mplayer-pupwebtv -playlist /tmp/PupWebTVplaylist

When you click a channel in the tree, "/tmp/PupWebTVplaylist" is created.
Then the script to run mplayer with this playlist is executed.
So the above command allows you to reproduce what the program does in console.

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:

#267 Post by MU »

I just installed upup-476, and the included Valaide 0.5 freezes the whole system when I try to open files :shock:
I then installed 0.4, and everything is fine.
I even can compile and run the Texteditor without installing anything else.

If you encounter the same problem, simply install:
http://dotpups.de/puppy4/dotpups/Progra ... -03-27.pet

After installation, you can delete the folder /usr/local/glib2.18/, it is not needed in upup.

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

nikobordx
Posts: 84
Joined: Sat 23 May 2009, 09:08
Location: Bordeaux, France

#268 Post by nikobordx »

Hi all,

Can you try the new texteditor with very basic print support ?

Thanks,
Nicolas.
Attachments
texteditor.gs.tar.gz
(3.71 KiB) Downloaded 344 times

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

#269 Post by MU »

yes, works here in NYP.
When I print, the pdf-writer dialog opens, and creates a PDF.
I have no printer installed.

Mark
[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:

#270 Post by 01micko »

MU wrote:
01micko wrote:I'm in upup alpha9 at the moment.... I can try plenty of others!
edit:
/usr/local/bin/mplayer-pupwebtv

Replace "gmplayer" with "mplayer".
There is a gmplayer executable, but it does not start, because a default skin is missing.

I had installed the "gnome-mplayer" with petget (upup-476).

You can test like this:
mplayer-pupwebtv -playlist /tmp/PupWebTVplaylist

When you click a channel in the tree, "/tmp/PupWebTVplaylist" is created.
Then the script to run mplayer with this playlist is executed.
So the above command allows you to reproduce what the program does in console.

Mark
Thanks again Mark, that works,

Cheers
Puppy Linux Blog - contact me for access

nikobordx
Posts: 84
Joined: Sat 23 May 2009, 09:08
Location: Bordeaux, France

#271 Post by nikobordx »

Hi mark,

Could you help me, i don't know how to convert from vala to genie:

Code: Select all

        switch (response_id) {
        case ResponseType.HELP:
            // show_help ();
            break;
        case ResponseType.APPLY:
            on_find_clicked ();
            break;
        case ResponseType.CLOSE:
            destroy ();
            break;
Do you know ?

Thanks,
Nicolas.

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

#272 Post by MU »

see here at bottom:
http://puppylinux.com/genie/loops.htm
Mark
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

nikobordx
Posts: 84
Joined: Sat 23 May 2009, 09:08
Location: Bordeaux, France

#273 Post by nikobordx »

Thank you Mark

I have new problem and i don't know why.

I'm using the function from Gtk+-2.0:

Code: Select all

public bool backward_search (string str, Gtk.TextSearchFlags flags, out Gtk.TextIter match_start, out Gtk.TextIter match_end, Gtk.TextIter? limit);
My code:

Code: Select all

match_start : TextIter
match_end : TextIter
found : bool = false
limit : TextIter

found = TextIter.backward_search (text, search_flags, out match_start, out match_end, ref limit)
But when i build:

Code: Select all

texteditor.gs:379.21-379.108: error: Access to instance member `Gtk.TextIter.backward_search' denied
            found = TextIter.backward_search (text, search_flags, out match_start, out match_end, ref limit)
What's wrong ?

Thanks in advance,
Nicolas.

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

#274 Post by MU »

http://valadoc.org/?pkg=gtk+-2.0&elemen ... ard_search

I think you must use it as method of an object, like

Code: Select all

titer = new TextIter()
var result = titer.backward_search(...options...)
If you can zip your current code, I could have a closer look.
Mark
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

nikobordx
Posts: 84
Joined: Sat 23 May 2009, 09:08
Location: Bordeaux, France

#275 Post by nikobordx »

Voilà !

Go to line: 379

Thanks,
Nicolas
Attachments
texteditor.gs.tar.gz
(4.22 KiB) Downloaded 274 times

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

#276 Post by MU »

this gives no errors, but there must be added the code, that jumps to the found iters then, so I cannot guarantee, that it is correct.

I attach the modified file, I also edited your searchdialog, so that "findtext()" is called, when you search.

Maybe my changes help you to continue, but if you get stuck again, let me know.

Mark
Last edited by MU on Mon 01 Jun 2009, 22:41, 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:

#277 Post by MU »

no, that was not good...
I attach a working one, it uses the SourceSearchFlags.
The searchword "test" is hardcoded.
compile, run.
Then enter "--test--" in your textview.
Then click on "search" in the toolbar and the button "search".
Now "test" should be selected.

You just must add more logic, e.g. to get the search-string from the entry.

Mark
Attachments
main.gs.tar.gz
(4.31 KiB) Downloaded 239 times
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

nikobordx
Posts: 84
Joined: Sat 23 May 2009, 09:08
Location: Bordeaux, France

#278 Post by nikobordx »

Hi Mark,

Thanks it's work.
But i think we need to implement a more better search function.

I try this week.

Nicolas.
Attachments
texteditor.gs.tar.gz
(4.31 KiB) Downloaded 272 times

gpnet
Posts: 56
Joined: Sat 09 May 2009, 15:49
Location: Ivrea ,Italy

#279 Post by gpnet »

Hi guys,

While I was waiting for a new version of apha-x release, I tried to do something in windows env. Just to make me understand what I learned about puppy. ( so I believe )

So I tried to re-make the PetBeGone ( by pizzasgood) shell.script to vala.

I have had some difficulty with glade3 and I need help about. Here is the result, though, is still to complete.

Could any of you try to compile in puppy and tell the results ?

thanks.
Attachments
PetBeGone.zip
(49.92 KiB) Downloaded 250 times

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

#280 Post by MU »

gpnet,
it does not run in Puppy 4, because it needs Gtk 2.16, but Puppy 4 has 2.14.
I will try it in upup (Puppy 5 alpha) tomorrow.
Mark
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

Post Reply