Esempio n. 1
0
    def loginCheck(self):
        username = unicode(self.uname_lineEdit.text())
        password = unicode(self.pass_lineEdit.text())

        data = 'USERNAME: '******' PASSWORD: '******'')
            tcpCliSock.close()
        except error:
            print 'THERE IS NO OPEN RoyTify SERVER IN LAN!'

        if data == "True":
            print("User Found ! ")

            filer = open(r"my_username.txt", "w")
            filer.write(username)
            filer.close()

            self.welcomeWindowShow()
        else:
            print("User Not Found !")
            Ui_signUp.showMessageBox(Ui_signUp(), 'Warning',
                                     'Invalid Username And Password')
Esempio n. 2
0
 def showPostLogin(self,paths):
     self.postLoginWindow =QtWidgets.QDialog()
     self.ui = Ui_Post_Login(client)
     #######################################
     self.ui.setupUi(self.postLoginWindow,paths)
     #######################################
     self.postLoginWindow.show()
     self.Dialog.hide()
Esempio n. 3
0
 def signUpCheck(self):
     print("hello signup button")
     self.signUpWindow = QtGui.QDialog()
     self.ui = Ui_signUp()
     print("i'm in self signup")
     self.ui.setupUi(self.signUpWindow)
     print("i'm in self setupUi method")
     self.signUpWindow.show()
     print("i'm in self signup windows")
Esempio n. 4
0
    def tableClickedDisover(self, row, column):

        indexit = self.musicTable_1.currentRow()
        connection = sqlite3.connect("songs_info.db")
        name = (
            connection.execute("SELECT * FROM SONGS")).fetchall()[indexit][0]
        try:
            print self.indexer.index(indexit)
            Ui_signUp.showMessageBox(
                Ui_signUp(), 'Notice',
                self.username + ', \nyou have already bought ' + name)
        except ValueError:
            if float(str(self.textEdit.toPlainText())) < self.price:
                Ui_signUp.showMessageBox(
                    Ui_signUp(), 'Notice', self.username +
                    ', \nyou have less money than needed for ' + name)
            else:
                self.textEdit.setText(
                    str(float(str(self.textEdit.toPlainText())) - self.price))
                self.indexer.append(indexit)
                self.addFiles_playList()
 def signUpShow(self):
     self.signUpWindow = QtGui.QDialog()
     self.ui = Ui_signUp()
     self.ui.setupUi(self.signUpWindow)
     self.signUpWindow.show()
 def welcomeWindowShow(self):
     self.welcomeWindow = QtGui.QMainWindow()
     self.ui = Ui_MainWindow()
     self.ui.setupUi(self.welcomeWindow)
     self.welcomeWindow.show()
class Ui_Dialog(object):
    def showMessageBox(self, title, message):
        msgBox = QtGui.QMessageBox()
        msgBox.setIcon(QtGui.QMessageBox.Warning)
        msgBox.setWindowTitle(title)
        msgBox.setText(message)
        msgBox.setStandardButtons(QtGui.QMessageBox.Ok)
        msgBox.exec_()

    def welcomeWindowShow(self):
        self.welcomeWindow = QtGui.QMainWindow()
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self.welcomeWindow)
        self.welcomeWindow.show()

    def signUpShow(self):
        self.signUpWindow = QtGui.QDialog()
        self.ui = Ui_signUp()
        self.ui.setupUi(self.signUpWindow)
        self.signUpWindow.show()

    def loginCheck(self):
        username = self.uname_lineEdit.text()
        password = self.pass_lineEdit.text()

        connection = sqlite3.connect("login.db")
        result = connection.execute(
            "SELECT * FROM USERS WHERE USERNAME = ? AND PASSWORD = ?",
            (username, password))
        if (len(result.fetchall()) > 0):
            print("User Found ! ")
            self.welcomeWindowShow()
        else:
            print("User Not Found !")
            self.showMessageBox('Warning', 'Invalid Username And Password')
        connection.close()

    def signUpCheck(self):
        print(" Sign Up Button Clicked !")
        self.signUpShow()

    def setupUi(self, Dialog):
        Dialog.setObjectName(_fromUtf8("Dialog"))
        Dialog.resize(742, 533)
        Dialog.setStyleSheet(_fromUtf8("background-color: rgb(0, 0, 255);"))
        self.u_name_label = QtGui.QLabel(Dialog)
        self.u_name_label.setGeometry(QtCore.QRect(130, 140, 131, 31))
        font = QtGui.QFont()
        font.setPointSize(14)
        font.setBold(False)
        font.setWeight(50)
        self.u_name_label.setFont(font)
        self.u_name_label.setStyleSheet(
            _fromUtf8("background-color: rgb(255, 170, 0);"))
        self.u_name_label.setAlignment(QtCore.Qt.AlignCenter)
        self.u_name_label.setObjectName(_fromUtf8("u_name_label"))
        self.pass_label = QtGui.QLabel(Dialog)
        self.pass_label.setGeometry(QtCore.QRect(130, 200, 131, 31))
        font = QtGui.QFont()
        font.setPointSize(14)
        self.pass_label.setFont(font)
        self.pass_label.setStyleSheet(
            _fromUtf8("background-color: rgb(255, 170, 0);"))
        self.pass_label.setAlignment(QtCore.Qt.AlignCenter)
        self.pass_label.setObjectName(_fromUtf8("pass_label"))
        self.uname_lineEdit = QtGui.QLineEdit(Dialog)
        self.uname_lineEdit.setGeometry(QtCore.QRect(280, 140, 221, 31))
        self.uname_lineEdit.setStyleSheet(
            _fromUtf8("background-color: rgb(255, 255, 255);\n"
                      "background-color: rgb(255, 255, 255);"))
        self.uname_lineEdit.setObjectName(_fromUtf8("uname_lineEdit"))
        self.pass_lineEdit = QtGui.QLineEdit(Dialog)
        self.pass_lineEdit.setGeometry(QtCore.QRect(280, 200, 221, 31))
        self.pass_lineEdit.setStyleSheet(
            _fromUtf8("\n"
                      "background-color: rgb(255, 255, 255);"))
        self.pass_lineEdit.setEchoMode(QtGui.QLineEdit.Password)
        self.pass_lineEdit.setObjectName(_fromUtf8("pass_lineEdit"))
        self.login_btn = QtGui.QPushButton(Dialog)
        self.login_btn.setGeometry(QtCore.QRect(220, 270, 171, 41))
        font = QtGui.QFont()
        font.setPointSize(14)
        self.login_btn.setFont(font)
        self.login_btn.setStyleSheet(
            _fromUtf8("background-color: rgb(255, 170, 0);"))
        self.login_btn.setObjectName(_fromUtf8("login_btn"))
        ######################### Button Event ##############################3
        self.login_btn.clicked.connect(self.loginCheck)
        #####################################################################
        self.signup_btn = QtGui.QPushButton(Dialog)
        self.signup_btn.setGeometry(QtCore.QRect(220, 340, 171, 41))
        font = QtGui.QFont()
        font.setPointSize(14)
        self.signup_btn.setFont(font)
        self.signup_btn.setStyleSheet(
            _fromUtf8("background-color: rgb(255, 170, 0);"))
        self.signup_btn.setObjectName(_fromUtf8("signup_btn"))
        ######################### Button Event ##############################3
        self.signup_btn.clicked.connect(self.signUpCheck)
        #####################################################################

        self.label = QtGui.QLabel(Dialog)
        self.label.setGeometry(QtCore.QRect(120, 20, 521, 51))
        font = QtGui.QFont()
        font.setPointSize(18)
        font.setBold(True)
        font.setItalic(True)
        font.setWeight(75)
        self.label.setFont(font)
        self.label.setStyleSheet(
            _fromUtf8("background-color: rgb(255, 170, 0);"))
        self.label.setAlignment(QtCore.Qt.AlignCenter)
        self.label.setObjectName(_fromUtf8("label"))

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog)

    def retranslateUi(self, Dialog):
        Dialog.setWindowTitle(_translate("Dialog", "Dialog", None))
        self.u_name_label.setText(_translate("Dialog", "USERNAME ", None))
        self.pass_label.setText(_translate("Dialog", "PASSWORD", None))
        self.login_btn.setText(_translate("Dialog", "Login", None))
        self.signup_btn.setText(_translate("Dialog", "Sign Up", None))
        self.label.setText(
            _translate("Dialog", "News Recommendation System", None))
Esempio n. 8
0
 def signUpShow(self):
     self.signUpWindow = QtWidgets.QDialog()
     self.ui = Ui_signUp(client)
     self.ui.setupUi(self.signUpWindow)
     self.signUpWindow.show()
     self.Dialog.hide()
Esempio n. 9
0
class Ui_Dialog(object):

    def __init__(self,client):
        self.client = client

    def showMessageBox(self,title,message):
        msgBox = QtGui.QMessageBox()
        msgBox.setIcon(QtGui.QMessageBox.Warning)
        msgBox.setWindowTitle(title)
        msgBox.setText(message)
        msgBox.setStandardButtons(QtGui.QMessageBox.Ok)
        msgBox.exec_()
    def showPostLogin(self,paths):
        self.postLoginWindow =QtWidgets.QDialog()
        self.ui = Ui_Post_Login(client)
        #######################################
        self.ui.setupUi(self.postLoginWindow,paths)
        #######################################
        self.postLoginWindow.show()
        self.Dialog.hide()

    def signUpShow(self):
        self.signUpWindow = QtWidgets.QDialog()
        self.ui = Ui_signUp(client)
        self.ui.setupUi(self.signUpWindow)
        self.signUpWindow.show()
        self.Dialog.hide()

    def loginCheck(self):
        username = self.uname_lineEdit.text()
        password = self.pass_lineEdit.text()
        certif = str(self.plainTextEdit.toPlainText())
        res = self.client.sign_in(username,password,certif)
        if res['res'] == True :
            paths = self.client.check_certif_key(username)
            self.client.run()
            self.showPostLogin(paths)


        
    def signUpCheck(self):
        print(" Sign Up Button Clicked !")
        self.signUpShow()

    def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(334, 410)
        Dialog.setStyleSheet("")
        self.Dialog = Dialog
        self.horizontalLayout = QtWidgets.QHBoxLayout(Dialog)
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.gridLayout = QtWidgets.QGridLayout()
        self.gridLayout.setObjectName("gridLayout")
        self.label_2 = QtWidgets.QLabel(Dialog)
        font = QtGui.QFont()
        font.setPointSize(10)
        self.label_2.setFont(font)
        self.label_2.setObjectName("label_2")
        self.gridLayout.addWidget(self.label_2, 6, 0, 1, 1, QtCore.Qt.AlignHCenter)
        self.uname_lineEdit = QtWidgets.QLineEdit(Dialog)
        self.uname_lineEdit.setStyleSheet("QPushButton#evilButton {\n"
"    background-color: red;\n"
"    border-style: outset;\n"
"    border-width: 2px;\n"
"    border-radius: 10px;\n"
"    border-color: beige;\n"
"    font: bold 14px;\n"
"    min-width: 10em;\n"
"    padding: 6px;\n"
"}")
        self.uname_lineEdit.setObjectName("uname_lineEdit")
        self.gridLayout.addWidget(self.uname_lineEdit, 3, 0, 1, 1)
        self.plainTextEdit = QtWidgets.QPlainTextEdit(Dialog)
        self.plainTextEdit.setObjectName("plainTextEdit")
        self.gridLayout.addWidget(self.plainTextEdit, 7, 0, 1, 1)
        self.label = QtWidgets.QLabel(Dialog)
        font = QtGui.QFont()
        font.setPointSize(18)
        self.label.setFont(font)
        self.label.setAlignment(QtCore.Qt.AlignCenter)
        self.label.setObjectName("label")
        self.gridLayout.addWidget(self.label, 0, 0, 1, 1)
        self.pass_label = QtWidgets.QLabel(Dialog)
        font = QtGui.QFont()
        font.setPointSize(10)
        self.pass_label.setFont(font)
        self.pass_label.setAlignment(QtCore.Qt.AlignCenter)
        self.pass_label.setObjectName("pass_label")
        self.gridLayout.addWidget(self.pass_label, 4, 0, 1, 1)
        self.login_btn = QtWidgets.QPushButton(Dialog)
        self.login_btn.setStyleSheet("QPushButton {\n"
"    background-color: #59B2E0;\n"
"    border-style: outset;\n"
"    border-width: 2px;\n"
"    border-radius: 10px;\n"
"    border-color: beige;\n"
"    font: bold 14px;\n"
"    padding: 6px;\n"
"}")
        self.login_btn.setObjectName("login_btn")
        ######################### Button Event ##############################3
        self.login_btn.clicked.connect(self.loginCheck)
        #####################################################################
        self.gridLayout.addWidget(self.login_btn, 9, 0, 1, 1)
        self.pass_lineEdit = QtWidgets.QLineEdit(Dialog)
        self.pass_lineEdit.setText("")
        self.pass_lineEdit.setEchoMode(QtWidgets.QLineEdit.Password)
        self.pass_lineEdit.setObjectName("pass_lineEdit")
        self.gridLayout.addWidget(self.pass_lineEdit, 5, 0, 1, 1)
        self.signup_btn = QtWidgets.QPushButton(Dialog)
        self.signup_btn.setStyleSheet("QPushButton {\n"
"    background-color: #59B2E0;\n"
"    border-style: outset;\n"
"    border-width: 2px;\n"
"    border-radius: 10px;\n"
"    border-color: beige;\n"
"    font: bold 14px;\n"
"    padding: 6px;\n"
"}")
        self.signup_btn.setObjectName("signup_btn")
        ######################### Button Event ##############################3
        self.signup_btn.clicked.connect(self.signUpCheck)
        #####################################################################
        self.gridLayout.addWidget(self.signup_btn, 10, 0, 1, 1)
        self.u_name_label = QtWidgets.QLabel(Dialog)
        font = QtGui.QFont()
        font.setPointSize(10)
        font.setBold(False)
        font.setWeight(50)
        self.u_name_label.setFont(font)
        self.u_name_label.setAlignment(QtCore.Qt.AlignCenter)
        self.u_name_label.setObjectName("u_name_label")
        self.gridLayout.addWidget(self.u_name_label, 2, 0, 1, 1)
        spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Maximum)
        self.gridLayout.addItem(spacerItem, 1, 0, 1, 1)
        self.horizontalLayout.addLayout(self.gridLayout)

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog)

    def retranslateUi(self, Dialog):
        _translate = QtCore.QCoreApplication.translate
        Dialog.setWindowTitle(_translate("Dialog", "Dialog"))
        self.label_2.setText(_translate("Dialog", "CERTIFICAT"))
        self.label.setText(_translate("Dialog", "Sign in"))
        self.pass_label.setText(_translate("Dialog", "PASSWORD"))
        self.login_btn.setText(_translate("Dialog", "Login"))
        self.signup_btn.setText(_translate("Dialog", "Sign Up"))
        self.u_name_label.setText(_translate("Dialog", "PSEUDO"))
Esempio n. 10
0
class Ui_Dialog(object):
    def showMessageBox(self, title, message):
        msgBox = QtGui.QMessageBox()
        msgBox.setIcon(QtGui.QMessageBox.Warning)
        msgBox.setWindowTitle(title)
        msgBox.setText(message)
        msgBox.setStandardButtons(QtGui.QMessageBox.Ok)
        msgBox.exec_()

    def welcomeWindowShow(self):
        self.welcomeWindow = QtGui.QMainWindow()
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self.welcomeWindow)
        self.welcomeWindow.show()

    def signUpShow(self):
        self.signUpWindow = QtGui.QDialog()
        self.ui = Ui_signUp()
        self.ui.setupUi(self.signUpWindow)
        self.signUpWindow.show()

    def loginCheck(self):
        username = self.uname_lineEdit.text()
        password = self.pass_lineEdit.text()

        connection = sqlite3.connect("login.db")
        result = connection.execute(
            "SELECT * FROM USERS WHERE USERNAME = ? AND PASSWORD = ?",
            (username, password))
        if (len(result.fetchall()) > 0):
            print("User Found ! ")
            self.welcomeWindowShow()
        else:
            print("User Not Found !")
            self.showMessageBox('Warning', 'Invalid Username And Password')
        connection.close()

    def signUpCheck(self):
        print(" Sign Up Button Clicked !")
        self.signUpShow()

    def setupUi(self, Dialog):
        Dialog.setObjectName(_fromUtf8("Dialog"))
        Dialog.resize(496, 265)
        self.u_name_label = QtGui.QLabel(Dialog)
        self.u_name_label.setGeometry(QtCore.QRect(150, 110, 71, 20))
        font = QtGui.QFont()
        font.setPointSize(10)
        font.setBold(False)
        font.setWeight(50)
        self.u_name_label.setFont(font)
        self.u_name_label.setAlignment(QtCore.Qt.AlignCenter)
        self.u_name_label.setObjectName(_fromUtf8("u_name_label"))
        self.pass_label = QtGui.QLabel(Dialog)
        self.pass_label.setGeometry(QtCore.QRect(150, 150, 71, 21))
        font = QtGui.QFont()
        font.setPointSize(10)
        self.pass_label.setFont(font)
        self.pass_label.setAlignment(QtCore.Qt.AlignCenter)
        self.pass_label.setObjectName(_fromUtf8("pass_label"))
        self.uname_lineEdit = QtGui.QLineEdit(Dialog)
        self.uname_lineEdit.setGeometry(QtCore.QRect(230, 110, 113, 20))
        self.uname_lineEdit.setObjectName(_fromUtf8("uname_lineEdit"))
        self.pass_lineEdit = QtGui.QLineEdit(Dialog)
        self.pass_lineEdit.setGeometry(QtCore.QRect(230, 150, 113, 20))
        self.pass_lineEdit.setObjectName(_fromUtf8("pass_lineEdit"))
        self.login_btn = QtGui.QPushButton(Dialog)
        self.login_btn.setGeometry(QtCore.QRect(230, 200, 51, 23))
        self.login_btn.setObjectName(_fromUtf8("login_btn"))
        ######################### Button Event ##############################3
        self.login_btn.clicked.connect(self.loginCheck)
        #####################################################################
        self.signup_btn = QtGui.QPushButton(Dialog)
        self.signup_btn.setGeometry(QtCore.QRect(290, 200, 51, 23))
        self.signup_btn.setObjectName(_fromUtf8("signup_btn"))
        ######################### Button Event ##############################3
        self.signup_btn.clicked.connect(self.signUpCheck)
        #####################################################################
        self.label = QtGui.QLabel(Dialog)
        self.label.setGeometry(QtCore.QRect(190, 10, 211, 51))
        font = QtGui.QFont()
        font.setPointSize(18)
        self.label.setFont(font)
        self.label.setObjectName(_fromUtf8("label"))

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog)

    def retranslateUi(self, Dialog):
        Dialog.setWindowTitle(_translate("Dialog", "Login Form", None))
        self.u_name_label.setText(_translate("Dialog", "USERNAME ", None))
        self.pass_label.setText(_translate("Dialog", "PASSWORD", None))
        self.login_btn.setText(_translate("Dialog", "Login", None))
        self.signup_btn.setText(_translate("Dialog", "Sign Up", None))
        self.label.setText(_translate("Dialog", "Login Form", None))
Esempio n. 11
0
class Ui_Dialog(object):
    def signUpShow(self):
        self.signUpWindow = QtGui.QDialog()
        self.ui = Ui_signUp()
        self.ui.setupUi(self.signUpWindow)
        self.signUpWindow.show()

    def welcomeWindowShow(self):
        """usage of socket module"""
        try:
            host = gethostbyname(gethostname())
            port = 51421
            address = (host, port)
            tcpCliSock = socket(AF_INET, SOCK_STREAM)
            tcpCliSock.connect(address)

            tcpCliSock.send('SONG_TRANSFER')
            data = tcpCliSock.recv(1024)
            tcpCliSock.send('')
            tcpCliSock.close()
            sys.argv = ['songs_Info.db']
            execfile('client.py')
        except error:
            print 'THERE IS NO OPEN RoyTify SERVER IN LAN!'
        subprocess.Popen([sys.executable, 'display.py'],
                         creationflags=subprocess.CREATE_NEW_CONSOLE)
        sys.exit()

    def loginCheck(self):
        username = unicode(self.uname_lineEdit.text())
        password = unicode(self.pass_lineEdit.text())

        data = 'USERNAME: '******' PASSWORD: '******'')
            tcpCliSock.close()
        except error:
            print 'THERE IS NO OPEN RoyTify SERVER IN LAN!'

        if data == "True":
            print("User Found ! ")

            filer = open(r"my_username.txt", "w")
            filer.write(username)
            filer.close()

            self.welcomeWindowShow()
        else:
            print("User Not Found !")
            Ui_signUp.showMessageBox(Ui_signUp(), 'Warning',
                                     'Invalid Username And Password')

    def signUpCheck(self):
        print(" Sign Up Button Clicked !")
        self.signUpShow()

    def setupUi(self, Dialog):
        Dialog.setObjectName(_fromUtf8("Dialog"))
        Dialog.resize(496, 265)
        self.u_name_label = QtGui.QLabel(Dialog)
        self.u_name_label.setGeometry(QtCore.QRect(150, 110, 71, 20))
        font = QtGui.QFont()
        font.setPointSize(10)
        font.setBold(True)
        font.setWeight(50)
        self.u_name_label.setFont(font)
        self.u_name_label.setAlignment(QtCore.Qt.AlignCenter)
        self.u_name_label.setObjectName(_fromUtf8("u_name_label"))
        self.pass_label = QtGui.QLabel(Dialog)
        self.pass_label.setGeometry(QtCore.QRect(150, 150, 71, 21))
        self.pass_label.setFont(font)
        self.pass_label.setAlignment(QtCore.Qt.AlignCenter)
        self.pass_label.setObjectName(_fromUtf8("pass_label"))
        self.uname_lineEdit = QtGui.QLineEdit(Dialog)
        self.uname_lineEdit.setGeometry(QtCore.QRect(230, 110, 113, 20))
        self.uname_lineEdit.setObjectName(_fromUtf8("uname_lineEdit"))
        self.pass_lineEdit = QtGui.QLineEdit(Dialog)
        self.pass_lineEdit.setGeometry(QtCore.QRect(230, 150, 113, 20))
        self.pass_lineEdit.setObjectName(_fromUtf8("pass_lineEdit"))
        self.pass_lineEdit.setEchoMode(QtGui.QLineEdit.Password)
        self.login_btn = QtGui.QPushButton(Dialog)
        self.login_btn.setGeometry(QtCore.QRect(230, 200, 51, 23))
        self.login_btn.setObjectName(_fromUtf8("login_btn"))

        #  ----------------------- Button Event ------------------------------
        self.login_btn.clicked.connect(self.loginCheck)
        #  -------------------------------------------------------------------
        self.signup_btn = QtGui.QPushButton(Dialog)
        self.signup_btn.setGeometry(QtCore.QRect(290, 200, 51, 23))
        self.signup_btn.setObjectName(_fromUtf8("signup_btn"))
        #  ------------------------ Button Event ------------------------------
        self.signup_btn.clicked.connect(self.signUpCheck)
        #  --------------------------------------------------------------------
        self.label = QtGui.QLabel(Dialog)
        self.label.setGeometry(QtCore.QRect(190, 10, 211, 51))
        font = QtGui.QFont()
        font.setPointSize(18)
        self.label.setFont(font)
        self.label.setObjectName(_fromUtf8("label"))

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog)

    def retranslateUi(self, Dialog):
        Dialog.setWindowTitle(_translate("Dialog", "Login Form", None))
        Dialog.setWindowIcon(QtGui.QIcon("useful\Logo.ico"))
        Dialog.setStyleSheet("background-image: url(Squares.jpg);"
                             " background-position: center; color: darkGreen;")

        self.u_name_label.setText(_translate("Dialog", "USERNAME ", None))
        self.pass_label.setText(_translate("Dialog", "PASSWORD", None))
        self.login_btn.setText(_translate("Dialog", "Login", None))
        self.signup_btn.setText(_translate("Dialog", "Sign Up", None))
        self.label.setText(_translate("Dialog", "Login Form", None))