sugar-toolkit-gtk3/services/clipboard/clipboardobject.py
Dan Williams 8b4ccf3eb1 Cleanup clipboard D-Bus API
- The clipboard now determines each objects unique id and
    returns it from add_object()
- The ID is opaque to the client and should not be used/accessed
    other than with the clipboard service
- Add object type hints for dbus-python
- Sugar clipboard bindings for get_object() now return a dict rather
    than a tuple
- ClipboardIcon now retrieves the real file path and uses that
    to open the file
- Adapt sugar bits to clipboard changes
2007-03-14 00:50:06 -04:00

57 lines
1.3 KiB
Python

import typeregistry
class ClipboardObject:
def __init__(self, object_path, name):
self._id = object_path
self._name = name
self._percent = 0
self._formats = {}
def get_id(self):
return self._id
def _get_type_info(self):
type_registry = typeregistry.get_instance()
return type_registry.get_type(self._formats)
def get_name(self):
if self._name:
return self._name
else:
return self._get_type_info().get_name()
def get_icon(self):
return self._get_type_info().get_icon()
def get_preview(self):
return self._get_type_info().get_preview()
def get_activity(self):
return self._get_type_info().get_activity()
def get_percent(self):
return self._percent
def set_percent(self, percent):
self._percent = percent
def add_format(self, format):
self._formats[format.get_type()] = format
def get_formats(self):
return self._formats
class Format:
def __init__(self, type, data, on_disk):
self._type = type
self._data = data
self._on_disk = on_disk
def get_type(self):
return self._type
def get_data(self):
return self._data