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
nikobordx
Posts: 84
Joined: Sat 23 May 2009, 09:08
Location: Bordeaux, France

StatusIcon test

#321 Post by nikobordx »

Oop's, a new test, StatusIcon:

Code: Select all

[indent=4]

/* Build with valac --pkg gtk+-2.0 yourfile.gs */

uses
    Gtk

init
    Gtk.init (ref args)
    var test = new StatusIconTest ()
    test.show_all ()
    Gtk.main ()

class StatusIconTest : Window

    trayicon : StatusIcon
    menu : Menu

    init
        title = "StatusIcon"
        window_position = WindowPosition.CENTER
        set_resizable(false)
        destroy += exit_app
        var label = new Label("Look the house in your taskbar !!!")
        var hbox = new HBox (false, 0)
        hbox.pack_start (label, false, true, 0)
        add (hbox)

        /* Create tray icon */
        trayicon = new StatusIcon.from_stock(STOCK_HOME)
        trayicon.set_tooltip_text ("Hello, i'm a tooltip !")
        trayicon.set_visible(true)
        trayicon.activate += icon_clicked
        create_menu()

        /* Create menu */
    def private create_menu ()
        menu = new Menu()
        var menuItem = new ImageMenuItem.from_stock(STOCK_ABOUT, null)
        menuItem.activate += about_clicked
        menu.append(menuItem)
        var menuItem2 = new ImageMenuItem.from_stock(STOCK_QUIT, null)
        menuItem2.activate += exit_app
        menu.append(menuItem2)
        menu.show_all()
        trayicon.popup_menu += def (button, time)
            show_popup(button, time)

        /* Show popup menu */
    def private show_popup (button : uint, time : uint)
        menu.popup(null, null, null, button, time)

    def private icon_clicked ()
        print("I know you have clicked on the icon !!")

def private about_clicked ()
        var about = new AboutDialog ()
        about.set_version("1.0")
        about.set_program_name("Simple StatusIcon Test")
        about.set_comments("This is a Simple StatusIcon Test")
        about.set_copyright("Nicolas alias nikobordx")
        about.run()
        about.hide()

    def private exit_app ()
        Gtk.main_quit()
I don't know what to test now ! :( if someone have an idea ... :D
Nicolas.

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

Genie SDK

#322 Post by nikobordx »

Hi,

For all persons interested, I created a small sdk of my genie test !

Nicolas.
Attachments
GenieSamples.tar.gz
(12.8 KiB) Downloaded 543 times

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

Re: New version of Text Editor

#323 Post by BarryK »

nikobordx wrote:Hi all,

This is a new version with "line number" and "syntax highlighting" support !!!

You need the new gtksourceview to make compile !

Please test it !
Nicolas.
Nicolas,
Yes, I now have syntax highlighting!

When I open a file from the commandline, for example:
# simpletexteditor demo.htm

It opens at the end of the file. Can this be fixed?


Starting the editor in a terminal, without specifying any file on the commandline, I see this warning:

Code: Select all

** (simpletexteditor:2615): CRITICAL **: text_file_viewer_open_file: assertion `filename != NULL' failed
Unable to delete temp file, anyway it's not important !
...does that matter?

Note, I'm running my latest Woof-built "413", based on Puppy 412 with upgrades, GTK 2.14.7.
[url]https://bkhome.org/news/[/url]

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

#324 Post by nikobordx »

Hi Barry,

I have the same, can you try this:
Delete this line: text_view.scroll_to_mark (buf.get_insert (), 0.25, false, 0.0, 0.0)
Rebuild and test !

I ask you because I updated vala (version 0.7.4) and I can't compile the texteditor anymore.

Code: Select all

texteditor.gs:567.61-567.67: error: Argument 3: Cannot convert from `ulong' to `int'
                FileUtils.get_contents (filename, out text, out len)
Nicolas.

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

#325 Post by nikobordx »

Re-Hi Barry,

Ok i found a solution.
Under the function:

Code: Select all

 def open_file (filename : string) 
Add this:

Code: Select all

 go_to_line(1)
Before the line:

Code: Select all

 status_bar.push(0, "You are editing: " + filename) 
See you,
Nicolas.

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

SDK

#326 Post by nikobordx »

[Message Deleted]

See more recent message !

Nicolas.
Last edited by nikobordx on Mon 15 Jun 2009, 20:41, edited 1 time in total.

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

#327 Post by nikobordx »

Hi all,
This is a new version of sdk.

25 examples and 3 complete app !

See you,
Nicolas.
Attachments
GenieSamples.tar.gz
(58.6 KiB) Downloaded 527 times

gege2061
Posts: 4
Joined: Sat 21 Mar 2009, 00:59
Location: France
Contact:

#328 Post by gege2061 »

BarryK wrote:Ah, I've just realised why I can't compile it, my system has gtk 2.14.7.
Is it possible to not be reliant on gtk >= 2.16.x?
You can try with the attached patch ;)
Attachments
gtk-2.14.patch.tar.gz
Patch for use valide with GTK+ 2.14
(640 Bytes) Downloaded 472 times

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#329 Post by BarryK »

Nicolas,
I inserted the line as you instructed above, it doesn't fix it. I now have two bugs to report with the simple text editor:

1
Chose to exit editor, file was changed, a dialog came up:
"The file is unregistered, do you want to save it?"
...clicking No or Yes buttons, nothing happens.

2.
Open a file on commandline, window displays end of file. The recommended fix
inserting go_to_line(1) did not work. The insertion point is at the beginning of the file, but it initially displays the end of the file.


...if you can fix these, I propose to replace Leafpad in Puppy. I would also like to rename the simple text editor as "NicEdit" if that's ok with you.
[url]https://bkhome.org/news/[/url]

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

#330 Post by nikobordx »

[Message Deleted]

See next message !

Nicolas.
Last edited by nikobordx on Mon 15 Jun 2009, 19:46, edited 1 time in total.

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

NicEdit

#331 Post by nikobordx »

[Message deleted]

See newer message !

Nicolas.
Last edited by nikobordx on Thu 18 Jun 2009, 15:06, edited 1 time in total.

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#332 Post by BarryK »

Nicolas,

A problem, I cannot get ValIDE to compile:

http://puppylinux.com/blog/?viewDetailed=00814

I love NicEdit, see my post, and a problem with syntax highlighting:

http://puppylinux.com/blog/?viewDetailed=00810
[url]https://bkhome.org/news/[/url]

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

#333 Post by nikobordx »

See more recent message !

Nicolas.
Last edited by nikobordx on Sat 20 Jun 2009, 20:21, edited 1 time in total.

User avatar
samedog
Posts: 56
Joined: Sun 12 Oct 2008, 11:03
Location: Panguipulli,Chile
Contact:

#334 Post by samedog »

Hi everyoine, i need a little help with a problem:

i have downloaded the GieneExamples by MU, after looking at the picturebrowseri decided to make some changes to to it (i just translate some buttons labels to spanish) after that i compiled it (with the compile button in the valide program) and everything was fine. After that i run the program, clicked on one folder on the tree and the program crashes with a "segmentation fault"

i have downloaded all from http://dotpups.de/puppy4/dotpups/Programming/Vala/

reinstalled lots of times, but nothing seems to work.

i have also tried to compile the GenieExamples program, with the same results: when i click a folder on the tree, the program crashes with seg. fault

i'm using puppy 4.00, and i have installed the following packages:

libgee-0.1.5.pet
libgee_DEV-0.1.5.pet
vala-0.7.2-i486.pet
valide-0.4-1-i686-svn-2009-03-27-and-gedit.pet
gtksourceview-2.4.2.pet
ORBit2-2.14.7-i686.pet
GConf-2.18.0.1-i686.pet


now i'm gonna try to compile from source and see what happens, but if someone can help me it would be very nice.


greetings.
<Rupp>ERROR: Communication problem with khotkeys, it probably crashed.
<Rupp>damn
<samedog>EPIC
<Rupp>FAIL
<samedog>hmm... pretty good for a signature..
<Rupp>XD

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

#335 Post by nikobordx »

[See newer message]

Nicolas.
Last edited by nikobordx on Mon 22 Jun 2009, 17:59, edited 1 time in total.

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

#336 Post by MU »

Nicolas,

in Newyearspup I had to replace in the file "wscript" 3 times "atleast_version='2.16.0'" to: "atleast_version='2.14.0'", then it compiled.

I also got the crash then.
So I ran:
gdb nicedit
run


Then when it crashed:
backtrace
(to finally exit, type "quit").

The backtrace showed:
(gdb) backtrace
#0 0xb7e3196d in gtk_print_context_get_height ()


So I replaced line 1054 for a test:

Code: Select all

        //height : double = context.get_height()
        var height = 1000
After compiling and running again, I get:
0xb7d61809 in gtk_print_operation_set_n_pages () from /usr/lib/libgtk-x11-2.0.so.0
(gdb) backtrace
#0 0xb7d61809 in gtk_print_operation_set_n_pages () from /usr/lib/libgtk-x11-2.0.so.0


So I comment line 1064:

Code: Select all

        //op.set_n_pages(numPages)
Now I get:
Program received signal SIGSEGV, Segmentation fault.
0xb7d7f9cd in gtk_print_context_get_width () from /usr/lib/libgtk-x11-2.0.so.0


With this method, you can find out, which function crashes your program.
I cannot tell you, why these functions crash, as I never used them before.
But I hope, this helps you, to find the errors.

Mark
Last edited by MU on Sat 20 Jun 2009, 21:52, 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:

#337 Post by MU »

Samedog, I will try to reproduce your errors tomorrow.
I actually had no time for coding as intended, sorry for the delay.

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

User avatar
samedog
Posts: 56
Joined: Sun 12 Oct 2008, 11:03
Location: Panguipulli,Chile
Contact:

#338 Post by samedog »

thanks for your answer MU, by the way, i have upgraded to puppy 4.2.1 and still getting the segmentation fault, now i'm gonna try to compile from sources..and see what happens
<Rupp>ERROR: Communication problem with khotkeys, it probably crashed.
<Rupp>damn
<samedog>EPIC
<Rupp>FAIL
<samedog>hmm... pretty good for a signature..
<Rupp>XD

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

#339 Post by nikobordx »

[See newer message]

Nicolas.
Last edited by nikobordx on Tue 23 Jun 2009, 17:57, edited 1 time in total.

User avatar
BarryK
Puppy Master
Posts: 9392
Joined: Mon 09 May 2005, 09:23
Location: Perth, Western Australia
Contact:

#340 Post by BarryK »

Nicolas,
I'm going to change the name of your text editor to 'NicoEdit' as I was informed that there is already a commercial javascript editor named NicEdit.

I'm downloading your latest "NicoEdit" right now, will test it.
[url]https://bkhome.org/news/[/url]

Post Reply