def warnings_window(self):
        from warnings_window import Ui_MainWindow

        self.window = QtWidgets.QMainWindow()
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self.window)
        self.window.show()
예제 #2
0
    def main_window(self):
        from main_window import Ui_MainWindow

        self.window = QtWidgets.QMainWindow()
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self.window)
        self.window.show()
        MainWindow.hide()
class Ui_MainWindow(object):
    def warnings_window(self):
        from warnings_window import Ui_MainWindow

        self.window = QtWidgets.QMainWindow()
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self.window)
        self.window.show()

    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(801, 671)
        MainWindow.setMinimumSize(QtCore.QSize(801, 671))
        MainWindow.setMaximumSize(QtCore.QSize(801, 671))
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.main_frame = QtWidgets.QFrame(self.centralwidget)
        self.main_frame.setGeometry(QtCore.QRect(0, 0, 901, 691))
        self.main_frame.setStyleSheet("#main_frame{\n"
                                      "background-color: rgb(66,133,244);\n"
                                      "}")
        self.main_frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.main_frame.setFrameShadow(QtWidgets.QFrame.Raised)
        self.main_frame.setObjectName("main_frame")
        self.choose_frame = QtWidgets.QFrame(self.main_frame)
        self.choose_frame.setGeometry(QtCore.QRect(100, 200, 611, 311))
        self.choose_frame.setMinimumSize(QtCore.QSize(8, 0))
        self.choose_frame.setStyleSheet("#choose_frame{\n"
                                        "background-color: rgb(244,180,0);\n"
                                        "border-radius:15px;\n"
                                        "}")
        self.choose_frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.choose_frame.setFrameShadow(QtWidgets.QFrame.Raised)
        self.choose_frame.setObjectName("choose_frame")
        self.choose_btn = QtWidgets.QPushButton(self.choose_frame)
        self.choose_btn.setGeometry(QtCore.QRect(470, 90, 93, 31))
        self.choose_btn.setStyleSheet("#choose_btn{\n"
                                      "background-color: rgb(255,255,255);\n"
                                      "    font: 57 10pt \"Google Sans\";\n"
                                      "border-radius:7px;\n"
                                      "}\n"
                                      "#choose_btn:hover{\n"
                                      "background-color:rgb(219,68,55);\n"
                                      "\n"
                                      "    color: rgb(255, 255, 255);\n"
                                      "}\n"
                                      "\n"
                                      "")
        self.choose_btn.setObjectName("choose_btn")
        self.lineEdit = QtWidgets.QLineEdit(self.choose_frame)
        self.lineEdit.setGeometry(QtCore.QRect(220, 83, 221, 41))
        self.lineEdit.setStyleSheet("font: 9pt \"MS Shell Dlg 2\";")
        self.lineEdit.setText("")
        self.lineEdit.setReadOnly(True)
        self.lineEdit.setObjectName("lineEdit")
        self.choose_label = QtWidgets.QLabel(self.choose_frame)
        self.choose_label.setGeometry(QtCore.QRect(20, 83, 171, 41))
        self.choose_label.setStyleSheet("#choose_label\n"
                                        "{\n"
                                        "    \n"
                                        "    \n"
                                        "    font: 57 14pt \"Google Sans\";\n"
                                        "}")
        self.choose_label.setObjectName("choose_label")
        self.status_label = QtWidgets.QLabel(self.choose_frame)
        self.status_label.setGeometry(QtCore.QRect(20, 190, 141, 21))
        self.status_label.setStyleSheet("#status_label\n"
                                        "{\n"
                                        "    \n"
                                        "    \n"
                                        "    font: 57 14pt \"Google Sans\";\n"
                                        "}")
        self.status_label.setObjectName("status_label")
        self.start_btn = QtWidgets.QPushButton(self.choose_frame)
        self.start_btn.setGeometry(QtCore.QRect(470, 190, 93, 31))
        self.start_btn.setStyleSheet("#start_btn{\n"
                                     "background-color: rgb(255,255,255);\n"
                                     "    font: 57 10pt \"Google Sans\";\n"
                                     "border-radius:7px;\n"
                                     "}\n"
                                     "#start_btn:hover{\n"
                                     "background-color:rgb(219,68,55);\n"
                                     "\n"
                                     "    color: rgb(255, 255, 255);\n"
                                     "}\n"
                                     "\n"
                                     "")
        self.start_btn.setObjectName("start_btn")
        self.lineEdit_2 = QtWidgets.QLineEdit(self.choose_frame)
        self.lineEdit_2.setGeometry(QtCore.QRect(220, 180, 221, 41))
        self.lineEdit_2.setStyleSheet("font: 9pt \"MS Shell Dlg 2\";")
        self.lineEdit_2.setObjectName("lineEdit_2")
        self.logo_label = QtWidgets.QLabel(self.main_frame)
        self.logo_label.setGeometry(QtCore.QRect(210, 60, 421, 71))
        self.logo_label.setStyleSheet(
            "#logo_label{\n"
            "    \n"
            "    \n"
            "    \n"
            "    \n"
            "    background-image: url(:/newPrefix/assets/dsc-uit---karachi-logo-x1 (1).png);\n"
            "    background-color: rgba(255, 255, 255,40);\n"
            "    background-image: url(:/newPrefix/dsc-uit---karachi-logo-x1 (1).png);\n"
            "    border-radius:15px;\n"
            "}\n"
            "")
        self.logo_label.setText("")
        self.logo_label.setObjectName("logo_label")
        self.dev_label = QtWidgets.QLabel(self.main_frame)
        self.dev_label.setGeometry(QtCore.QRect(350, 20, 151, 31))
        self.dev_label.setStyleSheet("#dev_label{    \n"
                                     "    \n"
                                     "    font: 75 14pt \"Google Sans\";\n"
                                     "\n"
                                     "}")
        self.dev_label.setObjectName("dev_label")
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 801, 26))
        self.menubar.setObjectName("menubar")
        self.menuDeveloped_By = QtWidgets.QMenu(self.menubar)
        self.menuDeveloped_By.setObjectName("menuDeveloped_By")
        self.menuWarnings = QtWidgets.QMenu(self.menubar)
        self.menuWarnings.setObjectName("menuWarnings")
        MainWindow.setMenuBar(self.menubar)
        self.actionRaheel_Siddiqui = QtWidgets.QAction(MainWindow)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(":/newPrefix/person.png"),
                       QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionRaheel_Siddiqui.setIcon(icon)
        self.actionRaheel_Siddiqui.setObjectName("actionRaheel_Siddiqui")
        self.actionWarnings = QtWidgets.QAction(MainWindow)
        icon1 = QtGui.QIcon()
        icon1.addPixmap(QtGui.QPixmap(":/newPrefix/gg.png"),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionWarnings.setIcon(icon1)
        self.actionWarnings.setObjectName("actionWarnings")
        self.actionGitHub_Code = QtWidgets.QAction(MainWindow)
        icon2 = QtGui.QIcon()
        icon2.addPixmap(QtGui.QPixmap(":/newPrefix/Octocat.png"),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionGitHub_Code.setIcon(icon2)
        self.actionGitHub_Code.setObjectName("actionGitHub_Code")
        self.actionGet_the_Software = QtWidgets.QAction(MainWindow)
        icon3 = QtGui.QIcon()
        icon3.addPixmap(QtGui.QPixmap(":/newPrefix/assets/gg.png"),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionGet_the_Software.setIcon(icon3)
        self.actionGet_the_Software.setObjectName("actionGet_the_Software")
        self.menuDeveloped_By.addAction(self.actionRaheel_Siddiqui)
        self.menuWarnings.addAction(self.actionWarnings)
        self.menuWarnings.addAction(self.actionGitHub_Code)
        self.menubar.addAction(self.menuDeveloped_By.menuAction())
        self.menubar.addAction(self.menuWarnings.menuAction())

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

        self.choose_btn.clicked.connect(self.open_dialogue_box)

        self.actionRaheel_Siddiqui.triggered.connect(self.goto_raheel)
        self.actionGitHub_Code.triggered.connect(self.goto_github)
        self.actionGet_the_Software.triggered.connect(self.get_software)
        self.actionWarnings.triggered.connect(self.warnings_window)
        self.start_btn.clicked.connect(self.Start)

    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
        self.choose_btn.setText(_translate("MainWindow", "Select"))
        self.lineEdit.setPlaceholderText(
            _translate("MainWindow", "CSV File Path.."))
        self.choose_label.setText(_translate("MainWindow", "Select CSV File:"))
        self.status_label.setText(_translate("MainWindow", "Event Link:"))
        self.start_btn.setText(_translate("MainWindow", "Start"))
        self.lineEdit_2.setPlaceholderText(
            _translate("MainWindow", "Enter Event Link"))
        self.dev_label.setText(_translate("MainWindow", "Developed By"))
        self.menuDeveloped_By.setTitle(_translate("MainWindow",
                                                  "Developed By"))
        self.menuWarnings.setTitle(_translate("MainWindow", "Help"))
        self.actionRaheel_Siddiqui.setText(
            _translate("MainWindow", "Raheel Siddiqui"))
        self.actionWarnings.setText(_translate("MainWindow", "Warnings!"))
        self.actionGitHub_Code.setText(_translate("MainWindow", "GitHub Code"))
        self.actionGet_the_Software.setText(
            _translate("MainWindow", "Get the Software"))

    def message(self, message):

        a1 = QMessageBox()
        a1.setWindowTitle("message!")
        a1.setText(message)
        a1.setIcon(QMessageBox.Information)
        a1.setStandardButtons(QMessageBox.Ok)
        x = a1.exec_()

    def settext(self, text):
        self.lineEdit.setText(str(text))

    def open_dialogue_box(self):
        filename = QFileDialog.getOpenFileName()
        self.path_csv = filename[0]
        if self.path_csv[-4:] != ".csv":
            self.message("Please select a .CSV file!")
        else:

            self.settext(self.path_csv)

    def goto_raheel(self):
        webbrowser.open("https://github.com/rawheel")

    def goto_github(self):
        webbrowser.open(
            "https://github.com/DSC-UIT-khi/Google-DSC-Platform-Extension")

    def get_software(self):
        webbrowser.open(
            "https://github.com/DSC-UIT-khi/Google-DSC-Platform-Extension")

    def Start(self):
        if len(self.lineEdit.text()) == 0:
            self.message("Please select a .CSV file!")
        else:

            event_sel = self.lineEdit_2.text()

        info = (open("py_files/secret_info.txt", "r").read()).split(' ')
        email = info[0]
        pas = info[2]
        uni_link = info[3]

        data = pd.read_csv(self.path_csv, encoding="ISO-8859-1")
        arr = np.array(data.columns)
        column = [i.lower() for i in arr]
        #data.columns = column
        if "first name" in column[0] and "last name" in column[
                1] and "email" in column[2]:
            column[0] = "first name"
            column[1] = "last name"
            column[2] = "email"
        data.columns = column

        try:

            data.sort_values("email", inplace=True)

            data.drop_duplicates(subset="email", keep="first", inplace=True)
            lower_limit = 0
            upper_limit = 70
            count = 1

            if len(data) < 250:

                def run_bot(f_name, l_name, eemail, event_sel, uni_link, email,
                            pas):
                    obj = dsc_bot()
                    obj.login(uni_link, email, pas)
                    obj.start(f_name, l_name, eemail, event_sel, uni_link)

                f_name = data['first name'][lower_limit:upper_limit]
                l_name = data['last name'][lower_limit:upper_limit]
                eemail = data['email'][lower_limit:upper_limit]

                run_bot(f_name, l_name, eemail, event_sel, uni_link, email,
                        pas)

            else:
                self.message("Make sure your data length is less than 250!")

        except Exception as e:
            print(e, "report this error to GitHub repo")
            self.message(f'{e}, report this error to GitHub repo')
                    obj.login(uni_link, email, pas)
                    obj.start(f_name, l_name, eemail, event_sel, uni_link)

                f_name = data['first name'][lower_limit:upper_limit]
                l_name = data['last name'][lower_limit:upper_limit]
                eemail = data['email'][lower_limit:upper_limit]

                run_bot(f_name, l_name, eemail, event_sel, uni_link, email,
                        pas)

            else:
                self.message("Make sure your data length is less than 250!")

        except Exception as e:
            print(e, "report this error to GitHub repo")
            self.message(f'{e}, report this error to GitHub repo')


#G:\University\Developers Student Club\Fast track Datascience\all data

import pics_main

if __name__ == "__main__":
    import sys
    app = QtWidgets.QApplication(sys.argv)
    MainWindow = QtWidgets.QMainWindow()
    ui = Ui_MainWindow()
    ui.setupUi(MainWindow)
    MainWindow.show()
    sys.exit(app.exec_())
예제 #5
0
class Ui_MainWindow(object):
    def warnings_window(self):
        from warnings_window import  Ui_MainWindow
        
        self.window = QtWidgets.QMainWindow()
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self.window)
        self.window.show()
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(801, 671)
        MainWindow.setMinimumSize(QtCore.QSize(801, 671))
        MainWindow.setMaximumSize(QtCore.QSize(801, 671))
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.main_frame = QtWidgets.QFrame(self.centralwidget)
        self.main_frame.setGeometry(QtCore.QRect(0, 0, 901, 691))
        self.main_frame.setStyleSheet("#main_frame{\n"
"background-color: rgb(66,133,244);\n"
"}")
        self.main_frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.main_frame.setFrameShadow(QtWidgets.QFrame.Raised)
        self.main_frame.setObjectName("main_frame")
        self.choose_frame = QtWidgets.QFrame(self.main_frame)
        self.choose_frame.setGeometry(QtCore.QRect(100, 200, 611, 311))
        self.choose_frame.setMinimumSize(QtCore.QSize(8, 0))
        self.choose_frame.setStyleSheet("#choose_frame{\n"
"background-color: rgb(244,180,0);\n"
"border-radius:15px;\n"
"}")
        self.choose_frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.choose_frame.setFrameShadow(QtWidgets.QFrame.Raised)
        self.choose_frame.setObjectName("choose_frame")
        self.choose_btn = QtWidgets.QPushButton(self.choose_frame)
        self.choose_btn.setGeometry(QtCore.QRect(470, 90, 93, 31))
        self.choose_btn.setStyleSheet("#choose_btn{\n"
"background-color: rgb(255,255,255);\n"
"    font: 57 10pt \"Google Sans\";\n"
"border-radius:7px;\n"
"}\n"
"#choose_btn:hover{\n"
"background-color:rgb(219,68,55);\n"
"\n"
"    color: rgb(255, 255, 255);\n"
"}\n"
"\n"
"")
        self.choose_btn.setObjectName("choose_btn")
        self.lineEdit = QtWidgets.QLineEdit(self.choose_frame)
        self.lineEdit.setGeometry(QtCore.QRect(220, 83, 221, 41))
        self.lineEdit.setStyleSheet("font: 9pt \"MS Shell Dlg 2\";")
        self.lineEdit.setText("")
        self.lineEdit.setReadOnly(True)
        self.lineEdit.setObjectName("lineEdit")
        self.choose_label = QtWidgets.QLabel(self.choose_frame)
        self.choose_label.setGeometry(QtCore.QRect(20, 83, 171, 41))
        self.choose_label.setStyleSheet("#choose_label\n"
"{\n"
"    \n"
"    \n"
"    font: 57 14pt \"Google Sans\";\n"
"}")
        self.choose_label.setObjectName("choose_label")
        self.status_label = QtWidgets.QLabel(self.choose_frame)
        self.status_label.setGeometry(QtCore.QRect(20, 190, 141, 21))
        self.status_label.setStyleSheet("#status_label\n"
"{\n"
"    \n"
"    \n"
"    font: 57 14pt \"Google Sans\";\n"
"}")
        self.status_label.setObjectName("status_label")
        self.comboBox = QtWidgets.QComboBox(self.choose_frame)
        self.comboBox.setGeometry(QtCore.QRect(220, 190, 221, 31))
        self.comboBox.setStyleSheet("#comboBox{    \n"
"    background-color: rgb(255, 255, 255);\n"
"    font: 57 14pt \"Google Sans\";\n"
"}")
        self.comboBox.setObjectName("comboBox")
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(":/newPrefix/assets/gg.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.comboBox.addItem(icon, "")
        self.comboBox.addItem(icon, "")
        self.comboBox.addItem(icon, "")
        self.start_btn = QtWidgets.QPushButton(self.choose_frame)
        self.start_btn.setGeometry(QtCore.QRect(470, 190, 93, 31))
        self.start_btn.setStyleSheet("#start_btn{\n"
"background-color: rgb(255,255,255);\n"
"    font: 57 10pt \"Google Sans\";\n"
"border-radius:7px;\n"
"}\n"
"#start_btn:hover{\n"
"background-color:rgb(219,68,55);\n"
"\n"
"    color: rgb(255, 255, 255);\n"
"}\n"
"\n"
"")
        self.start_btn.setObjectName("start_btn")
        self.show_check = QtWidgets.QCheckBox(self.choose_frame)
        self.show_check.setGeometry(QtCore.QRect(270, 230, 121, 41))
        self.show_check.setStyleSheet("#show_check{    \n"
"    font: 57 8pt \"Google Sans\";\n"
"\n"
"}")
        self.show_check.setObjectName("show_check")
        self.logo_label = QtWidgets.QLabel(self.main_frame)
        self.logo_label.setGeometry(QtCore.QRect(210, 60, 421, 71))
        self.logo_label.setStyleSheet("#logo_label{\n"
"    \n"
"    \n"
"    \n"
"    \n"
"    background-image: url(:/newPrefix/assets/dsc-uit---karachi-logo-x1 (1).png);\n"
"    background-color: rgb(255, 255, 255,40);\n"
"    border-radius:15px;\n"
"}\n"
"")
        self.logo_label.setText("")
        self.logo_label.setObjectName("logo_label")
        self.dev_label = QtWidgets.QLabel(self.main_frame)
        self.dev_label.setGeometry(QtCore.QRect(350, 20, 151, 31))
        self.dev_label.setStyleSheet("#dev_label{    \n"
"    \n"
"    font: 75 14pt \"Google Sans\";\n"
"\n"
"}")
        self.dev_label.setObjectName("dev_label")
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 801, 26))
        self.menubar.setObjectName("menubar")
        self.menuDeveloped_By = QtWidgets.QMenu(self.menubar)
        self.menuDeveloped_By.setObjectName("menuDeveloped_By")
        self.menuWarnings = QtWidgets.QMenu(self.menubar)
        self.menuWarnings.setObjectName("menuWarnings")
        MainWindow.setMenuBar(self.menubar)
        self.actionRaheel_Siddiqui = QtWidgets.QAction(MainWindow)
        icon1 = QtGui.QIcon()
        icon1.addPixmap(QtGui.QPixmap(":/newPrefix/assets/person.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionRaheel_Siddiqui.setIcon(icon1)
        self.actionRaheel_Siddiqui.setObjectName("actionRaheel_Siddiqui")
        self.actionWarnings = QtWidgets.QAction(MainWindow)
        self.actionWarnings.setIcon(icon)
        self.actionWarnings.setObjectName("actionWarnings")
        self.actionGitHub_Code = QtWidgets.QAction(MainWindow)
        icon2 = QtGui.QIcon()
        icon2.addPixmap(QtGui.QPixmap(":/newPrefix/assets/Octocat.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionGitHub_Code.setIcon(icon2)
        self.actionGitHub_Code.setObjectName("actionGitHub_Code")
        self.actionGet_the_Software = QtWidgets.QAction(MainWindow)
        self.actionGet_the_Software.setIcon(icon)
        self.actionGet_the_Software.setObjectName("actionGet_the_Software")
        self.menuDeveloped_By.addAction(self.actionRaheel_Siddiqui)
        self.menuWarnings.addAction(self.actionWarnings)
        self.menuWarnings.addAction(self.actionGitHub_Code)
        self.menuWarnings.addAction(self.actionGet_the_Software)
        self.menubar.addAction(self.menuDeveloped_By.menuAction())
        self.menubar.addAction(self.menuWarnings.menuAction())

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

        self.choose_btn.clicked.connect(self.open_dialogue_box)

        self.actionRaheel_Siddiqui.triggered.connect(self.goto_raheel)
        self.actionGitHub_Code.triggered.connect(self.goto_github)
        self.actionGet_the_Software.triggered.connect(self.get_software)
        self.actionWarnings.triggered.connect(self.warnings_window)
        self.start_btn.clicked.connect(self.Start)


    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
        self.choose_btn.setText(_translate("MainWindow", "Select"))
        self.lineEdit.setPlaceholderText(_translate("MainWindow", "CSV File Path.."))
        self.choose_label.setText(_translate("MainWindow", "Select CSV File:"))
        self.status_label.setText(_translate("MainWindow", "Event Status:"))
        self.comboBox.setItemText(0, _translate("MainWindow", "Live"))
        self.comboBox.setItemText(1, _translate("MainWindow", "Draft"))
        self.comboBox.setItemText(2, _translate("MainWindow", "Completed"))
        self.start_btn.setText(_translate("MainWindow", "Start"))
        self.show_check.setText(_translate("MainWindow", "Show Chrome"))
        self.dev_label.setText(_translate("MainWindow", "Developed By"))
        self.menuDeveloped_By.setTitle(_translate("MainWindow", "Developed By"))
        self.menuWarnings.setTitle(_translate("MainWindow", "Help"))
        self.actionRaheel_Siddiqui.setText(_translate("MainWindow", "Raheel Siddiqui"))
        self.actionWarnings.setText(_translate("MainWindow", "Warnings!"))
        self.actionGitHub_Code.setText(_translate("MainWindow", "GitHub Code"))
        self.actionGet_the_Software.setText(_translate("MainWindow", "Get the Software"))

    
    def message(self,message):

        a1= QMessageBox()
        a1.setWindowTitle("message!")
        a1.setText(message)
        a1.setIcon(QMessageBox.Information)
        a1.setStandardButtons(QMessageBox.Ok)
        x = a1.exec_()
    def settext(self,text):
        self.lineEdit.setText(str(text))
        
    def open_dialogue_box(self):
        filename = QFileDialog.getOpenFileName()
        self.path_csv = filename[0]
        if self.path_csv[-4:] != ".csv":
            self.message("Please select a .CSV file!")
        else:


            self.settext(self.path_csv )
    def goto_raheel(self):
        webbrowser.open("https://github.com/rawheel")
    def goto_github(self):
        webbrowser.open("https://github.com/DSC-UIT-khi/Get-DSC-Platform-Extension")

    def get_software(self):
        webbrowser.open("https://drive.google.com/drive/folders/1A4LPBtP_gRaumanvV5p_oIDUvbsTDw0i?usp=sharing")

    def Start(self):
        if len(self.lineEdit.text())==0:
            self.message("Please select a .CSV file!")
        else:
            check = 0
            if self.show_check.isChecked():
                check = 1
            comb_text = str(self.comboBox.currentText())
            print(comb_text)

        info = (open("py_files/secret_info.txt","r").read()).split(' ')
        email =info[0]
        pas = info[2]
        uni_link=info[3]

        data = pd.read_csv(self.path_csv)
        arr =np.array(data.columns)
        column = [i.lower() for i in arr]
        data.columns = column


        try:


            data.sort_values("email", inplace = True)

            data.drop_duplicates(subset ="email", keep = "first", inplace = True)
            

            f_name = data["first name"]
            l_name = data["last name"]
            eemail = data["email"]
            obj = dsc_bot()
            obj.login(uni_link,email,pas)
            obj.start(f_name,l_name,eemail,comb_text)

        except:
            self.message("Make Sure .csv file has columns (First Name, Last Name,Email)")
예제 #6
0
class Ui_MainWindow(object):
    def warnings_window(self):
        from warnings_window import Ui_MainWindow

        self.window = QtWidgets.QMainWindow()
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self.window)
        self.window.show()

    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(611, 591)
        MainWindow.setMinimumSize(QtCore.QSize(611, 591))
        MainWindow.setMaximumSize(QtCore.QSize(611, 591))
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.main_frame = QtWidgets.QFrame(self.centralwidget)
        self.main_frame.setGeometry(QtCore.QRect(0, 0, 611, 591))
        self.main_frame.setStyleSheet("#main_frame{\n"
                                      "background-color: rgb(66,133,244);\n"
                                      "}")
        self.main_frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.main_frame.setFrameShadow(QtWidgets.QFrame.Raised)
        self.main_frame.setObjectName("main_frame")
        self.choose_frame = QtWidgets.QFrame(self.main_frame)
        self.choose_frame.setGeometry(QtCore.QRect(80, 180, 451, 301))
        self.choose_frame.setMinimumSize(QtCore.QSize(8, 0))
        self.choose_frame.setStyleSheet("#choose_frame{\n"
                                        "background-color: rgb(244,180,0);\n"
                                        "border-radius:15px;\n"
                                        "}")
        self.choose_frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
        self.choose_frame.setFrameShadow(QtWidgets.QFrame.Raised)
        self.choose_frame.setObjectName("choose_frame")
        self.choose_label = QtWidgets.QLabel(self.choose_frame)
        self.choose_label.setGeometry(QtCore.QRect(30, 40, 81, 51))
        self.choose_label.setStyleSheet("#choose_label\n"
                                        "{\n"
                                        "    \n"
                                        "    \n"
                                        "    font: 57 14pt \"Google Sans\";\n"
                                        "}")
        self.choose_label.setObjectName("choose_label")
        self.login_btn = QtWidgets.QPushButton(self.choose_frame)
        self.login_btn.setGeometry(QtCore.QRect(260, 230, 93, 31))
        self.login_btn.setStyleSheet("#login_btn{\n"
                                     "background-color: rgb(255,255,255);\n"
                                     "    font: 57 10pt \"Google Sans\";\n"
                                     "border-radius:7px;\n"
                                     "}\n"
                                     "#login_btn:hover{\n"
                                     "background-color:rgb(219,68,55);\n"
                                     "\n"
                                     "    color: rgb(255, 255, 255);\n"
                                     "}\n"
                                     "\n"
                                     "")
        self.login_btn.setObjectName("login_btn")
        self.lineEdit = QtWidgets.QLineEdit(self.choose_frame)
        self.lineEdit.setGeometry(QtCore.QRect(200, 50, 221, 31))
        self.lineEdit.setStyleSheet("border-radius:9px;")
        self.lineEdit.setObjectName("lineEdit")
        self.lineEdit.setStyleSheet("    font: 57 9pt \"Google Sans\";\n"
                                    "border-radius:9px;\n")
        self.lineEdit_2 = QtWidgets.QLineEdit(self.choose_frame)
        self.lineEdit_2.setGeometry(QtCore.QRect(200, 110, 221, 31))
        self.lineEdit_2.setStyleSheet("    font: 57 9pt \"Google Sans\";\n"
                                      "border-radius:9px;")
        self.lineEdit_2.setEchoMode(QtWidgets.QLineEdit.Password)
        self.lineEdit_2.setObjectName("lineEdit_2")
        self.pass_label = QtWidgets.QLabel(self.choose_frame)
        self.pass_label.setGeometry(QtCore.QRect(30, 100, 121, 51))
        self.pass_label.setStyleSheet("#pass_label\n"
                                      "{\n"
                                      "    \n"
                                      "    \n"
                                      "    font: 57 14pt \"Google Sans\";\n"
                                      "}")
        self.pass_label.setObjectName("pass_label")
        self.uni_label = QtWidgets.QLabel(self.choose_frame)
        self.uni_label.setGeometry(QtCore.QRect(30, 170, 151, 21))
        self.uni_label.setStyleSheet("#uni_label\n"
                                     "{\n"
                                     "    \n"
                                     "    \n"
                                     "    font: 57 11pt \"Google Sans\";\n"
                                     "}")
        self.uni_label.setObjectName("uni_label")
        self.lineEdit_3 = QtWidgets.QLineEdit(self.choose_frame)
        self.lineEdit_3.setGeometry(QtCore.QRect(200, 160, 221, 41))
        self.lineEdit_3.setStyleSheet("border-radius:9px;")
        self.lineEdit_3.setObjectName("lineEdit_3")
        self.logo_label = QtWidgets.QLabel(self.main_frame)
        self.logo_label.setGeometry(QtCore.QRect(100, 60, 421, 71))
        self.logo_label.setStyleSheet(
            "#logo_label{\n"
            "    \n"
            "    \n"
            "    \n"
            "    \n"
            "    background-image: url(:/newPrefix/assets/dsc-uit---karachi-logo-x1 (1).png);\n"
            "    background-color: rgba(255, 255, 255,40);\n"
            "    border-radius:15px;\n"
            "}\n"
            "")
        self.logo_label.setText("")
        self.logo_label.setObjectName("logo_label")
        self.dev_label = QtWidgets.QLabel(self.main_frame)
        self.dev_label.setGeometry(QtCore.QRect(240, 20, 151, 31))
        self.dev_label.setStyleSheet("#dev_label{    \n"
                                     "    \n"
                                     "    font: 75 14pt \"Google Sans\";\n"
                                     "\n"
                                     "}")
        self.dev_label.setObjectName("dev_label")
        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(MainWindow)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 611, 26))
        self.menubar.setObjectName("menubar")
        self.menuDeveloped_By = QtWidgets.QMenu(self.menubar)
        self.menuDeveloped_By.setObjectName("menuDeveloped_By")
        self.menuWarnings = QtWidgets.QMenu(self.menubar)
        self.menuWarnings.setObjectName("menuWarnings")
        MainWindow.setMenuBar(self.menubar)
        self.actionRaheel_Siddiqui = QtWidgets.QAction(MainWindow)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(":/newPrefix/assets/person.png"),
                       QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionRaheel_Siddiqui.setIcon(icon)
        self.actionRaheel_Siddiqui.setObjectName("actionRaheel_Siddiqui")
        self.actionWarnings = QtWidgets.QAction(MainWindow)
        icon1 = QtGui.QIcon()
        icon1.addPixmap(QtGui.QPixmap(":/newPrefix/assets/gg.png"),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionWarnings.setIcon(icon1)
        self.actionWarnings.setObjectName("actionWarnings")
        self.actionGitHub_Code = QtWidgets.QAction(MainWindow)
        icon2 = QtGui.QIcon()
        icon2.addPixmap(QtGui.QPixmap(":/newPrefix/assets/Octocat.png"),
                        QtGui.QIcon.Normal, QtGui.QIcon.Off)
        self.actionGitHub_Code.setIcon(icon2)
        self.actionGitHub_Code.setObjectName("actionGitHub_Code")
        self.actionGet_the_Software = QtWidgets.QAction(MainWindow)
        self.actionGet_the_Software.setIcon(icon1)
        self.actionGet_the_Software.setObjectName("actionGet_the_Software")
        self.menuDeveloped_By.addAction(self.actionRaheel_Siddiqui)
        self.menuWarnings.addAction(self.actionWarnings)
        self.menuWarnings.addAction(self.actionGitHub_Code)
        self.menuWarnings.addAction(self.actionGet_the_Software)
        self.menubar.addAction(self.menuDeveloped_By.menuAction())
        self.menubar.addAction(self.menuWarnings.menuAction())

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

        self.actionRaheel_Siddiqui.triggered.connect(self.goto_raheel)
        self.actionGitHub_Code.triggered.connect(self.goto_github)
        self.actionGet_the_Software.triggered.connect(self.get_software)
        self.actionWarnings.triggered.connect(self.warnings_window)
        self.login_btn.clicked.connect(self.Login)

    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
        self.choose_label.setText(_translate("MainWindow", "Email:"))
        self.login_btn.setText(_translate("MainWindow", "Save Data"))
        self.lineEdit.setPlaceholderText(
            _translate("MainWindow", " Enter Email"))
        self.lineEdit_2.setPlaceholderText(
            _translate("MainWindow", " Enter Password"))
        self.pass_label.setText(_translate("MainWindow", "Password:"******"MainWindow", "Uni_platform_Link:"))
        self.lineEdit_3.setPlaceholderText(
            _translate(
                "MainWindow",
                " https://dsc.community.dev/usman-institute-of-technology/"))
        self.dev_label.setText(_translate("MainWindow", "Developed By"))
        self.menuDeveloped_By.setTitle(_translate("MainWindow",
                                                  "Developed By"))
        self.menuWarnings.setTitle(_translate("MainWindow", "Help"))
        self.actionRaheel_Siddiqui.setText(
            _translate("MainWindow", "Raheel Siddiqui"))
        self.actionWarnings.setText(_translate("MainWindow", "Warnings!"))
        self.actionGitHub_Code.setText(_translate("MainWindow", "GitHub Code"))
        self.actionGet_the_Software.setText(
            _translate("MainWindow", "Get the Software"))

    def message(self, message):

        a1 = QMessageBox()
        a1.setWindowTitle("message!")
        a1.setText(message)
        a1.setIcon(QMessageBox.Information)
        a1.setStandardButtons(QMessageBox.Ok)
        x = a1.exec_()

    def main_window(self):
        from main_window import Ui_MainWindow

        self.window = QtWidgets.QMainWindow()
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self.window)
        self.window.show()
        MainWindow.hide()

    def goto_raheel(self):
        webbrowser.open("https://github.com/rawheel")

    def goto_github(self):
        webbrowser.open(
            "https://github.com/DSC-UIT-khi/Get-DSC-Platform-Extension")

    def get_software(self):
        webbrowser.open(
            "https://github.com/DSC-UIT-khi/Google-DSC-Platform-Extension")

    def Login(self):
        self.email = self.lineEdit.text()
        self.password = self.lineEdit_2.text()
        self.Uni_platform_Link = self.lineEdit_3.text()
        self.save_info()

    def save_info(self):
        if len(self.email) == 0 or len(self.password) == 0 or len(
                self.Uni_platform_Link) == 0:
            self.message("Enter Proper Information!")

        else:
            if "https:" not in self.Uni_platform_Link:
                self.message("Enter Proper Uni_platform_Link with https:")
            else:
                secret_info = open("py_files/secret_info.txt", "w")
                secret_info.write(self.email + " ")
                secret_info.write(" " + self.password)
                secret_info.write(" " + self.Uni_platform_Link)
                secret_info.close()
                self.main_window()