Add some tab icons, still missing web site icons

This commit is contained in:
Marco Pesenti Gritti 2006-04-27 14:58:10 -04:00
parent af89be9a0c
commit 38c5e5847b
8 changed files with 61 additions and 26 deletions

View File

@ -1,5 +1,7 @@
SUBDIRS = chat browser shell SUBDIRS = chat browser shell
bin_SCRIPTS = sugar
sugardir = $(pythondir)/sugar sugardir = $(pythondir)/sugar
sugar_PYTHON = \ sugar_PYTHON = \
__init__.py \ __init__.py \

26
README
View File

@ -11,28 +11,28 @@ Building
You will need gnome-common. You will need gnome-common.
./autogen.sh --prefix=/usr --sysconfdir=/etc --localstatedir=/var ./autogen.sh
make make
make install # make require root privileges make install
Running Running
======= =======
To run the python sources from your source tree run sugar
$ ./setup-run-from-source.sh
in the top-level directory. Icons and other resources are still loaded Debug
from the installed location though. =====
To run the shell To run the shell:
$ cd shell/src sugar shell
$ ./shell.py
You can run activities like this To run the chat activity:
$ cd browser sugar chat
$ ./browser.py
To run the web activity:
sugar browser
(Just remember to have the shell running)

View File

@ -151,6 +151,8 @@ class BrowserActivity(activity.Activity):
self.activity_set_ellipsize_tab(True) self.activity_set_ellipsize_tab(True)
self.activity_set_can_close(True) self.activity_set_can_close(True)
self.activity_set_tab_text("Web Page") self.activity_set_tab_text("Web Page")
self.activity_set_tab_icon_name("web-browser")
self.activity_show_icon(True)
vbox = gtk.VBox() vbox = gtk.VBox()
@ -186,6 +188,8 @@ class WebActivity(activity.Activity):
def activity_on_connected_to_shell(self): def activity_on_connected_to_shell(self):
self.activity_set_tab_text("Web Browser") self.activity_set_tab_text("Web Browser")
self.activity_set_tab_icon_name("web-browser")
self.activity_show_icon(True)
vbox = gtk.VBox() vbox = gtk.VBox()
@ -264,6 +268,3 @@ def main():
gtk.main() gtk.main()
except KeyboardInterrupt: except KeyboardInterrupt:
pass pass
if __name__=="__main__":
main()

View File

@ -175,6 +175,8 @@ class BuddyChat(Chat):
def activity_on_connected_to_shell(self): def activity_on_connected_to_shell(self):
Chat.activity_on_connected_to_shell(self) Chat.activity_on_connected_to_shell(self)
self.activity_set_can_close(True) self.activity_set_can_close(True)
self.activity_set_tab_icon_name("im")
self.activity_show_icon(True)
def recv_message(self, msg): def recv_message(self, msg):
Chat.recv_message(self, self._buddy, msg) Chat.recv_message(self, self._buddy, msg)
@ -303,6 +305,10 @@ class GroupChat(Chat):
def activity_on_connected_to_shell(self): def activity_on_connected_to_shell(self):
Chat.activity_on_connected_to_shell(self) Chat.activity_on_connected_to_shell(self)
self.activity_set_tab_icon_name("stock_help-chat")
self.activity_show_icon(True)
aniter = self._buddy_list_model.append(None) aniter = self._buddy_list_model.append(None)
self._buddy_list_model.set(aniter, self._MODEL_COL_NICK, "Group", self._buddy_list_model.set(aniter, self._MODEL_COL_NICK, "Group",
self._MODEL_COL_ICON, self._pixbuf_active_chat, self._MODEL_COL_BUDDY, None) self._MODEL_COL_ICON, self._pixbuf_active_chat, self._MODEL_COL_BUDDY, None)

View File

@ -1,7 +0,0 @@
#!/bin/sh
# for activity.py
export PYTHONPATH=`pwd`/shell/src/
# for sugar_globals.py
export PYTHONPATH=$PYTHONPATH:`pwd`/

View File

@ -105,6 +105,14 @@ class Activity(dbus.service.Object):
@dbus.service.method("com.redhat.Sugar.Activity", \ @dbus.service.method("com.redhat.Sugar.Activity", \
in_signature="", \ in_signature="", \
out_signature="") out_signature="")
def activity_set_tab_icon_name(self, icon_name):
icon_theme = gtk.icon_theme_get_default()
icon_info = icon_theme.lookup_icon(icon_name, gtk.ICON_SIZE_MENU, 0)
pixbuf = icon_info.load_icon()
scaled_pixbuf = pixbuf.scale_simple(16, 16, gtk.gdk.INTERP_BILINEAR)
self.activity_set_icon(scaled_pixbuf)
def lost_focus(self): def lost_focus(self):
self.activity_on_lost_focus() self.activity_on_lost_focus()

View File

@ -300,6 +300,3 @@ def main():
gtk.main() gtk.main()
except KeyboardInterrupt: except KeyboardInterrupt:
pass pass
if __name__=="__main__":
main()

28
sugar Executable file
View File

@ -0,0 +1,28 @@
#!/usr/bin/python
import sys
import os
if len(sys.argv) == 1:
# FIXME Start a session
# We are lucky and this
# currently behave as we want.
# The chat depends on the
# web browser, so both activities
# are spanned. But obviously we
# need something better.
import sugar.chat
sugar.chat.main()
elif sys.argv[1] == 'shell':
import sugar.shell
sugar.shell.main()
elif sys.argv[1] == 'chat':
import sugar.chat
sugar.chat.main()
elif sys.argv[1] == 'browser':
import sugar.browser
sugar.browser.main()
else:
print "Unkown activity"