Merge branch 'master' of git+ssh://dev.laptop.org/git/sugar
This commit is contained in:
commit
e60e86c06a
@ -114,7 +114,14 @@ class ClipboardIcon(CanvasIcon):
|
|||||||
formats = obj['FORMATS']
|
formats = obj['FORMATS']
|
||||||
if len(formats) > 0:
|
if len(formats) > 0:
|
||||||
path = cb_service.get_object_data(self._object_id, formats[0])
|
path = cb_service.get_object_data(self._object_id, formats[0])
|
||||||
if os.path.exists(path):
|
|
||||||
|
# FIXME: would be better to check for format.onDisk
|
||||||
|
try:
|
||||||
|
path_exists = os.path.exists(path)
|
||||||
|
except TypeError:
|
||||||
|
path_exists = False
|
||||||
|
|
||||||
|
if path_exists:
|
||||||
activityfactory.create_with_uri(self._activity, path)
|
activityfactory.create_with_uri(self._activity, path)
|
||||||
else:
|
else:
|
||||||
logging.debug("Clipboard item file path %s didn't exist" % path)
|
logging.debug("Clipboard item file path %s didn't exist" % path)
|
||||||
|
@ -30,6 +30,7 @@ from view.frame.framepopupcontext import FramePopupContext
|
|||||||
from model.ShellModel import ShellModel
|
from model.ShellModel import ShellModel
|
||||||
from sugar.graphics import animator
|
from sugar.graphics import animator
|
||||||
from sugar.graphics import units
|
from sugar.graphics import units
|
||||||
|
from sugar.clipboard import clipboardservice
|
||||||
|
|
||||||
MODE_NONE = 0
|
MODE_NONE = 0
|
||||||
MODE_MOUSE = 1
|
MODE_MOUSE = 1
|
||||||
@ -156,6 +157,9 @@ class Frame(object):
|
|||||||
screen = gtk.gdk.screen_get_default()
|
screen = gtk.gdk.screen_get_default()
|
||||||
screen.connect('size-changed', self._size_changed_cb)
|
screen.connect('size-changed', self._size_changed_cb)
|
||||||
|
|
||||||
|
cb_service = clipboardservice.get_instance()
|
||||||
|
cb_service.connect_after('object-added', self._clipboard_object_added_cb)
|
||||||
|
|
||||||
self._key_listener = _KeyListener(self)
|
self._key_listener = _KeyListener(self)
|
||||||
self._mouse_listener = _MouseListener(self)
|
self._mouse_listener = _MouseListener(self)
|
||||||
|
|
||||||
@ -297,7 +301,12 @@ class Frame(object):
|
|||||||
|
|
||||||
def _size_changed_cb(self, screen):
|
def _size_changed_cb(self, screen):
|
||||||
self._update_position()
|
self._update_position()
|
||||||
|
|
||||||
|
def _clipboard_object_added_cb(self, cb_service, object_id, name):
|
||||||
|
if not self.visible:
|
||||||
|
self.show()
|
||||||
|
gobject.timeout_add(2000, lambda: self.hide())
|
||||||
|
|
||||||
def _popup_context_activated_cb(self, popup_context):
|
def _popup_context_activated_cb(self, popup_context):
|
||||||
self._mouse_listener.mouse_enter()
|
self._mouse_listener.mouse_enter()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user