def setCurrentID(self, idName): if idName is not None: currentID = Q2QAddress.fromString(idName) # Log in? # Self.animator.start() SL = self.xml.get_widget( "identifymenuitem").get_children()[0].set_label def loggedIn(result): SL(str(currentID)) self.currentID = currentID def notLoggedIn(error): SL("Identify") # Self.animator.stop(0) # This following order is INSANE - you should definitely not have # to wait until the LISTEN succeeds to start the service; quite the # opposite, you should wait until the service has started, then # issue the LISTEN!! For some reason, the connection drops # immediately if you do that, and I have no idea why. As soon as I # can fix that issue the startService should be moved up previous # to listenQ2Q. self.clientService.listenQ2Q(currentID, {'vertex': VertexFactory(self)}, "desktop vertex UI").addCallbacks( loggedIn, notLoggedIn).addCallback( lambda ign: self.clientService.startService())
def setCurrentID(self, idName): if idName is not None: currentID = Q2QAddress.fromString(idName) # log in? # self.animator.start() SL = self.xml.get_widget( "identifymenuitem").get_children()[0].set_label def loggedIn(result): SL(str(currentID)) self.currentID = currentID def notLoggedIn(error): SL("Identify") # self.animator.stop(0) # This following order is INSANE - you should definitely not have # to wait until the LISTEN succeeds to start the service; quite the # opposite, you should wait until the service has started, then # issue the LISTEN!! For some reason, the connection drops # immediately if you do that, and I have no idea why. As soon as I # can fix that issue the startService should be moved up previous # to listenQ2Q. self.clientService.listenQ2Q(currentID, { 'vertex': VertexFactory(self) }, "desktop vertex UI").addCallbacks( loggedIn, notLoggedIn).addCallback( lambda ign: self.clientService.startService())
def identifyOK(self, event): idstr = self.addressEntry.get_text() D = self.clientService.authorize( Q2QAddress.fromString(idstr), self.passwordEntry.get_text()) sensitiveWidgets = [self.addressEntry, self.passwordEntry, self.okButton, self.cancelButton] for widget in sensitiveWidgets: widget.set_sensitive(False) self.progressLabel.set_text("Authenticating...") def itWorked(workedNone): self.identifyWindow.destroy() self.plug.setCurrentID(idstr) def itDidntWork(error): self.progressLabel.set_text(error.getErrorMessage()) for widget in sensitiveWidgets: widget.set_sensitive(True) D.addCallbacks(itWorked, itDidntWork)
def identifyOK(self, event): idstr = self.addressEntry.get_text() D = self.clientService.authorize(Q2QAddress.fromString(idstr), self.passwordEntry.get_text()) sensitiveWidgets = [ self.addressEntry, self.passwordEntry, self.okButton, self.cancelButton ] for widget in sensitiveWidgets: widget.set_sensitive(False) self.progressLabel.set_text("Authenticating...") def itWorked(workedNone): self.identifyWindow.destroy() self.plug.setCurrentID(idstr) def itDidntWork(error): self.progressLabel.set_text(error.getErrorMessage()) for widget in sensitiveWidgets: widget.set_sensitive(True) D.addCallbacks(itWorked, itDidntWork)