Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/extensions/cpsection/aboutme
diff options
context:
space:
mode:
authorSimon Schampijer <erikos@localhost.localdomain>2008-10-11 16:19:59 (GMT)
committer Simon Schampijer <erikos@localhost.localdomain>2008-10-11 16:19:59 (GMT)
commit8361ca82ae89ce8b038a4faa8274b2b88cfe81a6 (patch)
treed89a24023f019235a88c104b10fa6a2291bd82c8 /extensions/cpsection/aboutme
parent38cb73f56dd83c58252a27ace7b067109cefa311 (diff)
Use gconf for the profile
Diffstat (limited to 'extensions/cpsection/aboutme')
-rw-r--r--extensions/cpsection/aboutme/__init__.py7
-rw-r--r--extensions/cpsection/aboutme/model.py35
-rw-r--r--extensions/cpsection/aboutme/view.py25
3 files changed, 29 insertions, 38 deletions
diff --git a/extensions/cpsection/aboutme/__init__.py b/extensions/cpsection/aboutme/__init__.py
index b683e28..98843e1 100644
--- a/extensions/cpsection/aboutme/__init__.py
+++ b/extensions/cpsection/aboutme/__init__.py
@@ -15,11 +15,14 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
from gettext import gettext as _
-from sugar import profile
+import gconf
+
+from sugar.graphics.xocolor import XoColor
CLASS = 'AboutMe'
ICON = 'module-about_me'
TITLE = _('About Me')
-COLOR = profile.get_color()
+client = gconf.client_get_default()
+COLOR = XoColor(client.get_string('/desktop/sugar/user/color'))
diff --git a/extensions/cpsection/aboutme/model.py b/extensions/cpsection/aboutme/model.py
index 3818792..8500799 100644
--- a/extensions/cpsection/aboutme/model.py
+++ b/extensions/cpsection/aboutme/model.py
@@ -16,9 +16,7 @@
#
from gettext import gettext as _
-
-from sugar import profile
-from sugar.graphics.xocolor import XoColor
+import gconf
_COLORS = {'red': {'dark':'#b20008', 'medium':'#e6000a', 'light':'#ffadce'},
'orange': {'dark':'#9a5200', 'medium':'#c97e00', 'light':'#ffc169'},
@@ -31,7 +29,8 @@ _COLORS = {'red': {'dark':'#b20008', 'medium':'#e6000a', 'light':'#ffadce'},
_MODIFIERS = ('dark', 'medium', 'light')
def get_nick():
- return profile.get_nick_name()
+ client = gconf.client_get_default()
+ return client.get_string("/desktop/sugar/user/nick")
def print_nick():
print get_nick()
@@ -42,18 +41,18 @@ def set_nick(nick):
"""
if not nick:
raise ValueError(_("You must enter a name."))
- pro = profile.get_profile()
if not isinstance(nick, unicode):
nick = unicode(nick, 'utf-8')
- pro.nick_name = nick
- pro.save()
+ client = gconf.client_get_default()
+ client.set_string("/desktop/sugar/user/nick", nick)
return 1
-def get_color():
- return profile.get_color()
+def get_color():
+ client = gconf.client_get_default()
+ return client.get_string("/desktop/sugar/user/color")
def print_color():
- color_string = get_color().to_string()
+ color_string = get_color()
tmp = color_string.split(',')
stroke_tuple = None
@@ -98,19 +97,19 @@ def set_color(stroke, fill, stroke_modifier='medium', fill_modifier='medium'):
color = _COLORS[stroke][stroke_modifier] + ',' \
+ _COLORS[fill][fill_modifier]
- pro = profile.get_profile()
- pro.color = XoColor(color)
- pro.save()
+
+ client = gconf.client_get_default()
+ client.set_string("/desktop/sugar/user/color", color)
return 1
-def get_color_xo():
- return profile.get_color()
+def get_color_xo():
+ client = gconf.client_get_default()
+ return client.get_string("/desktop/sugar/user/color")
def set_color_xo(color):
"""Set a color with an XoColor
This method is used by the graphical user interface
"""
- pro = profile.get_profile()
- pro.color = color
- pro.save()
+ client = gconf.client_get_default()
+ client.set_string("/desktop/sugar/user/color", color)
return 1
diff --git a/extensions/cpsection/aboutme/view.py b/extensions/cpsection/aboutme/view.py
index fc4f351..cabd66a 100644
--- a/extensions/cpsection/aboutme/view.py
+++ b/extensions/cpsection/aboutme/view.py
@@ -21,16 +21,10 @@ from gettext import gettext as _
from sugar.graphics.icon import Icon
from sugar.graphics import style
from sugar.graphics.xocolor import XoColor
-from sugar import profile
from jarabe.controlpanel.sectionview import SectionView
from jarabe.controlpanel.inlinealert import InlineAlert
-CLASS = 'AboutMe'
-ICON = 'module-about_me'
-COLOR = profile.get_color()
-TITLE = _('About Me')
-
class EventIcon(gtk.EventBox):
__gtype_name__ = "SugarEventIcon"
def __init__(self, **kwargs):
@@ -49,7 +43,7 @@ class ColorPicker(EventIcon):
__gsignals__ = {
'color-changed': (gobject.SIGNAL_RUN_FIRST,
gobject.TYPE_NONE,
- ([object]))
+ ([str]))
}
def __init__(self, xocolor=None):
EventIcon.__init__(self)
@@ -64,7 +58,7 @@ class ColorPicker(EventIcon):
def _set_random_colors(self):
xocolor = XoColor()
self.icon.props.xo_color = xocolor
- self.emit('color-changed', xocolor)
+ self.emit('color-changed', xocolor.to_string())
class AboutMe(SectionView):
def __init__(self, model, alerts):
@@ -160,7 +154,8 @@ class AboutMe(SectionView):
def setup(self):
self._nick_entry.set_text(self._model.get_nick())
- self._color_picker.icon.props.xo_color = self._model.get_color_xo()
+ color = XoColor(self._model.get_color_xo())
+ self._color_picker.icon.props.xo_color = color
self._color_valid = True
self._nick_valid = True
@@ -198,13 +193,12 @@ class AboutMe(SectionView):
self._model.set_nick(widget.get_text())
except ValueError, detail:
self._nick_alert.props.msg = detail
- self._nick_valid = False
+ self._nick_valid = False
else:
self._nick_alert.props.msg = self.restart_msg
- self._nick_valid = True
+ self._nick_valid = True
self.needs_restart = True
self.restart_alerts.append('nick')
-
self._validate()
self._nick_alert.show()
return False
@@ -218,9 +212,4 @@ class AboutMe(SectionView):
self._validate()
self._color_alert.show()
-
-
-
-
-
-
+ return False