Refactor startup. In progress, give me a couple hours.

For now start sugar with "sugar-emulator shell/sugar-shell"
This commit is contained in:
Marco Pesenti Gritti
2006-10-16 13:34:43 +02:00
parent a3be4492b2
commit bc0ee6d34c
22 changed files with 108 additions and 428 deletions
+2 -1
View File
@@ -18,6 +18,7 @@ import gtk
import dbus
import conf
from sugar import profile
from sugar.activity import Activity
from sugar.presence import PresenceService
from sugar.graphics.iconcolor import IconColor
@@ -92,7 +93,7 @@ class ActivityHost:
if activity != None:
return IconColor(activity.get_color())
else:
return conf.get_profile().get_color()
return profile.get_color()
def share(self):
self._activity.share()
+19 -14
View File
@@ -14,11 +14,14 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
import gtk
import os
from ConfigParser import ConfigParser
import gtk
from gettext import gettext as _
import conf
from sugar.graphics.iconcolor import IconColor
from sugar import env
class FirstTimeDialog(gtk.Dialog):
def __init__(self):
@@ -37,22 +40,24 @@ class FirstTimeDialog(gtk.Dialog):
self._ok = gtk.Button(None, gtk.STOCK_OK)
self._ok.set_sensitive(False)
self.vbox.pack_start(self._ok)
self._ok.connect('clicked', self.__ok_button_clicked_cb)
self._ok.connect('clicked', self._ok_button_clicked_cb)
self._ok.show()
def _entry_changed_cb(self, entry):
valid = (len(entry.get_text()) > 0)
self._ok.set_sensitive(valid)
def __ok_button_clicked_cb(self, button):
profile = conf.get_profile()
profile.set_nick_name(self._entry.get_text())
self.destroy()
def _ok_button_clicked_cb(self, button):
cp = ConfigParser()
def get_profile():
profile = conf.get_profile()
if profile.get_nick_name() == None:
dialog = FirstTimeDialog()
dialog.connect('destroy', self.__first_time_dialog_destroy_cb)
dialog.show()
return profile
section = 'Buddy'
cp.add_section(section)
cp.set(section, 'NickName', self._entry.get_text())
cp.set(section, 'Color', IconColor().to_string())
config_path = os.path.join(env.get_profile_path(), 'config')
fileobject = open(config_path, 'w')
cp.write(fileobject)
fileobject.close()
self.destroy()
+1 -2
View File
@@ -15,10 +15,9 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
from sugar.graphics.canvasicon import CanvasIcon
import conf
from sugar import profile
class MyIcon(CanvasIcon):
def __init__(self):
profile = conf.get_profile()
CanvasIcon.__init__(self, icon_name='stock-buddy',
color=profile.get_color())