]> code.delx.au - bg-scripts/commitdiff
Automated merge with ssh://hg@kagami.tsukasa.net.au/bg_scripts/
authorGreg Darke <greg@tsukasa.net.au>
Thu, 9 Oct 2008 10:52:34 +0000 (21:52 +1100)
committerGreg Darke <greg@tsukasa.net.au>
Thu, 9 Oct 2008 10:52:34 +0000 (21:52 +1100)
1  2 
randombg.py

diff --combined randombg.py
index a259e1e0d4c251cf1e844ec70f93c701466acfac,0b13ba3e124293a0d4ac52848983663a97eba576..0bc4b7973610495f8ac665bc82c11a4d21b72406
@@@ -40,6 -40,7 +40,7 @@@ class BaseFileList(object)
        """Base file list implementation"""
        def __init__(self):
                self.paths = []
+               self.favourites = []
  
        def add_path(self, path):
                self.paths.append(path)
@@@ -48,7 -49,7 +49,7 @@@
                try:
                        logging.debug("Attempting to store cache")
                        fd = open(filename, 'wb')
-                       pickle.dump(obj = self, file = fd, protocol = 2)
+                       pickle.dump(self, fd, 2)
                        logging.debug("Cache successfully stored")
                except Exception, e:
                        warning("Storing cache: %s" % e)
                        logging.warning("Loading cache: %s" % e)
                        return False
  
+       def add_to_favourites(self):
+               '''Adds the current image to the list of favourites'''
+               self.favourites.append(self.get_current_image())
        def scan_paths(self):
                raise NotImplementedError()
  
@@@ -166,7 -171,7 +171,7 @@@ class AllRandomFileList(BaseFileList)
                        if self.paths == tmp.paths:
                                logging.debug("Path lists match, copying properties")
                                # Overwrite this object with the other
-                               for attr in ('list', 'imagePointer'):
+                               for attr in ('list', 'imagePointer', 'favourites'):
                                        setattr(self, attr, getattr(tmp, attr))
                        else:
                                logging.debug("Ignoring cache, path lists do not match")
@@@ -245,7 -250,7 +250,7 @@@ class Cycler(object)
                self.history_filename = options.history_filename
  
                logging.debug("Initialising wallchanger")
 -              wallchanger.init(options.background_colour, options.permanent)
 +              wallchanger.init(options.background_colour, options.permanent, options.convert)
  
                logging.debug("Initialising file list")
                if options.all_random:
        def cmd_exit(self):
                asyncsched.exit()
  
+       def cmd_favourite(self):
+               self.filelist.add_to_favourites()
  class Server(asynchat.async_chat):
        def __init__(self, cycler, conn, addr):
                asynchat.async_chat.__init__(self, conn=conn)