| 
			
			 | 
		#76 | |
| 
			
			
			
			 Guru 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 730 
				Karma: 72743 
				Join Date: Feb 2008 
				Location: Here or there 
				
				
				Device: iRex iLiad, iRex DR800S. K4NT. Kobo Aura, Aura One, Libra 2. 
				
				
				 | 
	
	
	
		
		
		
		
		 Quote: 
	
 Study those examples and take also a look at hansel's and my own's programs: multicalc, minipad, toolbox...[*] I usually check pygtk docs and programs too and then translate to lua. Though is not directly translatable it should point you in the proper direction. Note that callbacks send arguments in a different way. Iņigo [*] Hansel lua code is quite polished and pretty, mine is ugly 'cos I don't know lua much.  | 
|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#77 | 
| 
			
			
			
			 Guru 
			
			![]() ![]() ![]() ![]() ![]() ![]() Posts: 976 
				Karma: 687 
				Join Date: Nov 2007 
				
				
				
				Device: Dell X51v; iLiad v2 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Well, I can live without a manual. 
		
	
		
		
		
		
		
		
		
		
		
		
	
	Just wrote a image viewer running on iLiad in 15 lines of lua script. And the speed is quite fast. Really amazing. In fact, lgob provides operation with ATK, CAIRO, PANGO, GDK ,GTK in lua script. I guess I can turn my homebrew application written in over one thousand lines of C code to 200 lines of lua script.  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#78 | |
| 
			
			
			
			 Guru 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 730 
				Karma: 72743 
				Join Date: Feb 2008 
				Location: Here or there 
				
				
				Device: iRex iLiad, iRex DR800S. K4NT. Kobo Aura, Aura One, Libra 2. 
				
				
				 | 
	
	
	
		
		
		
		
		 Quote: 
	
 note however that some recent pango/gtk/... functions are not available on Iliad. I consult pygtk docs to find out which they are. I have just joined #iliad in irc.freenode.net if you want realtime chat ;-) Iņigo  | 
|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#79 | 
| 
			
			
			
			 Guru 
			
			![]() ![]() ![]() ![]() ![]() ![]() Posts: 976 
				Karma: 687 
				Join Date: Nov 2007 
				
				
				
				Device: Dell X51v; iLiad v2 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Iņigo, 
		
	
		
		
			thanx. I need some time to adapt to the way to call GTK+ function in lua. This is a image viewer written in lua. Users can open file dialog to choose a image file to open. Unpack to anywhere and execute from Contentlister.  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#80 | 
| 
			
			
			
			 JSR FFD2 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 305 
				Karma: 1045 
				Join Date: Aug 2008 
				Location: Rotterdam, Netherlands, Europe, Sol 3 
				
				
				Device: iliad 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			The official gtk docs are quite good.  
		
	
		
		
		
		
		
		
		
		
		
		
	
	
 The Lua api is almost identical to the C api if you replace the underscores with dots, and capitalize here and there ![]() Pay special attention where it mentions 'available since...' If its old enough, it will work on the Iliad. The Iliad versions are 
 Great to see your enthusiasm! Happy coding, Hansel  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#81 | 
| 
			
			
			
			 Guru 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 730 
				Karma: 72743 
				Join Date: Feb 2008 
				Location: Here or there 
				
				
				Device: iRex iLiad, iRex DR800S. K4NT. Kobo Aura, Aura One, Libra 2. 
				
				
				 | 
	
	
	
		
		
			
			 
				
				Help: call to poweroff doesn't work inside lgob callback
			 
			
			
			Does anyone know why this code does not work? 
		
	
		
		
		
		
		
		
		
		
		
		
	
	Code: 
	btn:connect("clicked", function ()
                              win:hide()
                              win:destroy()
                              os.execute("/sbin/poweroff")
                           end)
I've also checked with "shutdown -t 0 now". No way to switch off the Iliad from inside a lua+lgob program. Thanks, Iņigo  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#82 | 
| 
			
			
			
			 JSR FFD2 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 305 
				Karma: 1045 
				Join Date: Aug 2008 
				Location: Rotterdam, Netherlands, Europe, Sol 3 
				
				
				Device: iliad 
				
				
				 | 
	
	|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#83 | 
| 
			
			
			
			 JSR FFD2 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 305 
				Karma: 1045 
				Join Date: Aug 2008 
				Location: Rotterdam, Netherlands, Europe, Sol 3 
				
				
				Device: iliad 
				
				
				 | 
	
	|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#84 | |
| 
			
			
			
			 Guru 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 730 
				Karma: 72743 
				Join Date: Feb 2008 
				Location: Here or there 
				
				
				Device: iRex iLiad, iRex DR800S. K4NT. Kobo Aura, Aura One, Libra 2. 
				
				
				 | 
	
	
	
		
		
		
		
		 Quote: 
	
 It's strange because /sbin/reboot works, and it's a link in fact. Anyway, I've found a command that can shutdown the Iliad "/sbin/shutdown.sysvinit -h -P now"! I'll study it a bit more... ![]() Thanks, Iņigo  | 
|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#85 | 
| 
			
			
			
			 Guru 
			
			![]() ![]() ![]() ![]() ![]() ![]() Posts: 976 
				Karma: 687 
				Join Date: Nov 2007 
				
				
				
				Device: Dell X51v; iLiad v2 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			I have a question: 
		
	
		
		
		
		
		
		
		
		
		
		
		
			Can I access gdk_gc_new() (http://library.gnome.org/devel/gdk/s...-Contexts.html) in lua script through lgob? I want to use some GDK drawing primitives (http://library.gnome.org/devel/gdk/2...rimitives.html), and some functions need GdkGC parameter. Added: I figured it out. It's gdk.GC.new(). Last edited by ericshliao; 10-31-2009 at 10:23 AM.  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#86 | 
| 
			
			
			
			 Guru 
			
			![]() ![]() ![]() ![]() ![]() ![]() Posts: 976 
				Karma: 687 
				Join Date: Nov 2007 
				
				
				
				Device: Dell X51v; iLiad v2 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Another question: 
		
	
		
		
		
		
		
		
		
		
		
		
		
			I want to access some function, such as pango_matrix_rotate() (http://library.gnome.org/devel/pango...h-Storage.html). I have tried several times with no success. How do I know if certain function can be access through lgob, and in what form? Added: It seems the correct form is pango.Matrix.rotate().  
		Last edited by ericshliao; 10-31-2009 at 10:47 AM.  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#87 | |
| 
			
			
			
			 Guru 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 730 
				Karma: 72743 
				Join Date: Feb 2008 
				Location: Here or there 
				
				
				Device: iRex iLiad, iRex DR800S. K4NT. Kobo Aura, Aura One, Libra 2. 
				
				
				 | 
	
	
	
		
		
		
		
		 Quote: 
	
 What I do is grep lgob sources for the function I need. Look at the .def, .ovr, and iface.c files. Also, note that the translation from C to lua is almost always done in this way: module_widget_method => module.Widget.method so pango_matrix_rotate() => pango.Matrix.rotate() Btw, instead of using GDK drawing primitives, maybe is a better option to use Cairo, it's much powerful, easier and looks it has better documentation as well. You can find 3 or 4 examples in lgob sources too. Regards, Iņigo  | 
|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#88 | 
| 
			
			
			
			 Guru 
			
			![]() ![]() ![]() ![]() ![]() ![]() Posts: 976 
				Karma: 687 
				Join Date: Nov 2007 
				
				
				
				Device: Dell X51v; iLiad v2 
				
				
				 | 
	
	
	
		
		
		
		
		 
			
			Another question: 
		
	
		
		
		
		
		
		
		
		
		
		
		
			I have a line of C code "PangoMatrix matrix = PANGO_MATRIX_INIT;" (http://library.gnome.org/devel/pango...h-Storage.html) and I want to convert it to Lua. The line will create a struct consisting 6 double variables. I tried with "p_matrix = pango.PANGO_MATRIX_INIT". Lua interpretor did accept the form, but in fact p_matrix is still "nil". How do I solve the problem? Added: There seems a convenient utility: toLua (http://www.tecgraf.puc-rio.br/~celes/tolua/). But I can't build it on my Linux desktop. Added 2: I can build toLua now, but it seems not what I want. Added 3: Problem solved. The correct form is "p_matrix = pango.Matrix.INIT". Added 4: I am wrong. "p_matrix = pango.Matrix.INIT" is not correct. Last edited by ericshliao; 10-31-2009 at 02:17 PM.  | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#89 | |
| 
			
			
			
			 JSR FFD2 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 305 
				Karma: 1045 
				Join Date: Aug 2008 
				Location: Rotterdam, Netherlands, Europe, Sol 3 
				
				
				Device: iliad 
				
				
				 | 
	
	
	
		
		
		
		
		 Quote: 
	
 I also wrote a function 'pr()' (included in MiniPad.tgz), which recursively prints any Lua variable. The top table in Lua is '_G'. So if you load some modules with require, and then do pr(_G), it will show you all variables (including all known modules and functions) Happy Lua!  | 
|
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
| 
			
			 | 
		#90 | 
| 
			
			
			
			 JSR FFD2 
			
			![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 305 
				Karma: 1045 
				Join Date: Aug 2008 
				Location: Rotterdam, Netherlands, Europe, Sol 3 
				
				
				Device: iliad 
				
				
				 | 
	
	
	
		
		
			
			 
			
			This is becoming a top  thread: 6th if you sort by nr of replies  
		
	
		
		
		
		
		
		
		
		
		
		
	
	![]() It even beats the battery hack thread  
		 | 
| 
		 | 
	
	
	
		
		
		
		
			 
		
		
		
		
		
		
		
			
		
		
		
	 | 
![]()  | 
            
        
            
| Tags | 
| gtk+, iliad, lgob, lua, networking, xml | 
            
  | 
    
			 
			Similar Threads
		 | 
	||||
| Thread | Thread Starter | Forum | Replies | Last Post | 
| Pandigital announce the black Novel | Nate the great | News | 0 | 08-18-2010 06:21 PM | 
| iLiad China iLiad users can get developer package. | ericshliao | iRex Developer's Corner | 35 | 03-20-2010 06:21 AM | 
| iLiad Announce: Glade4Lua, develop graphical apps for the Iliad | hansel | iRex Developer's Corner | 1 | 10-27-2009 06:00 PM | 
| Sony to announce colour e-book ? | markiehill | News | 11 | 08-22-2009 01:45 PM | 
| Proud to announce our new moderator! | Alexander Turcic | Announcements | 5 | 12-09-2003 12:18 AM |