Merge branch 'master' of git+ssh://guillaume@dev.laptop.org/git/sugar
This commit is contained in:
commit
a840be0c01
@ -1,2 +1 @@
|
||||
services/nm/nmclient.py
|
||||
sugar/chat/ChatEditor.py
|
||||
|
@ -183,9 +183,6 @@ class ServerPlugin(gobject.GObject):
|
||||
self._conn[CONN_INTERFACE_BUDDY_INFO].connect_to_signal('ActivitiesChanged', self._activities_changed_cb)
|
||||
|
||||
def _status_changed_cb(self, state, reason):
|
||||
gobject.idle_add(self._status_changed_cb2, state, reason)
|
||||
|
||||
def _status_changed_cb2(self, state, reason):
|
||||
if state == CONNECTION_STATUS_CONNECTING:
|
||||
print 'connecting: %r' % reason
|
||||
elif state == CONNECTION_STATUS_CONNECTED:
|
||||
|
@ -8,3 +8,5 @@ sugar_PYTHON = \
|
||||
|
||||
dbusservicedir = $(sysconfdir)/dbus-1/system.d/
|
||||
dbusservice_DATA = NetworkManagerInfo.conf
|
||||
|
||||
EXTRA_DIST = $(dbusservice_DATA)
|
||||
|
@ -117,19 +117,19 @@ class ColorPicker(hippo.CanvasBox, hippo.CanvasItem):
|
||||
stroke_color=color.HTMLColor(self._fg_hex),
|
||||
fill_color=color.HTMLColor(self._bg_hex))
|
||||
self._set_random_colors()
|
||||
self._emit_color()
|
||||
self._xo.connect('activated', self._xo_activated_cb)
|
||||
self.append(self._xo)
|
||||
|
||||
def _xo_activated_cb(self, item):
|
||||
self._set_random_colors()
|
||||
self._emit_color()
|
||||
|
||||
def _emit_color(self):
|
||||
xo_color = XoColor('%s,%s' % (self._xo.props.stroke_color.get_html(),
|
||||
self._xo.props.fill_color.get_html()))
|
||||
self.emit('color', xo_color)
|
||||
|
||||
def get_color(self):
|
||||
return XoColor('%s,%s' % (self._xo.props.stroke_color.get_html(),
|
||||
self._xo.props.fill_color.get_html()))
|
||||
|
||||
def _update_xo_hex(self, fg=None, bg=None):
|
||||
"""set the colors of the XO man"""
|
||||
if fg:
|
||||
|
@ -185,6 +185,8 @@ class ColorBox(hippo.CanvasBox, hippo.CanvasItem):
|
||||
self._cp.connect('color', self._new_color_cb)
|
||||
self.append(self._cp)
|
||||
|
||||
self._color = self._cp.get_color()
|
||||
|
||||
def _new_color_cb(self, widget, color):
|
||||
self._color = color
|
||||
|
||||
@ -194,6 +196,11 @@ class ColorBox(hippo.CanvasBox, hippo.CanvasItem):
|
||||
class IntroBox(hippo.CanvasBox, hippo.CanvasItem):
|
||||
__gtype_name__ = 'SugarIntroBox'
|
||||
|
||||
__gsignals__ = {
|
||||
'ok': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,
|
||||
([gobject.TYPE_PYOBJECT, gobject.TYPE_PYOBJECT, gobject.TYPE_PYOBJECT]))
|
||||
}
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
hippo.CanvasBox.__init__(self, **kwargs)
|
||||
self._pixbuf = None
|
||||
@ -222,40 +229,10 @@ class IntroBox(hippo.CanvasBox, hippo.CanvasItem):
|
||||
color = self._color_box.get_color()
|
||||
|
||||
if not pixbuf or not name or not color:
|
||||
print "not one of pixbuf(%r), name(%r), or color(%r)"
|
||||
return
|
||||
|
||||
self._create_profile(pixbuf, name, color)
|
||||
gtk.main_quit()
|
||||
|
||||
def _create_profile(self, pixbuf, name, color):
|
||||
# Save the buddy icon
|
||||
icon_path = os.path.join(env.get_profile_path(), "buddy-icon.jpg")
|
||||
scaled = pixbuf.scale_simple(200, 200, gtk.gdk.INTERP_BILINEAR)
|
||||
pixbuf.save(icon_path, "jpeg", {"quality":"85"})
|
||||
|
||||
cp = ConfigParser()
|
||||
section = 'Buddy'
|
||||
cp.add_section(section)
|
||||
cp.set(section, 'NickName', name)
|
||||
cp.set(section, 'Color', color.to_string())
|
||||
|
||||
secion = 'Server'
|
||||
cp.add_section(section)
|
||||
cp.set(section, 'Server', 'olpc.collabora.co.uk')
|
||||
cp.set(Section, 'Registered', 'False')
|
||||
|
||||
config_path = os.path.join(env.get_profile_path(), 'config')
|
||||
f = open(config_path, 'w')
|
||||
cp.write(f)
|
||||
f.close()
|
||||
|
||||
# Generate keypair
|
||||
import commands
|
||||
keypath = os.path.join(env.get_profile_path(), "owner.key")
|
||||
cmd = "ssh-keygen -q -t dsa -f %s -C '' -N ''" % keypath
|
||||
(s, o) = commands.getstatusoutput(cmd)
|
||||
if s != 0:
|
||||
logging.error("Could not generate key pair: %d" % s)
|
||||
self.emit('ok', pixbuf, name, color)
|
||||
|
||||
|
||||
class IntroWindow(gtk.Window):
|
||||
@ -272,10 +249,50 @@ class IntroWindow(gtk.Window):
|
||||
padding_top=units.grid_to_pixels(2),
|
||||
padding_left=units.grid_to_pixels(3),
|
||||
padding_right=units.grid_to_pixels(3))
|
||||
self._intro_box.connect('ok', self._ok_cb)
|
||||
self._canvas.set_root(self._intro_box)
|
||||
self.add(self._canvas)
|
||||
self._canvas.show()
|
||||
|
||||
def _ok_cb(self, widget, pixbuf, name, color):
|
||||
self.hide()
|
||||
gobject.idle_add(self._create_profile, pixbuf, name, color)
|
||||
|
||||
def _create_profile(self, pixbuf, name, color):
|
||||
# Save the buddy icon
|
||||
icon_path = os.path.join(env.get_profile_path(), "buddy-icon.jpg")
|
||||
scaled = pixbuf.scale_simple(200, 200, gtk.gdk.INTERP_BILINEAR)
|
||||
pixbuf.save(icon_path, "jpeg", {"quality":"85"})
|
||||
|
||||
cp = ConfigParser()
|
||||
section = 'Buddy'
|
||||
if not cp.has_section(section):
|
||||
cp.add_section(section)
|
||||
cp.set(section, 'NickName', name)
|
||||
cp.set(section, 'Color', color.to_string())
|
||||
|
||||
secion = 'Server'
|
||||
if not cp.has_section(section):
|
||||
cp.add_section(section)
|
||||
cp.set(section, 'Server', 'olpc.collabora.co.uk')
|
||||
cp.set(section, 'Registered', 'False')
|
||||
|
||||
config_path = os.path.join(env.get_profile_path(), 'config')
|
||||
f = open(config_path, 'w')
|
||||
cp.write(f)
|
||||
f.close()
|
||||
|
||||
# Generate keypair
|
||||
import commands
|
||||
keypath = os.path.join(env.get_profile_path(), "owner.key")
|
||||
cmd = "ssh-keygen -q -t dsa -f %s -C '' -N ''" % keypath
|
||||
(s, o) = commands.getstatusoutput(cmd)
|
||||
if s != 0:
|
||||
logging.error("Could not generate key pair: %d" % s)
|
||||
|
||||
gtk.main_quit()
|
||||
return False
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
w = IntroWindow()
|
||||
|
@ -20,6 +20,7 @@ from gettext import gettext as _
|
||||
import hippo
|
||||
|
||||
from sugar.graphics.menu import Menu, MenuItem
|
||||
from sugar.graphics import color
|
||||
from sugar.graphics.iconbutton import IconButton
|
||||
import sugar
|
||||
|
||||
@ -79,19 +80,27 @@ class ZoomBox(hippo.CanvasBox):
|
||||
self._popup_context = popup_context
|
||||
self._activity_icon = None
|
||||
|
||||
icon = IconButton(icon_name='theme:stock-zoom-mesh')
|
||||
icon = IconButton(icon_name='theme:stock-zoom-mesh',
|
||||
stroke_color=color.BLACK,
|
||||
fill_color=color.WHITE)
|
||||
icon.connect('activated', self._level_clicked_cb, sugar.ZOOM_MESH)
|
||||
self.append(icon)
|
||||
|
||||
icon = IconButton(icon_name='theme:stock-zoom-friends')
|
||||
icon = IconButton(icon_name='theme:stock-zoom-friends',
|
||||
stroke_color=color.BLACK,
|
||||
fill_color=color.WHITE)
|
||||
icon.connect('activated', self._level_clicked_cb, sugar.ZOOM_FRIENDS)
|
||||
self.append(icon)
|
||||
|
||||
icon = IconButton(icon_name='theme:stock-zoom-home')
|
||||
icon = IconButton(icon_name='theme:stock-zoom-home',
|
||||
stroke_color=color.BLACK,
|
||||
fill_color=color.WHITE)
|
||||
icon.connect('activated', self._level_clicked_cb, sugar.ZOOM_HOME)
|
||||
self.append(icon)
|
||||
|
||||
icon = IconButton(icon_name='theme:stock-zoom-activity')
|
||||
icon = IconButton(icon_name='theme:stock-zoom-activity',
|
||||
stroke_color=color.BLACK,
|
||||
fill_color=color.WHITE)
|
||||
icon.connect('activated', self._level_clicked_cb, sugar.ZOOM_ACTIVITY)
|
||||
self.append(icon)
|
||||
|
||||
|
@ -99,4 +99,4 @@ def create_with_uri(service_name, uri):
|
||||
"""Create a new activity and pass the uri as handle."""
|
||||
activity_handle = ActivityHandle(_find_activity_id())
|
||||
activity_handle.uri = uri
|
||||
return ActivityCreationHandler(service_name, handle)
|
||||
return ActivityCreationHandler(service_name, activity_handle)
|
||||
|
@ -47,7 +47,8 @@ class Button(hippo.CanvasBox, hippo.CanvasItem):
|
||||
self._round_box.props.background_color = color.BLACK.get_int()
|
||||
self._round_box.props.padding_top = units.points_to_pixels(1)
|
||||
self._round_box.props.padding_bottom = units.points_to_pixels(1)
|
||||
|
||||
self._round_box.props.spacing = units.points_to_pixels(3)
|
||||
|
||||
self._text_box = hippo.CanvasText()
|
||||
self._text_box.props.font_desc = font.DEFAULT.get_pango_desc()
|
||||
self._text_box.props.color = color.BUTTON_NORMAL.get_int()
|
||||
@ -87,8 +88,8 @@ class Button(hippo.CanvasBox, hippo.CanvasItem):
|
||||
else:
|
||||
self._icon = CanvasIcon(icon_name=value,
|
||||
scale=units.SMALL_ICON_SCALE,
|
||||
fill_color=color.WHITE,
|
||||
stroke_color=color.BLACK)
|
||||
fill_color=color.BLACK,
|
||||
stroke_color=color.WHITE)
|
||||
# Insert icon on the label's left
|
||||
self._round_box.remove_all()
|
||||
self._round_box.append(self._icon)
|
||||
|
@ -102,9 +102,7 @@ class IconButton(CanvasIcon):
|
||||
def prelight(self, enter):
|
||||
if enter:
|
||||
if self._active:
|
||||
self.props.fill_color = color.BLACK
|
||||
self.props.background_color = color.BLACK.get_int()
|
||||
else:
|
||||
if self._active:
|
||||
self.props.fill_color = self._normal_fill_color
|
||||
self.props.background_color = self._normal_background_color
|
||||
|
@ -1,6 +1,6 @@
|
||||
VERSION=0.63
|
||||
DATE=`date +%Y%m%d`
|
||||
RELEASE=2.22
|
||||
RELEASE=2.23
|
||||
TARBALL=sugar-$VERSION-$RELEASE.${DATE}git.tar.bz2
|
||||
|
||||
rm sugar-$VERSION.tar.bz2
|
||||
|
Loading…
Reference in New Issue
Block a user