Improve notification bar appeareance.
This commit is contained in:
parent
533dbd638e
commit
6f77290880
@ -2,6 +2,7 @@ import pygtk
|
||||
pygtk.require('2.0')
|
||||
import gtk
|
||||
import gobject
|
||||
import cairo
|
||||
|
||||
class NotificationBar(gtk.HBox):
|
||||
__gsignals__ = {
|
||||
@ -11,17 +12,37 @@ class NotificationBar(gtk.HBox):
|
||||
|
||||
def __init__(self):
|
||||
gtk.HBox.__init__(self)
|
||||
|
||||
self.set_name("notif bar")
|
||||
self.set_border_width(3)
|
||||
|
||||
self._text_label = gtk.Label()
|
||||
self._text_label.set_alignment(0.0, 0.5)
|
||||
self.pack_start(self._text_label)
|
||||
self._text_label.show()
|
||||
|
||||
|
||||
self._action_button = gtk.Button()
|
||||
self._action_button.connect('clicked', self.__button_clicked)
|
||||
self.pack_start(self._action_button, False)
|
||||
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):
|
||||
self._text_label.set_text(text)
|
||||
self._text_label.set_markup('<b>' + text + '</b>')
|
||||
|
||||
def set_action(self, action_id, action_text):
|
||||
self._action_id = action_id
|
||||
|
@ -1,7 +1,8 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
|
||||
from xml.sax import saxutils
|
||||
|
||||
import dbus
|
||||
import dbus.service
|
||||
import dbus.glib
|
||||
@ -240,8 +241,11 @@ class BrowserActivity(activity.Activity):
|
||||
bus = dbus.SessionBus()
|
||||
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.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):
|
||||
self.activity_set_tab_text(embed.get_title())
|
||||
@ -339,7 +343,7 @@ class BrowserShell(dbus.service.Object):
|
||||
if len(sys.argv) > 1 and sys.argv[1] == "--console":
|
||||
sys.stdout = LogWriter("Web Browser")
|
||||
sys.stderr = LogWriter("Web Browser")
|
||||
|
||||
|
||||
gtk.rc_parse(sugar.env.get_data_file('browser.rc'))
|
||||
|
||||
BrowserShell.get_instance().open_web_activity()
|
||||
|
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):
|
||||
if filename.endswith(".activity"):
|
||||
path = os.path.join(activities_dir, filename)
|
||||
|
||||
cp = ConfigParser()
|
||||
cp.read([path])
|
||||
python_class = cp.get('Activity', "python_class")
|
||||
|
||||
activities.append(python_class)
|
||||
|
||||
for activity in activities:
|
||||
|
Loading…
Reference in New Issue
Block a user