ChortleVision

April 17, 2009

damn you ubuntu putty!

Filed under: ubuntu — Tags: , , , , — gordallott @ 10:00 pm

I would like to take five minutes to talk to you all about this:

ubuntu thinking putty

ubuntu thinking putty

Its called ‘Thinking putty‘ and you can get it at the ubuntu shop. I only actually picked some up because I was getting some other nice gear (nice bag to hold my laptop and some nice t-shirts). But it has taken over my life, if i am sitting and working, then take a break for only ten seconds my hands instinctively reach over for the stuff and start forming it into the strangest shapes, maybe even start ripping at it or pulling it apart to create ubuntu spaghetti, who knows? All i do know is that ubuntu thinking putty does not help you think at all, before you know it the ‘five minute break’ you had set aside to think about how to implement something has been lost inside the squishyness of the devil putty. Stay away from this one!

April 5, 2009

Update Notifying Icon is back! yay!

Filed under: code, ubuntu — Tags: , , , , — gordallott @ 1:19 pm

Well okay, its not really.. but sort of. For those not in the know, in jaunty the update-notification daemon no longer provides you with a little icon in your notification area to tell you you have updates, its annoying, its really annoying. I barely ever remember to update because of it, so i wrote a small python script to put a little notification icon up there when i have new updates and thought i would share it with the rest of the world.

if you want to use this, you will want to put it in a file called update_notifier.py and make it executionable. then stick it in ~/bin (or wherever you want really). I also added it to my list of startup programs running the following command:

nice -n20 /home/gord/bin/update_notfier.py

the reason for the nice -n20 is that checking the entire repository for new packages (does not download new package lists, just checks your current ones via python-apt) can eat up cpu power, nice just makes sure it won’t get in your way hopefully. - it runs once every 24 hours (my update mechanism only gets new info once every 24 hours, no point i doing more surely?)

here come the code:


#!/usr/bin/env python
#
#       update_notfier.py
#
#       Copyright 2009 Gordon Allott
#
#       This program is free software; you can redistribute it and/or modify
#       it under the terms of the GNU General Public License as published by
#       the Free Software Foundation; either version 3 of the License, or
#       (at your option) any later version.
#
#       This program is distributed in the hope that it will be useful,
#       but WITHOUT ANY WARRANTY; without even the implied warranty of
#       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#       GNU General Public License for more details.
#
#       You should have received a copy of the GNU General Public License
#       along with this program; if not, write to the Free Software
#       Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
#       MA 02110-1301, USA.

import pygtk
import gtk, gobject
import apt
import os, sys
import subprocess

class AptNotifier(object):

    def __init__(self):
        self.icon = gtk.StatusIcon()
        self.icon.set_from_stock(gtk.STOCK_INFO)
        self.icon.connect('activate', self.icon_activate)
        self.icon.set_visible(False)
        self.refresh()

    def icon_activate(self, icon):
        subprocess.Popen('update-manager')

    def check_new(self):
        cache = apt.Cache()
        cache.upgrade(True)
        if len(cache.getChanges()) > 0:
            # we have changes if we get here, return True
            return True

        return False

    def display_icon(self):
        self.icon.set_visible(True)

    def destroy_icon(self):
        self.icon.set_visible(False)

    def refresh(self):
        """ checks for new update items """
        if self.check_new():
            self.display_icon()

        else:
            self.destroy_icon()

        return True # we return true to make the timeout repeat

    def run(self):
        gobject.timeout_add(60*60*24*1000, self.refresh)
        gtk.main()

def main():
    notifier = AptNotifier()
    notifier.run()
    return 0

if __name__ == '__main__': main()

March 22, 2009

pyweek 9.04!

Filed under: code, opengl, ubuntu — Tags: , , , , , — gordallott @ 5:32 pm

Well its offical, I’m entering into pyweek again this year (one week of solid open source game development at the end of april going into may). Last year was far too much fun and we learnt a lot (we being me and
Jeiel, a good friend of mine). As normal i’ll be developing the codebase on ubuntu and porting it to other platforms :)

Looking forward to it lots, our entry page can be found here (not much yet obviously) and our last entry can be found here

« Newer PostsOlder Posts »

Powered by WordPress