[gnome-clocks] Move Alert in utils



commit a24c45925ad6f7d533f1a9d102b4029b9736a188
Author: Paolo Borelli <pborelli gnome org>
Date:   Sat Aug 18 10:56:23 2012 +0200

    Move Alert in utils

 gnomeclocks/clocks.py |   19 ++-----------------
 gnomeclocks/utils.py  |   18 +++++++++++++++++-
 2 files changed, 19 insertions(+), 18 deletions(-)
---
diff --git a/gnomeclocks/clocks.py b/gnomeclocks/clocks.py
index 64241c0..4250eb3 100644
--- a/gnomeclocks/clocks.py
+++ b/gnomeclocks/clocks.py
@@ -16,12 +16,13 @@
 #
 # Author: Seif Lotfy <seif lotfy collabora co uk>
 
-from gi.repository import Gtk, GObject, Gio, Gst, Notify
+from gi.repository import Gtk, GObject, Gio
 from gi.repository.GdkPixbuf import Pixbuf
 
 from widgets import NewWorldClockDialog, NewAlarmDialog
 from widgets import DigitalClock, AlarmWidget, EmptyPlaceholder
 from storage import worldclockstorage
+from utils import Alert
 
 from timer import TimerWelcomeScreen, TimerScreen
 from alarm import AlarmItem, ICSHandler
@@ -481,19 +482,3 @@ class Timer(Clock):
             return False
         else:
             return True
-
-
-class Alert:
-    def __init__(self):
-        Gst.init('gst')
-
-    def do_alert(self, msg):
-        if Notify.init("GNOME Clocks"):
-            Alert = Notify.Notification.new("Clocks", msg, 'test')
-            Alert.show()
-            playbin = Gst.ElementFactory.make('playbin', None)
-            playbin.set_property('uri',
-              'file:///usr/share/sounds/gnome/default/alerts/glass.ogg')
-            playbin.set_state(Gst.State.PLAYING)
-        else:
-            print "Error: Could not trigger Alert"
diff --git a/gnomeclocks/utils.py b/gnomeclocks/utils.py
index 01ac4fb..ad1816c 100644
--- a/gnomeclocks/utils.py
+++ b/gnomeclocks/utils.py
@@ -17,7 +17,7 @@
 # Author: Seif Lotfy <seif lotfy collabora co uk>
 
 import os
-
+from gi.repository import Gst, Notify
 
 class Dirs:
     @staticmethod
@@ -43,3 +43,19 @@ class Dirs:
         except:
             path = "locale"
         return path
+
+
+class Alert:
+    def __init__(self):
+        Gst.init('gst')
+
+    def do_alert(self, msg):
+        if Notify.init("GNOME Clocks"):
+            Alert = Notify.Notification.new("Clocks", msg, 'test')
+            Alert.show()
+            playbin = Gst.ElementFactory.make('playbin', None)
+            playbin.set_property('uri',
+              'file:///usr/share/sounds/gnome/default/alerts/glass.ogg')
+            playbin.set_state(Gst.State.PLAYING)
+        else:
+            print "Error: Could not trigger Alert"



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]