Questions tagged [genie]

Genie is a programming language allowing one to program in Vala with a Python-like syntax.

Genie is a programming language allowing one to program in Vala with a Python-like syntax.

93 questions
1
vote
1 answer

Genie how to return an array of unowned strings

how to return an array of unowned strings that all point to the same location in memory? example: init var str = "ABC" var unowned_string_array = repeat (str, 5) def repeat (s: string, n: int): array of string // code and this array…
Naam Famas
  • 124
  • 7
1
vote
1 answer

What is the syntax for nested generic types in Genie?

I want to declare a HasTable with string as it's key and array of int as it's value: [indent=4] init var h = new HashTable of string, array of int (str_hash, str_equal) h["a"] = {1, 2, 3} h["b"] = {5, 6, 7} Error…
Jens Mühlenhoff
  • 14,565
  • 6
  • 56
  • 113
1
vote
2 answers

genie HashTable of string, STRUCT

NOTE: my question is array, not [ Array or GenericArray ] this is my code: init var h = new HashTable of string, Int? (str_hash, str_equal) h["a"] = Int ({1, 2, 3}) h["b"] = Int ({5, 6, 7}) // HERE: WORKS FINE // ERROR HERE: …
Naam Famas
  • 124
  • 7
1
vote
0 answers

How to connect() an anonymous handler to an event in Genie?

Guides and samples seem to tell you to use the += operator to add handlers to GObject events. E.g. "A brief guide" and Gtk tutorials. f.my_event += def (t, a) print "event was detected with value %d", a The compiler complains about this: $…
XTL
  • 851
  • 1
  • 8
  • 23
1
vote
3 answers

[genie/vala]: How to Sort using a custom comparator?

genie! how to Sort an array (or list) of strings in order of descending length, and in ascending lexicographic order for strings of equal length. my data is datas : array of string = { "cold", "z", "bpples", "pallalala", "apples", "xccv" …
Naam Famas
  • 124
  • 7
1
vote
1 answer

How do you import in Genie?

How is one supposed to import modules or libraries in the Genie programming language? I looked through the documentation and examples, but I haven't found anything.
Zauberin Stardreamer
  • 1,284
  • 1
  • 13
  • 22
1
vote
1 answer

How can I load a png with vala/genie and SDL?

This code gives me an error: uses SDL uses SDLGraphics uses SDLImage screen: unowned SDL.Screen alto: int16=400 ancho:int16 =600 imagen: SDL.Surface src: SDL.RWops init SDL.init(SDL.InitFlag.VIDEO) screen = SDL.Screen.set_video_mode (ancho,…
txasatonga
  • 419
  • 2
  • 11
0
votes
2 answers

Create a Genie Array

Hi I have a Problem with Arrays. I have class Arr the var a = new array of int[100] is the problem. The example works but wenn I put the var a ... behind class Arr (return) (Tab) i have this error message : arr.gs:3.2-3.4: error: syntax error,…
0
votes
1 answer

Hiding transition in Gtk

This is a continuation of a previous question on the Gtk.SearchEntry widget. In that question I manage to reveal the entry widget upon clicking in the icon, now I want the widget to disappear after it loses focus. The approach used now was with: …
lf_araujo
  • 1,991
  • 2
  • 16
  • 39
0
votes
1 answer

"Embedded statement cannot be declaration" error in Genie

It seems that is something out-of-date in Genie's website. Perhaps HashMaps are not supported anymore or their syntax has changed. If one tries the examples from the old BarryK website: uses Gee init var d = new dict of string,string …
lf_araujo
  • 1,991
  • 2
  • 16
  • 39
0
votes
1 answer

Handling errors with Genie

I am trying to refactor a python class into Genie, but I am stuck with how to handle errors. Some pointers would be greatly appreciated. If I understood properly, the way of handling errors with Genie is using Try...except blocks, but how to…
lf_araujo
  • 1,991
  • 2
  • 16
  • 39
0
votes
2 answers

How to find out the last item in a list of string?

Working with list of string is pretty straightforward in Genie. I was wondering if one could locate the last added item with something similar to [-1] in python. Taking the example from Genie's tutorial: [indent=4] init /* test lists */ …
lf_araujo
  • 1,991
  • 2
  • 16
  • 39
0
votes
1 answer

Class could not be found error

Doing my best to try to solve my problems w/o posting questions here. However, valadoc search system has been broken recently and #vala IRC channel is less helpful when it comes to Genie code (understandably). Aim I am trying to provide a OOP Gtk…
lf_araujo
  • 1,991
  • 2
  • 16
  • 39
0
votes
1 answer

Execl error debuging

Aim My objective is to create a simple frontend to pandoc. I have learned that execl is a good way of calling executables in the system. Note in the following code the function btn_pressed, that calls pandoc using the mentioned…
lf_araujo
  • 1,991
  • 2
  • 16
  • 39
0
votes
1 answer

Avoiding global variables in Genie

Below is a working code of a ToolbarButton in Genie. The objective is to get the uri for the chosen file and return it back to the construct/init of the class. The problem is that in all examples I’ve come across global _variables are used (as shown…
lf_araujo
  • 1,991
  • 2
  • 16
  • 39