Automakeify

This commit is contained in:
Marco Pesenti Gritti 2006-04-26 00:18:21 -04:00
parent ba744c32db
commit 7c2531899b
15 changed files with 118 additions and 179 deletions

8
Makefile.am Normal file
View File

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

0
__init__.py Normal file
View File

20
autogen.sh Executable file
View File

@ -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

7
browser/Makefile.am Normal file
View File

@ -0,0 +1,7 @@
sugardir = $(pythondir)/sugar
sugar_PYTHON = browser.py
icondir = $(pkgdatadir)
icon_DATA = \
fold.png \
unfold.png

View File

@ -11,9 +11,10 @@ import gtk
import geckoembed import geckoembed
import sys import sys
sys.path.append('../shell/example-activity/')
import activity import activity
from sugar_globals import *
class AddressToolbar(gtk.Toolbar): class AddressToolbar(gtk.Toolbar):
def __init__(self): def __init__(self):
gtk.Toolbar.__init__(self) gtk.Toolbar.__init__(self)
@ -60,14 +61,14 @@ class AddressEntry(gtk.HBox):
def _update_folded_state(self): def _update_folded_state(self):
if self.folded: if self.folded:
image = gtk.Image() image = gtk.Image()
image.set_from_file("unfold.png") image.set_from_file(data_dir + "/unfold.png")
self.button.set_image(image) self.button.set_image(image)
image.show() image.show()
self.entry.hide() self.entry.hide()
else: else:
image = gtk.Image() image = gtk.Image()
image.set_from_file("fold.png") image.set_from_file(data_dir + "/fold.png")
self.button.set_image(image) self.button.set_image(image)
image.show() image.show()
@ -234,14 +235,15 @@ class BrowserShell(dbus.service.Object):
self.__browsers.append(browser) self.__browsers.append(browser)
browser.activity_connect_to_shell() browser.activity_connect_to_shell()
web_activity = WebActivity() def main():
web_activity.activity_connect_to_shell() web_activity = WebActivity()
web_activity.activity_connect_to_shell()
session_bus = dbus.SessionBus() session_bus = dbus.SessionBus()
bus_name = dbus.service.BusName('com.redhat.Sugar.Browser', bus=session_bus) bus_name = dbus.service.BusName('com.redhat.Sugar.Browser', bus=session_bus)
browser_shell = BrowserShell(bus_name) browser_shell = BrowserShell(bus_name)
try: try:
gtk.main() gtk.main()
except KeyboardInterrupt: except KeyboardInterrupt:
pass pass

12
chat/Makefile.am Normal file
View File

@ -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

View File

@ -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>

View File

@ -15,8 +15,6 @@ import pwd
import gc import gc
import socket import socket
sys.path.append(os.getcwd())
sys.path.append('../shell/example-activity/')
import activity import activity
import presence import presence
@ -25,6 +23,8 @@ import network
import richtext import richtext
import xmlrpclib import xmlrpclib
from sugar_globals import *
class Chat(object): class Chat(object):
def __init__(self, parent, view, label): def __init__(self, parent, view, label):
self._parent = parent 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._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_active_chat = gtk.gdk.pixbuf_new_from_file(data_dir + "/bubbleOutline.png")
self._pixbuf_new_message = gtk.gdk.pixbuf_new_from_file("bubble.png") self._pixbuf_new_message = gtk.gdk.pixbuf_new_from_file(data_dir + "/bubble.png")
sw = gtk.ScrolledWindow() sw = gtk.ScrolledWindow()
sw.set_shadow_type(gtk.SHADOW_IN) sw.set_shadow_type(gtk.SHADOW_IN)

25
configure.ac Normal file
View File

@ -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
])

1
shell/Makefile.am Normal file
View File

@ -0,0 +1 @@
SUBDIRS = src

4
shell/src/Makefile.am Normal file
View File

@ -0,0 +1,4 @@
sugardir = $(pythondir)/sugar
sugar_PYTHON = \
activity.py \
shell.py

View File

@ -264,10 +264,10 @@ class ActivityContainer(dbus.service.Object):
i += 1 i += 1
def main():
session_bus = dbus.SessionBus()
service = dbus.service.BusName("com.redhat.Sugar.Shell", bus=session_bus)
session_bus = dbus.SessionBus() activityContainer = ActivityContainer(service, session_bus)
service = dbus.service.BusName("com.redhat.Sugar.Shell", bus=session_bus)
activityContainer = ActivityContainer(service, session_bus) gtk.main()
gtk.main()

16
sugar Executable file
View File

@ -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"

1
sugar_globals.py.in Normal file
View File

@ -0,0 +1 @@
data_dir = "@prefix@/share/sugar"