def get_childs(self, sender): """ Generate sub dirs relevant to main menu element """ self.clear_child_table() self.current_parent = sender # Create Childs self.refresh_element = QToolButton() self.refresh_element.setObjectName('refresh') self.refresh_element.setIcon(QIcon(':/refresh')) self.refresh_element.setIconSize(QSize(22, 22)) self.refresh_element.setCursor(Qt.PointingHandCursor) self.refresh_element.clicked.connect(lambda: self.get_keys(True, refresh=self.refresh_element.statusTip())) self.refresh_element.setEnabled(False) self.second_layout_keys_childs.addWidget(self.refresh_element) self.second_layout_keys_childs.addSpacing(5) sql = "SELECT DISTINCT child " \ "FROM passwords " \ "WHERE parent=? " \ "ORDER BY child ASC" query = self.cursor.execute(sql, (sender,)) for item in query.fetchall(): child_element = QRadioButton() child_element.setObjectName("child-element") child_element.setText(item[0]) child_element.setMinimumHeight(22) child_element.setCursor(Qt.PointingHandCursor) child_element.clicked.connect(self.get_keys) self.second_layout_keys_childs.addWidget(child_element) self.second_layout_keys_childs.addSpacing(5)
def initUI(self): try: self.setWindowState(QtCore.Qt.WindowMaximized) except: self.setGeometry(10, 30, 1350, 750) self.setWindowTitle('Dana') self.setWindowIcon( QIcon('download.png') ) # Have this png at same directory as this code is. Icon Image oImage = QImage( "download(1).jpg" ) # Have this png at same directory as this code is. Background Image sImage = oImage.scaled(QSize(1350, 750)) palette = QPalette() palette.setBrush(10, QBrush(sImage)) self.setPalette(palette) saveButton = QPushButton("ADD/MODIFY", self) deleteButton = QPushButton("DELETE", self) clearButton = QPushButton("CLEAR", self) TrainButton = QPushButton("Train DANA", self) saveButton.setFont(QtGui.QFont("Calibri", 13)) deleteButton.setFont(QtGui.QFont("Calibri", 13)) clearButton.setFont(QtGui.QFont("Calibri", 13)) TrainButton.setFont(QtGui.QFont("Calibri", 13)) saveButton.move(100, 690) clearButton.move(260, 690) TrainButton.move(420, 690) saveButton.clicked.connect(self.saveClicked) deleteButton.clicked.connect(self.deleteClicked) clearButton.clicked.connect(self.clearClicked) TrainButton.clicked.connect(self.TrainClicked) saveButton.setStyleSheet("background-color: #F7CE16") deleteButton.setStyleSheet("background-color: #F7CE16") clearButton.setStyleSheet("background-color: #F7CE16") TrainButton.setStyleSheet("background-color: #F7CE16") headerfont = QtGui.QFont("Cambria", 13, QtGui.QFont.Bold) l1 = QLabel("BOOK ID: ") l1.setFont(headerfont) l1.setMinimumHeight(30) l1.setFixedWidth(180) text1 = QLineEdit() text1.setFixedWidth(250) text1.setMinimumHeight(30) text1.setPlaceholderText("The Library Book ID ") text1.setFont(QtGui.QFont("Times", 11)) l2 = QLabel("AUTHOR: ") l2.setFont(headerfont) l2.setMinimumHeight(30) l2.setFixedWidth(180) text2 = QLineEdit() text2.setFixedWidth(600) text2.setMinimumHeight(30) text2.setPlaceholderText(" EX: Sumitra Arora ") text2.setFont(QtGui.QFont("Times", 11)) l3 = QLabel("TITLE: ") l3.setFont(headerfont) l3.setMinimumHeight(30) l3.setFixedWidth(180) text3 = QLineEdit() text3.setFixedWidth(600) text3.setMinimumHeight(30) text3.setPlaceholderText(" EX: Artificial Intelligence,C,C++ ") text3.setFont(QtGui.QFont("Times", 11)) l4 = QLabel("PUBLICATION: ") l4.setFont(headerfont) l4.setMinimumHeight(30) l4.setFixedWidth(180) text4 = QLineEdit() text4.setFixedWidth(600) text4.setMinimumHeight(30) text4.setPlaceholderText(" EX: TATA MCGRAW HILL ") text4.setFont(QtGui.QFont("Times", 11)) l5 = QLabel("EDITION: ") l5.setFont(headerfont) l5.setMinimumHeight(30) l5.setFixedWidth(180) text5 = QLineEdit() text5.setFixedWidth(250) text5.setMinimumHeight(30) text5.setPlaceholderText(" EX: 1,2,3 ") text5.setFont(QtGui.QFont("Times", 11)) l6 = QLabel("ISSUE STATUS: ") l6.setFont(headerfont) l6.setMinimumHeight(30) l6.setFixedWidth(200) hboxperiod = QHBoxLayout() hboxperiod.setSpacing(70) r1 = QRadioButton("BOOK ISSUED") r1.setFont(QtGui.QFont("Calibri", 9, QtGui.QFont.Bold)) r1.setMinimumHeight(30) r2 = QRadioButton("NOT ISSUED") r2.setFont(QtGui.QFont("Calibri", 9, QtGui.QFont.Bold)) r2.setMinimumHeight(30) r2.setChecked(True) widgetperiod = QWidget(self) groupperiod = QButtonGroup(widgetperiod) groupperiod.addButton(r1) groupperiod.addButton(r2) hboxperiod.addWidget(r1) hboxperiod.addWidget(r2) hboxperiod.addStretch() l7 = QLabel("PRICE: ") l7.setFont(headerfont) l7.setMinimumHeight(30) l7.setFixedWidth(200) text7 = QLineEdit() text7.setFixedWidth(250) text7.setMinimumHeight(30) text7.setPlaceholderText("Price of the Book") text7.setFont(QtGui.QFont("Times", 11)) l8 = QLabel("ROW NUMBER: ") l8.setFont(headerfont) l8.setMinimumHeight(30) l8.setFixedWidth(200) text8 = QLineEdit() text8.setFixedWidth(250) text8.setMinimumHeight(30) text8.setPlaceholderText("Start counting from Door") text8.setFont(QtGui.QFont("Times", 11)) l9 = QLabel("COLUMN NUMBER: ") l9.setFont(headerfont) l9.setMinimumHeight(30) l9.setFixedWidth(200) text9 = QLineEdit() text9.setFixedWidth(250) text9.setMinimumHeight(30) text9.setPlaceholderText("Start counting from the Help Desk") text9.setFont(QtGui.QFont("Times", 11)) l10 = QLabel("SHELF PARTION NUMBER: ") l10.setFont(headerfont) l10.setMinimumHeight(30) l10.setFixedWidth(200) text10 = QLineEdit() text10.setFixedWidth(250) text10.setMinimumHeight(30) text10.setPlaceholderText("Start counting from top of the shelf") text10.setFont(QtGui.QFont("Times", 11)) l11 = QLabel("CLASSIFYING SUBJECT: ") l11.setFont(headerfont) l11.setMinimumHeight(30) l11.setFixedWidth(180) text11 = QLineEdit() text11.setFixedWidth(600) text11.setMinimumHeight(30) text11.setPlaceholderText( " EX: Mathematics/Science/Computer Science or others.") text11.setFont(QtGui.QFont("Times", 11)) text12 = QLineEdit() text12.setFixedWidth(600) text12.setMinimumHeight(30) text12.setPlaceholderText( " Enter the BOOK ID and Press the Delete Button to delete the data of the book" ) text12.setFont(QtGui.QFont("Times", 11)) fbox = QFormLayout() fbox.setVerticalSpacing(27) fbox.setHorizontalSpacing(30) fbox.addRow(l1, text1) fbox.addRow(l2, text2) fbox.addRow(l3, text3) fbox.addRow(l4, text4) fbox.addRow(l5, text5) fbox.addRow(l11, text11) fbox.addRow(l6, hboxperiod) fbox.addRow(l7, text7) fbox.addRow(l8, text8) fbox.addRow(l9, text9) fbox.addRow(l10, text10) fbox.addRow(deleteButton, text12) self.setLayout(fbox) self.lineedits = [ text1, text2, text3, text4, text5, text7, text8, text9, text10, text11 ] self.deletelineedit = [text12] self.radiobutton = [r1, r2] self.show()
def initUI(self): saveButton = QPushButton("SAVE", self) clearButton = QPushButton("CLEAR", self) saveButton.setFont(QtGui.QFont("Calibri", 13)) clearButton.setFont(QtGui.QFont("Calibri", 13)) saveButton.move(100, 680) clearButton.move(260, 680) comboBoxyopass = QtWidgets.QComboBox(self) comboBoxyopass.addItem("SELECT") i = 2050 while i >= 2000: comboBoxyopass.addItem(str(i)) i -= 1 comboBoxyopass.setMinimumHeight(35) comboBoxyopass.setFixedWidth(150) comboBoxyopass.setFont(QtGui.QFont("Calibri", 14)) comboBoxtrcentr = QtWidgets.QComboBox(self) comboBoxtrcentr.addItem("SELECT CENTER") comboBoxtrcentr.addItem('Jaipur ') comboBoxtrcentr.addItem('Hyderabad') comboBoxtrcentr.addItem('Raipur ') comboBoxtrcentr.addItem('Lucknow ') comboBoxtrcentr.addItem('Pune ') comboBoxtrcentr.addItem('Vizag ') comboBoxtrcentr.addItem('Bhopal ') comboBoxtrcentr.addItem('Delhi ') comboBoxtrcentr.setMinimumHeight(35) comboBoxtrcentr.setFixedWidth(180) comboBoxtrcentr.setFont(QtGui.QFont("Calibri", 14)) comboBoxcourse = QtWidgets.QComboBox(self) comboBoxcourse.addItem("SELECT COURSE") comboBoxcourse.addItem('ESR (30 Days) ') comboBoxcourse.addItem('ESR (45 Days) ') comboBoxcourse.addItem('Matlab (30 Days) ') comboBoxcourse.addItem('IOT (15 Days) ') comboBoxcourse.addItem('IOT (30 Days) ') comboBoxcourse.addItem('JAVA (30 Days) ') comboBoxcourse.addItem('Python (30 Days) ') comboBoxcourse.addItem('PLC-SCADA (30 Days)') comboBoxcourse.addItem('C/C++ (45 Days) ') comboBoxcourse.addItem('Android (15 Days) ') comboBoxcourse.addItem('Android (30 Days) ') comboBoxcourse.setMinimumHeight(35) comboBoxcourse.setFixedWidth(200) comboBoxcourse.setFont(QtGui.QFont("Calibri", 14)) comboBoxsem = QtWidgets.QComboBox(self) comboBoxsem.addItem("SELECT") i = 1 while i <= 8: comboBoxsem.addItem(str(i)) i += 1 comboBoxsem.addItem("Passed Out") comboBoxsem.setMinimumHeight(35) comboBoxsem.setFixedWidth(100) comboBoxsem.setFont(QtGui.QFont("Calibri", 14)) comboBoxstate = QtWidgets.QComboBox(self) comboBoxstate.addItem("SELECT") comboBoxstate.addItem('Andhra Pradesh') comboBoxstate.addItem('Arunachal Pradesh') comboBoxstate.addItem('Assam') comboBoxstate.addItem('Bihar') comboBoxstate.addItem('Goa') comboBoxstate.addItem('Gujarat') comboBoxstate.addItem('Haryana') comboBoxstate.addItem('Himachal Pradesh') comboBoxstate.addItem('Jammu & Kashmir') comboBoxstate.addItem('Karnataka') comboBoxstate.addItem('Kerala') comboBoxstate.addItem('Madhya Pradesh') comboBoxstate.addItem('Maharashtra') comboBoxstate.addItem('Manipur') comboBoxstate.addItem('Meghalaya') comboBoxstate.addItem('Mizoram') comboBoxstate.addItem('Nagaland') comboBoxstate.addItem('Orissa') comboBoxstate.addItem('Punjab') comboBoxstate.addItem('Rajasthan') comboBoxstate.addItem('Sikkim') comboBoxstate.addItem('Tamil Nadu') comboBoxstate.addItem('Tripura') comboBoxstate.addItem('Uttar Pradesh') comboBoxstate.addItem('West Bengal') comboBoxstate.addItem('Chhattisgarh') comboBoxstate.addItem('Uttarakhand') comboBoxstate.addItem('Jharkhand') comboBoxstate.addItem('Telangana') comboBoxstate.setMinimumHeight(35) comboBoxstate.setFixedWidth(250) comboBoxstate.setFont(QtGui.QFont("Calibri", 14)) hboxsex = QHBoxLayout() hboxsex.setSpacing(60) r1 = QRadioButton("Male") r1.setFont(QtGui.QFont("Calibri", 10.5, QtGui.QFont.Bold)) r1.setMinimumHeight(30) r2 = QRadioButton("Female") r2.setFont(QtGui.QFont("Calibri", 10.5, QtGui.QFont.Bold)) r2.setMinimumHeight(30) widgetsex = QWidget(self) groupsex = QButtonGroup(widgetsex) groupsex.addButton(r1) groupsex.addButton(r2) hboxsex.addWidget(r1) hboxsex.addWidget(r2) hboxsex.addStretch() headerfont = QtGui.QFont("Cambria", 13, QtGui.QFont.Bold) saveloc = str("Student_List.xlsx") l1 = QLabel("Name: ") l1.setFont(headerfont) l1.setMinimumHeight(30) l1.setFixedWidth(180) text1 = QLineEdit() text1.setFixedWidth(600) text1.setMinimumHeight(30) text1.setFont(QtGui.QFont("Times", 11)) l2 = QLabel("Email Id: ") l2.setFont(headerfont) l2.setMinimumHeight(30) l2.setFixedWidth(180) text2 = QLineEdit() text2.setFixedWidth(600) text2.setMinimumHeight(30) text2.setFont(QtGui.QFont("Times", 11)) l3 = QLabel("Contact No.: ") l3.setFont(headerfont) l3.setMinimumHeight(30) l3.setFixedWidth(180) text3 = QLineEdit() text3.setFixedWidth(600) text3.setMinimumHeight(30) text3.setFont(QtGui.QFont("Times", 11)) l4 = QLabel("City: ") l4.setFont(headerfont) l4.setMinimumHeight(30) l4.setFixedWidth(180) text4 = QLineEdit() text4.setFixedWidth(600) text4.setMinimumHeight(30) text4.setFont(QtGui.QFont("Times", 11)) l5 = QLabel("State: ") l5.setFont(headerfont) l5.setMinimumHeight(30) l5.setFixedWidth(180) l6 = QLabel("College: ") l6.setFont(headerfont) l6.setMinimumHeight(30) l6.setFixedWidth(180) text6 = QLineEdit() text6.setFixedWidth(600) text6.setMinimumHeight(30) text6.setFont(QtGui.QFont("Times", 11)) l7 = QLabel("Branch: ") l7.setFont(headerfont) l7.setMinimumHeight(30) l7.setFixedWidth(180) text7 = QLineEdit() text7.setFixedWidth(600) text7.setMinimumHeight(30) text7.setFont(QtGui.QFont("Times", 11)) l8 = QLabel("Semester: ") l8.setFont(headerfont) l8.setMinimumHeight(30) l8.setFixedWidth(180) l9 = QLabel("Year Of Passing: ") l9.setFont(headerfont) l9.setFixedWidth(180) l10 = QLabel("Course: ") l10.setFont(headerfont) l10.setMinimumHeight(30) l10.setFixedWidth(180) l11 = QLabel("Batch: ") l11.setFont(headerfont) l11.setMinimumHeight(30) l11.setFixedWidth(180) text11 = QLineEdit() text11.setFixedWidth(600) text11.setMinimumHeight(30) text11.setFont(QtGui.QFont("Times", 11)) l12 = QLabel("Training Center: ") l12.setFont(headerfont) l12.setMinimumHeight(30) l12.setFixedWidth(180) l13 = QLabel("SEX: ") l13.setFont(headerfont) l13.setFixedWidth(180) l14 = QLabel("Save File As: ") l14.setFont(headerfont) l14.setMinimumHeight(30) l14.setFixedWidth(180) text14 = QLineEdit() text14.setFixedWidth(600) text14.setMinimumHeight(30) text14.setFont(QtGui.QFont("Times", 11, QtGui.QFont.Bold)) text14.setText(saveloc) l15 = QLabel("Query/Regarding What: ") l15.setFont(QtGui.QFont("Cambria", 12, QtGui.QFont.Bold)) l15.setMinimumHeight(30) l15.setFixedWidth(200) text15 = QLineEdit() text15.setFixedWidth(600) text15.setMinimumHeight(30) text15.setFont(QtGui.QFont("Times", 11)) hboxcourse = QHBoxLayout() hboxcourse.setSpacing(25) l16 = QLabel("Others: ") l16.setFont(headerfont) l16.setMinimumHeight(30) l16.setFixedWidth(100) text16 = QLineEdit() text16.setFixedWidth(250) text16.setMinimumHeight(30) text16.setFont(QtGui.QFont("Times", 11)) hboxcourse.addWidget(comboBoxcourse) hboxcourse.addWidget(l16) hboxcourse.addWidget(text16) hboxcourse.addStretch() hboxstate = QHBoxLayout() hboxstate.setSpacing(25) l17 = QLabel("Others: ") l17.setFont(headerfont) l17.setMinimumHeight(30) l17.setFixedWidth(70) text17 = QLineEdit() text17.setFixedWidth(230) text17.setMinimumHeight(30) text17.setFont(QtGui.QFont("Times", 11)) hboxstate.addWidget(comboBoxstate) hboxstate.addWidget(l17) hboxstate.addWidget(text17) hboxstate.addStretch() fbox = QFormLayout() fbox.setVerticalSpacing(10) fbox.addRow(l1, text1) fbox.addRow(l2, text2) fbox.addRow(l3, text3) fbox.addRow(l4, text4) fbox.addRow(l5, hboxstate) fbox.addRow(l6, text6) fbox.addRow(l7, text7) fbox.addRow(l8, comboBoxsem) fbox.addRow(l9, comboBoxyopass) fbox.addRow(l10, hboxcourse) fbox.addRow(l11, text11) fbox.addRow(l12, comboBoxtrcentr) l18 = QLabel("Training Session: ") l18.setFont(headerfont) l18.setMinimumHeight(30) l18.setFixedWidth(200) hboxperiod = QHBoxLayout() hboxperiod.setSpacing(70) r3 = QRadioButton("Summer Training") r3.setFont(QtGui.QFont("Calibri", 10, QtGui.QFont.Bold)) r3.setMinimumHeight(30) r4 = QRadioButton("Winter Training") r4.setFont(QtGui.QFont("Calibri", 10, QtGui.QFont.Bold)) r4.setMinimumHeight(30) r5 = QRadioButton("Project Based") r5.setFont(QtGui.QFont("Calibri", 10, QtGui.QFont.Bold)) r5.setMinimumHeight(30) r6 = QRadioButton("Other") r6.setFont(QtGui.QFont("Calibri", 10, QtGui.QFont.Bold)) r6.setMinimumHeight(30) widgetperiod = QWidget(self) groupperiod = QButtonGroup(widgetperiod) groupperiod.addButton(r3) groupperiod.addButton(r4) groupperiod.addButton(r5) groupperiod.addButton(r6) hboxperiod.addWidget(r3) hboxperiod.addWidget(r4) hboxperiod.addWidget(r5) hboxperiod.addWidget(r6) hboxperiod.addStretch() fbox.addRow(l18, hboxperiod) fbox.addRow(l13, hboxsex) fbox.addRow(l15, text15) fbox.addRow(l14, text14) self.lineedits = [ text1, text2, text3, text4, text6, text7, text11, text14, text15, text16, text17 ] self.saveedit = [text14] self.comboBox = [ comboBoxstate, comboBoxsem, comboBoxyopass, comboBoxtrcentr, comboBoxcourse ] self.radiobutton = [r1, r2, r3, r4, r5, r6] saveButton.clicked.connect(self.saveClicked) clearButton.clicked.connect(self.clearClicked) self.setLayout(fbox) try: self.setWindowState(QtCore.Qt.WindowMaximized) except: self.setGeometry(10, 30, 1350, 750) self.setWindowTitle('Managemet System Software ') self.setWindowIcon( QIcon('logso.png')) # Enter your Icon Image url here oImage = QImage("image2.jpg") # Enter your Background Image url here sImage = oImage.scaled(QSize(1350, 750)) palette = QPalette() palette.setBrush(10, QBrush(sImage)) self.setPalette(palette) self.show()