[pygtk] wnck.window.is_visible_on_workspace(ws) not working under compiz
Hello, Hopefully it is OK to post queries here relating to use of wnck via python. I'm not sure where else to go... I've written a little python program to tile windows under gnome. It worked nicely until I started using compiz. Under compiz, all windows report that they are on 'Workspace 1', and so is_visible_on_workspace(ws) reports that all windows are visible on the current workspace, even though they are spread across different workspaces as depicted in the gnome panel's workspace switcher. It looks to me as though the concept of workspaces no longer holds under compiz? i.e. they are all called "Workspace 1" and are number "0" according to wnck? I've included a sample program at [1] below with output at [2]. My versions are shown at [3]. Thanks for any tips, Jason. -- [1] Sample program -- #!/usr/bin/env python import pygtk pygtk.require('2.0') import gtk import gobject import wnck import math class TestClass: def printWindows(self, screen): # Print windows on the current workspace ws = screen.get_active_workspace() windows = screen.get_windows() for w in windows: type=w.get_window_type() if w.is_visible_on_workspace(ws) and type == wnck.WINDOW_NORMAL: print "Window: " + repr(w.get_name()) + " " + repr(w.get_workspace().get_name()) # Our work is done - quit the main loop gtk.main_quit() def main(self): # register a callback to be invoked when main loop is idle screen = wnck.screen_get_default() gobject.idle_add(self.printWindows, screen) gtk.main() # This is the entry point if we are invoked on the command-line if __name__ == "__main__": testClass = TestClass() testClass.main() -- [2] Program output -- [...@talby temp]$ ./windows.py Window: 'Inbox (2 unread, 44 total) - Evolution' 0 Window: 'screen' 0 Window: 'windows.py (~/temp) - GVIM' 0 Window: 'j...@powell:~' 0 Window: 'wnck.window.is_visible_on_workspace(ws) not working under compiz' 0 Window: 'WnckWorkspace - Mozilla Firefox 3.5 Beta 4' 0 -- [3] Versions (under fedora 11) -- [...@talby temp]$ uname -a Linux talby 2.6.29.4-167.fc11.i686.PAE #1 SMP Wed May 27 17:28:22 EDT 2009 i686 i686 i386 GNU/Linux [r...@talby ~]# rpm -qa | egrep 'wnck|gtk' | sort authconfig-gtk-5.4.10-1.fc11.i586 GConf2-gtk-2.26.2-1.fc11.i586 gnome-python2-gtkhtml2-2.25.3-6.fc11.i586 gnome-python2-libwnck-2.26.0-3.fc11.i586 gtk2-2.16.2-1.fc11.i586 gtk2-devel-2.16.2-1.fc11.i586 gtk2-engines-2.18.1-1.fc11.i586 gtk-doc-1.11-4.fc11.noarch gtkglext-libs-1.2.0-9.fc11.i586 gtkhtml2-2.11.1-5.fc11.i586 gtkhtml3-3.26.1.1-1.fc11.i586 gtkmm24-2.16.0-1.fc11.i586 gtk-nodoka-engine-0.7.2-4.fc11.i586 gtk-sharp2-2.12.7-4.fc11.i586 gtksourceview2-2.6.1-1.fc11.i586 gtkspell-2.0.15-1.fc11.i586 ibus-gtk-1.1.0.20090423-1.fc11.i586 libcanberra-gtk2-0.12-1.fc11.i586 libwnck-2.26.1-1.fc11.i586 PackageKit-gtk-module-0.4.8-2.fc11.i586 pygtk2-2.14.1-1.fc11.i586 pygtk2-libglade-2.14.1-1.fc11.i586 pygtkglext-1.1.0-6.fc11.i586 pygtksourceview-2.4.0-3.fc11.i586 python-slip-gtk-0.1.15-3.fc11.noarch usermode-gtk-1.100-2.i586 webkitgtk-1.1.4-1.fc11.i586 xdg-user-dirs-gtk-0.8-3.fc11.i586 ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/
Re: [pygtk] [Re] Strange TreeView issue when selecting rows with mouse
Ok, actually I resolved that problem by connecting the callback to TreeSelection's "changed" signal instead of TreeView's "cursor-changed" signal. *yahoo* ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/
Re: [pygtk] gtk combobox issues with glade+gtkbuilder ui tamplate
I got some assistance from crdlb on the irc channel and he cleared it up for me - the issue was in how I was using the combobox.add_attribute() function, and not populating the ListStore - the final working app: === #!/usr/bin/env python import gobject, gtk import os, sys class Combos: def delete_event(self, widget, event, data=None): return False def destroy(self, widget, data=None): gtk.main_quit() def __init__(self): builder = gtk.Builder() builder.add_from_file("cboxdebug.xml") self.window = builder.get_object("window1") builder.connect_signals(self) self.window.connect("delete_event", self.delete_event) self.window.connect("destroy", self.destroy) # populate combobox1 self.combobox1 = builder.get_object("combobox1") liststore = gtk.ListStore(gobject.TYPE_STRING) dynentries = ['foo1', 'foo2', 'foo3'] for entry in dynentries: liststore.append([entry]) self.combobox1.set_model(liststore) cell = gtk.CellRendererText() self.combobox1.pack_start(cell, True) self.combobox1.add_attribute(cell, 'text', 0) def main(self): gtk.main() if __name__ == "__main__": combos = Combos() combos.window.show() combos.main() On Tue, Aug 25, 2009 at 12:33 PM, Bernard Gray wrote: > Hi All, ... > Can somebody give me a clue about how to make this work? > > Thanks, > Bernie > ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/
[pygtk] gtk combobox issues with glade+gtkbuilder ui tamplate
Hi All, I've built a gtk window interface in glade using the gtkbuilder format. It contains a combobox which I need to populate "on the fly" ie as part of the object initialisation, but I can't get it to display any entries. Searching has revealed a lot of people having difficulty with it - there are a lot of suggested resolutions, none of which have worked for me (yet) - My example code looks like: #!/usr/bin/env python import gobject, gtk import os, sys class Combos: def delete_event(self, widget, event, data=None): return False def destroy(self, widget, data=None): gtk.main_quit() def __init__(self): builder = gtk.Builder() builder.add_from_file("cboxdebug.xml") self.window = builder.get_object("window1") builder.connect_signals(self) self.window.connect("delete_event", self.delete_event) self.window.connect("destroy", self.destroy) # populate combobox1 self.combobox1 = builder.get_object("combobox1") liststore = gtk.ListStore(gobject.TYPE_STRING) self.combobox1.set_model(liststore) cell = gtk.CellRendererText() self.combobox1.pack_start(cell, True) dynentries = ['foo1', 'foo2', 'foo3'] for entry in dynentries: self.combobox1.add_attribute(cell, entry, 0) #self.combobox1.get_row_span_column() #self.combobox1.get_column_span_column() def main(self): gtk.main() if __name__ == "__main__": combos = Combos() combos.window.show() combos.main() When I run it, the combobox is greyed out. There is no error/debug output. I've tried setting the Row Span Column and Column Span Column values > -1 in the glade designer, and the output I get is: cboxdebug.py:17: GtkWarning: gtk_tree_model_get_n_columns: assertion `GTK_IS_TREE_MODEL (tree_model)' failed builder.add_from_file("cboxdebug.xml") cboxdebug.py:17: GtkWarning: gtk_combo_box_set_row_span_column: assertion `row_span >= -1 && row_span < col' failed builder.add_from_file("cboxdebug.xml") cboxdebug.py:17: GtkWarning: gtk_combo_box_set_column_span_column: assertion `column_span >= -1 && column_span < col' failed builder.add_from_file("cboxdebug.xml") I assume I need to make use of the set_row_span_column() and set_column_span_column() functions but I cannot get a clear indication of what they do/how to use them. I've also seen mention that populating the combobox in glade designer with a None entry helps, however this option is listed as a libglade format thing only and the option is greyed out in the designer (I'm using what I understand is the newer/better gtkbuilder format). Can somebody give me a clue about how to make this work? Thanks, Bernie ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/
[pygtk] [Re] Strange TreeView issue when selecting rows with mouse
Yes, and I discovered that if I select the items with "rubber band", it works fine. But with "Shift+click" or "ctrl+click" - doesn't work well. I would appreciate any help ;) ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/