Big refactor of the directory structure and packages to

reflect private/public
This commit is contained in:
Marco Pesenti Gritti 2006-06-21 14:23:18 -04:00
parent a6974cd597
commit f4e2791c89
35 changed files with 60 additions and 42 deletions

20
.gitignore vendored
View File

@ -1,2 +1,22 @@
# Generic
*.pyc *.pyc
*~ *~
Makefile
Makefile.in
# Absolute
aclocal.m4
autom4te.cache
config.h
config.h.in
config.log
config.status
configure
install-sh
missing
py-compile
stamp-h1
sugar/__installed__.py

View File

@ -6,13 +6,14 @@ pygtk.require('2.0')
import gtk import gtk
import geckoembed import geckoembed
from sugar.shell import activity from sugar.activity import activity
from sugar.browser import NotificationBar
from sugar.browser import NavigationToolbar
from sugar.presence.PresenceService import PresenceService from sugar.presence.PresenceService import PresenceService
from sugar.p2p.model.LocalModel import LocalModel from sugar.p2p.model.LocalModel import LocalModel
from sugar.p2p.model.RemoteModel import RemoteModel from sugar.p2p.model.RemoteModel import RemoteModel
from NotificationBar import NotificationBar
from NavigationToolbar import NavigationToolbar
_BROWSER_ACTIVITY_TYPE = "_web_olpc._udp" _BROWSER_ACTIVITY_TYPE = "_web_olpc._udp"
_SERVICE_URI_TAG = "URI" _SERVICE_URI_TAG = "URI"
_SERVICE_TITLE_TAG = "Title" _SERVICE_TITLE_TAG = "Title"
@ -83,7 +84,7 @@ class BrowserActivity(activity.Activity):
vbox = gtk.VBox() vbox = gtk.VBox()
self._notif_bar = NotificationBar.NotificationBar() self._notif_bar = NotificationBar()
vbox.pack_start(self._notif_bar, False) vbox.pack_start(self._notif_bar, False)
self._notif_bar.connect('action', self.__notif_bar_action_cb) self._notif_bar.connect('action', self.__notif_bar_action_cb)
@ -94,7 +95,7 @@ class BrowserActivity(activity.Activity):
self.embed.show() self.embed.show()
self.embed.load_address(self.uri) self.embed.load_address(self.uri)
nav_toolbar = NavigationToolbar.NavigationToolbar(self) nav_toolbar = NavigationToolbar(self)
vbox.pack_start(nav_toolbar, False) vbox.pack_start(nav_toolbar, False)
nav_toolbar.show() nav_toolbar.show()

View File

@ -6,10 +6,10 @@ import gtk
import gobject import gobject
import sugar.env import sugar.env
from sugar.browser.BrowserActivity import BrowserActivity
from sugar.presence import Service from sugar.presence import Service
from BrowserActivity import BrowserActivity
class BrowserShell(dbus.service.Object): class BrowserShell(dbus.service.Object):
def __init__(self, bus_name, object_path = '/com/redhat/Sugar/Browser'): def __init__(self, bus_name, object_path = '/com/redhat/Sugar/Browser'):
dbus.service.Object.__init__(self, bus_name, object_path) dbus.service.Object.__init__(self, bus_name, object_path)

View File

@ -2,7 +2,7 @@ import pygtk
pygtk.require('2.0') pygtk.require('2.0')
import gtk import gtk
from sugar.browser.AddressItem import AddressItem from AddressItem import AddressItem
class NavigationToolbar(gtk.Toolbar): class NavigationToolbar(gtk.Toolbar):
def __init__(self, browser): def __init__(self, browser):

View File

@ -0,0 +1,2 @@
[Activity]
python_class = browser

View File

@ -6,9 +6,9 @@ import gtk
import dbus import dbus
import sugar.env import sugar.env
from sugar.session.LogWriter import LogWriter from sugar.session.LogWriter import LogWriter
from sugar.browser.BrowserShell import BrowserShell
from BrowserShell import BrowserShell
log_writer = LogWriter("Web") log_writer = LogWriter("Web")
log_writer.start() log_writer.start()

View File

Before

Width:  |  Height:  |  Size: 156 B

After

Width:  |  Height:  |  Size: 156 B

View File

Before

Width:  |  Height:  |  Size: 157 B

After

Width:  |  Height:  |  Size: 157 B

View File

@ -1,4 +1,4 @@
AC_INIT([Sugar],[0.9],[],[sugar]) AC_INIT([Sugar],[0.10],[],[sugar])
AC_PREREQ([2.59]) AC_PREREQ([2.59])
@ -17,15 +17,15 @@ AC_SUBST(PYGTK_LIBS)
AC_OUTPUT([ AC_OUTPUT([
Makefile Makefile
activities/browser/Makefile
cut-n-paste/Makefile cut-n-paste/Makefile
shell/Makefile
shell/session/Makefile
sugar/Makefile sugar/Makefile
sugar/__installed__.py sugar/__installed__.py
sugar/browser/Makefile
sugar/chat/Makefile sugar/chat/Makefile
sugar/chat/sketchpad/Makefile sugar/chat/sketchpad/Makefile
sugar/p2p/Makefile sugar/p2p/Makefile
sugar/p2p/model/Makefile sugar/p2p/model/Makefile
sugar/shell/Makefile
sugar/session/Makefile
sugar/presence/Makefile sugar/presence/Makefile
]) ])

View File

@ -7,9 +7,10 @@ import cgi
import xml.sax.saxutils import xml.sax.saxutils
import gobject import gobject
import google from google import google
from sugar.presence.PresenceService import PresenceService from sugar.presence.PresenceService import PresenceService
from sugar.browser import BrowserActivity
_BROWSER_ACTIVITY_TYPE = "_web_olpc._udp"
_COLUMN_TITLE = 0 _COLUMN_TITLE = 0
_COLUMN_ADDRESS = 1 _COLUMN_ADDRESS = 1
@ -78,7 +79,7 @@ class ActivitiesModel(gtk.ListStore):
return return
# Only accept browser activities for now # Only accept browser activities for now
if service.get_type() == BrowserActivity._BROWSER_ACTIVITY_TYPE: if service.get_type() == _BROWSER_ACTIVITY_TYPE:
escaped_title = service.get_one_property('Title') escaped_title = service.get_one_property('Title')
escaped_uri = service.get_one_property('URI') escaped_uri = service.get_one_property('URI')
if escaped_title and escaped_uri: if escaped_title and escaped_uri:
@ -169,7 +170,7 @@ class StartPage(gtk.HBox):
self._pservice.connect("buddy-appeared", self._on_buddy_appeared_cb) self._pservice.connect("buddy-appeared", self._on_buddy_appeared_cb)
self._pservice.connect("buddy-disappeared", self._on_buddy_disappeared_cb) self._pservice.connect("buddy-disappeared", self._on_buddy_disappeared_cb)
self._pservice.start() self._pservice.start()
self._pservice.track_service_type(BrowserActivity._BROWSER_ACTIVITY_TYPE) self._pservice.track_service_type(_BROWSER_ACTIVITY_TYPE)
if self._pservice.get_owner(): if self._pservice.get_owner():
self._on_buddy_appeared_cb(self._pservice, self._pservice.get_owner()) self._on_buddy_appeared_cb(self._pservice, self._pservice.get_owner())

View File

@ -1,4 +1,4 @@
cut_n_pastedir = $(pythondir)/cut-n-paste cut_n_pastedir = $(datadir)/sugar
cut_n_paste_PYTHON = \ cut_n_paste_PYTHON = \
google.py \ google.py \
GoogleSOAPFacade.py \ GoogleSOAPFacade.py \

0
shell/google/__init__.py Normal file
View File

View File

View File

@ -6,7 +6,7 @@ import pygtk
pygtk.require('2.0') pygtk.require('2.0')
import gtk import gtk
from sugar.shell.shell import Shell from shell import Shell
from sugar import env from sugar import env
class Session: class Session:

View File

@ -9,13 +9,14 @@ import pango
import gobject import gobject
import sugar.util import sugar.util
from sugar.session.LogWriter import LogWriter
from sugar.shell.PresenceWindow import PresenceWindow
from sugar.chat.ChatWindow import ChatWindow from sugar.chat.ChatWindow import ChatWindow
from sugar.shell.Owner import ShellOwner
from sugar.shell.StartPage import StartPage
from sugar.shell.WindowManager import WindowManager
from sugar.chat.GroupChat import GroupChat from sugar.chat.GroupChat import GroupChat
from sugar.session.LogWriter import LogWriter
from Owner import ShellOwner
from StartPage import StartPage
from WindowManager import WindowManager
from PresenceWindow import PresenceWindow
class ActivityHost(dbus.service.Object): class ActivityHost(dbus.service.Object):

View File

@ -56,19 +56,15 @@ if not os.environ.has_key("SUGAR_NICK_NAME"):
os.environ['SUGAR_NICK_NAME'] = nick os.environ['SUGAR_NICK_NAME'] = nick
os.environ['SUGAR_USER_DIR'] = os.path.expanduser('~/.sugar') os.environ['SUGAR_USER_DIR'] = os.path.expanduser('~/.sugar')
curdir = os.path.dirname(__file__)
if curdir == '.':
basedir = os.path.dirname(os.getcwd())
else:
basedir = os.path.dirname(curdir)
if os.path.isfile(os.path.join(curdir, '__uninstalled__.py')): curdir = os.path.abspath(os.path.dirname(__file__))
if basedir == '': basedir = os.path.dirname(curdir)
print 'Running sugar from current directory...'
else: if os.path.isfile(os.path.join(basedir, 'sugar/__uninstalled__.py')):
print 'Running sugar from ' + basedir + ' ...' print 'Running sugar from ' + basedir + ' ...'
add_to_python_path(basedir) add_to_python_path(basedir)
add_to_python_path(os.path.join(basedir, 'cut-n-paste')) add_to_python_path(os.path.join(basedir, 'shell'))
add_to_python_path(os.path.join(basedir, 'activities/browser'))
else: else:
print 'Running the installed sugar...' print 'Running the installed sugar...'
@ -76,7 +72,7 @@ add_to_python_path(os.path.expanduser('~/.sugar/activities'))
print 'Redirecting output to the console, press ctrl+d to open it.' print 'Redirecting output to the console, press ctrl+d to open it.'
from sugar.session.session import Session from session.session import Session
session = Session() session = Session()
session.start() session.start()

View File

@ -1,5 +1,5 @@
import os import os
data_basedir = os.path.dirname(os.path.dirname(__file__)) data_basedir = os.path.dirname(os.path.dirname(__file__))
data_dirs = [ 'sugar/browser', 'sugar/chat' ] data_dirs = [ 'activities/browser' ]
activities_dir = '' activities_dir = ''

View File

View File

@ -1,2 +0,0 @@
[Activity]
python_class = sugar/browser/browser

View File

@ -3,5 +3,4 @@ sugar_PYTHON = \
__init__.py \ __init__.py \
AbstractModel.py \ AbstractModel.py \
LocalModel.py \ LocalModel.py \
RemoteModel.py \ RemoteModel.py
Store.py