Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS3
-rw-r--r--chat.py3
-rw-r--r--notify.py51
3 files changed, 4 insertions, 53 deletions
diff --git a/NEWS b/NEWS
index c6aafd4..8ac4eda 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,6 @@
+* use NotifyAlert from sugar.graphics.alert instead of local
+ copy (thanks erikos!) (morgs)
+
27
* Use sugar.graphics.alert to show status info (morgs)
diff --git a/chat.py b/chat.py
index 2a4e74f..b9a3783 100644
--- a/chat.py
+++ b/chat.py
@@ -26,6 +26,7 @@ from datetime import datetime
from sugar import profile
from sugar.activity.activity import Activity, ActivityToolbox
from sugar.activity import activityfactory
+from sugar.graphics.alert import NotifyAlert
from sugar.graphics.style import (Color, COLOR_BLACK, COLOR_WHITE,
FONT_BOLD, FONT_NORMAL)
from sugar.graphics.roundbox import CanvasRoundBox
@@ -46,8 +47,6 @@ from telepathy.constants import (
CONNECTION_STATUS_CONNECTED, CONNECTION_STATUS_DISCONNECTED,
CONNECTION_STATUS_CONNECTING)
-from notify import NotifyAlert
-
logger = logging.getLogger('chat-activity')
class Chat(Activity):
diff --git a/notify.py b/notify.py
deleted file mode 100644
index 1e8ef15..0000000
--- a/notify.py
+++ /dev/null
@@ -1,51 +0,0 @@
-# Copyright 2007 Collabora Ltd.
-# Copyright 2007 One Laptop Per Child
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-from gettext import gettext as _
-
-import gtk
-import gobject
-import hippo
-from sugar.graphics.alert import Alert, _TimeoutIcon
-from sugar.graphics import style
-
-class NotifyAlert(Alert):
- """Timeout alert with only an "OK" button - just for notifications"""
-
- def __init__(self, timeout=5, **kwargs):
- Alert.__init__(self, **kwargs)
-
- self._timeout = timeout
-
- self._timeout_text = _TimeoutIcon(
- text=self._timeout,
- color=style.COLOR_BUTTON_GREY.get_int(),
- background_color=style.COLOR_WHITE.get_int())
- canvas = hippo.Canvas()
- canvas.set_root(self._timeout_text)
- canvas.show()
- self.add_button(gtk.RESPONSE_OK, _('OK'), canvas)
-
- gobject.timeout_add(1000, self.__timeout)
-
- def __timeout(self):
- self._timeout -= 1
- self._timeout_text.props.text = self._timeout
- if self._timeout == 0:
- self._response(gtk.RESPONSE_OK)
- return False
- return True