pyxpcomext
| resources: | Home Installation Downloads Samples Tutorials Source Code Members Mailing List Bugs |
|---|
PyXPCOM Samples
Python Shell extension (download it)
The idea and parts of the pyshell code is based on the wonderful Javascript Shell.
Provides a shell like window that enables you to interact with the PyXPCOM Python interpreter and perform Python instructions. It provides tab completions through object inspection and has the ability to interact with the application through XPCOM. Check out the source.
PyShell in action, saying a hello from Python through the XPCOM nsIPromptService. The code for this:
promptSvc = components.classes["@mozilla.org/embedcomp/prompt-service;1"].\
getService(Components.interfaces.nsIPromptService)
promptSvc.alert(None, 'Greeting...', "Hello from Python")
SFTP and SSH Protocol (download it)
Adds SFTP (Secure FTP) and SSH (Secure Shell) protocols to Mozilla based applications. For example, after installing this extension you can type in a SFTP url into the Firefox url textbox and it will connect using the SFTP protocol and display directory contents and allow you to view and download files. Further to this, the extension also provides the ability to run remote commands over SSH. Check out the source, including the tests directory which shows off the example usage of the protocol.
The SSH Console extension, is a great companion to this extension and will enable you to start remote SSH console sessions.
PyXPCOM Examples extension (download it)
This is an extension that shows PyXPCOM working within Mozilla. It utilizes Python xpcom components, with XUL and JavaScript for the UI. It also shows off usage of Python ctypes in conjunction with the PyDOM components.
This shows off how you can use a Python UDP socket to communicate (send and receive) with a remote host. Check out the code.
PyDOM Example extension (download it)
This is an extension that shows PyDOM working within Mozilla. It utilizes Python working inside of XUL and the DOM (similar to JavaScript). Check out the code.
After installing this extension in Firefox, type in the following url to access the python/xul test page, then use the "Run Tests" button to run all of the tests.
chrome://pyxultest/content/pyxultest.xul