Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell/intro
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2007-02-27 20:03:25 (GMT)
committer Dan Williams <dcbw@redhat.com>2007-02-27 20:03:25 (GMT)
commit8a53a31c49f0a8fd04631273aae80634a15f2431 (patch)
tree34c96892b52ed435203ca20f9586258fe049762b /shell/intro
parentf5051b7c14cdd7990387cb3aaa98119fe522c5fe (diff)
Have IntroWindow handle profile creation so it can hide itself before generating keys
Diffstat (limited to 'shell/intro')
-rw-r--r--shell/intro/intro.py57
1 files changed, 36 insertions, 21 deletions
diff --git a/shell/intro/intro.py b/shell/intro/intro.py
index 66f4b84..327f052 100644
--- a/shell/intro/intro.py
+++ b/shell/intro/intro.py
@@ -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,10 +229,34 @@ 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()
+ self.emit('ok', pixbuf, name, color)
+
+
+class IntroWindow(gtk.Window):
+ def __init__(self):
+ gtk.Window.__init__(self)
+ self.set_default_size(gtk.gdk.screen_width(),
+ gtk.gdk.screen_height())
+ self.realize()
+ self.window.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DESKTOP)
+
+ self._canvas = hippo.Canvas()
+ self._intro_box = IntroBox(background_color=0x000000ff,
+ yalign=hippo.ALIGNMENT_START,
+ 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
@@ -244,7 +275,7 @@ class IntroBox(hippo.CanvasBox, hippo.CanvasItem):
if not cp.has_section(section):
cp.add_section(section)
cp.set(section, 'Server', 'olpc.collabora.co.uk')
- cp.set(Section, 'Registered', 'False')
+ cp.set(section, 'Registered', 'False')
config_path = os.path.join(env.get_profile_path(), 'config')
f = open(config_path, 'w')
@@ -259,24 +290,8 @@ class IntroBox(hippo.CanvasBox, hippo.CanvasItem):
if s != 0:
logging.error("Could not generate key pair: %d" % s)
-
-class IntroWindow(gtk.Window):
- def __init__(self):
- gtk.Window.__init__(self)
- self.set_default_size(gtk.gdk.screen_width(),
- gtk.gdk.screen_height())
- self.realize()
- self.window.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DESKTOP)
-
- self._canvas = hippo.Canvas()
- self._intro_box = IntroBox(background_color=0x000000ff,
- yalign=hippo.ALIGNMENT_START,
- padding_top=units.grid_to_pixels(2),
- padding_left=units.grid_to_pixels(3),
- padding_right=units.grid_to_pixels(3))
- self._canvas.set_root(self._intro_box)
- self.add(self._canvas)
- self._canvas.show()
+ gtk.main_quit()
+ return False
if __name__ == "__main__":