예제 #1
0
class AsianetLogin(QtGui.QDialog, Ui_AsianetLogin):
	def __init__(self, parent = None):
		super(AsianetLogin, self).__init__(parent)
		self.setupUi(self)
		self.running = False
		
		if os.path.exists("asianetconf"):
			file = open("asianetconf", 'r')
			text = file.readline()
			data = text.split("=")
			self.edUsername.setText(data[0])
			self.edPassword.setText(data[1])
			file.close()
		
		self.login = AsianetLoginMain(self)
		self.connect(self.login, QtCore.SIGNAL("diplayMessage(QString)"), self.displayLog)
		
		self.connect(self.bnClose, QtCore.SIGNAL("clicked()"), self.close)
		self.connect(self.bnConnect, QtCore.SIGNAL("clicked()"), self.onConnect)
		self.connect(self.bnAbout, QtCore.SIGNAL("clicked()"), self.onAbout)
	
	def onAbout(self):
		aboutstring = """<b>AsianetLogin - Asianet Broadband Login Utility</b><br><br>
                     Version 1.0.0<br>
                     Copyright (c) 2010 Anoop Panavalappil [<a href="mailto:[email protected]">[email protected]</a>]<br><br>
                     Icon Designed by Hiran Venugopalan [<a href="mailto:[email protected]">[email protected]</a>]<br>
                     <a href="http://hiran.in">http://hiran.in</a><br><br>
                     <a href="http://github.com/gnuanu/AsianetLoginGui">github repository</a><br>
                     <a href="http://www.gnu.org/licenses/gpl.html">License - GNU General Public License Version - 3</a>"""
		QtGui.QMessageBox.about(self, "About AsianetLogin", aboutstring)
	
	def onConnect(self):
		if self.edUsername.text() == "" or self.edPassword.text() == "":
			QtGui.QMessageBox.warning(self, "Error - AsianetLogin", "Username and Password are mandatory fields")
			return
		
		if self.chkRemember.isChecked():
			file = open("asianetconf", 'w')
			file.write(self.edUsername.text() + "=" + self.edPassword.text())
			file.close()
			
		# Check whether the thread is running or not
		if not self.running:			
			self.login.initialize(self.edUsername.text(), self.edPassword.text())
			self.login.start()
			self.running = True
		else:
			if self.login.isFinished():
				self.running = False
				self.onConnect()
	
	def displayLog(self, log):
		display_log = self.teLog.toPlainText()
		display_log += log + "\n"
		self.teLog.setText(display_log)
		scrollbar = self.teLog.verticalScrollBar()
		scrollbar.setValue(scrollbar.maximum())
예제 #2
0
	def __init__(self, parent = None):
		super(AsianetLogin, self).__init__(parent)
		self.setupUi(self)
		self.running = False
		
		if os.path.exists("asianetconf"):
			file = open("asianetconf", 'r')
			text = file.readline()
			data = text.split("=")
			self.edUsername.setText(data[0])
			self.edPassword.setText(data[1])
			file.close()
		
		self.login = AsianetLoginMain(self)
		self.connect(self.login, QtCore.SIGNAL("diplayMessage(QString)"), self.displayLog)
		
		self.connect(self.bnClose, QtCore.SIGNAL("clicked()"), self.close)
		self.connect(self.bnConnect, QtCore.SIGNAL("clicked()"), self.onConnect)
		self.connect(self.bnAbout, QtCore.SIGNAL("clicked()"), self.onAbout)