diff options
author | Marco Pesenti Gritti <mpg@redhat.com> | 2006-04-26 04:18:21 (GMT) |
---|---|---|
committer | Marco Pesenti Gritti <mpg@redhat.com> | 2006-04-26 04:18:21 (GMT) |
commit | 7c2531899bff565e144e8c70da1bc52c8f1c315f (patch) | |
tree | f96285dd6651e3b77d3fd9272d9ad3474eaaacd1 | |
parent | ba744c32dbb74592dbb501d8fc5b16b2ebcfb4df (diff) |
Automakeify
-rw-r--r-- | Makefile.am | 8 | ||||
-rw-r--r-- | __init__.py | 0 | ||||
-rwxr-xr-x | autogen.sh | 20 | ||||
-rw-r--r-- | browser/Makefile.am | 7 | ||||
-rwxr-xr-x | browser/browser.py | 32 | ||||
-rw-r--r-- | chat/Makefile.am | 12 | ||||
-rw-r--r-- | chat/chat.glade | 157 | ||||
-rwxr-xr-x | chat/chat.py | 8 | ||||
-rw-r--r-- | configure.ac | 25 | ||||
-rw-r--r-- | shell/Makefile.am | 1 | ||||
-rw-r--r-- | shell/src/Makefile.am | 4 | ||||
-rw-r--r-- | shell/src/activity.py (renamed from shell/example-activity/activity.py) | 0 | ||||
-rwxr-xr-x | shell/src/shell.py | 10 | ||||
-rwxr-xr-x | sugar | 16 | ||||
-rw-r--r-- | sugar_globals.py.in | 1 |
15 files changed, 120 insertions, 181 deletions
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 @@ -<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> -<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> - -<glade-interface> - -<widget class="GtkWindow" id="mainWindow"> - <property name="visible">True</property> - <property name="title" translatable="yes">Chat</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="window_position">GTK_WIN_POS_NONE</property> - <property name="modal">False</property> - <property name="default_width">440</property> - <property name="default_height">250</property> - <property name="resizable">True</property> - <property name="destroy_with_parent">False</property> - <property name="decorated">True</property> - <property name="skip_taskbar_hint">False</property> - <property name="skip_pager_hint">False</property> - <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property> - <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> - <property name="focus_on_map">True</property> - <property name="urgency_hint">False</property> - - <child> - <widget class="GtkTable" id="mainTable"> - <property name="visible">True</property> - <property name="n_rows">2</property> - <property name="n_columns">2</property> - <property name="homogeneous">False</property> - <property name="row_spacing">0</property> - <property name="column_spacing">0</property> - - <child> - <widget class="GtkEntry" id="entry"> - <property name="visible">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char">•</property> - <property name="activates_default">False</property> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="y_options">shrink|fill</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox1"> - <property name="border_width">6</property> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkTreeView" id="buddyListView"> - <property name="border_width">2</property> - <property name="width_request">167</property> - <property name="visible">True</property> - <property name="headers_visible">False</property> - <property name="rules_hint">False</property> - <property name="reorderable">False</property> - <property name="enable_search">True</property> - <property name="fixed_height_mode">False</property> - <property name="hover_selection">False</property> - <property name="hover_expand">False</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">0</property> - <property name="bottom_attach">2</property> - <property name="x_options">fill</property> - <property name="y_options">fill</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox1"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkLabel" id="chatLabel"> - <property name="visible">True</property> - <property name="label" translatable="yes"></property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkTextView" id="chatView"> - <property name="visible">True</property> - <property name="editable">False</property> - <property name="overwrite">False</property> - <property name="accepts_tab">True</property> - <property name="justification">GTK_JUSTIFY_LEFT</property> - <property name="wrap_mode">GTK_WRAP_NONE</property> - <property name="cursor_visible">True</property> - <property name="pixels_above_lines">0</property> - <property name="pixels_below_lines">0</property> - <property name="pixels_inside_wrap">0</property> - <property name="left_margin">0</property> - <property name="right_margin">0</property> - <property name="indent">0</property> - <property name="text" translatable="yes"></property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_options">fill</property> - </packing> - </child> - </widget> - </child> -</widget> - -</glade-interface> 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() @@ -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" |