From sbalneav at legalaid.mb.ca  Mon Jun  5 11:06:57 2006
From: sbalneav at legalaid.mb.ca (Scott Balneaves)
Date: Mon, 5 Jun 2006 10:06:57 -0500
Subject: [Python Wpg] Gnome background switcher!!!
Message-ID: <20060605150657.GA9381@localdomain>

Hello PUGlings!

So, if you're like me (and heaven help you if you are) you've probably
managed to acquire a huge number of background wallpapers in your life
online.  However, one of gnome's minor deficiencies is that the
wallpaper switcher doesn't have a feature where it cycles through a list
of wallpapers.  What to do, what to do... 

One could write a python program!!!

This is an amalgam of about 3 different programs I found on the
interweb.  The problem with two of them was that they didn't actually
exit after your gnome session quit (they'd happily continue on in the
background.  For most people, it wouldn't be a problem, since when they
log out, they probably shut down.  On LTSP servers, however, this isn't
the case), and the other progam wasn't a background swither at all, but
it DID have the gnome/gtk framework for calling gtk.main, and a timeout
function.

So, slapping all 3 together, and a bit of glue, and voila!

To use:

Go to preferences->sessions, and in the "Startup Programs" tab, you'll
want something like:

/path/to/background.py -f /path/to/backgrounds

If you want to adjust the interval (currently, it switches the wallpaper
every 10 minutes), you can add a "-i interval_seconds" to the command
line as well.

The program automatically scans a directory tree, so if you have your
wallpapers organized into folders, thats no problem.

And now, for your viewing pleasure, background.py:


#!/usr/bin/python

import gtk
import gobject
import gconf
import os
import threading
import signal
import sys
import random
from optparse import OptionParser

class GtkBackgroundSwitcher (threading.Thread):
    """
    A gnome-aware background switcher.  Properly exits when your gnome
    session goes away.  Sets your picture filename in the gconf database
    appropriately.
    """

    def __init__(self, filelist, interval):
        threading.Thread.__init__ (self)

        self.index = 0
        self.filelist = filelist
        self.filelistlen = len(self.filelist)
        self.interval = interval * 1000         # Gnome intervals are in ms

        self.ready = threading.Condition()
        self.client = gconf.client_get_default()

    def run(self):
        """
        Logan's?
        """
        gobject.timeout_add(self.interval, self.change_background)
        gtk.main()

    def change_background(self):
        """
        Change the gconf background key to the next image file in the list.
        """
        self.ready.acquire ()

        if self.index < (self.filelistlen - 1):
            self.index += 1
        else:
            self.index = 0
        self.client.set_string('/desktop/gnome/background/picture_filename',
                               self.filelist[self.index])
        self.ready.release()
        return 1 

#
# Signal handler
#

def signal_handler (*args):
    print "SIGNAL:", args
    sys.exit()

#
# walk_tree builds a list of files recursively in a directory structure.
#

def walk_tree(pathvar, d):
    for name in os.listdir(d):
        path = os.path.join(d, name)
        if os.path.isdir(path):
            walk_tree(pathvar, path)
        else:
            pathvar.append(d + os.sep + name)

if __name__ == "__main__":
    parser = OptionParser()
    parser.add_option("-f", "--folder", dest="folder",
                      help="use wallpapers from FOLDER", metavar="FOLDER")
    parser.add_option("-i", "--interval", type="int",
                      dest="interval", default=600,
                      help="time interval in seconds", metavar="INTERVAL")
    (options, args) = parser.parse_args()

    if options.folder is None:
        raise ValueError, "No valid folder specified"
    if not os.path.isdir(options.folder):
        raise ValueError, "The folder specified is not valid"

    signal.signal(signal.SIGINT, signal_handler)
    signal.signal(signal.SIGSEGV, signal_handler)
    
    filelist = []
    walk_tree(filelist, options.folder)

    if not filelist:
        raise ValueError, "Folder does not contain any image files"

    random.shuffle(filelist)
    
    background = GtkBackgroundSwitcher(filelist, options.interval)
    background.start()


-- 
Scott L. Balneaves | "Looking beyond the embers of bridges glowing behind us
Systems Department |  To a glimpse of how green it was on the other side..."
Legal Aid Manitoba |    -- Pink Floyd "High Hopes"


From stuartw at mts.net  Mon Jun  5 23:33:11 2006
From: stuartw at mts.net (Stuart Williams)
Date: Mon, 5 Jun 2006 22:33:11 -0500
Subject: [Python Wpg] Gnome background switcher!!!
In-Reply-To: <20060605150657.GA9381@localdomain>
References: <20060605150657.GA9381@localdomain>
Message-ID: <17540.63351.615077.198870@gargle.gargle.HOWL>

>>>>> Scott Balneaves writes:
> Subject: [Python Wpg] Gnome background switcher!!!

Cool!

A couple of alternatives occurred to me.

First, there's an os.walk function which you could use like this, also
switching the filelist to a value returned from walk_tree.

...
def walk_tree(d):
    result = []
    for root, dirs, files in os.walk(d):
        result.extend([os.path.join(root, f) for f in files])
    return result
...
filelist = walk_tree(options.folder)
...


Also the itertools.cycle function can simplify the switching code
thusly:

	...
        self.filelist = cycle(filelist)
        # self.filelistlen = len(self.filelist)

    def change_background(self):
        """
        Change the gconf background key to the next image file in the list.
        """
        self.ready.acquire ()
        self.client.set_string('/desktop/gnome/background/picture_filename',
                               self.filelist.next())
        self.ready.release()
        return 1 

By the way, is the thread.Threading.Condition lock (acquire/release)
necessary?

Stuart.


From sbalneav at legalaid.mb.ca  Tue Jun  6 10:37:08 2006
From: sbalneav at legalaid.mb.ca (Scott Balneaves)
Date: Tue, 6 Jun 2006 09:37:08 -0500
Subject: [Python Wpg] Gnome background switcher!!!
In-Reply-To: <17540.63351.615077.198870@gargle.gargle.HOWL>
References: <20060605150657.GA9381@localdomain>
	<17540.63351.615077.198870@gargle.gargle.HOWL>
Message-ID: <20060606143708.GA23582@localdomain>

On Mon, Jun 05, 2006 at 10:33:11PM -0500, Stuart Williams wrote:

<snip>

> First, there's an os.walk function which you could use like this, also
> switching the filelist to a value returned from walk_tree.

Ah, even better.  I'm still trying to learn all the goodies that are
available in the standard library.  Generally, my learning goes thusly:

1) Figure out what I need to do
2) Figure out how I should be doing it in Python
3) Code the function, test, get working.
4) Find out there was a standard library function that already did what 
   I wanted.
5) Slap forhead
6) ???
7) Profit!!!

> Also the itertools.cycle function can simplify the switching code
> thusly:

Step 5

> By the way, is the thread.Threading.Condition lock (acquire/release)
> necessary?

Probably not, but it was in the skeleton framework I found, so I left it
in there as a matter of course.  It could probably come out, as there's
only the one thread.

Scott

-- 
Scott L. Balneaves | "Looking beyond the embers of bridges glowing behind us
Systems Department |  To a glimpse of how green it was on the other side..."
Legal Aid Manitoba |    -- Pink Floyd "High Hopes"


From stuartw at mts.net  Mon Jun 12 22:44:11 2006
From: stuartw at mts.net (Stuart Williams)
Date: Mon, 12 Jun 2006 21:44:11 -0500
Subject: [Python Wpg] Last meeting, next meeting.
Message-ID: <17550.9851.710584.290429@gargle.gargle.HOWL>

Our last meeting on May 24th went well.  Thanks to Syd for the nice
presentation.

Our next meeting is June 28th with a presentation about iterators and
generators.

At the last meeting there was some discussion about summer schedule.
Most in attendance said they would likely attend.  We weren't excited
about planning a topic that some would miss due to vacation schedules
or weather too nice to be inside.

We were excited, though, about the idea of a sprint.  Ideas for
projects included starlanes, ldapfs, and pypy.  If we booked the room
for a little earlier would anyone be interested in sprinting over the
supper hour in addition to the regular 7:30 - 9:30 slot on July 26th
or August 23rd?

Stuart.


From syd at plug.ca  Tue Jun 13 10:18:07 2006
From: syd at plug.ca (Sydney Weidman)
Date: Tue, 13 Jun 2006 09:18:07 -0500
Subject: [Python Wpg] Last meeting, next meeting.
In-Reply-To: <17550.9851.710584.290429@gargle.gargle.HOWL>
References: <17550.9851.710584.290429@gargle.gargle.HOWL>
Message-ID: <1150208287.28810.3.camel@localhost.localdomain>

On Mon, 2006-06-12 at 21:44 -0500, Stuart Williams wrote:

> We were excited, though, about the idea of a sprint.  Ideas for
> projects included starlanes, ldapfs, and pypy.  If we booked the room
> for a little earlier would anyone be interested in sprinting over the
> supper hour in addition to the regular 7:30 - 9:30 slot on July 26th
> or August 23rd?

I'm game for doing that in July. I'm open to working on anything, as I
think the sprint techniques will be worthwhile regardless.

- Syd


From umjenki5 at cc.umanitoba.ca  Tue Jun 13 12:25:19 2006
From: umjenki5 at cc.umanitoba.ca (Mark Jenkins)
Date: Tue, 13 Jun 2006 11:25:19 -0500
Subject: [Python Wpg] Last meeting, next meeting.
In-Reply-To: <17550.9851.710584.290429@gargle.gargle.HOWL>
References: <17550.9851.710584.290429@gargle.gargle.HOWL>
Message-ID: <448EE6EF.2030600@cc.umanitoba.ca>

I'm willing to present on writing a python binding to a C library. A
topic worth holding out on until the fall or summer worthy?


From jason at peaceworks.ca  Tue Jun 13 17:03:16 2006
From: jason at peaceworks.ca (Jason Hildebrand)
Date: Tue, 13 Jun 2006 16:03:16 -0500
Subject: [Python Wpg] Last meeting, next meeting.
In-Reply-To: <448EE6EF.2030600@cc.umanitoba.ca>
References: <17550.9851.710584.290429@gargle.gargle.HOWL>
	<448EE6EF.2030600@cc.umanitoba.ca>
Message-ID: <1150232596.6409.73.camel@jason.wpg.peaceworks.ca>

Hi Mark,

Would you be able to present on this on June 28?  I've have been
pencilled in to do a talk on generators and iterators, as Stuart wrote.

My work schedule has been kind of crazy though, and I'd appreciate being
able to postpone this talk if you're able to step in for the 28th.

peace,
Jason

On Tue, 2006-06-13 at 11:25 -0500, Mark Jenkins wrote:
> I'm willing to present on writing a python binding to a C library. A
> topic worth holding out on until the fall or summer worthy?
> _______________________________________________
> Winnipeg mailing list
> Winnipeg at python.org
> http://mail.python.org/mailman/listinfo/winnipeg
> 



From sbalneav at legalaid.mb.ca  Wed Jun 14 11:49:40 2006
From: sbalneav at legalaid.mb.ca (Scott Balneaves)
Date: Wed, 14 Jun 2006 10:49:40 -0500
Subject: [Python Wpg] Last meeting, next meeting.
In-Reply-To: <448EE6EF.2030600@cc.umanitoba.ca>
References: <17550.9851.710584.290429@gargle.gargle.HOWL>
	<448EE6EF.2030600@cc.umanitoba.ca>
Message-ID: <20060614154940.GC15835@localdomain>

On Tue, Jun 13, 2006 at 11:25:19AM -0500, Mark Jenkins wrote:

Yikes, sorry, madly preparing for the Ubuntu conference.

A sprint on LDAPFS is cool with me.  I'm away all nex week, but I'll be
back for the 28th, so whatever's good.  Count me in.

There's lots of pythonistas in the Ubuntu crowd, I'll try and have a
short report on the state of Python in Ubuntu.

Cheers.

Scott

-- 
Scott L. Balneaves | "Looking beyond the embers of bridges glowing behind us
Systems Department |  To a glimpse of how green it was on the other side..."
Legal Aid Manitoba |    -- Pink Floyd "High Hopes"


From mpfaiffer at callapple.org  Wed Jun 14 23:49:25 2006
From: mpfaiffer at callapple.org (Mike Pfaiffer)
Date: Wed, 14 Jun 2006 22:49:25 -0500
Subject: [Python Wpg] Python IDE
Message-ID: <200606142249.25547.mpfaiffer@callapple.org>

	Having seen last nights MUUG meeting where Steve showed off a JAVA IDE 
(Eclipse). I was wondering what other people are using for Python, if 
anything. A quick Google search shows there are IDEs available. I've never 
had experience with an IDE before. Is it worth getting one?

	I ask because right now I'm experiencing a phase we all go through from time 
to time. I'm using some older programs under Linux and I think I can do a 
better job writing a similar set of programs with Python. When I get 
sufficiently annoyed to get moving on it, I'd like to have a good set of 
tools and knowledge available. Since there is already quite a bit of code 
pre-written in various modules, I figure an IDE might be a good tool to keep 
track of things.

				Later
				Mike


-- 
+----------------------------------------------------------------------+
|Call-A.P.P.L.E. and the Digital Civilization http://www.callapple.org |
|   http://members.shaw.ca/pfaiffer = Mike Pfaiffer (B.A., B.Sc.)      |
+----------------------------------------------------------------------+
----- BEGIN GEEK CODE BLOCK -----
Version: 3.12
GCS/G/IT/PA/SS d s+:- a? C++ UL L++ W++ N++ o+ K- w(---) O+@ M++@ V PS+
PE !PGP t+ 5+ X R tv b+ DI+++ D++ G e++* h! r-- !y-- UF++
------ END GEEK CODE BLOCK ------


From stuartw at mts.net  Thu Jun 15 17:13:43 2006
From: stuartw at mts.net (Stuart Williams)
Date: Thu, 15 Jun 2006 16:13:43 -0500
Subject: [Python Wpg] Python IDE
In-Reply-To: <200606142249.25547.mpfaiffer@callapple.org>
References: <200606142249.25547.mpfaiffer@callapple.org>
Message-ID: <17553.52615.959309.197404@gargle.gargle.HOWL>

>>>>> Mike Pfaiffer writes:
> Subject: [Python Wpg] Python IDE

> Having seen last nights MUUG meeting where Steve showed off a JAVA
> IDE (Eclipse). I was wondering what other people are using for
> Python, if anything...

I use xemacs with python-mode and IPython.  I used to use teco (I'm
joking.  I did use teco, but never for Python).

Python comes with idle that works reasonably well and is neither
complex nor powerful.

For a Python class I investigated Eric and DrPython.  I found Eric too
complicated and settled on DrPython as being about the right level of
complexity for students.  I didn't want the complexity of the IDE to
take too much student or class attention.  However, the class was
postponed so I can comment on how wise my choice was.

Finally, there's Eclipse.  While Eclipse is written in Java, it's not
limited to editing Java.  It works with numerous languages (at least
two dozen under "Languages" at
http://www.eclipseplugincentral.com/Web_Links.html) including Python
via PyDEV (at http://pydev.sourceforge.net).

Stuart.


From umjenki5 at cc.umanitoba.ca  Fri Jun 16 05:06:58 2006
From: umjenki5 at cc.umanitoba.ca (Mark Jenkins)
Date: Fri, 16 Jun 2006 04:06:58 -0500
Subject: [Python Wpg] Last meeting, next meeting.
In-Reply-To: <1150232596.6409.73.camel@jason.wpg.peaceworks.ca>
References: <17550.9851.710584.290429@gargle.gargle.HOWL>	
	<448EE6EF.2030600@cc.umanitoba.ca>
	<1150232596.6409.73.camel@jason.wpg.peaceworks.ca>
Message-ID: <449274B2.5010402@cc.umanitoba.ca>

> My work schedule has been kind of crazy though, and I'd appreciate being
> able to postpone this talk if you're able to step in for the 28th.

I shall present.


From jason at peaceworks.ca  Fri Jun 16 11:31:16 2006
From: jason at peaceworks.ca (Jason Hildebrand)
Date: Fri, 16 Jun 2006 10:31:16 -0500
Subject: [Python Wpg] Last meeting, next meeting.
In-Reply-To: <449274B2.5010402@cc.umanitoba.ca>
References: <17550.9851.710584.290429@gargle.gargle.HOWL>
	<448EE6EF.2030600@cc.umanitoba.ca>
	<1150232596.6409.73.camel@jason.wpg.peaceworks.ca>
	<449274B2.5010402@cc.umanitoba.ca>
Message-ID: <1150471876.21170.0.camel@trotzdem.walnut.peaceworks.ca>

Thanks, Mark.  I look forward to hearing your presentation.

I'll present on iterators and generators at some later date, either in
summer or in fall.

peace,
Jason

On Fri, 2006-06-16 at 04:06 -0500, Mark Jenkins wrote:
> > My work schedule has been kind of crazy though, and I'd appreciate being
> > able to postpone this talk if you're able to step in for the 28th.
> 
> I shall present.
> 
-- 
Jason D. Hildebrand
T: 204 775 1212
E: jason at peaceworks.ca




From syd at plug.ca  Wed Jun 21 21:24:41 2006
From: syd at plug.ca (syd at plug.ca)
Date: Wed, 21 Jun 2006 20:24:41 -0500 (CDT)
Subject: [Python Wpg] [Fwd: [Trac] ANN: Installing Trac at WebFaction]
Message-ID: <61430.142.132.4.215.1150939481.squirrel@mail2.plug.ca>

Maybe we could set up Trac and Subversion for our sprint with these folks?

- Syd

---------------------------- Original Message ----------------------------
Subject: [Trac] ANN: Installing Trac at WebFaction
From:    "Remi Delon" <remi at cherrypy.org>
Date:    Wed, June 21, 2006 5:50 pm
To:      trac at lists.edgewall.com
--------------------------------------------------------------------------

Hello everyone,

WebFaction (formerly Python-Hosting.com) have released a screencast demo
of  their control panel.
The 6 minute demo shows how you can setup a Rails, WordPress, Django and 
TurboGears application in a few clicks.

Even though Trac itself is not shown in the demo, setting up a
Trac/Subversion site is just as simple as setting up the other
applications  (and getting HTTPS support is just an extra click).

The one-click installer already supports all major tools, including Rails,
 WordPress, Django, TurboGears, Plone, Trac and Subversion, but also 
lightweight tools such as static HTML, CGI or PHP.

The demo is available at: http://blog.webfaction.com/control-panel-demo

We're planning on making another demo showing how to install Trac and 
Subversion with HTTPS support in just a few clicks.

Remi.
http://www.webfaction.com  - Hosting for an agile web


PS: We offer free Trac/Svn hosting for open-source python projects (we 
already host more than 200 of them).

PPS: This announcement is also on Digg so if you like the screencast and
you've got a digg account feel free to vote for the story :)
http://digg.com/programming/Setup_a_Rails,_Wordpress,Django_and_TurboGears_site_in_1min37_and_12_clicks

_______________________________________________
Trac mailing list
Trac at lists.edgewall.com
http://lists.edgewall.com/mailman/listinfo/trac






From stuartw at mts.net  Tue Jun 27 22:58:25 2006
From: stuartw at mts.net (Stuart Williams)
Date: Tue, 27 Jun 2006 21:58:25 -0500
Subject: [Python Wpg] Meeting reminder, Wednesday night
Message-ID: <17569.61521.860077.150675@gargle.gargle.HOWL>

Don't forget the meeting Wednesday evening at 7:30 when Mark Jenkins
will entertain us with a lively and engaging presentation on wrapping
C libraries in Python, in room 2M70 at the UW.  If you need directions
or more information, see WinniPUG.ca

Stuart.


From stuartw at mts.net  Fri Jun 30 10:21:15 2006
From: stuartw at mts.net (Stuart Williams)
Date: Fri, 30 Jun 2006 09:21:15 -0500
Subject: [Python Wpg] July Meeting - LdapFS.py Sprint
Message-ID: <17573.13147.594580.631619@gargle.gargle.HOWL>

At Wednesday night's meeting, after Mark's fine presentation, we
discussed July's meeting on the 26th and agreed to sprint (see
definition below) on LdapFS.py under Scott's guidance.  Scott thinks
that one evening of sprinting will be enough for it to be ready to be
unleashed on the world.

Several folks said they'd arrive early to sprint over the dinner hour.
Perhaps those who plan to do so should coordinate pizza or falafels
(Pyramid Falafel is just two blocks away!) via the mailing list.

For the August meeting we're also planning to sprint on something, the
something to be decided at the July meeting.

A good definition of sprint is on wikipedia here:
  http://en.wikipedia.org/wiki/Hackathon
Below is an excerpt.

Stuart.

  A sprint is a short period of software development. Sprints have
  become popular events among some Open Source projects, for example,
  the PyPy project is developed the most through regularly held
  sprints, where most of the international team gathers. They are
  often held near conferences which most of the project's team
  attends, but they can also be hosted by some involved party at their
  premises or some interesting location.

  The practice of using sprints for pivotal development was pioneered
  by the Zope Corporation in the early days of the Zope 3 project,
  where the greatest improvements in the software were made during the
  gatherings. From January 2002 till the start of 2006 more than 30
  Zope 3 sprints have taken place.

  The sprints organized by companies often focus on the concepts of
  the Extreme Programming software development method. There the
  sprint is directed by the coach, who suggests tasks, tracks their
  progress and makes sure that none of the developers encounter
  insurmountable difficulties. Often the development happens in pairs
  or small teams. A large open space is often chosen as a venue for
  efficient communication.

  Sprints can vary in focus. During some sprints people new to the
  project are welcomed and get an intensive hands-on introduction
  pairing with an experienced project member. The first part of such
  sprints is usually spent getting ready, presenting the tutorials,
  getting the network setup and CVS or Subversion checkouts working on
  everyone's laptops. A different kind of sprint is where only the
  core team gathers and gets some important work done in a
  concentrated manner.

  As with the larger hackathons, a significant benefit of sprinting is
  that the project members meet in person, socialize, and start to
  communicate more effectively when working together remotely.