def __init__(self): self._interfaces = set([ CLIENT, CLIENT_HANDLER, CLIENT_INTERFACE_REQUESTS, PROPERTIES_IFACE, CLIENT_APPROVER ]) bus = dbus.Bus() bus_name = dbus.service.BusName(SUGAR_CLIENT_SERVICE, bus=bus) dbus.service.Object.__init__(self, bus_name, SUGAR_CLIENT_PATH) DBusProperties.__init__(self) self._implement_property_get( CLIENT, { 'Interfaces': lambda: list(self._interfaces), }) self._implement_property_get( CLIENT_HANDLER, { 'HandlerChannelFilter': self.__get_filters_handler_cb, }) self._implement_property_get( CLIENT_APPROVER, { 'ApproverChannelFilter': self.__get_filters_approver_cb, }) self.got_channel = dispatch.Signal() self.got_dispatch_operation = dispatch.Signal()
def __init__(self): bus = dbus.SessionBus() bus_name = dbus.service.BusName(_DBUS_SERVICE, bus=bus) dbus.service.Object.__init__(self, bus_name, _DBUS_PATH) self._notification_counter = 0 self.notification_received = dispatch.Signal() self.notification_cancelled = dispatch.Signal()
def __init__(self, query, page_size): self._total_count = -1 self._position = -1 self._query = query self._page_size = page_size self._offset = 0 self._cache = _Cache() self.ready = dispatch.Signal() self.progress = dispatch.Signal()
def __init__(self): client = gconf.client_get_default() self._layout = client.get_string(self._FAVORITES_KEY) logging.debug('FavoritesSetting layout %r', self._layout) self._mode = None self.changed = dispatch.Signal()
def __init__(self): self._bus = dbus.SystemBus() dbus.service.Object.__init__(self, self._bus, NM_SECRET_AGENT_PATH) self.secrets_request = dispatch.Signal() proxy = self._bus.get_object(NM_IFACE, NM_AGENT_MANAGER_PATH) proxy.Register("org.sugarlabs.sugar", dbus_interface=NM_AGENT_MANAGER_IFACE, reply_handler=self._register_reply_cb, error_handler=self._register_error_cb)
def __init__(self): gobject.GObject.__init__(self) self._screen = wnck.screen_get_default() self._screen.connect('window-opened', self._window_opened_cb) self._screen.connect('window-closed', self._window_closed_cb) self._screen.connect('active-window-changed', self._active_window_changed_cb) self.zoom_level_changed = dispatch.Signal() self._desktop_level = self.ZOOM_HOME self._zoom_level = self.ZOOM_HOME self._current_activity = None self._activities = [] self._shared_activities = {} self._active_activity = None self._tabbing_activity = None self._launchers = {} self._screen.toggle_showing_desktop(True)
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA import gconf from sugar import env from sugar import _sugarext from sugar import dispatch VOLUME_STEP = 10 muted_changed = dispatch.Signal() volume_changed = dispatch.Signal() _volume = _sugarext.VolumeAlsa() def get_muted(): return _volume.get_mute() def get_volume(): return _volume.get_volume() def set_volume(new_volume): old_volume = _volume.get_volume()
def __datastore_created_cb(object_id): metadata = _get_data_store().get_properties(object_id, byte_arrays=True) updated.send(None, object_id=object_id, metadata=metadata) def __datastore_updated_cb(object_id): metadata = _get_data_store().get_properties(object_id, byte_arrays=True) updated.send(None, object_id=object_id, metadata=metadata) def __datastore_deleted_cb(object_id): deleted.send(None, object_id=object_id) created = dispatch.Signal() deleted = dispatch.Signal() updated = dispatch.Signal() _get_data_store() class DSMetadata(gobject.GObject): """A representation of the metadata associated with a DS entry.""" __gsignals__ = { 'updated': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ([])), } def __init__(self, properties=None): gobject.GObject.__init__(self) if not properties:
FT_STATE_COMPLETED = 4 FT_STATE_CANCELLED = 5 FT_REASON_NONE = 0 FT_REASON_REQUESTED = 1 FT_REASON_LOCAL_STOPPED = 2 FT_REASON_REMOTE_STOPPED = 3 FT_REASON_LOCAL_ERROR = 4 FT_REASON_LOCAL_ERROR = 5 FT_REASON_REMOTE_ERROR = 6 # FIXME: use constants from tp-python once the spec is undrafted CHANNEL_TYPE_FILE_TRANSFER = \ 'org.freedesktop.Telepathy.Channel.Type.FileTransfer' new_file_transfer = dispatch.Signal() # TODO Move to use splice_async() in Sugar 0.88 class StreamSplicer(gobject.GObject): _CHUNK_SIZE = 10240 # 10K __gsignals__ = { 'finished': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ([])), } def __init__(self, input_stream, output_stream): gobject.GObject.__init__(self) self._input_stream = input_stream self._output_stream = output_stream self._pending_buffers = []