From 7c2531899bff565e144e8c70da1bc52c8f1c315f Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Wed, 26 Apr 2006 04:18:21 +0000 Subject: Automakeify --- diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..64267ce --- /dev/null +++ b/Makefile.am @@ -0,0 +1,8 @@ +SUBDIRS = chat browser shell + +bin_SCRIPTS = sugar + +sugardir = $(pythondir)/sugar +sugar_PYTHON = \ + __init__.py \ + sugar_globals.py diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/__init__.py diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..4a02f43 --- /dev/null +++ b/autogen.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# Run this to generate all the initial makefiles, etc. + +srcdir=`dirname $0` +test -z "$srcdir" && srcdir=. + +PKG_NAME="sugar" + +(test -f $srcdir/README) || { + echo -n "**Error**: Directory "\`$srcdir\'" does not look like the" + echo " top-level $PKG_NAME directory" + exit 1 +} + +which gnome-autogen.sh || { + echo "You need to install gnome-common from the GNOME CVS" + exit 1 +} + +REQUIRED_AUTOMAKE_VERSION=1.9 USE_GNOME2_MACROS=1 . gnome-autogen.sh diff --git a/browser/Makefile.am b/browser/Makefile.am new file mode 100644 index 0000000..0bc5b88 --- /dev/null +++ b/browser/Makefile.am @@ -0,0 +1,7 @@ +sugardir = $(pythondir)/sugar +sugar_PYTHON = browser.py + +icondir = $(pkgdatadir) +icon_DATA = \ + fold.png \ + unfold.png diff --git a/browser/browser.py b/browser/browser.py index c2ad8e1..fbb16f8 100755 --- a/browser/browser.py +++ b/browser/browser.py @@ -11,9 +11,10 @@ import gtk import geckoembed import sys -sys.path.append('../shell/example-activity/') import activity +from sugar_globals import * + class AddressToolbar(gtk.Toolbar): def __init__(self): gtk.Toolbar.__init__(self) @@ -60,14 +61,14 @@ class AddressEntry(gtk.HBox): def _update_folded_state(self): if self.folded: image = gtk.Image() - image.set_from_file("unfold.png") + image.set_from_file(data_dir + "/unfold.png") self.button.set_image(image) image.show() self.entry.hide() else: image = gtk.Image() - image.set_from_file("fold.png") + image.set_from_file(data_dir + "/fold.png") self.button.set_image(image) image.show() @@ -233,15 +234,16 @@ class BrowserShell(dbus.service.Object): browser = BrowserActivity(uri) self.__browsers.append(browser) browser.activity_connect_to_shell() - -web_activity = WebActivity() -web_activity.activity_connect_to_shell() - -session_bus = dbus.SessionBus() -bus_name = dbus.service.BusName('com.redhat.Sugar.Browser', bus=session_bus) -browser_shell = BrowserShell(bus_name) - -try: - gtk.main() -except KeyboardInterrupt: - pass + +def main(): + web_activity = WebActivity() + web_activity.activity_connect_to_shell() + + session_bus = dbus.SessionBus() + bus_name = dbus.service.BusName('com.redhat.Sugar.Browser', bus=session_bus) + browser_shell = BrowserShell(bus_name) + + try: + gtk.main() + except KeyboardInterrupt: + pass diff --git a/chat/Makefile.am b/chat/Makefile.am new file mode 100644 index 0000000..b59548d --- /dev/null +++ b/chat/Makefile.am @@ -0,0 +1,12 @@ +sugardir = $(pythondir)/sugar +sugar_PYTHON = \ + BuddyList.py \ + chat.py \ + network.py \ + presence.py \ + richtext.py + +icondir = $(pkgdatadir) +icon_DATA = \ + bubble.png \ + bubbleOutline.png diff --git a/chat/chat.glade b/chat/chat.glade deleted file mode 100644 index eda4612..0000000 --- a/chat/chat.glade +++ /dev/null @@ -1,157 +0,0 @@ - - - - - - - True - Chat - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - 440 - 250 - True - False - True - False - False - GDK_WINDOW_TYPE_HINT_NORMAL - GDK_GRAVITY_NORTH_WEST - True - False - - - - True - 2 - 2 - False - 0 - 0 - - - - True - True - True - 0 - - True - - False - - - 0 - 1 - 1 - 2 - shrink|fill - - - - - - 6 - True - False - 0 - - - - 2 - 167 - True - False - False - False - True - False - False - False - - - 0 - True - True - - - - - 1 - 2 - 0 - 2 - fill - fill - - - - - - True - False - 0 - - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - False - False - True - GTK_JUSTIFY_LEFT - GTK_WRAP_NONE - True - 0 - 0 - 0 - 0 - 0 - 0 - - - - 0 - True - True - - - - - 0 - 1 - 0 - 1 - fill - - - - - - - diff --git a/chat/chat.py b/chat/chat.py index f5e7315..bb66d8f 100755 --- a/chat/chat.py +++ b/chat/chat.py @@ -15,8 +15,6 @@ import pwd import gc import socket -sys.path.append(os.getcwd()) -sys.path.append('../shell/example-activity/') import activity import presence @@ -25,6 +23,8 @@ import network import richtext import xmlrpclib +from sugar_globals import * + class Chat(object): def __init__(self, parent, view, label): self._parent = parent @@ -193,8 +193,8 @@ class ChatActivity(activity.Activity): self._buddy_list_model = gtk.ListStore(gobject.TYPE_STRING, gtk.gdk.Pixbuf, gobject.TYPE_PYOBJECT) - self._pixbuf_active_chat = gtk.gdk.pixbuf_new_from_file("bubbleOutline.png") - self._pixbuf_new_message = gtk.gdk.pixbuf_new_from_file("bubble.png") + self._pixbuf_active_chat = gtk.gdk.pixbuf_new_from_file(data_dir + "/bubbleOutline.png") + self._pixbuf_new_message = gtk.gdk.pixbuf_new_from_file(data_dir + "/bubble.png") sw = gtk.ScrolledWindow() sw.set_shadow_type(gtk.SHADOW_IN) diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..c87e806 --- /dev/null +++ b/configure.ac @@ -0,0 +1,25 @@ +AC_INIT([Sugar],[0.1],[],[sugar]) + +AC_PREREQ([2.59]) + +AC_CONFIG_HEADERS([config.h]) +AC_CONFIG_SRCDIR([configure.ac]) + +AM_INIT_AUTOMAKE([1.9 foreign dist-bzip2 no-dist-gzip]) + +AM_MAINTAINER_MODE + +AM_PATH_PYTHON + +PKG_CHECK_MODULES(PYGTK, pygtk-2.0 >= 2.6) +AC_SUBST(PYGTK_CFLAGS) +AC_SUBST(PYGTK_LIBS) + +AC_OUTPUT([ +Makefile +sugar_globals.py +browser/Makefile +chat/Makefile +shell/Makefile +shell/src/Makefile +]) diff --git a/shell/Makefile.am b/shell/Makefile.am new file mode 100644 index 0000000..af437a6 --- /dev/null +++ b/shell/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = src diff --git a/shell/src/Makefile.am b/shell/src/Makefile.am new file mode 100644 index 0000000..604552a --- /dev/null +++ b/shell/src/Makefile.am @@ -0,0 +1,4 @@ +sugardir = $(pythondir)/sugar +sugar_PYTHON = \ + activity.py \ + shell.py diff --git a/shell/example-activity/activity.py b/shell/src/activity.py index 8ff6835..8ff6835 100644 --- a/shell/example-activity/activity.py +++ b/shell/src/activity.py diff --git a/shell/src/shell.py b/shell/src/shell.py index 869f987..193c2a3 100755 --- a/shell/src/shell.py +++ b/shell/src/shell.py @@ -264,10 +264,10 @@ class ActivityContainer(dbus.service.Object): i += 1 +def main(): + session_bus = dbus.SessionBus() + service = dbus.service.BusName("com.redhat.Sugar.Shell", bus=session_bus) -session_bus = dbus.SessionBus() -service = dbus.service.BusName("com.redhat.Sugar.Shell", bus=session_bus) + activityContainer = ActivityContainer(service, session_bus) -activityContainer = ActivityContainer(service, session_bus) - -gtk.main() + gtk.main() diff --git a/sugar b/sugar new file mode 100755 index 0000000..2036d9b --- /dev/null +++ b/sugar @@ -0,0 +1,16 @@ +#!/usr/bin/python + +import sys + +# FIXME Without args we should startup the session thing +if len(sys.argv) == 1 or 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" diff --git a/sugar_globals.py.in b/sugar_globals.py.in new file mode 100644 index 0000000..97fd271 --- /dev/null +++ b/sugar_globals.py.in @@ -0,0 +1 @@ +data_dir = "@prefix@/share/sugar" -- cgit v0.9.1