Reply
Thread Tools
Posts: 1,101 | Thanked: 1,184 times | Joined on Aug 2008 @ Spain
#1
I'm porting to the N8x0 a pygtk application which uses keypress events. It works fine with the hardware keyboard, but the virtual keyboard doesn't seem to emit keypress events, except for the enter and backspace keys.
Is there any way to get keypress events when using the virtual keyboard?
 
noobmonkey's Avatar
Posts: 3,203 | Thanked: 1,391 times | Joined on Nov 2009 @ Worthing, England
#2
Originally Posted by maacruz View Post
I'm porting to the N8x0 a pygtk application which uses keypress events. It works fine with the hardware keyboard, but the virtual keyboard doesn't seem to emit keypress events, except for the enter and backspace keys.
Is there any way to get keypress events when using the virtual keyboard?
good point... no idea....

Could make your own - http://www.ossramblings.com/pygame_virtual_keyboard
__________________
----------- Follow me on Twitter here
----------- My Photography Website and Blog is here
----------- Author of the N900 Health Check Application ----------- New Version in Extras Devel (Dec 2010 - 2.9.10)
----------- Are you on the N900 World Map? - http://pininthemap.com/maemo - masterpin: shotgun
----------- What apps do you want to see on the n900 or in MeeGo in the future? -
 

The Following User Says Thank You to noobmonkey For This Useful Post:
daperl's Avatar
Posts: 2,427 | Thanked: 2,986 times | Joined on Dec 2007
#3
Originally Posted by maacruz View Post
I'm porting to the N8x0 a pygtk application which uses keypress events. It works fine with the hardware keyboard, but the virtual keyboard doesn't seem to emit keypress events, except for the enter and backspace keys.
Is there any way to get keypress events when using the virtual keyboard?
As far as I know, the only way the virtual keyboard will appear in Nokia GTK is if the keyboard focus is grabbed by a widget that implements the gtk.Editable interface, so here are the gtk.Editable signal prototypes:

Code:
"changed"
    def callback(editable, user_param1, ...)

"delete-text"
    def callback(editable, start, end, user_param1, ...)

"insert-text"
    def callback(editable, new_text, new_text_length, position, user_param1, ...)
EDIT: Woops, This seems to only be true for simple text editing, but here's the explaination of "insert-text":

The "insert-text" signal is emitted when text is inserted into the widget by the user. The default handler for this signal will normally be responsible for inserting the text, so by connecting to this signal and then stopping the signal with the gobject.stop_emission() method, it is possible to prevent it from being inserted entirely. The position parameter is a gobject.GPointer object containing a pointer to the insertion position - there is no way to access the position value from PyGTK.
__________________
N9: Go white or go home

Last edited by daperl; 2010-02-21 at 02:27.
 

The Following User Says Thank You to daperl For This Useful Post:
Posts: 1,101 | Thanked: 1,184 times | Joined on Aug 2008 @ Spain
#4
Yes, it seems the only way is to override the do_insert_text method from the gtk.Editable interface. For now, I settled to using the TAB key (the event of interest was triggered by the space key).
Now, another question: How can I set the taskbar icon?
No matter how much I try, it seems I can't do it. I have copied the icon to /usr/share/pixmaps and /usr/share/icons/hicolor/26x26/hildon, updated the icon cache, and created a .desktop file. The icon shows in the menu, but not in the taskbar. gtk.window_set_default_icon() doesn't seem to work.
 
qwerty12's Avatar
Posts: 4,274 | Thanked: 5,358 times | Joined on Sep 2007 @ Looking at y'all and sighing
#5
Originally Posted by maacruz View Post
Now, another question: How can I set the taskbar icon?
No matter how much I try, it seems I can't do it. I have copied the icon to /usr/share/pixmaps and /usr/share/icons/hicolor/26x26/hildon, updated the icon cache, and created a .desktop file. The icon shows in the menu, but not in the taskbar. gtk.window_set_default_icon() doesn't seem to work.
Don't bother with the GTK+ functions for setting the icon; hildon-desktop only takes notice if the icon is 64x54 (thanks, javispedro) and you shouldn't need them.
It's been a looong time since I've dealt with icon issues on the N8x0 (Fremantle is nicer in this regard, with the menu icon being the only thing you have to worry about ) so all I can offer is general hints (sorry if these come off as "No ****, Sherlock").

* The icon in /usr/share/icons/hicolor/26x26/hildon is a 26x26 PNG, with the same file name as the the one in /usr/share/pixmaps etc.?
* You have a 64x64 PNG in /usr/share/icons/hicolor/scalable/hildon?
* In your desktop file, you aren't trying to set the icon directory or the WMClass?
* Hildon-desktop takes notice of the X-Window-Icon and X-Window-Icon-Dimmed fields in the desktop file if all else fails.

Last edited by qwerty12; 2010-02-21 at 22:45. Reason: scalable, not 26x26
 

The Following User Says Thank You to qwerty12 For This Useful Post:
Posts: 1,101 | Thanked: 1,184 times | Joined on Aug 2008 @ Spain
#6
Thanks, after much renaming and linking I finally got it (the png file has to have the same name as the executable), but your hints will allow me to do it right once and for all
 

The Following User Says Thank You to maacruz For This Useful Post:
qwerty12's Avatar
Posts: 4,274 | Thanked: 5,358 times | Joined on Sep 2007 @ Looking at y'all and sighing
#7
Originally Posted by maacruz View Post
Thanks, after much renaming and linking I finally got it (the png file has to have the same name as the executable), but your hints will allow me to do it right once and for all
Makes sense... Hildon-desktop is very pedantic about WMClass (esp. in regard to icons) and I believe GDK sets the WMClass for a GTK+ app from argv[0]
 
Reply


 
Forum Jump


All times are GMT. The time now is 02:38.