Improve notification bar appeareance.
This commit is contained in:
parent
533dbd638e
commit
6f77290880
@ -2,6 +2,7 @@ import pygtk
|
|||||||
pygtk.require('2.0')
|
pygtk.require('2.0')
|
||||||
import gtk
|
import gtk
|
||||||
import gobject
|
import gobject
|
||||||
|
import cairo
|
||||||
|
|
||||||
class NotificationBar(gtk.HBox):
|
class NotificationBar(gtk.HBox):
|
||||||
__gsignals__ = {
|
__gsignals__ = {
|
||||||
@ -11,7 +12,12 @@ class NotificationBar(gtk.HBox):
|
|||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
gtk.HBox.__init__(self)
|
gtk.HBox.__init__(self)
|
||||||
|
|
||||||
|
self.set_name("notif bar")
|
||||||
|
self.set_border_width(3)
|
||||||
|
|
||||||
self._text_label = gtk.Label()
|
self._text_label = gtk.Label()
|
||||||
|
self._text_label.set_alignment(0.0, 0.5)
|
||||||
self.pack_start(self._text_label)
|
self.pack_start(self._text_label)
|
||||||
self._text_label.show()
|
self._text_label.show()
|
||||||
|
|
||||||
@ -20,8 +26,23 @@ class NotificationBar(gtk.HBox):
|
|||||||
self.pack_start(self._action_button, False)
|
self.pack_start(self._action_button, False)
|
||||||
self._action_button.show()
|
self._action_button.show()
|
||||||
|
|
||||||
|
self.connect('expose_event', self.expose)
|
||||||
|
|
||||||
|
def expose(self, widget, event):
|
||||||
|
rect = self.get_allocation()
|
||||||
|
ctx = widget.window.cairo_create()
|
||||||
|
|
||||||
|
ctx.new_path()
|
||||||
|
ctx.rectangle(rect.x, rect.y, rect.width, rect.height)
|
||||||
|
ctx.set_source_rgb(0.56 , 0.75 , 1)
|
||||||
|
ctx.fill_preserve()
|
||||||
|
ctx.set_source_rgb(0.16 , 0.35 , 0.6)
|
||||||
|
ctx.stroke()
|
||||||
|
|
||||||
|
return False
|
||||||
|
|
||||||
def set_text(self, text):
|
def set_text(self, text):
|
||||||
self._text_label.set_text(text)
|
self._text_label.set_markup('<b>' + text + '</b>')
|
||||||
|
|
||||||
def set_action(self, action_id, action_text):
|
def set_action(self, action_id, action_text):
|
||||||
self._action_id = action_id
|
self._action_id = action_id
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
from xml.sax import saxutils
|
||||||
|
|
||||||
import dbus
|
import dbus
|
||||||
import dbus.service
|
import dbus.service
|
||||||
import dbus.glib
|
import dbus.glib
|
||||||
@ -240,8 +241,11 @@ class BrowserActivity(activity.Activity):
|
|||||||
bus = dbus.SessionBus()
|
bus = dbus.SessionBus()
|
||||||
proxy_obj = bus.get_object('com.redhat.Sugar.Chat', '/com/redhat/Sugar/Chat')
|
proxy_obj = bus.get_object('com.redhat.Sugar.Chat', '/com/redhat/Sugar/Chat')
|
||||||
chat_shell = dbus.Interface(proxy_obj, 'com.redhat.Sugar.ChatShell')
|
chat_shell = dbus.Interface(proxy_obj, 'com.redhat.Sugar.ChatShell')
|
||||||
chat_shell.send_message('<richtext><link href="' + address + '">' +
|
|
||||||
self.embed.get_title() + '</link></richtext>')
|
escaped_address = saxutils.escape(self.embed.get_title())
|
||||||
|
escaped_title = saxutils.escape(address)
|
||||||
|
chat_shell.send_message('<richtext><link href="' + escaped_address +
|
||||||
|
'">' + escaped_title + '</link></richtext>')
|
||||||
|
|
||||||
def __title_cb(self, embed):
|
def __title_cb(self, embed):
|
||||||
self.activity_set_tab_text(embed.get_title())
|
self.activity_set_tab_text(embed.get_title())
|
||||||
|
7
sugar/browser/browser.rc
Normal file
7
sugar/browser/browser.rc
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
style "NotificationBarButton" = "button"
|
||||||
|
{
|
||||||
|
xthickness = 0
|
||||||
|
ythickness = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
widget "*.notif bar.*GtkButton*" style "NotificationBarButton"
|
@ -27,11 +27,9 @@ def start(console):
|
|||||||
for filename in os.listdir(activities_dir):
|
for filename in os.listdir(activities_dir):
|
||||||
if filename.endswith(".activity"):
|
if filename.endswith(".activity"):
|
||||||
path = os.path.join(activities_dir, filename)
|
path = os.path.join(activities_dir, filename)
|
||||||
|
|
||||||
cp = ConfigParser()
|
cp = ConfigParser()
|
||||||
cp.read([path])
|
cp.read([path])
|
||||||
python_class = cp.get('Activity', "python_class")
|
python_class = cp.get('Activity', "python_class")
|
||||||
|
|
||||||
activities.append(python_class)
|
activities.append(python_class)
|
||||||
|
|
||||||
for activity in activities:
|
for activity in activities:
|
||||||
|
Loading…
Reference in New Issue
Block a user