Active Topics

 


Reply
Thread Tools
Posts: 540 | Thanked: 288 times | Joined on Sep 2009
#1
the "set-focus" -signal is for any widget in the window which is way too often for my needs. I just want to check if certain data is still fresh when the program main window gets focus (either via task manager [if it was in background] or when returning from a subview [which I could do via other means too but one signal to rule them all would be great]).

I'm doing this in python in case that detail matters (it should not).

I tried to look for it last night but I may have been blind (or just tired).
 
Posts: 654 | Thanked: 664 times | Joined on Feb 2009 @ Germany
#2
Try the "notify::is-topmost" property of HildonWindow. That should do the trick.
http://maemo.org/api_refs/5.0/5.0-fi...ow--is-topmost
 

The Following 2 Users Say Thank You to conny For This Useful Post:
Posts: 540 | Thanked: 288 times | Joined on Sep 2009
#3
Originally Posted by conny View Post
Try the "notify::is-topmost" property of HildonWindow. That should do the trick.
http://maemo.org/api_refs/5.0/5.0-fi...ow--is-topmost
Finally got around testing this, the problem is that it's a property, how do I trigger a signal ?

I found that there is 'focus' signal on gtk.Widget from which just about everything inherits from but unfortunatly that gets triggered for the window only at program start (even switching between programs does not trigger it), same for 'window-state-event'

I guess part of the problem is using window vs stackablewindow offer no difference here (and stackablewindow is definitely the way to go).

edit: and also the set-focus is not usable since when I return from stackable window or other application the previous widget still retains it's focus...

Last edited by rambo; 2010-03-29 at 18:54.
 
Posts: 654 | Thanked: 664 times | Joined on Feb 2009 @ Germany
#4
Every property emits a signal whenever it's value is changed. The "notify::" part will do the trick. Try something like this:
Code:
g_signal_connect (win, "notify::is-topmost", G_CALLBACK(cb_func), NULL);
 

The Following 2 Users Say Thank You to conny For This Useful Post:
Posts: 540 | Thanked: 288 times | Joined on Sep 2009
#5
Originally Posted by conny View Post
Every property emits a signal whenever it's value is changed.
Recalled something like that but the problem is attaching the signal to the property

Originally Posted by conny View Post
The "notify::" part will do the trick. Try something like this:
Code:
g_signal_connect (win, "notify::is-topmost", G_CALLBACK(cb_func), NULL);
Any idea how to do that in python ?

Edit: I was stupid (and tired) and parsed the C wrong at first...

Code:
self.mainwindow.connect('notify::is-topmost', self.got_focus, 'notify::is-topmost')
Works fine.

"Problem" is that I get this signal for every subwindow instantiated as well but that is a minor annoyance, thanks.

edit2: I realized that of course I get the signal every time I change away from the window, it's no longer topmost... duh! (yes I was tired last night)

Last edited by rambo; 2010-03-30 at 04:35.
 

The Following 2 Users Say Thank You to rambo For This Useful Post:
yerga's Avatar
Posts: 696 | Thanked: 1,012 times | Joined on Mar 2006 @ Asturies, Spain
#6
Originally Posted by rambo View Post
Any idea how to do that in python ?
I think that the normal way should work:
window.connect("notify::is-topmost", callback)
__________________
Daniel Martín Yerga
maemo.org profile
Twitter
 

The Following User Says Thank You to yerga For This Useful Post:
Reply


 
Forum Jump


All times are GMT. The time now is 14:40.