[pygtk] PyGTK deadlocks... I know, right?

2013-01-12 Thread Niklas Koep
Here's one. I'm using PyGTK 2.24 with gstreamer 0.10.36. Whenever gstreamer reports an error on my playbin2's message bus I display the error in a gtk.MessageDialog. This causes the app to deadlock unless I use a context manager with gtk.gdk.lock. At first I suspected a threading issue, but accordi

Re: [pygtk] Key event handling and Pythons lake of switch statement

2013-01-28 Thread Niklas Koep
Just to quote the Python docs on the subject: "An if ... elif ... elif ... sequence is a substitute for the switch or case statements found in other languages." Regards 2013/1/27 David Ripton > On 01/27/2013 03:24 PM, Christian

Re: [pygtk] Reload gtk.Image contents

2013-01-28 Thread Niklas Koep
If you're updating your gtk.Image contents via its set_from_file() method you don't need to request an update at all -- it happens automatically. Generally speaking, however, gtk.Widget implements a queue_draw() method which can be used to invalidate the entire visible area of a widget which in tur

Re: [pygtk] Reload gtk.Image contents

2013-01-28 Thread Niklas Koep
> expression = x_equation + "," + y_equation > plotter.set_expression(expression) > plotter.plot() > image.set_from_file("test.png") > image.queue_draw() > > self.equations_apply.connect("clicked", self.appl

Re: [pygtk] Reload gtk.Image contents

2013-01-28 Thread Niklas Koep
ot so perfect in other aspects too, so I guess I should > either improve it and send patches back to the author or make a less > general purpose synchronous interface myself. :) > > > On 01/29/2013 03:28 AM, Niklas Koep wrote: > > I've tested the what I described earl

Re: [pygtk] [GTK3] get background color

2013-01-29 Thread Niklas Koep
Sounds like you're trying to retrieve the default colors before the widget has been realized. Consider this (mind you this uses pygtk): #!/usr/bin/env python import gtk def main(): window = gtk.Window(gtk.WINDOW_TOPLEVEL) window.connect("delete-event", lambda *x: gtk.main_quit()) t

Re: [pygtk] gstreamer 0.10 to 1.0 and gtk2 to gtk3 errors

2013-02-01 Thread Niklas Koep
I think a minimal program which reproduces the error would be helpful here. What exact versions of gstreamer, pygobject (python2-gobject), etc. are you using? In any case, calling Gst.ElementFactory.make with one argument from an interactive session already raises a TypeError exception for me as th

Re: [pygtk] gstreamer 0.10 to 1.0 and gtk2 to gtk3 errors

2013-02-02 Thread Niklas Koep
n any case you have to call Gst.init() which you may or may not be doing anyway. 2013/2/1 Niklas Koep > I think a minimal program which reproduces the error would be helpful > here. What exact versions of gstreamer, pygobject (python2-gobject), etc. > are you using? I

Re: [pygtk] UI will be blocked if creating a message dialog by emitting a signal

2013-07-25 Thread Niklas Koep
Emitting signals from a thread will run the handler in the same thread. You shouldn't call gtk functions from a thread other than the main one. If you insist on doing so you have to make sure to acquire the GDK lock first by wrapping your code in gtk.gdk.threads_enter() ... gtk.gdk.threads_leave()

Re: [pygtk] use gtk.FileChooser to check mime type

2013-09-27 Thread Niklas Koep
Hey, there are two ways to do this that I can think of off the top of my head. One is using gio.content_type_guess, the other (and likely slower albeit more accurate) way would be to use a gio.File insta