def buttonClicked_(self, sender): if self.attention is not None: NSApp.cancelUserAttentionRequest_(self.attention) self.attention = None action = sender.cell().representedObject().integerValue() try: (session, view) = ((sess, view) for sess, view in self.sessions.iteritems() if view == sender.superview().superview()).next() except StopIteration: return if self.proposals.has_key(session): self.decideForProposalRequest(action, session, self.proposals[session]) else: self.decideForSessionRequest(action, session)
def decideForAllSessionRequests(self, action): if self.attention is not None: NSApp.cancelUserAttentionRequest_(self.attention) self.attention = None self.panel.close() if action == ACCEPT: NSApp.activateIgnoringOtherApps_(True) for session in self.sessions.keys(): sessionController = self.sessionControllersManager.sessionControllerForSession(session) if sessionController is None: continue is_proposal = self.proposals.has_key(session) try: if is_proposal: sessionController.log_info(u"Accepting all proposed streams from %s" % format_identity_to_string(session.remote_identity)) self.acceptProposedStreams(session) else: sessionController.log_info(u"Accepting session from %s" % format_identity_to_string(session.remote_identity)) self.acceptStreams(session) except Exception, exc: sessionController.log_info(u"Error accepting session: %s" % exc) self.removeSession(session)
def windowWillClose_(self, notification): self.stopSpeechRecognition() self.stopSpeechSynthesizer() if self.attention is not None: NSApp.cancelUserAttentionRequest_(self.attention) self.attention = None