[conduit] Support for Mac OSX added to Wallpaper Module
- From: Andrew Stormont <astormont src gnome org>
- To: svn-commits-list gnome org
- Subject: [conduit] Support for Mac OSX added to Wallpaper Module
- Date: Mon, 20 Jul 2009 07:33:01 +0000 (UTC)
commit c774c1b255142771b9b9d7a615dd68847c20408f
Author: Andrew Stormont <astormont svn gnome org>
Date: Mon Jul 20 09:32:30 2009 +0200
Support for Mac OSX added to Wallpaper Module
ChangeLog | 7 ++++-
conduit/modules/DesktopWallpaperModule.py | 43 +++++++++++++++++++++++------
2 files changed, 40 insertions(+), 10 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index a6c7eef..09ad76e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,13 @@
+2009-07-20 Andrew Stormont <astormont svn gnome org>
+
+ * conduit/modules/DesktopWallpaperModule.py:
+ Support for Mac OSX added to Wallpaper Module
+
2009-07-17 Andrew Stormont <astormont svn gnome org>
* conduit/modules/ConverterModule.py:
* conduit/modules/Firefox3Module/Firefox3Module.py:
- Support for Mac OSX added to Firefox 3 Module
+ Support for Mac OSX added to Firefox 3 Module
2009-07-16 Andrew Stormont <astormont svn gnome org>
diff --git a/conduit/modules/DesktopWallpaperModule.py b/conduit/modules/DesktopWallpaperModule.py
index 972533d..db1e457 100644
--- a/conduit/modules/DesktopWallpaperModule.py
+++ b/conduit/modules/DesktopWallpaperModule.py
@@ -1,4 +1,3 @@
-import gconf
import logging
log = logging.getLogger( "modules.DesktopWallpaper")
@@ -9,9 +8,30 @@ import conduit.dataproviders.DataProvider as DataProvider
from gettext import gettext as _
-MODULES = {
- "DesktopWallpaperDataProvider" : { "type": "dataprovider" }
-}
+(WPNONE,WPGNOME,WPMAC) = range(3)
+WPTYPE = WPNONE
+
+import sys
+
+if sys.platform == 'darwin':
+ try:
+ from appscript import app, mactypes
+ WPTYPE = WPMAC
+ except ImportError:
+ log.warn("Wallpaper syncing disabled, install py25-appscript")
+else:
+ try:
+ import gconf
+ WPTYPE = WPGNOME
+ except ImportError:
+ log.warn("Wallpaper syncing disabled, install python-gconf")
+
+if WPTYPE:
+ MODULES = {
+ "DesktopWallpaperDataProvider" : { "type": "dataprovider" }
+ }
+else:
+ MODULES = {}
class DesktopWallpaperDataProvider(FileDataProvider.FolderTwoWay):
@@ -43,7 +63,8 @@ class DesktopWallpaperDataProvider(FileDataProvider.FolderTwoWay):
followSymlinks=False
)
- self._client = gconf.client_get_default()
+ if WPTYPE == WPGNOME:
+ self._client = gconf.client_get_default()
def get_UID(self):
return Utils.get_user_string()
@@ -54,10 +75,14 @@ class DesktopWallpaperDataProvider(FileDataProvider.FolderTwoWay):
#if the file was successfully transferred then set it
#as the wallpaper
if vfsFile.exists():
- self._client.set_string(
- "/desktop/gnome/background/picture_filename",
- vfsFile.get_local_uri()
- )
+ if WPTYPE == WPMAC:
+ print "SETTING BACKGROUND IMAGE"
+ app('Finder').desktop_picture.set(mactypes.File(vfsFile.get_local_uri()))
+ else:
+ self._client.set_string(
+ "/desktop/gnome/background/picture_filename",
+ vfsFile.get_local_uri()
+ )
return rid
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]