Beispiel #1
0
    def on_btn_menuitem_activated(self, menuitem, selection):
        if selection == "Update Now":
            self.deadline = datetime.datetime.now()
            self.update()
            return

        if selection == "Account":
            c = credentials.dialog()
            if len(c["username"]) > 0 and len(c["password"]) > 0:
                self.credentials = None
                self.service = None
                self.usage = None
                # do twice incase user unlocked keyring on prompt
                for index in range(2):
                    try:
                        credentials.save(c)
                        self.credentials = c
                        self.logger.debug(str(self.credentials))
                        self.logger.info("credentials updated")
                        self.deadline = datetime.datetime.now()
                        self.update()
                        return
                    except GK_IOError:
                        try:
                            credentials.trigger_unlock()
                        except GK_CancelledError, e:
                            pass
            return
Beispiel #2
0
	def on_btn_menuitem_activated(self,menuitem,selection):
		if selection == "Update Now":
			self.deadline = datetime.datetime.now()
			self.update()
			return

		if selection == "Account":
			c = credentials.dialog()
			if len(c["username"]) > 0 and len(c["password"]) > 0:
				self.credentials = None
				self.service = None
				self.usage = None
				# do twice incase user unlocked keyring on prompt
				for index in range(2):
					try:
						credentials.save(c)
						self.credentials = c
						self.logger.debug(str(self.credentials))
						self.logger.info("credentials updated")
						self.deadline = datetime.datetime.now()
						self.update()
						return
					except GK_IOError:
						try:
							credentials.trigger_unlock()
						except GK_CancelledError, e:
							pass
			return
Beispiel #3
0
 def update_credentials(self):
     if self.credentials == None:
         try:
             self.logger.debug("credentials get")
             self.credentials = credentials.load()
             self.logger.info("credentials retrieved")
         except credentials.NotFoundException:
             self.logger.error("credentials not found")
             raise AbortException("OFF")
         except GK_IOError, e:
             try:
                 credentials.trigger_unlock()
                 raise RetryException("keyring is locked, trigger unlock")
             except GK_CancelledError:
                 self.logger.error("keyring is locked")
                 raise AbortException("KEYR")
Beispiel #4
0
	def update_credentials(self):
		if self.credentials == None:
			try:
				self.logger.debug("credentials get")
				self.credentials = credentials.load()
				self.logger.info("credentials retrieved")
			except credentials.NotFoundException:
					self.logger.error("credentials not found")
					raise AbortException("OFF")
			except GK_IOError, e:
				try:
					credentials.trigger_unlock()
					raise RetryException("keyring is locked, trigger unlock")
				except GK_CancelledError:
					self.logger.error("keyring is locked")
					raise AbortException("KEYR")