Adapt to the new API

This commit is contained in:
Marco Pesenti Gritti 2006-07-12 22:45:13 +02:00
parent 02c697d862
commit 326f372f54
4 changed files with 14 additions and 40 deletions

View File

@ -1,2 +1,4 @@
[Activity]
python_class = gmail
name = GMail
id = org.sugar.GMail
python_module = gmail.GMailActivity

View File

@ -1,8 +1,5 @@
import os
import pygtk
pygtk.require('2.0')
import gtk
import geckoembed
from sugar.activity.Activity import Activity
@ -11,27 +8,15 @@ import sugar.env
_GMAIL_ACTIVITY_TYPE = "_gmail_google._tcp"
class GMailActivity(Activity):
def __init__(self):
def __init__(self, args):
Activity.__init__(self, _GMAIL_ACTIVITY_TYPE)
def on_connected_to_shell(self):
profile_path = os.path.join(sugar.env.get_user_dir(), 'gmail')
geckoembed.set_profile_path(profile_path)
self.set_tab_text("Mail")
self.set_tab_icon(name="stock_mail")
self.set_show_tab_icon(True)
plug = self.gtk_plug()
self.set_title("Mail")
embed = geckoembed.Embed()
plug.add(embed)
self.add(embed)
embed.show()
plug.show()
embed.load_address("http://www.gmail.com")
activity = GMailActivity()
activity.connect_to_shell()
gtk.main()

View File

@ -1,2 +1,4 @@
[Activity]
python_class = terminal
name = Terminal
id = org.sugar.Terminal
python_module = terminal.TerminalActivity

View File

@ -1,5 +1,3 @@
import os
import gtk
import vte
import pango
@ -26,7 +24,7 @@ class Terminal(gtk.HBox):
self._vte.connect("child-exited", lambda term: term.fork_command())
self._vte.fork_command()
def _configure_vte(self):
self._vte.set_font(pango.FontDescription('Monospace 10'))
self._vte.set_colors(gtk.gdk.color_parse ('#AAAAAA'),
@ -53,24 +51,11 @@ class Terminal(gtk.HBox):
pass
class TerminalActivity(Activity):
def __init__(self):
def __init__(self, args):
Activity.__init__(self, _TERMINAL_ACTIVITY_TYPE)
def on_connected_to_shell(self):
self.set_tab_text("Terminal")
plug = self.gtk_plug()
self.set_title("Terminal")
terminal = Terminal()
plug.add(terminal)
self.add(terminal)
terminal.show()
plug.show()
activity = TerminalActivity()
activity.connect_to_shell()
try:
gtk.main()
except KeyboardInterrupt:
pass