Last active
December 11, 2015 03:19
-
-
Save taonico/4537102 to your computer and use it in GitHub Desktop.
moeclock MacOS X patch
http://code.google.com/p/moeclock/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/moeclock.py b/moeclock.py | |
index b5937e2..171f29a 100755 | |
--- a/moeclock.py | |
+++ b/moeclock.py | |
@@ -2,9 +2,11 @@ | |
# -*- coding: utf-8 -*- | |
import sys | |
+import pygtk; pygtk.require('2.0') | |
import gtk | |
-import glib | |
-import gnome.ui | |
+#import glib | |
+import gobject | |
+#import gnome.ui | |
import os | |
import random | |
import logging | |
@@ -16,6 +18,7 @@ import codecs | |
import commands | |
import datetime | |
import cairo | |
+import platform | |
WALLPAPER_PATH = "/home/kaoru/themes/BackGround/used-wallpaper" | |
VERSION="1.2.0.2" | |
@@ -114,6 +117,7 @@ class moeclock: | |
iconifed = False | |
noticeFlag = True | |
notice = True | |
+ soundPlayCmd = { "Linux":"aplay ", "Darwin":"afplay " } | |
def __init__(self): | |
logging.debug("__init__") | |
@@ -226,7 +230,7 @@ class moeclock: | |
#tmplist = os.listdir(WALLPAPER_PATH+"/") | |
#self.wallpaper_list = [ WALLPAPER_PATH+"/" +x for x in tmplist if x.find(".jpg") >= 0 or x.find(".JPG") >= 0 or x.find(".png") >= 0 or x.find(".PNG") >= 0] | |
logging.debug(str(self.wallpaper_list)) | |
- self.timeout = glib.timeout_add_seconds(int(self.timeout_interval),self.timeout_callback,self) | |
+ self.timeout = gobject.timeout_add_seconds(int(self.timeout_interval),self.timeout_callback,self) | |
def __getitem__(self, key): | |
return self.wTree.get_object (key) | |
@@ -248,10 +252,10 @@ class moeclock: | |
self.skin = self.fcSkin.get_filename() | |
self._saveConf() | |
self.preferences.hide() | |
- glib.source_remove(self.timeout) | |
+ gobject.source_remove(self.timeout) | |
self._buildWallPaper(self.wlist[self.sw]) | |
self._setWallpaper("/tmp/moeclock.png") | |
- self.timeout = glib.timeout_add_seconds(int(self.timeout_interval),self.timeout_callback,self) | |
+ self.timeout = gobject.timeout_add_seconds(int(self.timeout_interval),self.timeout_callback,self) | |
def on_BTN_CANCEL_clicked(self,widget): | |
self.selectedFolder.set_filename(WALLPAPER_PATH+"/") | |
@@ -260,7 +264,7 @@ class moeclock: | |
def on_btnPlay_clicked(self,widget): | |
if os.path.exists(self.sound) : | |
soundFile = self.fcSound.get_filename() | |
- cmdStr = "aplay " + soundFile | |
+ cmdStr = self.soundPlayCmd[ platform.system() ] + soundFile | |
self.execCommand(cmdStr) | |
def on_fcSkin_file_set(self,widget): | |
@@ -366,28 +370,28 @@ class moeclock: | |
mainWindow.resize(280,88) | |
while gtk.events_pending(): | |
gtk.main_iteration(1) | |
- self.timeout2 = glib.timeout_add(100,self.chanegSize_callback,self) | |
+ self.timeout2 = gobject.timeout_add(100,self.chanegSize_callback,self) | |
def on_miSmall_activate(self,widget): | |
mainWindow = self.wMain.get_object("Main") | |
mainWindow.resize(320,180) | |
while gtk.events_pending(): | |
gtk.main_iteration(1) | |
- self.timeout2 = glib.timeout_add(100,self.chanegSize_callback,self) | |
+ self.timeout2 = gobject.timeout_add(100,self.chanegSize_callback,self) | |
def on_miMidium_activate(self,widget): | |
mainWindow = self.wMain.get_object("Main") | |
mainWindow.resize(400,225) | |
while gtk.events_pending(): | |
gtk.main_iteration(1) | |
- self.timeout2 = glib.timeout_add(100,self.chanegSize_callback,self) | |
+ self.timeout2 = gobject.timeout_add(100,self.chanegSize_callback,self) | |
def on_miLarge_activate(self,widget): | |
mainWindow = self.wMain.get_object("Main") | |
mainWindow.resize(480,270) | |
while gtk.events_pending(): | |
gtk.main_iteration(1) | |
- self.timeout2 = glib.timeout_add(100,self.chanegSize_callback,self) | |
+ self.timeout2 = gobject.timeout_add(100,self.chanegSize_callback,self) | |
def on_Main_size_allocate(self,widget,event): | |
if self.userResize : | |
@@ -443,7 +447,7 @@ class moeclock: | |
if self.notice : | |
if d.minute == 0 and self.noticeFlag: | |
if os.path.exists(self.sound) : | |
- self.timeout3 = glib.timeout_add(500,self.sound_callback,self) | |
+ self.timeout3 = gobject.timeout_add(500,self.sound_callback,self) | |
self.noticeFlag = False | |
if d.minute > 0: | |
self.noticeFlag = True | |
@@ -454,7 +458,7 @@ class moeclock: | |
self._setWallpaper("/tmp/moeclock.png") | |
def sound_callback(self,event): | |
- cmdStr = "aplay " + self.sound | |
+ cmdStr = self.soundPlayCmd[ platform.system() ] + self.sound | |
self.execCommand(cmdStr) | |
def _buildWallPaper(self,wallpaper): | |
diff --git a/moeclock.sh b/moeclock.sh | |
new file mode 100644 | |
index 0000000..e8d885c | |
--- /dev/null | |
+++ b/moeclock.sh | |
@@ -0,0 +1,2 @@ | |
+#!/bin/sh | |
+/Applications/moeclock.app/Contents/MacOS/moeclock2.sh & | |
\ No newline at end of file | |
diff --git a/moeclock2.sh b/moeclock2.sh | |
new file mode 100755 | |
index 0000000..76dd118 | |
--- /dev/null | |
+++ b/moeclock2.sh | |
@@ -0,0 +1,45 @@ | |
+#!/bin/sh | |
+# | |
+# (c) 2008-2012, Simone Karin Lehmann, simone at lisanet dot de | |
+# GPL version 2 or later | |
+# script 1.4 | |
+MOECLOCKDIR="/Applications/moeclock.app/Contents/Resources" | |
+export PYTHONPATH=/Applications/Gimp.app/Contents/Resources/lib/python2.6/site-packages | |
+export PATH=$PATH:/Applications/Gimp.app/Contents/Resources/bin | |
+DIR="/Applications/Gimp.app/Contents/MacOS" | |
+cd "$DIR/../.." | |
+APPDIR=`pwd` | |
+cd - > /dev/null | |
+# edit the next line to match version file | |
+VERSION=2.8.0 | |
+LNDIR=/tmp/skl/Gimp.app | |
+if [ ! -e "$LNDIR/Contents/Resources/v$VERSION" ]; then | |
+rm -f "$LNDIR" | |
+mkdir -p /tmp/skl | |
+chmod a+w /tmp/skl | |
+ln -s "$APPDIR" "$LNDIR" | |
+fi | |
+ | |
+# check if we have XQuartz installed, cairo depends on it :-( | |
+checkx || exit 1 | |
+# setup gimp user directories | |
+setup-gimpdir | |
+# setup help, for more information see bin/help-locale | |
+rm -f /tmp/skl/Gimphelp | |
+ln -s "$DIR/share/gimp/2.0/nohelp" /tmp/skl/Gimphelp | |
+help-locale | |
+# set font size | |
+if [ -e "/tmp/skl/Gimp.app/Contents/Resources/bin/set-fontsize" ]; then | |
+set-fontsize | |
+fi | |
+ | |
+cd ~/ > /dev/null | |
+ | |
+DBUS=`dbus-launch --sh-syntax` | |
+eval $DBUS | |
+echo $DBUS_SESSION_BUS_ADDRESS > /tmp/skl/dbus-address-$UID | |
+ | |
+python2.6 ${MOECLOCKDIR}/moeclock.py > /dev/null | |
+ | |
+rm /tmp/skl/dbus-address-$UID | |
+kill $DBUS_SESSION_BUS_PID | |
\ No newline at end of file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment