Merge branch 'master' of git+ssh://dev.laptop.org/git/sugar
This commit is contained in:
@@ -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
|
||||
"""
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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:":
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user