|
behaviour of window.present() on different WM: msg#00045gnome.gtk+.python
Hi list, I'm trying to popup a window_toplevel (win2) when a key is pressed in a first window_toplevel (win) but I also want to keep the first one (win) the active window with the focus on the textview inside (win), at the end the second (win2) have to stay on top anyway... To achieve this goal I'm using window.present() on (win) after the second is popped-up (win2) then textview.grab_focus and window.set_keep_above(gtk.TRUE) on the second window (win2).... Because probably my english sucks...let's post some code: This is the first version, it works perfectly on the following DE or WM: kde, openbox, waimea, fvwm2, xfce4 and also Microsoft Windows. When a key is pressed on win1, win2 is shown, win1 gets active and the focus is into the textview. but it does not work on: gnome (metacity) and fluxbox. import pygtk pygtk.require('2.0') import gtk class SecondWin: def __init__(self): self.win = gtk.Window(gtk.WINDOW_TOPLEVEL) self.win.connect("delete_event", self.delete_event) self.win.connect("destroy", self.destroy) self.win.connect("key-press-event", self.newTree) self.win.set_default_size(500, 500) self.text = gtk.TextView() self.win.add(self.text) self.win.show_all() def newTree(self, widget, event): self.win2 = gtk.Window(gtk.WINDOW_TOPLEVEL) self.win2.set_default_size(300, 300) self.tree = gtk.TreeView() self.win2.add(self.tree) self.win2.show_all() self.win.grab_focus() self.win.present() self.win2.set_keep_above(gtk.TRUE) def delete_event(self, widget, event, data=None): return gtk.FALSE def destroy(self, widget, data=None): return gtk.main_quit() def main(self): gtk.main() if __name__ == "__main__": second = SecondWin() second.main() After I spoke with xordoquy (thanks again) in IRC he proposed this: def newTree(self, widget, event): self.win2 = gtk.Window(gtk.WINDOW_TOPLEVEL) self.win2.set_default_size(300, 300) self.tree = gtk.TreeView() self.win2.add(self.tree) self.win2.show_all() gtk.idle_add(self.delay) def delay(self): self.win.present() self.win.grab_focus() self.win2.set_keep_above(gtk.TRUE) It does work only once (the first time you press a button but then not anymore) on gnome (metacity), with fluxbox it doesn't work at all. Sorry for the long post but I would like to understand why this happen and maybe what I can do to have my code running as I would like on all the DE / WM. Thanks a lot to everybody for the patience. Have a nice day, evening or whatever in the world now :) GMario _______________________________________________ pygtk mailing list pygtk@xxxxxxxxxx http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/ |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | FileChooserDialog an FontSelectionDialog: 00045, Nemesis |
|---|---|
| Next by Date: | Re: behaviour of window.present() on different WM: 00045, Elijah Newren |
| Previous by Thread: | FileChooserDialog an FontSelectionDialogi: 00045, Nemesis |
| Next by Thread: | Re: behaviour of window.present() on different WM: 00045, Elijah Newren |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | Mail Home | sitemap | FAQ | advertise |