def _new_tube_cb(self, id, initiator, type, service, params, state): """ Create a new tube. """ debug_output( 'New tube: ID=%d initator=%d type=%d service=%s \ params=%r state=%d' % (id, initiator, type, service, params, state), self._tw.running_sugar) if (type == telepathy.TUBE_TYPE_DBUS and service == SERVICE): if state == telepathy.TUBE_STATE_LOCAL_PENDING: self.tubes_chan[telepathy.CHANNEL_TYPE_TUBES]\ .AcceptDBusTube(id) tube_conn = TubeConnection( self.conn, self.tubes_chan[telepathy.CHANNEL_TYPE_TUBES], id, group_iface=self.text_chan[telepathy.CHANNEL_INTERFACE_GROUP]) # We'll use a chat tube to send serialized stacks back and forth. self.chattube = ChatTube(tube_conn, self.initiating, self.event_received_cb) # Now that we have the tube, we can ask for the turtle dictionary. if self.waiting_for_turtles: # A joiner must wait for turtles. debug_output('Sending a request for the turtle dictionary', self._tw.running_sugar) # We need to send our own nick, colors, and turtle position colors = self._get_colors() event = 't|' + data_to_string([self._get_nick(), colors]) debug_output(event, self._tw.running_sugar) self.send_event(event)
def _new_tube_cb(id, initiator, type, service, params, state): log.debug( 'New tube: ID=%d initator=%d type=%d service=%s ' 'params=%r state=%d', id, initiator, type, service, params, state) if (type == telepathy.TUBE_TYPE_DBUS and service == SERVICE): if state == telepathy.TUBE_STATE_LOCAL_PENDING: tubes_chan[telepathy.CHANNEL_TYPE_TUBES].AcceptDBusTube(id) tube_conn = TubeConnection( conn, tubes_chan[telepathy.CHANNEL_TYPE_TUBES], id, group_iface=text_chan[telepathy.CHANNEL_INTERFACE_GROUP])
def _new_tube_cb(self, id, initiator, type, service, params, state): if (type == telepathy.TUBE_TYPE_DBUS and service == SERVICE): if state == telepathy.TUBE_STATE_LOCAL_PENDING: self.tubes_chan[telepathy.CHANNEL_TYPE_TUBES].AcceptDBusTube( id) # Create Tube Connection tube_conn = TubeConnection( self.conn, self.tubes_chan[telepathy.CHANNEL_TYPE_TUBES], id, group_iface=self.tubes_chan[telepathy.CHANNEL_INTERFACE_GROUP]) self.controlTube = TubeSpeak(tube_conn, self.__activity.net_cb)
def _new_tube_cb(self, id, initiator, type, service, params, state): logging.debug( 'New tube: ID=%d initator=%d type=%d service=%s ' 'params=%r state=%d', id, initiator, type, service, params, state) if (type == telepathy.TUBE_TYPE_DBUS and service == NRLTube.SERVICE): if state == telepathy.TUBE_STATE_LOCAL_PENDING: self.tubes_chan[telepathy.CHANNEL_TYPE_TUBES].AcceptDBusTube( id) tube_conn = TubeConnection( self.conn, self.tubes_chan[telepathy.CHANNEL_TYPE_TUBES], id, group_iface=self.text_chan[telepathy.CHANNEL_INTERFACE_GROUP]) self.newsreader_tube = NRLTube.NRLTube(self, tube_conn, self.initiating, self._get_buddy)
def _new_tube_cb(self, id, initiator, type, service, params, state): self._logger.debug( 'New tube: ID=%d initator=%d type=%d service=%s ' 'params=%r state=%d', id, initiator, type, service, params, state) if (type == telepathy.TUBE_TYPE_DBUS and service == SERVICE): if state == telepathy.TUBE_STATE_LOCAL_PENDING: self.tubes_chan[telepathy.CHANNEL_TYPE_TUBES].AcceptDBusTube( id) tube_conn = TubeConnection( self.conn, self.tubes_chan[telepathy.CHANNEL_TYPE_TUBES], id, group_iface=self.text_chan[telepathy.CHANNEL_INTERFACE_GROUP]) self.cmdtube = CanvasSync(tube_conn, self.initiating, self.process_cmd_cb, self._get_buddy, self._scribblewidget)
def _new_tube_cb(self, id, initiator, type, service, params, state): self.logger.debug( 'New tube: ID=%d initator=%d type=%d service=%s ' 'params=%r state=%d', id, initiator, type, service, params, state) if (type == telepathy.TUBE_TYPE_DBUS and service == self.dbus_name): if state == telepathy.TUBE_STATE_LOCAL_PENDING: self.tubes_chan[telepathy.CHANNEL_TYPE_TUBES].AcceptDBusTube( id) tube_conn = TubeConnection( self.conn, self.tubes_chan[telepathy.CHANNEL_TYPE_TUBES], id, group_iface=self.text_chan[telepathy.CHANNEL_INTERFACE_GROUP]) self.tubebox.insert_tube(tube_conn, self.initiating) self._sharing_completed = True if self._readfile_completed and not self.initialized: self._initialize_display()
def new_tube_cb(id, initiator, type, service, params, state): log.debug("New_tube_cb called: %s %s %s" % (id, initiator, type)) if (type == telepathy.TUBE_TYPE_DBUS and service == DBUS_SERVICE): if state == telepathy.TUBE_STATE_LOCAL_PENDING: channel = tubes_chan[telepathy.CHANNEL_TYPE_TUBES] if hasattr(channel, 'AcceptDBusTube'): channel.AcceptDBusTube(id) else: channel.AcceptTube(id) tube_conn = TubeConnection( conn, tubes_chan[telepathy.CHANNEL_TYPE_TUBES], id, group_iface=text_chan[telepathy.CHANNEL_INTERFACE_GROUP]) global pygametubes, initiating pygametubes.append(PygameTube(tube_conn, initiating, len(pygametubes)))
def _new_tube_cb(self, id, initiator, type, service, params, state): logger.debug( 'New tube: ID=%d initator=%d type=%d service=%s params=%r state=%d', id, initiator, type, service, params, state) if type != telepathy.TUBE_TYPE_DBUS or service != constants.DBUS_SERVICE: return if state == telepathy.TUBE_STATE_LOCAL_PENDING: self._tubes_channel.AcceptDBusTube(id) tube_connection = TubeConnection(self._connection, self._tubes_channel, id, group_iface=self._text_channel) self._tube = RecordTube(tube_connection) self._tube.connect("new-recd", self._new_recd_cb) self._tube.connect("recd-request", self._recd_request_cb) self._tube.connect("recd-bits-arrived", self._recd_bits_arrived_cb) self._tube.connect("recd-unavailable", self._recd_unavailable_cb)
def _new_tube_cb(self, id, initiator, type, service, params, state): """ Create a new tube. """ print('New tube: ID=%d initator=%d type=%d service=%s params=%r \ state=%d' % (id, initiator, type, service, params, state)) if (type == telepathy.TUBE_TYPE_DBUS and service == SERVICE): if state == telepathy.TUBE_STATE_LOCAL_PENDING: self.tubes_chan[ \ telepathy.CHANNEL_TYPE_TUBES].AcceptDBusTube(id) tube_conn = TubeConnection(self.conn, self.tubes_chan[telepathy.CHANNEL_TYPE_TUBES], id, \ group_iface=self.text_chan[telepathy.CHANNEL_INTERFACE_GROUP]) self.chattube = ChatTube(tube_conn, self.initiating, \ self.event_received_cb) # Let the sharer know joiner is waiting for a hand. if self.waiting_for_hand: self.send_event('j|%s' % (json_dump([self.nick, self.colors])))
def _new_tube_cb(self, id, initiator, type, service, params, state): '''Callback for when we have a Tube.''' logging.debug( 'New tube: ID=%d initator=%d type=%d service=%s params=%r state=%d', id, initiator, type, service, params, state) if (type == telepathy.TUBE_TYPE_DBUS and service == MESH_SERVICE): if state == telepathy.TUBE_STATE_LOCAL_PENDING: self.tubes_chan[telepathy.CHANNEL_TYPE_TUBES].AcceptDBusTube( id) tube_conn = TubeConnection( self.__telepathy_connection, self.tubes_chan[telepathy.CHANNEL_TYPE_TUBES], id, group_iface=self.text_chan[telepathy.CHANNEL_INTERFACE_GROUP]) logging.info('Starting a new JokeMachineSession') self.__session = JokeMachineSession(tube_conn, self.__telepathy_initiating, self._get_buddy, self)
def _new_tube_cb(self, id, initiator, type, service, params, state): logger.debug( 'New tube: ID=%d initator=%d type=%d service=%s ' 'params=%r state=%d', id, initiator, type, service, params, state) if (type == telepathy.TUBE_TYPE_DBUS and service == self.service): if state == telepathy.TUBE_STATE_LOCAL_PENDING: self.tubes_chan[telepathy.CHANNEL_TYPE_TUBES].AcceptDBusTube( id) self.tube_conn = TubeConnection( self.conn, self.tubes_chan[telepathy.CHANNEL_TYPE_TUBES], id, group_iface=self.text_chan[telepathy.CHANNEL_INTERFACE_GROUP]) logger.debug("creating game tube") self.game_tube = self.tube_class(self.tube_conn, self.initiating, self) self.new_tube_cb()
def _on_new_tube(self, tube_id, initiator, tube_type, service, params, state): details = 'ID=%d initiator=%d type=%d service=[%s] params=%r state=%d' % \ (tube_id, initiator, tube_type, service, params, state) ka_debug.info('New tube ' + details) self._new_tubes.append(details) self._status.set(ka_status.TOPIC_COLLABORATION, ka_status.SUB_TUBES, self._new_tubes) if (tube_type == telepathy.TUBE_TYPE_DBUS and service == kandidtube.SERVICE): if state == telepathy.TUBE_STATE_LOCAL_PENDING: self.tubes_chan[telepathy.CHANNEL_TYPE_TUBES].AcceptDBusTube( tube_id) tube_conn = TubeConnection( self.telepathy_conn, self.tubes_chan[telepathy.CHANNEL_TYPE_TUBES], tube_id, group_iface=self.text_chan[telepathy.CHANNEL_INTERFACE_GROUP]) population_controller = self._controller.find_page( 'PopulationController') if population_controller is not None: self.kandidtube = population_controller.on_new_tube( self.telepathy_conn, tube_conn, self._get_my_id(), self.initiating, self.get_buddy_by_handle)
def new_tube_cb(self, tube_id, initiator, type, service, params, state): self.__logger.debug( 'New tube: ID=%d initator=%d type=%d service=%s params=%r state=%d', tube_id, initiator, type, service, params, state) if (not self.__got_dbus_tube and type == telepathy.TUBE_TYPE_DBUS and service == SERVICE): if (state == telepathy.TUBE_STATE_LOCAL_PENDING): self.__iface.AcceptDBusTube(tube_id) self.__dbus_tube = TubeConnection(self.__conn, self.__iface, tube_id, group_iface=self.__iface_grp) self.__got_dbus_tube = True self.__logger.debug("Got our dbus tube!") # lots of stuff to do once we get our tube if (self.__is_initiating): self.__deck.connect('slide-changed', self.send_slide_changed_signal) self.__deck.connect('local-ink-added', self.send_ink_path) self.__deck.connect('instructor-ink-cleared', self.instr_clear_ink_cb) self.__deck.connect('instructor-ink-removed', self.instr_remove_ink_cb) self.__deck.connect('ink-broadcast', self.bcast_submission_cb) self.__dbus_tube.add_signal_receiver( self.student_dl_complete_cb, 'Deck_Download_Complete', IFACE, path=PATH, sender_keyword='sender') self.__dbus_tube.add_signal_receiver( self.receive_submission_cb, 'Send_Submission', IFACE, path=PATH) else: self.__deck.connect('ink-submitted', self.submit_ink_cb) self.__dbus_tube.add_signal_receiver(self.slide_changed_cb, 'Slide_Changed', IFACE, path=PATH) self.__dbus_tube.add_signal_receiver(self.lock_nav_cb, 'Lock_Nav', IFACE, path=PATH) self.__dbus_tube.add_signal_receiver(self.add_ink_path_cb, 'Add_Ink_Path', IFACE, path=PATH) self.__dbus_tube.add_signal_receiver( self.recv_instr_clear_ink_cb, 'Instructor_Clear_Ink', IFACE, path=PATH) self.__dbus_tube.add_signal_receiver( self.recv_instr_remove_ink_cb, 'Instructor_Remove_Ink', IFACE, path=PATH) self.__dbus_tube.add_signal_receiver( self.receive_submission_cb, 'Bcast_Submission', IFACE, path=PATH) #self.__dbus_tube.watch_participants(self.participant_change_cb) super(Shared, self).__init__(self.__dbus_tube, PATH)