diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2007-05-21 10:27:47 (GMT) |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2007-05-21 10:27:47 (GMT) |
commit | 8c8dffe662b9b2491eed2e553e3165c827f1c3cc (patch) | |
tree | 1610e49397b81582a225fb25ad2821fba889635c /sugar | |
parent | cd0a2b3ecd3b10cdb60daf5cf1dfc2eec08b9f4c (diff) | |
parent | 11c89d86c91d91de42a815f7715076494c33fa25 (diff) |
Merge commit 'origin' into submit
Diffstat (limited to 'sugar')
-rw-r--r-- | sugar/activity/activity.py | 11 | ||||
-rw-r--r-- | sugar/activity/bundle.py | 8 | ||||
-rw-r--r-- | sugar/datastore/datastore.py | 3 | ||||
-rw-r--r-- | sugar/datastore/dbus_helpers.py | 2 | ||||
-rw-r--r-- | sugar/graphics/canvasicon.py | 2 | ||||
-rw-r--r-- | sugar/graphics/toolbox.py | 14 |
6 files changed, 33 insertions, 7 deletions
diff --git a/sugar/activity/activity.py b/sugar/activity/activity.py index 421d7ba..3dba4c7 100644 --- a/sugar/activity/activity.py +++ b/sugar/activity/activity.py @@ -28,6 +28,7 @@ import gtk, gobject from sugar.presence import presenceservice from sugar.activity.activityservice import ActivityService +from sugar.activity import bundleregistry from sugar.graphics.window import Window from sugar.graphics.toolbox import Toolbox from sugar.graphics.toolbutton import ToolButton @@ -200,13 +201,15 @@ class Activity(Window, gtk.Container): if handle.object_id: self.jobject = datastore.get(handle.object_id) + self.jobject.object_id = '' + del self.jobject['ctime'] + del self.jobject['mtime'] elif create_jobject: logging.debug('Creating a jobject.') self.jobject = datastore.create() self.jobject['title'] = '%s %s' % (get_bundle_name(), 'Activity') self.jobject['activity'] = self.get_service_name() - self.jobject['date'] = str(time.time()) - self.jobject['icon'] = '' + self.jobject['icon'] = self._get_icon() self.jobject['keep'] = '0' self.jobject['buddies'] = '' self.jobject['preview'] = '' @@ -329,6 +332,10 @@ class Activity(Window, gtk.Container): raise self.destroy() + def _get_icon(self): + registry = bundleregistry.get_registry() + return registry.get_bundle(self.get_service_name()).get_icon() + def get_bundle_name(): """Return the bundle name for the current process' bundle """ diff --git a/sugar/activity/bundle.py b/sugar/activity/bundle.py index 98b9e9a..d3c490f 100644 --- a/sugar/activity/bundle.py +++ b/sugar/activity/bundle.py @@ -78,10 +78,14 @@ class Bundle: if cp.has_option(section, 'class'): self._class = cp.get(section, 'class') self._exec = '%s --bundle-path="%s"' % ( - env.get_bin_path(_PYTHON_FACTORY), self.get_path()) + env.get_bin_path(_PYTHON_FACTORY), self._path) elif cp.has_option(section, 'exec'): self._class = None - self._exec = cp.get(section, 'exec') + cmdline = cp.get(section, 'exec') + cmdline = os.path.join(self._path, cmdline) + cmdline = cmdline.replace('$SUGAR_BUNDLE_PATH', self._path) + cmdline = os.path.expandvars(cmdline) + self._exec = cmdline else: self._exec = None self._valid = False diff --git a/sugar/datastore/datastore.py b/sugar/datastore/datastore.py index 99fd230..9d65670 100644 --- a/sugar/datastore/datastore.py +++ b/sugar/datastore/datastore.py @@ -39,6 +39,9 @@ class DSObject(gobject.GObject): self.metadata[key] = value self.emit('updated') + def __delitem__(self, key): + del self.metadata[key] + def get_metadata(self): return self._metadata diff --git a/sugar/datastore/dbus_helpers.py b/sugar/datastore/dbus_helpers.py index 33aa9a6..fa05491 100644 --- a/sugar/datastore/dbus_helpers.py +++ b/sugar/datastore/dbus_helpers.py @@ -40,7 +40,7 @@ def create(properties, filename): return object_id def update(uid, properties, filename, reply_handler=None, error_handler=None): - logging.debug('dbus_helpers.update') + logging.debug('dbus_helpers.update: %s, %s' % (uid, filename)) if reply_handler and error_handler: _data_store.update(uid, dbus.Dictionary(properties), filename, reply_handler=reply_handler, diff --git a/sugar/graphics/canvasicon.py b/sugar/graphics/canvasicon.py index 14f8351..ec141d0 100644 --- a/sugar/graphics/canvasicon.py +++ b/sugar/graphics/canvasicon.py @@ -123,7 +123,7 @@ class _IconCache: del self._icons[evict_key] def get_handle(self, name, fill_color, stroke_color): - if name == None: + if not name: return None if name[0:6] == "theme:": diff --git a/sugar/graphics/toolbox.py b/sugar/graphics/toolbox.py index 17b1b5f..1b7121a 100644 --- a/sugar/graphics/toolbox.py +++ b/sugar/graphics/toolbox.py @@ -34,6 +34,16 @@ class Toolbox(gtk.VBox): self._notebook.set_show_tabs(False) self.pack_start(self._notebook) self._notebook.show() + + def _toolbar_box_expose_cb(self, widget, event): + widget.style.paint_flat_box(widget.window, + gtk.STATE_NORMAL, gtk.SHADOW_NONE, + event.area, widget, 'toolbox', + widget.allocation.x, + widget.allocation.y, + widget.allocation.width, + widget.allocation.height) + return False def add_toolbar(self, name, toolbar): label = gtk.Label(name) @@ -42,7 +52,9 @@ class Toolbox(gtk.VBox): toolbar_box = gtk.HBox() toolbar_box.pack_start(toolbar, True, True, units.grid_to_pixels(1)) - + toolbar_box.set_size_request(-1, units.grid_to_pixels(1)) + toolbar_box.connect('expose-event', self._toolbar_box_expose_cb) + self._notebook.append_page(toolbar_box, label) toolbar_box.show() |