How can I load an NPAPI plugin in my own application? - python

The docs I've found on NPAPI plugins explain how to write plugins to be loaded by browsers, but how hard is it to write an application that loads existing NPAPI plugins?
(My ultimate goal here is to find a way to use SWF content inside an application written with Python and wxPython in Linux. I've accomplished this on Windows by using the comtypes module to load the ActiveX Flash player. For Linux, I'm thinking that wrapping the Gnash NPAPI plugin in some C/C++ code and making this a Python extension seems like it would work, albeit a bit convoluted...)

Your best bet (assuming basing your hosting code on open source software isn't an issue for you licensing-wise) is probably to look at the implementation of NPAPI host in WebKit, Chromium, and/or Gecko.
The Mozilla documentation for the browser side of NPAPI will help, but there are a lot of little corner cases where plugins expect certain behavior because some early browser did it, and now everyone who wants to support those plugins has to do the same thing even if it's not part of the standard; the only way to learn about those is to look at existing implementation.

Related

CPython/wxWidgets front-end using Java6 jar

How can I use the functionality of a Java library I have in JAR format (no sources) in a wxPython front-end app running on OS X 10.8?
I can use the library in Jython, everything works fine, but of course wx is CPython-only so I could not find anything better than this: http://jpype.sourceforge.net/doc/user-guide/userguide.html :(
Needless to say, JPype is really cumbersome, at least for the extensive use I need to make of the JAR in question.. are there better ways to do this or more advanced systems?
I can't change wxPython as the GUI as all the toolchain depends on it, up to the latest packaging step of PyInstaller.. and I can't rewrite the JAR nor replace it with some open-source package..
I would suggest running it in a different process as a java application, and then communicate with the Python application using some form of IPC.

Embeding flash in WebKit for pygtk on windows

I am looking for a way to play video streams with python. I couldn't find anything nice, so I ended up embedding webkit inside a gtk window, and streaming the video in there. it works well, but feels rather hacky to me.
So, my question(s):
Is there any other way to stream video (youtube, justin tv) using python and gtk?
If not, is there a way to make my code run on Windows? Currently it only runs on Linux, I suspect because of a lack of Flash support for GTK on windows. Are there any efforts being made to fix this?
ALright, I've come up with an answer.
Instead of using webkit, which doesn't seem to have flash support on windows, I'm gonna use the chromium embedded framework. It should let me do what I need to do, which is embed flash in a desktop app, whilst also allowing for the option of a html based interface.
It's open source, and supports flash on windows(and linux, I believe).
Take a look at GStreamer (python package)
http://gstreamer.freedesktop.org/
Its an open source multimedia framework.
There are also articles about RTP streaming using GStreamer in below links
http://gstreamer.freedesktop.org/documentation/rtp.html
http://eetimes.com/design/signal-processing-dsp/4004620/DSP-video-processing-via-open-sourceAPIs
There is also a streaming media server built using GStreamer (with LGPL license).
http://www.flumotion.net/
PS: if you are keen on using Adobe AIR to build a cross platform flash player below mentioned link will be at your rescue.
http://www.artima.com/weblogs/viewpost.jsp?thread=208528
I myself haven't built this app, however had researched it earlier to build one. Hope it would be useful.

PyWinAuto still useful?

I've been playing with PyWinAuto today and having fun automating all sorts GUI tests. I was wondering if it is still state of the art or if there might be something else (also free) which does windows rich client automation better.
pywinauto is great because it's Python.
Perhaps a bit more full featured is AutoIT, which has a COM server that you can automate (from Python using win32com), and some cool tools, like a "Window Info" utility, which will give you the text (title), class, size, status-bar text, and so on for the window currently under the mouse cursor.
There are some cases where pywinauto is a bit harder to use than AutoIt, and seems a little less polished. One example is automating Inno Setup programs. The Inno Setup "setup.exe" program launches a separate application that actually performs the install, and it's a pain to track this down with pywinauto, but AutoIt makes it easy.
I used to do test automation on our projects with AutoIt but switched over to pywinauto 3 months ago and have been very happy with that decision. There are some rough edges, but I've been able to fill them in with my own supplementary test functions. In addition I find that coding tests and support code in Python is much easier and more manageable compared to AutoIt. With Python I have way more powerful options for logging, debugging, documentation, process management and test configuration. For me it was absolutely the right way to go.
I am going the same way, bit by bit and I have to say that python + pywinauto is good stuff!
New pywinauto 0.6.0 has introduced MS UI Automation support under the hood. So that WinForms, WPF, Qt, Store apps etc. could be automated almost the same way as an old native Win32 application.
Moreover it's possible to use mouse and keyboard modules out of a window/control context. These modules work on Linux as well!
New module win32_hooks is inspired by pyHook and similar libraries, but it doesn't require compilation.
Yeah, this post is a kind of ad. But I just wanna say pywinauto is still useful and I believe it will be even more useful in the future. The developers community currently consists of 2 mature developers and 3 talented students and we have long term plans on Linux and Mac OS X.
P.S. There are some more open source tools:
similar tools overview in the pywinauto docs
UI Automation tools rating by GitHub stars and SO stats.

What's a good embedded browser for a pygtk application?

I'm planning on using an embedded browser in my pygtk application and I'm debating between gtkmozembed and pywebkitgtk. Is there any compelling difference between the two? Are there any third options that I don't know about?
It should be noted that I won't be using this to access content on the web. I'm mainly using it for UI purposes.
My priorities are:
It needs to be stable.
It needs to be cross-platform.
It should be easy to use.
It should be actively maintained.
It should be extensible.
It should be fast.
gtkmozembed is not available on Windows, although you can use the gecko embedding interface directly. This would require you to write some C++ code.
As far as I know, the gtk webkit port is not available on Windows yet, and still appears to be undergoing a lot of change.
For an example of a cross-platform gecko embedding solution, check out Miro.
Miro is python, and they've written just a couple of C++ classes to embed gecko on Windows, while using gtkmozembed on linux.
if you judge by the web pages then definitely pywebkitgtk
pygtkmoz from this page
"Note: this project is no longer maintained. Please use gnome-python-extras (http://www.pygtk.org) instead. I apologize for any trouble this might cause, but this is better in the long run. Python bindings for GtkEmbedMozilla."
and pywebkitgtk looks like active project changes

Cross Platform SWF Playback with Python?

I'm looking for different solutions to playing back SWF files on Windows, OSX and Linux using Python. Ideally I'd like to embed the player inside a wxPython frame/window.
One possibility I'm investigating is the Mozilla XPCOM framework since its used by FireFox to load the Flash plugin within the browser.
Have you considered Adobe AIR?
Bruce Eckel said: Try combining the power of Python with the polish of Adobe Flash to create a desktop application.
Though I don't know how to embed a browser within a wxPython window, the following code might serve in a pinch (and will work cross-platform, assuming you're working in Python 2.5 or above):
import webbrowser
webbrowser.open(your_swf_url)
It might be best to delegate this task to the browser anyway.

Categories

Resources