Re: [pygtk] Problem with gtk.Window().maximize()
2013/1/19 Ajay Garg ajaygargn...@gmail.com Hi all. If a gtk.Window has been maximized, it seems that the resize() method doesn't take effect thereafter. I will illustrate with the following code snippets :: a) ### import gtk import gobject win = gtk.Window() win.show() win.resize(683, 346) gobject.MainLoop().run() ### When the above snippet is run, the window is resized as expected. b) ### import gtk import gobject win = gtk.Window() win.show() win.maximize() ### Culprit line :-( win.resize(683, 346) gobject.MainLoop().run() ### Here, once the window is maximized, the resize() stops working :-( Is it expected? Is it a bug? Is there anyway I can get the window to resize, AFTER calling window.maximize() ? Will be grateful for any pointers :) Regards, Ajay ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/ Hi Ajay, I am not a expert, but I think that when you specify .maximize, any default window sizes that have been set will be overridden. Then you leave the window to the composite window manager (compiz, metacity, unity, etc) to handle maximize/unmaximize/resize, etc. When using .unmaximize(), the window will shrink to the size of the child content or to any size specified. You can get some useful trace info with window-state-event or configure-event event. Also could be useful ensure the resizable status with .set_resizable(True) and I recomend migrate your code to PyGObject (For GTK 3+) https://live.gnome.org/PyGObject So I think that you cannot maximize and after resize without user action from composite window manager. Maybe someone with more knowledge than me could give you more info. Regards ___ 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] PyObject fails with Gst on signal sync-message::element
2011/11/2 Tomeu Vizoso to...@sugarlabs.org OYou don't need gst-python any more, that's the point of the move to introspection: https://live.gnome.org/GObjectIntrospection/Architecture For building gstreamer master from git: http://gstreamer.freedesktop.org/ Good luck, Tomeu Hi again, This is my current progress at the moment. I try to compile gstreamer 0.11.1 on Ubuntu Oneiric 11.10 with this: sudo apt-get install bison flex wget http://gstreamer.freedesktop.org/src/gstreamer/gstreamer-0.11.1.tar.gz tar -xvzf gstreamer-*.tar.gz cd gstreamer-* ./configure sudo make sudo make install All succesfully. This install the binaries under /usr/local/ But apparently, the first problem comes, I need compile gir files for create the typelib files. I see on the package gir1.2-gstreamer-0.10 for Ubuntu, that I need at least all this typelib files: /usr/lib/girepository-1.0/Gst-0.10.typelib /usr/lib/girepository-1.0/GstBase-0.10.typelib /usr/lib/girepository-1.0/GstCheck-0.10.typelib /usr/lib/girepository-1.0/GstController-0.10.typelib /usr/lib/girepository-1.0/GstNet-0.10.typelib http://packages.ubuntu.com/es/precise/gir1.2-gstreamer-0.10 http://packages.ubuntu.com/es/precise/i386/gir1.2-gstreamer-0.10/filelist So I don't know until now where get that .gir files or how to generate the gir files for 0.11. Apparently gir files is like an XML format with the migration spec. Then I should compile the files with something like for generate the typelib files: /opt/pygi/bin/g-ir-compiler --includedir=. --includedir=. /usr/share/gir-1.0/Gst-0.10.gir -o /usr/lib/girepository-1.0/Gst-0.10.typelib http://manpages.ubuntu.com/manpages/natty/man1/g-ir-compiler.1.html I don't know where find documentation for this process, just I google for known words and found things like this for extract knowledge: http://pastebin.com/jUP0aLEH The info is very spread and nobody writes a documented procedure for this. I found on http://live.gnome.org/GnomeGoals/AddGObjectIntrospectionSupportthat Gstreamer have support done for instrospection, but no reference that how to do it. So I keep google for hours and I found this, that it show me a little how to generate the .gir files with g-ir-scanner: http://wksprivate.appspot.com/pastebin/detail-js/9060/ /usr/local/bin/g-ir-scanner -v --namespace Gst --nsversion=0.10 \ 283. --add-include-path=. --add-include-path=. \ 284. --include=GObject-2.0 \ 285. --include=GModule-2.0 \ 286. --include=libxml2-2.0 \ 287. --library=gstbase-0.10 \ 288. --libtool=/bin/sh ../libtool \ 289. --pkg gobject-2.0 \ 290. --pkg gstreamer-0.10 \ 291. --pkg gstreamer-base-0.10 \ 292. --output Gst-0.10.gir \ 293. `pkg-config --variable=includedir gstreamer-0.10`/gst/gstbin.h \ 294. `pkg-config --variable=includedir gstreamer-0.10`/gst/gstbuffer.h \ 295. `pkg-config --variable=includedir gstreamer-0.10`/gst/gstbus.h \ 296. `pkg-config --variable=includedir gstreamer-0.10`/gst/gstcaps.h \ 297. `pkg-config --variable=includedir gstreamer-0.10`/gst/gstchildproxy.h \ 298. `pkg-config --variable=includedir gstreamer-0.10`/gst/gstclock.h \ 299. `pkg-config --variable=includedir gstreamer-0.10`/gst/gstcompat.h \ 300. `pkg-config --variable=includedir gstreamer-0.10`/gst/gstconfig.h \ 301. `pkg-config --variable=includedir gstreamer-0.10`/gst/gstdebugutils.h \ 302. `pkg-config --variable=includedir gstreamer-0.10`/gst/gstelementfactory.h \ 303. `pkg-config --variable=includedir gstreamer-0.10`/gst/gstelement.h \ 304. `pkg-config --variable=includedir gstreamer-0.10`/gst/gstenumtypes.h \ 305. `pkg-config --variable=includedir gstreamer-0.10`/gst/gsterror.h \ 306. `pkg-config --variable=includedir gstreamer-0.10`/gst/gstevent.h \ 307. `pkg-config --variable=includedir gstreamer-0.10`/gst/gstfilter.h \ 308. `pkg-config --variable=includedir gstreamer-0.10`/gst/gstformat.h \ 309. `pkg-config --variable=includedir gstreamer-0.10`/gst/gstghostpad.h \ 310. `pkg-config --variable=includedir gstreamer-0.10`/gst/gst.h \ 311. `pkg-config --variable=includedir gstreamer-0.10`/gst/gstindexfactory.h \ 312. `pkg-config --variable=includedir gstreamer-0.10`/gst/gstindex.h \ 313. `pkg-config --variable=includedir gstreamer-0.10`/gst/gstinfo.h \ 314. `pkg-config --variable=includedir gstreamer-0.10`/gst/gstinterface.h \ 315. `pkg-config --variable=includedir gstreamer-0.10`/gst/gstiterator.h \ 316. `pkg-config --variable=includedir gstreamer-0.10`/gst/gstmacros.h \ 317. `pkg-config --variable=includedir gstreamer-0.10`/gst/gstmarshal.h \ 318. `pkg-config --variable=includedir gstreamer-0.10`/gst/gstmessage.h \ 319. `pkg-config --variable=includedir gstreamer-0.10`/gst/gstminiobject.h \ 320. `pkg-config --variable=includedir gstreamer-0.10`/gst/gstobject.h \ 321. `pkg-config --variable=includedir gstreamer-0.10`/gst/gstpad.h \ 322. `pkg-config --variable=includedir gstreamer-0.10`/gst/gstpadtemplate.h \ 323. `pkg-config --variable=includedir gstreamer-0.10`/gst/gstparamspecs.h \ 324. `pkg-config --variable=includedir
Re: [pygtk] PyObject fails with Gst on signal sync-message::element
2011/10/29 Pietro Battiston m...@pietrobattiston.it Il giorno sab, 29/10/2011 alle 10.57 +0200, Angel Guzman Maeso ha scritto: Please, anybody can help me? I search on pygstreamer and GIR files code and changelog and there is not reference for changes related with syn-message::element. Nothing to do with the This signal will not be emitted by default, you have to set up gst_bus_sync_signal_handler() as a sync handler if you want this signal to be emitted when a message is posted on the bus, like this: I read in the documentation? (just a guess, I'm not an expert about gstreamer) Pietro Hi Pietro, Thanks for your response. Your response seems to be right, but it doesn't work on GTK3 with PyGi This line should enable the signal for the emission. bus.enable_sync_message_emission() The Gnome Bug #631901 shows that there is a problem with the signals emitted: https://bugzilla.gnome.org/show_bug.cgi?id=631901 message::eos, message::error and sync-message::element are not emitted, just message and sync-message without members. Maybe it is a problem with MiniObject support through GI. http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstMessage.html http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstMiniObject.html#GstMiniObject Using bus.connect('message', self.on_message) and def on_message(self, bus, message): print('message: {!r}'.format(message)) it show this traceback on close: Traceback (most recent call last): File test.py, line 62, in on_message print('message: {!r}'.format(message)) TypeError: unknown type GstMessage Also I found: gst_bus_create_watch, since GSource aren't wrapped in pygtk gst_bus_sync_signal_handler and gst_bus_async_signal_func since these functions are used by the default bus handler anyway. http://ftp.tuwien.ac.at/hci/freedesktop.org/gstreamer/gst-python/gst/gstbus.override,v ___ 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] PyObject fails with Gst on signal sync-message::element
2011/11/1 Tomeu Vizoso to...@sugarlabs.org Hi, what version of GStreamer are you using? I think only 0.11 (future 1.0) can be used through introspection. There are other programs that are being ported to introspection and that use GStreamer, such as Pitivi, I would look at them for ideas. Regards, Tomeu Hi, I am using Ubuntu 10.10 Oneiric. The default version of GStreamer seems to be 0.10 $ ls /usr/share/gir-1.0/ | grep Gst Gst-0.10.gir GstApp-0.10.gir GstAudio-0.10.gir GstBase-0.10.gir GstCheck-0.10.gir GstController-0.10.gir GstFft-0.10.gir GstInterfaces-0.10.gir GstNet-0.10.gir GstNetbuffer-0.10.gir GstPbutils-0.10.gir GstRiff-0.10.gir GstRtp-0.10.gir GstRtsp-0.10.gir GstSdp-0.10.gir GstTag-0.10.gir GstVideo-0.10.gir Where I can find 0.11 (1.0) for download and compile on Ubuntu? I need to fix this ASAP (I am doing a app for my dissertation). ___ 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] PyObject fails with Gst on signal sync-message::element
2011/11/1 Tomeu Vizoso to...@sugarlabs.org On Tue, Nov 1, 2011 at 19:37, Angel Guzman Maeso shaka...@gmail.com wrote: Where I can find 0.11 (1.0) for download and compile on Ubuntu? I need to fix this ASAP (I am doing a app for my dissertation). If you are in such a hurry, may be better to stay with the old static bindings. Regards, Tomeu But all my app already works with Gtk3 (it took me a week) and I want use GTK3, so if it is needed compile new sources no problem for me, just I need the info. Could you provide me more info about 0.11? I clone this repo: git clone git://anongit.freedesktop.org/gstreamer/gst-python ___ 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] PyObject fails with Gst on signal sync-message::element
Please, anybody can help me? I search on pygstreamer and GIR files code and changelog and there is not reference for changes related with syn-message::element. ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/
[pygtk] PyObject fails with Gst on signal sync-message::element
Hi everyone, I am migrating a old code written with GTK+ 2.X to GTK 3+ for play a .ogv video with gstreamer. The problem seems that the signal sync-message::element is never launched (but if it is launched sync-message). So, as result we cannot attach a Gtk.DrawingArea() inside of another window because I dont get never the window.xid This is the old code for GTK+ 2.x working perfectly: import pygtk pygtk.require('2.0') import gtk import pygst pygst.require('0.10') import gst import os, sys class Video: def __init__(self): def on_message(bus, message): if message.type == gst.MESSAGE_EOS: # End of Stream player.set_state(gst.STATE_NULL) elif message.type == gst.MESSAGE_ERROR: player.set_state(gst.STATE_NULL) (err, debug) = message.parse_error() print Error: %s % err, debug def on_sync_message(bus, message): if message.structure is None: return False if message.structure.get_name() == prepare-xwindow-id: if sys.platform == win32: win_id = videowidget.window.handle else: win_id = videowidget.window.xid assert win_id gtk.gdk.threads_enter() gtk.gdk.display_get_default().sync() imagesink = message.src imagesink.set_property(force-aspect-ratio, True) imagesink.set_xwindow_id(win_id) gtk.gdk.threads_leave() win = gtk.Window() win.set_resizable(False) win.set_has_frame(False) win.set_position(gtk.WIN_POS_CENTER) fixed = gtk.Fixed() win.add(fixed) fixed.show() videowidget = gtk.DrawingArea() fixed.put(videowidget, 0, 0) videowidget.set_size_request(640, 480) videowidget.show() # Setup GStreamer player = gst.element_factory_make(playbin, MultimediaPlayer) bus = player.get_bus() bus.add_signal_watch() bus.enable_sync_message_emission() #used to get messages that GStreamer emits bus.connect(message, on_message) #used for connecting video to your application bus.connect(sync-message::element, on_sync_message) player.set_property(uri, file:// + /SOME/PATH/SOMEFILE.ogv) player.set_state(gst.STATE_PLAYING) win.show() def main(): gtk.gdk.threads_init() gtk.main() return 0 if __name__ == __main__: Video() main() And this is the new code for GTK+ 3 not working properly because xid it is not attached creating another window: import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk from gi.repository import Gst from gi.repository import Gdk import os, sys class Video: def __init__(self): win = Gtk.Window() win.set_resizable(False) #win.set_has_frame(False) I dont know the name of method on gtk3 so comment this #win.set_position(Gtk.WIN_POS_CENTER) same but with the constant fixed = Gtk.Fixed() win.add(fixed) fixed.show() videowidget = Gtk.DrawingArea() fixed.put(videowidget, 0, 0) videowidget.set_size_request(640, 480) videowidget.show() # Setup GStreamer Gst.init_check(None) self.player = Gst.ElementFactory.make(playbin, MultimediaPlayer) self.player.set_state(Gst.State.NULL) bus = self.player.get_bus() bus.add_signal_watch() bus.enable_sync_message_emission() #used to get messages that GStreamer emits bus.connect('message::eos', self.on_message_eos) bus.connect('message::error', self.on_message_error) #used for connecting video to your application bus.connect(sync-message::element, self.on_sync_message) self.player.set_property(uri, file:// + /SOME/PATH/SOMEFILE.ogv) self.player.set_state(Gst.State.PLAYING) win.show() def on_message_eos(self, bus, message): # End of Stream self.player.set_state(Gst.State.NULL) def on_message_error(self, bus, message): # End of Stream self.player.set_state(Gst.State.NULL) print 'Error' def on_sync_message(self, bus, message): print hola if message.structure is None: return False if message.structure.get_name() == prepare-xwindow-id: if sys.platform == win32: win_id = videowidget.window.handle else: win_id = videowidget.window.xid assert win_id Gdk.threads_enter() Gdk.display_get_default().sync() imagesink = message.src imagesink.set_property(force-aspect-ratio, True) imagesink.set_xwindow_id(win_id) Gdk.threads_leave() def main():
[pygtk] How to make a POST request?
Hi, I new using python + webkit. I need make a POST request with webkit, but I dont know how to it. I have this example with urllib: #!/usr/bin/python import urllib2, urllib import httplib server = 'server.somesite.com' data = {'name' : 'shakaran', 'password' : 'Only_I_know'} d = urllib.urlencode(data) headers = {Content-type: application/x-www-form- urlencoded, Accept: text/plain} conn = httplib.HTTPConnection(server) conn.request(POST, /login.php, d, headers) response = conn.getresponse() if response.status == 200: print response.status, response.reason print response.getheaders() data = response.read() print data conn.close() I need a simple example with webkit. I look in the documentation for Webkit.HTTPRequest http://www.webwareforpython.org/WebKit/Docs/Source/Docs/WebKit.HTTPRequest.html I try with webkit.NetworkRequest() but I don't know how to it. Some help? Thanks -- Blog: www.shakaran.net Tivion: a simple streaming player for TV, Radio and Sopcast www.shakaran.net/blog/tivion My RPG: www.apogeus.es www.apogeus.es/ao Hosting: www.quijost.com ___ 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] PyGTK and visual python integration
2009/12/7 Michele Mattioni matti...@gmail.com Hello PyGTK list, I'm trying to use Visual Python [1] with PyGTK. My goal is to run the PyGTK app from an ipython console with the interactive loop, to launch the visual python and to be able to process the input coming from the console. I was able to do it on ubuntu jaunty, but for some reasons this is not the case anymore in karmic. The version I was using before of Ipython 0.9.1, what is shipped with karmic is 0.10. The PyGTK in jaunty is 2.14.1-1ubuntu1 and in karmic is 2.16.0-0ubuntu1 With the 0.9.1 ipython version and the 2.14 PyGTK I was able to achieve this behaviour starting the console with the -pylab options, and I was using GTKAgg as my backend. In my program it was possible to start a visual window clicking on a gtk button. I attach a simple case code to show the problem. What has changed ? Is Ipython, PyGTK or both? [1] http://vpython.org/ [2] http://ipython.scipy.org Regards, Michele. ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/ For me, this line: import visual Generate a segmentation fault (I use Ubuntu Lucid alpha 1) and I did before: sudo apt-get install python-visual Maybe you should report a bug for visual python on Ubuntu package. -- Blog: www.shakaran.es Tivion: un simple reproductor de canales streaming de TV www.shakaran.es/blog/tivion Mi juego de rol online: www.apogeus.es www.apogeus.es/ao Servicio manchego de hosting propio: www.quijost.com ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/