Personal tools
You are here: Home Members rea SLUG Meetings pictureToss.py
Navigation
Log in


Forgot your password?
 
Document Actions

pictureToss.py

by Robert Anderson last modified 2008-07-17 15:27

What do you do when you're not very happy with the new KDE4 background options? Skip a night of sleep and write your own.

What Meeting SLUG
When 2008-08-11
from 19:00 to 21:00
Where UNH Durham, Morse Hall room 332
Add event to calendar vCal
iCal

Since KDE4 came to my desktop with Fedora9, I've not been happy with my background program choices. In the past I used a random background feature from KDE and I wrote a small SuperKaramba Applet that used dcop to advance the background when clicked. This all falls apart with KDE4 because they no longer exposed the "nextbackground" like functionality in dbus (the new dcop). The result is that if I point it at some random bunch of vacation pictures, I might end up looking at some dumb photo for a half hour until it changes on it's own timer.

I then decided to put up a couple of pictures on the background using one of the new background applets shipped with KDE4. The trouble was that they don't randomize and are not connected together. So that if I put up four of them and point them to the same directory I start the day looking at the same four pictures (since they are set to advance at different times they eventually would de-synchronise).

OK, so when dissatisfied with the choices available you have to either wait for more choices (which I did for a few months) or roll your own. I've been wanting to do a little more programming with PyQt4 so I started writing. One sleepless night and I had the program we'll talk about here. A few more evenings of "feature creep" and it becomes very nice, but still isn't tied to a background yet.

The resulting PyQt4 application we'll talk about is currently about 300 lines of Python. With the following features:

  • Randomizes one or more directories of pictures
  • Randomly sizes and rescales the given image.
  • Randomly places smaller images on a single larger image.
  • Randomly rotates images in a +/- 10 degree ranges
  • Command line options for many variables like: rotation, number of images
  • Time based "next image in sequence" replacement of a randomly selected image being displayed.
  • Image collision detection to keep too many photos from overlaying each other.
  • Runtime mouse selection enabling: movement, resizing, rotation, and layering
  • Runtime keyboard input for: Replacement, Deletion, Addition of images, rescaling to currently viewed size, layering
  • The ability to print or save the current view as a PNG.

Future enhancements:

  1. A way to save and load a given layout.
  2. Hooking in as much as possible into a KDE4 background (probably involving Kross)

Powered by Plone CMS, the Open Source Content Management System

This site conforms to the following standards: