コード例 #1
0
ファイル: main.py プロジェクト: Ash-Shaun/CyberHawk
 def __init__(self, MainWindow):
     Ui_MainWindow.__init__(self)
     self.setupUi(MainWindow)
     self.usr = None
     self.client_identifier = None
     self.auth_stat = "Not_Authenticated"
     self.login.clicked.connect(self.login_initiator)
     self.cancel.clicked.connect(self.exit)
     self.login_2.clicked.connect(self.connect_thread)
     self.auth_stat = "No"
コード例 #2
0
ファイル: login.py プロジェクト: xiangchao0127/ziyuan
class login_window(QMainWindow):
    def __init__(self):
        super().__init__()
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        self.ui.closeButton.clicked.connect(self.close)
        self.ui.loginButton.clicked.connect(self.Login)
        # self.ui.password.textChanged.connect(self.password)
    def mouseMoveEvent(self, e: QMouseEvent):  # 重写移动事件
        self._endPos = e.pos() - self._startPos
        self.move(self.pos() + self._endPos)

    def mousePressEvent(self, e: QMouseEvent):
        if e.button() == Qt.LeftButton:
            self._isTracking = True
            self._startPos = QPoint(e.x(), e.y())

    def mouseReleaseEvent(self, e: QMouseEvent):
        if e.button() == Qt.LeftButton:
            self._isTracking = False
            self._startPos = None
            self._endPos = None

    def password(self):
        c2 = self.ui.password.text()
        strinfo = re.compile('\S')
        d2 = strinfo.sub(
            '*',
            c2,
        )
        self.ui.password.setText(d2)

    def Login(self):
        # 调用接口
        print(self.ui.username.text().strip(), self.ui.password.text().strip())
        post = requests.post(
            "http://192.168.2.206:8051/user/ExistAccountPassword?Account=" +
            self.ui.username.text().strip() + "&Password=" +
            self.ui.password.text().strip())
        success = json.loads(post.text)['data'][0]['code'] == '00'
        if success:
            qt.show()
            self.close()
        else:
            self.ui.error.show()
            print('login fail')
コード例 #3
0
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        
        # slots and signals
	QtCore.QObject.connect(self.ui.ok, QtCore.SIGNAL("clicked()"), self.login)
	QtCore.QObject.connect(self.ui.clear, QtCore.SIGNAL("clicked()"), self.clear_fields)
コード例 #4
0
class StartQT4(QtGui.QMainWindow):
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        
        # slots and signals
	QtCore.QObject.connect(self.ui.ok, QtCore.SIGNAL("clicked()"), self.login)
	QtCore.QObject.connect(self.ui.clear, QtCore.SIGNAL("clicked()"), self.clear_fields)
    
    def login(self):
	quid = self.ui.username.text()
	uid = str(quid)
	qpwd = self.ui.password.text()
	pwd = str(qpwd)
	u = False
	p = False
	f1 = open("uids")
	f2 = open("pwds")
	uids = f1.read().split(None)
	pwds = f2.read().split(None)
	#print uids
	#print pwds
	for user in uids:
		if uid == user:
			u = True
	for passwd in pwds:
		if passwd == pwd:
			p = True
	if u == True and p == True:
		self.ui.message.setPlainText('success')
	else:
		self.ui.message.setPlainText('epic fail')
	f1.close()
	f2.close()
		
    def clear_fields(self):
    	self.ui.username.setText('')
    	self.ui.password.setText('')
	self.ui.message.setPlainText('')
コード例 #5
0
ファイル: login.py プロジェクト: xiangchao0127/ziyuan
 def __init__(self):
     super().__init__()
     self.ui = Ui_MainWindow()
     self.ui.setupUi(self)
     self.ui.closeButton.clicked.connect(self.close)
     self.ui.loginButton.clicked.connect(self.Login)
コード例 #6
0
 def __init__(self, parent=None):
     QtGui.QWidget.__init__(self, parent)
     self.ui = Ui_MainWindow()
     self.ui.setupUi(self)
コード例 #7
0
ファイル: login.py プロジェクト: yoonhas/QT_practice
 def __init__(self, w):
     Ui_MainWindow.__init__(self)
     self.setupUi(w)