Ejemplo n.º 1
0
Archivo: main.py Proyecto: zarthon/sam
	def logout (self):
		try:
			Cyberoam.logout (self.username, self.passwd)
			self.setText (1, 'Logged out')
			self.thread.emit (SIGNAL('setIcon(QString)'), YELLOW)
			self.thread.emit (SIGNAL('loggedOut()'))
		except IOError:
			self.thread.emit (SIGNAL('networkError()'))
			#self.setText (1, 'Network Error')
			self.thread.emit (SIGNAL('setIcon(QString)'), RED)
Ejemplo n.º 2
0
Archivo: main.py Proyecto: zarthon/sam
	def getQuota (self):
		try:
			quota = Cyberoam.netUsage (self.username, self.passwd)
			self.setText (3, quota[1])
			used, suff = quota[0].split()
			used = round(float(used)/1024) if suff=='KB' else round(float(used))
			self.thread.emit (SIGNAL('usage(int)'), int(used))
			self.thread.emit (SIGNAL('gotQuota(int)'), self.acc_no)
			if self.text(1) != 'Logged in':
				self.setText (1, '')
				self.thread.emit (SIGNAL('setIcon(QString)'), YELLOW)
			return
		except Cyberoam.DataTransferLimitExceeded:
			self.setText (3, '0.00 MB')
			self.thread.emit (SIGNAL('usage(int)'), self.pbar.maximum())
			self.thread.emit (SIGNAL('limitExceeded()'))
			self.setText (1, 'Limit Reached')
		except Cyberoam.WrongPassword:
			self.thread.emit (SIGNAL('wrongPassword()'))
			self.setText (1, 'Wrong Password')
		except IOError:
			self.thread.emit (SIGNAL('networkError()'))
			#self.setText (1, 'Network Error')
			return
		self.thread.emit(SIGNAL('switch(int)'), self.acc_no)
		self.thread.emit (SIGNAL('setIcon(QString)'), RED)
Ejemplo n.º 3
0
Archivo: main.py Proyecto: zarthon/sam
	def login (self):
		try:
			Cyberoam.login (self.username, self.passwd)
			self.setText (1, 'Logged in')
			self.thread.emit (SIGNAL('setIcon(QString)'), GREEN)
			self.thread.emit (SIGNAL('loggedIn(int)'), self.acc_no)
			return
		except Cyberoam.DataTransferLimitExceeded:
			self.setText (3, '0.00 MB')
			self.thread.emit (SIGNAL('usage(int)'), self.pbar.maximum())
			self.thread.emit (SIGNAL('limitExceeded()'))
			self.setText (1, 'Limit Reached')
		except Cyberoam.WrongPassword:
			self.thread.emit (SIGNAL('wrongPassword()'))
			self.setText (1, 'Wrong Password')
		except Cyberoam.MultipleLoginError:
			self.thread.emit (SIGNAL('multipleLogin()'))
			self.setText (1, 'Account in use')
		except IOError:
			self.thread.emit (SIGNAL('networkError()'))
			#self.setText (1, 'Network Error')
			return
		self.thread.emit (SIGNAL('setIcon(QString)'), RED)
		self.thread.emit(SIGNAL('switch(int)'), self.acc_no)