set_state() could be called when there are still no formats.

This commit is contained in:
Tomeu Vizoso 2007-06-07 12:07:25 +01:00
parent fde3159002
commit 340fcc271d
2 changed files with 6 additions and 3 deletions

View File

@ -91,7 +91,10 @@ class ClipboardIcon(CanvasIcon):
def set_state(self, name, percent, icon_name, preview, activity): def set_state(self, name, percent, icon_name, preview, activity):
cb_service = clipboardservice.get_instance() cb_service = clipboardservice.get_instance()
obj = cb_service.get_object(self._object_id) obj = cb_service.get_object(self._object_id)
installable = (obj['FORMATS'][0] == 'application/vnd.olpc-x-sugar') if obj['FORMATS'] and obj['FORMATS'][0] == 'application/vnd.olpc-x-sugar':
installable = True
else:
installable = False
self._name = name self._name = name
self._percent = percent self._percent = percent

View File

@ -46,11 +46,11 @@ class ClipboardPanelWindow(FrameWindow):
self.connect("drag_data_get", self._clipboard_box.drag_data_get_cb) self.connect("drag_data_get", self._clipboard_box.drag_data_get_cb)
def _owner_change_cb(self, clipboard, event): def _owner_change_cb(self, clipboard, event):
logging.debug("owner_change_cb")
if self._clipboard_box.owns_clipboard(): if self._clipboard_box.owns_clipboard():
return return
logging.debug("owner_change_cb")
cb_service = clipboardservice.get_instance() cb_service = clipboardservice.get_instance()
key = cb_service.add_object(name="") key = cb_service.add_object(name="")
cb_service.set_object_percent(key, percent = 100) cb_service.set_object_percent(key, percent = 100)