Showing posts with label python. Show all posts
Showing posts with label python. Show all posts

New tutorial: PySide/QML on MeeGo

In addition to my old PySide tutorials, there is now a proper PDF guide for PySide development on MeeGo available. Except for packaging, all steps apply to Maemo as well, and this is the document that includes the first gPodder QML UI code example (the final gPodder QML UI will be totally different and "much cooler", though).

As part of the new year's cleanup, I also dug out the old MTF UI demo of gPodder and put its source online here - for third party applications, QML is now the preferred UI over MeeGo Touch, so this might not be of much use for you now, but maybe somebody can put it to good use.

PySide/QML tutorials online, workshop next Sunday

To get myself accustomed to PySide UI development using Qt Quick (aka QML) and to check out what works already and what does not, I've experimented with creating some common elements that I'd use in an application (i.e. a QML version of gPodder - a blingy demo already exists) and decided to share my experiences and results as tutorials.

Here are all the tutorials in their current state:

Screenshots are available on Flickr:

I'd like to get some feedback on whether or not the tutorials worked for you and were helpful and what else you would like to see. You can try out all the examples on your N900 today! Just install python-pyside and python-qtmobility (for the last example) from Extras-Devel and copy the examples from the Wiki. The usual disclaimers for software in Extras-Devel apply.

In related news, there will be a PySide/QML workshop at the December meeting of the Python User Group Austria, so if you happen to be in or around Vienna on Sunday, 2010-12-12, stop by at the Metalab and meet fellow Pythonistas.

MeeGoConf 2010: Fun, QML, gPodder, Python

I've attended the MeeGo Conference 2010 in Dublin this week. Meeting people, playing werewolf or table tennis and discussing MeeGo Python are just some of the great things about this conference.

One of my burning questions for third-party app development ("QWidget? MeeGo Touch? QML? Which one of those?") was answered with "QML". I've played with QML before, and it's great, but right now, one has to work on a very low level (as in "design your own buttons") and without any UI style guidelines. Let's hope the Qt Components provide reusable UI parts there and that the style guidelines are published as soon as possible.

I've also got some gPodder feedback: Niels suggested subscription pausing and auto-deletion of episodes (both are already implemented and just need exposure as UI elements). Murray suggested a custom TreeModel implementation for the episode list, which I've started working on now. Mike suggested the often-requested multi-episode deletion feature, which is also something I plan for the next release.

On Wednesday, we had a Python BoF to discuss the state and future of MeeGo Python. I'm looking forward to using PySide for the QML UI of gPodder. A PySide/QML workshop is planned for the next PyUGAT meeting, so join in if you are in Vienna in early December.

Oh, and the IdeaPad that we got from Intel is great. Thanks a lot for that. Will come in handy for prototyping and testing Touch UI interfaces!

Hope to see you again in a future MeeGo event :)

MaePadWeb 2.0: Take your MaePad anywhere (even on a N8)

The companion app to MaePad that has been announced some days ago is now available in Extras-Devel for your N900, with some nifty features:

  • Fully edit the checklists in your database
  • Native Maemo 5 look and feel in the browser (title bar, toolbar, lists, ...)
  • Dynamic themeing based on current Maemo theme
  • Per-session password for some security (inspired by MAD Developer)
MaePadWeb in a web browser

This means that if you are using the NSeries theme, it looks like this, but if you are using Digital Nature, this is how it looks (and that should work for all themes). On your device, you will see a simple info window. Now, that's bringing the Maemo 5 UI to your Desktop computer's web browser. But does it work on mobile devices as well? Of course! Let me present you MaePadWeb running in the Symbian web browser on a N8-00:

MaePadWeb on a N8-00

If you think that this looks shopped, check out the video for further proof and to see the checklist editor view in action :)

This project brings together some great technologies: Python (for the backend) and HTML/CSS and JavaScript (using JQuery for convenience) for the frontend. Apart from the artwork, it does not depend on anything from Maemo 5/Hildon that isn't available in MeeGo already. In fact, Python with SQLite3 support is the only real dependency of this app on the backend side. With all the confusion on what to use for MeeGo Handset UIs (MeeGo Touch Framework, QWidget-based Qt, QWidget inside QGraphicsView, QML, Qt Components, ...), the HTML/CSS/JavaScript combo seems like a good cross-platform alternative (you still have to run the backend somewhere, but it can run on the same device, of course). All you need is a good browser/JS engine/rendering engine combo (Fennec/QtWebKit on MeeGo Handset, MicroB on Maemo). This also works on the N8x0 with MicroB :)

Playing around with MeeGo Touch

While the MeeGo Touch Python Bindings are still not packaged and released, I though I'd give the C++ library a try and have a look through the class hierarchy. After getting the basic "Hello World" app running, I decided to create an application that can load the list of subscriptions from gPodder's SQLite database:

This view uses MContentItem, which already provides an icon and two lines of text - correctly styled and ready to go. Menu and toolbar items are MAction objects that can either appear everywhere or only at specific places (e.g. only in the toolbar). The great thing is that this all works on your Desktop in a normal window, so testing applications on your computer will be much easier with MeeGo Touch than it is with Hildon (which does not really run without its own hildon-desktop session in Xephyr).

The screenshot above is from the prototype written in C++, and shows how a gPodder MeeGo UI could look like. The MeeGo Touch UI of gPodder will be implemented in Python once the bindings are ready - the framework seems to be fun to work with so far. If you would like to play around with it yourself: MeeGo Touch is available from the MeeGo PPA of Ville M. Vainio if you are on Ubuntu and don't want to build it yourself.

gPodder 2.8 for Maemo 5: Notifications and MAFW integration

It's been some time since the last gPodder release, and I've been busy adding some nifty features to make the best use of the on-board facilities of Maemo 5. As already mentioned in a previous post, this new version comes with built-in notification support. After installation, you might have to re-start hildon-home (or your device) for the changes to become effective. That's what you will get when new episodes are found:

The other and more "invisible" change is that gPodder now listens to MAFW and also talks to it at times. MAFW is the backend of the Media Player application, and you profit in two ways from this integration:

  • The last playback position and duration of an episode are displayed in gPodder and synchronized to gpodder.net
  • Playback can be resumed even with the Media Player application

This means that users of the normal Media Player application will benefit from all the goodies that were previously only available in combination with Panucci. Combined with the new notifications, this makes for yet another great release with even better integration into the Maemo 5 environment.

gPodder 2.8 is now available from Extras-Testing, so please test, review and vote on the package.

gPodder running in the MeeGo Handset UX for N900

Three days ago, a new MeeGo Handset UX image has been released for the N900. I wanted to try out gPodder on it to see how far I could come without any coding...

It was quite easy to get things going: Download the image, dd it to a MicroSD card, boot the kernel (detailed instructions) and set up USB networking. After that, I could ssh into the environment (the root password is meego) and have a look around.

Instead of using apt-cache and apt-get to search for and install packages, I utilized yum to search for and install PyGTK. Then, I used rsync to copy my Git checkout of gPodder to the device. There are two additional dependencies for gPodder that aren't yet available in the MeeGo repositories, namely feedparser and mygpoclient, so I just copied the Python modules from my Laptop into the src/ folder of the gPodder checkout. Then, just switch to the MeeGo user (su - meego), make sure that the DISPLAY variable is set (export DISPLAY=:0) and start gPodder from the source folder (with bin/gpodder - it automatically loads the modules from the right path) - gPodder says hello MeeGo.

The basic functions work, it's just that the Desktop UI isn't suited for mobile devices (the MeeGo compositor/decorator also has several problems, but that seems to be a more general problem). Python bindings for Hildon aren't (yet ?) available, so I could not test the Maemo 4 or Maemo 5 UIs, but I would like to do a proper Qt/MeeGo Touch-based UI for gPodder, anyway. Let's hope the PyMaemo or PySide teams are quick to release bindings and make them available in the MeeGo repositories, so Python developers can create usable UIs for MeeGo handsets :) Oh, and two MeeGo-Python facts: It comes pre-installed in the N900 image, and the version shipped is 2.6.

In short: Apart from the UI framework, everything is already in place (and working) for Python on MeeGo. With the recent release of Qt Mobility for PySide, let's hope that MeeGo Touch bindings are not that far away.

Desktop notification support in gPodder

Three days ago, Maemo bug 11130 was filed: It complains about gPodder stealing focus when it has finished checking for new episodes in the background. This is true, and I've been bitten by this annoyance several times already, so I decided to finally have a look into the SMS/IM/Phone-style notifications (the "yellow" bubble that merges into your task switcher after some time). Thankfully, Daniel Would (of Witter fame) has published his research results some months ago already, so getting up and running was easy from that point. Here are the results so far:

One problem that I still have not figured out how to fix (even after digging in the hildon-home source tree) is how to attach such a notification to the a given window (or application) instead of having it appear as separate "window" in the task switcher (see the second screenshot). Can somebody in the know give me a hint? On the other hand, the callback for clicking on the notification works fine already and opens the new episodes dialog.

A related change that also prevents gPodder from stealing focus was to replace the progress indicator dialog with a HildonBanner - it might not look so good without a progress bar, but it makes gPodder less intrusive when the user interacts with other applications.

Streaming video to the big screen

This is a pretty obvious hack and nothing new at all, using plain command line tools that existed for ages. Still, it might come in handy, and maybe you did not even think about it yet:

Prerequisites are a computer with an installed SSH server and mplayer or a similar media player. On your N900 (this obviously works just as well for the N800 and N810), you just need the SSH client for the first variant, and Python for the second variant. No other tools or apps are necessary.

In my case, I downloaded a video onto my N900 using gPodder, but I didn't want to watch it on the small screen, and I don't have a TV to hook it up to. So I decided to just stream the video over the network to my computer (ideally initiating the stream from the N900).

What you need to do is find out the $DISPLAY variable in your X session on the computer (:0 usually works, but strangely I'm on :4.0 with Ubuntu 10.04 here). You can do this with echo $DISPLAY in a X Terminal on the computer. Remember that value. Now, let's go to the X Terminal on the N900, cd into the folder with the videos and note the file name. To stream the video fullscreen to the computer, use a command like this: ssh username@computerip 'DISPLAY=:4.0 mplayer -fs -' < filename.mp4.

If you don't have SSH access, an alternative is to use HTTP for streaming (e.g. with VLC, which is also available on Windows and Mac OS X). The easiest way to do is (if you have Python installed, which you most likely have) to cd into the directory that you want to share (the directory and all its subdirectories will be shared - be sure to have no sensitive data there!) and use the command python -m SimpleHTTPServer for some instant HTTP server goodness on port 8000. Use VLC or a web browser on your computer to access the share. You can use Ctrl+C to stop the server.

So, if you want to browse the downloaded podcasts of gPodder on your computer, use the following command sequence in X Terminal:

cd
cd MyDocs/Podcasts
python -m SimpleHTTPServer

Now, use the web browser on your computer (connected to the same network) and access http://n900ipaddress:8000/ to get a directory listing of all downloaded content. Copy the URLs into VLC and start streaming over the air.

Usually the limiting factor here is the wireless bandwidth and the reading speed of the eMMC. Apart from that, no restrictions apply - you can easily stream HD content, as the decoding is done on your computer, and the N900 just reads the data and sends it unmodified over the network without much processing (that's why everything said here also applies to the N800 and N810 and should work just as well).

Multiplayer NumptyPhysics (on a MT table)

(Again, not really tablet-related, but multiplayer could be ported to tablets eventually. Feel free to skip :)

The multi-touch table version of Tim Edmonds' NumptyPhysics gained support for multi-player modes and multi-touch drawing, dragging and deleting in the last few weeks. You can watch the evaluation video here or below.

New features and play modes include:

  • Multi-player cooperative (single token and goal)
  • Multi-token single-goal versus game
  • Multi-token multi-goal versus game
  • Draw multiple strokes at the same time
  • Move drawn items with two-finger-drag
  • Delete drawn items with three-finger-tap

Lesson learned: You need to get the level design right.

Word count for "multi" in this post: 10.

gPodder 0.14.1 in Maemo Extras

Packages for gPodder 0.14.1 (a podcast downloader for Maemo and Linux Desktops) are now available in Maemo Extras (Chinook at least.. the Diablo autobuilder is busy (broken?) at the moment). The UI experiments (mokoui2 finger scrolling) are not included in this release yet, but will be in a future release. 0.14.1 is a bugfix release, so it's recommended that you upgrade.

libmokoui2 (+Python bindings) in Diablo Extras

For the next version of gPodder, I plan to have a better suited user interface for the tablets. For this, I needed a finger-scrolling replacement of GTK+'s ScrolledWindow. libmokoui2 provides just that, and it's now available in Diablo Extras.

The package is based on Ubuntu's libmokoui2 source package, but I have removed the doc package and the Vala bindings, because you can read the docs on your computer or online, and I didn't want to mess with Vala (yet).

It also did not build on Chinook, maybe someone can have a look at the build logs? It's working fine on Diablo, though. Example code in Python is also available.