def init_style(self): self.pushButton_8.setHidden(True) CommonUtil.set_combobox_style1(self.comboBox) CommonUtil.set_combobox_style1(self.comboBox_3) CommonUtil.set_groupbox_style(self.groupBox) CommonUtil.set_groupbox_style(self.groupBox_2) CommonUtil.set_button_style1(self.pushButton_8)
def register(self): Session = sessionmaker(bind=engine) session = Session() try: if self.lineEdit.text() == '' or self.lineEdit_2.text() == '': CommonUtil.hint_dialog(self, CommonUtil.APP_ICON, '提示', '请输入用户名和密码') return users = session.query(user).filter( user.name == self.lineEdit.text()) if users.count() >= 1: CommonUtil.hint_dialog(self, CommonUtil.APP_ICON, '提示', '用户已经存在~') return else: newuser = user() newuser.name = self.lineEdit.text().strip() newuser.password = self.lineEdit_2.text().strip() session.add(newuser) session.commit() except Exception as e: print(e.args) finally: session.close()
def inithidebutton(self): CommonUtil.set_button_style3(self.pushButton) CommonUtil.set_button_style3(self.pushButton_2) CommonUtil.set_button_style3(self.pushButton_3) CommonUtil.set_button_style3(self.pushButton_4) CommonUtil.set_button_style3(self.pushButton_5) self.pushButton.hide() self.pushButton_2.hide() self.pushButton_3.hide() self.pushButton_5.hide()
def inittihaodisplay(self): papernum = len(self.paperlist) rownum = papernum // 25 + 1 clonum = 25 tihao = 1 for i in range(rownum): for j in range(clonum): if tihao > papernum: break checkboxname = "tihao" + str(tihao) checkbox = QtWidgets.QPushButton() CommonUtil.set_button_style4(checkbox) checkbox.setFixedSize(60, 25) checkbox.setObjectName(checkboxname) checkbox.setText(str(tihao)) self.tihaolayout.addWidget(checkbox, i, j) checkbox.clicked.connect( partial(self.jumptihao, checkbox.text())) tihao += 1
def __init__(self,current_username,coursename): super().__init__() self.setupUi(self) self.setWindowIcon(QIcon(CommonUtil.APP_ICON)) CommonUtil.set_treewiget_style1(self.treeWidget) self.coursename=coursename self.current_username=current_username self.zhangjie=None self.xunlianmoshi=0 self.questionnowid=0 self.pushButton.clicked.connect(self.shangyiti) self.pushButton_2.clicked.connect(self.xiayiti) self.gridtalLayout1 = QtWidgets.QGridLayout(self.groupBox_2) self.pushButton_5.clicked.connect(self.tijiaodaan) self.lineEdit.installEventFilter(self) self.pushButton_3.clicked.connect(self.inittimu) self.pushButton_7.clicked.connect(self.jiaojuan) self.treeWidget.itemClicked.connect(self.handleChanged) # self.treeWidget.itemDoubleClicked.connect(self.initcheckbox) self.pushButton_6.clicked.connect(self.collecttimu) self.initbutton() self.inittree()
def login(self): Session = sessionmaker(bind=engine) session = Session() try: currentuser = self.lineEdit.text().strip() currentpass = self.lineEdit_2.text().strip() users = session.query(user).filter( and_(user.name == currentuser, user.password == currentpass)) if users.count() >= 1: #设置config.ini conf = ConfigParser() conf.set_user(currentuser, currentpass) self.close() self.ui1.currentuser = currentuser self.ui1.show() else: CommonUtil.hint_dialog(self, CommonUtil.APP_ICON, '提示', '用户名或密码错误') return except Exception as e: print(e.args) finally: session.close()
def init_ui(self): self.setWindowIcon(QIcon(CommonUtil.APP_ICON)) CommonUtil.set_button_style2(self.pushButton_2) CommonUtil.set_button_style2(self.pushButton) CommonUtil.set_label_style1(self.label_3) CommonUtil.set_label_style2(self.label_2) CommonUtil.set_label_style2(self.label) CommonUtil.set_checkbox_style1(self.checkBox) CommonUtil.set_linedit_style1(self.lineEdit) CommonUtil.set_linedit_style1(self.lineEdit_2) self.checkBox.setChecked(True) conf = ConfigParser() self.lineEdit.setText(conf.get_username()) self.lineEdit_2.setText(conf.get_pass())
def initbutton(self): CommonUtil.set_button_style3(self.pushButton) CommonUtil.set_button_style3(self.pushButton_2) CommonUtil.set_button_style3(self.pushButton_3) CommonUtil.set_button_style3(self.pushButton_6) CommonUtil.set_button_style3(self.pushButton_5) CommonUtil.set_button_style3(self.pushButton_7) self.pushButton_2.setHidden(True) self.pushButton_5.setHidden(True) self.pushButton_6.setHidden(True) self.pushButton_7.setHidden(True) self.pushButton.setHidden(True) self.lineEdit.setHidden(True) self.label_3.setHidden(True)
def setstyle(self): self.setWindowIcon(QIcon(CommonUtil.APP_ICON)) CommonUtil.set_button_style1( self.pushButton ) CommonUtil.set_button_style1(self.pushButton_2 ) CommonUtil.set_button_style1(self.pushButton_7 ) CommonUtil.set_button_style1(self.pushButton_8 ) CommonUtil.set_groupbox_style(self.groupBox) CommonUtil.set_groupbox_style_withimage(self.groupBox_2,'') CommonUtil.set_horizontalline_style(self.line) self.label.setText("理论知识学习系统")