Use @property for properties
authorJoel Rosdahl <joel@rosdahl.net>
Wed, 14 May 2008 19:45:40 +0000 (21:45 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Wed, 14 May 2008 19:45:40 +0000 (21:45 +0200)
src/packages/kofoto/clientenvironment.py
src/packages/kofoto/gkofoto/cachingpixbufloader.py
src/packages/kofoto/gkofoto/objectcollection.py
src/packages/kofoto/rectangle.py

index 9a0c99d..9250f98 100644 (file)
@@ -188,45 +188,45 @@ class ClientEnvironment(object):
             expanduser(self.config.get("image cache", "location")),
             self.config.getboolean("image cache", "use_orientation_attribute"))
 
-    def getLocaleEncoding(self):
+    @property
+    def localeEncoding(self):
         """Get encoding of the locale."""
         return self.__localeEncoding
-    localeEncoding = property(getLocaleEncoding)
 
-    def getFilesystemEncoding(self):
+    @property
+    def filesystemEncoding(self):
         """Get encoding of the filesystem."""
         return self.__filesystemEncoding
-    filesystemEncoding = property(getFilesystemEncoding)
 
-    def getConfig(self):
+    @property
+    def config(self):
         """Get the Config instance."""
         return self.__config
-    config = property(getConfig)
 
-    def getConfigFileLocation(self):
+    @property
+    def configFileLocation(self):
         """Get the configuration file location."""
         return self.__configFileLocation
-    configFileLocation = property(getConfigFileLocation)
 
-    def getShelf(self):
+    @property
+    def shelf(self):
         """Get the Shelf instance."""
         return self.__shelf
-    shelf = property(getShelf)
 
-    def getShelfLocation(self):
+    @property
+    def shelfLocation(self):
         """Get the shelf location."""
         return self.__shelfLocation
-    shelfLocation = property(getShelfLocation)
 
-    def getImageCache(self):
+    @property
+    def imageCache(self):
         """Get the ImageCache instance."""
         return self.__imageCache
-    imageCache = property(getImageCache)
 
-    def getVersion(self):
+    @property
+    def version(self):
         """Get the Kofoto version (a string)."""
         return kofotoVersion
-    version = property(getVersion)
 
     def _writeInfo(self, infoString):
         """Write an informational string to a suitable place.
index add5f82..82f2d1a 100644 (file)
@@ -177,9 +177,9 @@ class _Request(object):
 
     # ----------------------------------
 
-    def get_key(self):
+    @property
+    def key(self):
         return (self._path, self._size_limit)
-    key = property(get_key)
 
     # ----------------------------------
 
@@ -244,7 +244,7 @@ class CachingPixbufLoader(object):
     function to the load() method. The callback function is called
     when the load has finished (or immediately, if the pixbuf already
     exists in the cache). Old load requests have higher priority than
-    new. Load requests have higher priority than preload requests. 
+    new. Load requests have higher priority than preload requests.
     Load requests are never forgotten.
 
     Preload requests are also asynchronous. A preload request is used
index ee84bea..36ddffc 100644 (file)
@@ -630,7 +630,7 @@ class ObjectCollection(object):
             nr_of_albums_before_index = 0
             for row in self.getModel():
                 objectId = row[self.COLUMN_OBJECT_ID]
-                obj = env.getShelf().getObject(objectId)
+                obj = env.shelf.getObject(objectId)
                 if not obj.isAlbum():
                     imageVersions.append(obj.getPrimaryVersion())
                 elif index > current_row:
index a1dea9f..7017ca3 100644 (file)
@@ -81,13 +81,13 @@ class Rectangle:
 
     # ----------------------------------
 
-    def get_width(self):
+    @property
+    def width(self):
         return self._width
-    width = property(get_width)
 
-    def get_height(self):
+    @property
+    def height(self):
         return self._height
-    height = property(get_height)
 
     # ----------------------------------