diff options
author | Sascha Silbe <silbe@activitycentral.com> | 2011-03-12 17:44:09 (GMT) |
---|---|---|
committer | Sascha Silbe <silbe@activitycentral.com> | 2011-03-12 17:44:09 (GMT) |
commit | db56ac4562a9ab10308de0998b56262956f51b64 (patch) | |
tree | e9ea3923a6203538480822593354146c01d1341b /src/jarabe/intro | |
parent | 8cd75e783fec952497eda68ae06e00323a4c179b (diff) | |
parent | ff47b24c5aa032f830c6f3dc3ae32dfed3c72229 (diff) |
Merge commit 'refs/top-bases/t/bug-1755' into t/bug-1755t/bug-1755
* commit 'refs/top-bases/t/bug-1755': (261 commits)
Fix up style issues introduced by commit 3f8a1e1
Don't set default timezone
Restore setting a language with the command line OLPC #10681
battery frame device: replace HAL with UPower
use ConsoleKit instead of HAL for shutdown/reboot
fix recognition of JEBs outside of data store
Adjust the year in the licence visible in the control panel
Handle activities that cycle through windows dlo#10695
Speaker frame device: pop up palette on left-click instead of toggling mute
recognise translations using pgettext
Remove last few pieces of buddy-icon.jpg handling
fix whitespace error introduced by 4b6a534 (revert of 4a3416b)
Commit from Sugar Labs: Translation System by user RafaelOrtiz.: 374 of 374 messages translated (0 fuzzy).
Intro: Fall back to user name if GECOS real name field is empty
Sugar Ad-hoc icons show in search results when connect/disconnect to AP OLPC #10412
Show busy cursor during session shutdown
Show free space for the Journal in the Journal volumes toolbar (SL#2318)
Fix incorrect logging level for warning about missing GSM configuration
simplify extension loading exception error
Revert "Add cpu and memory resource indicator to frame" as agreed on with erikos. Scheduling for inclusion in 0.94 after potential artwork changes based on feedback from the Design Team.
...
Conflicts:
src/jarabe/util/emulator.py
Diffstat (limited to 'src/jarabe/intro')
-rw-r--r-- | src/jarabe/intro/Makefile.am | 4 | ||||
-rw-r--r-- | src/jarabe/intro/__init__.py | 1 | ||||
-rw-r--r-- | src/jarabe/intro/colorpicker.py | 1 | ||||
-rw-r--r-- | src/jarabe/intro/default-picture.png | bin | 10442 -> 0 bytes | |||
-rw-r--r-- | src/jarabe/intro/window.py | 50 |
5 files changed, 25 insertions, 31 deletions
diff --git a/src/jarabe/intro/Makefile.am b/src/jarabe/intro/Makefile.am index a9fb96b..2ea7cea 100644 --- a/src/jarabe/intro/Makefile.am +++ b/src/jarabe/intro/Makefile.am @@ -1,7 +1,3 @@ -imagedir = $(pythondir)/jarabe/intro -image_DATA = default-picture.png - -EXTRA_DIST = $(conf_DATA) $(image_DATA) sugardir = $(pythondir)/jarabe/intro sugar_PYTHON = \ __init__.py \ diff --git a/src/jarabe/intro/__init__.py b/src/jarabe/intro/__init__.py index ca4f64d..d2932f1 100644 --- a/src/jarabe/intro/__init__.py +++ b/src/jarabe/intro/__init__.py @@ -8,6 +8,7 @@ from sugar.profile import get_profile from jarabe.intro.window import IntroWindow from jarabe.intro.window import create_profile + def check_profile(): profile = get_profile() diff --git a/src/jarabe/intro/colorpicker.py b/src/jarabe/intro/colorpicker.py index a939857..997199b 100644 --- a/src/jarabe/intro/colorpicker.py +++ b/src/jarabe/intro/colorpicker.py @@ -20,6 +20,7 @@ from sugar.graphics.icon import CanvasIcon from sugar.graphics import style from sugar.graphics.xocolor import XoColor + class ColorPicker(hippo.CanvasBox, hippo.CanvasItem): def __init__(self, **kwargs): hippo.CanvasBox.__init__(self, **kwargs) diff --git a/src/jarabe/intro/default-picture.png b/src/jarabe/intro/default-picture.png Binary files differdeleted file mode 100644 index e26b9b0..0000000 --- a/src/jarabe/intro/default-picture.png +++ /dev/null diff --git a/src/jarabe/intro/window.py b/src/jarabe/intro/window.py index 35c0cda..df19fbf 100644 --- a/src/jarabe/intro/window.py +++ b/src/jarabe/intro/window.py @@ -32,38 +32,34 @@ from sugar.graphics.xocolor import XoColor from jarabe.intro import colorpicker + _BACKGROUND_COLOR = style.COLOR_WHITE -def create_profile(name, color=None, pixbuf=None): - if not pixbuf: - path = os.path.join(os.path.dirname(__file__), 'default-picture.png') - pixbuf = gtk.gdk.pixbuf_new_from_file(path) +def create_profile(name, color=None): if not color: color = XoColor() - icon_path = os.path.join(env.get_profile_path(), "buddy-icon.jpg") - pixbuf.save(icon_path, "jpeg", {"quality":"85"}) - client = gconf.client_get_default() - client.set_string("/desktop/sugar/user/nick", name) - client.set_string("/desktop/sugar/user/color", color.to_string()) + client.set_string('/desktop/sugar/user/nick', name) + client.set_string('/desktop/sugar/user/color', color.to_string()) + client.suggest_sync() # Generate keypair import commands - keypath = os.path.join(env.get_profile_path(), "owner.key") + keypath = os.path.join(env.get_profile_path(), 'owner.key') if not os.path.isfile(keypath): 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", s, o) + logging.error('Could not generate key pair: %d %s', s, o) else: - logging.error("Keypair exists, skip generation.") + logging.error('Keypair exists, skip generation.') + class _Page(hippo.CanvasBox): __gproperties__ = { - 'valid' : (bool, None, None, False, - gobject.PARAM_READABLE) + 'valid': (bool, None, None, False, gobject.PARAM_READABLE), } def __init__(self, **kwargs): @@ -81,6 +77,7 @@ class _Page(hippo.CanvasBox): def activate(self): pass + class _NamePage(_Page): def __init__(self, intro): _Page.__init__(self, xalign=hippo.ALIGNMENT_CENTER, @@ -90,7 +87,7 @@ class _NamePage(_Page): self._intro = intro - label = hippo.CanvasText(text=_("Name:")) + label = hippo.CanvasText(text=_('Name:')) self.append(label) self._entry = CanvasEntry(box_width=style.zoom(300)) @@ -118,6 +115,7 @@ class _NamePage(_Page): def activate(self): self._entry.props.widget.grab_focus() + class _ColorPage(_Page): def __init__(self, **kwargs): _Page.__init__(self, xalign=hippo.ALIGNMENT_CENTER, @@ -125,7 +123,7 @@ class _ColorPage(_Page): spacing=style.DEFAULT_SPACING, yalign=hippo.ALIGNMENT_CENTER, **kwargs) - self._label = hippo.CanvasText(text=_("Click to change color:"), + self._label = hippo.CanvasText(text=_('Click to change color:'), xalign=hippo.ALIGNMENT_CENTER) self.append(self._label) @@ -138,10 +136,11 @@ class _ColorPage(_Page): def get_color(self): return self._cp.get_color() + class _IntroBox(hippo.CanvasBox): __gsignals__ = { 'done': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, - ([gobject.TYPE_PYOBJECT, gobject.TYPE_PYOBJECT])) + ([gobject.TYPE_PYOBJECT, gobject.TYPE_PYOBJECT])), } PAGE_NAME = 0 @@ -166,13 +165,9 @@ class _IntroBox(hippo.CanvasBox): self._page = self.PAGE_COLOR if default_nick == 'system': pwd_entry = pwd.getpwuid(os.getuid()) - if pwd_entry.pw_gecos: - nick = pwd_entry.pw_gecos.split(',')[0] - self._name_page.set_name(nick) - else: - self._name_page.set_name(pwd_entry.pw_name) - else: - self._name_page.set_name(default_nick) + default_nick = (pwd_entry.pw_gecos.split(',')[0] or + pwd_entry.pw_name) + self._name_page.set_name(default_nick) self._setup_page() @@ -255,6 +250,7 @@ class _IntroBox(hippo.CanvasBox): self.emit('done', name, color) + class IntroWindow(gtk.Window): def __init__(self): gtk.Window.__init__(self) @@ -282,16 +278,16 @@ class IntroWindow(gtk.Window): return False def __key_press_cb(self, widget, event): - if gtk.gdk.keyval_name(event.keyval) == "Return": + if gtk.gdk.keyval_name(event.keyval) == 'Return': self._intro_box.next() return True - elif gtk.gdk.keyval_name(event.keyval) == "Escape": + elif gtk.gdk.keyval_name(event.keyval) == 'Escape': self._intro_box.back() return True return False -if __name__ == "__main__": +if __name__ == '__main__': w = IntroWindow() w.show() w.connect('destroy', gtk.main_quit) |