def change_id(self): new_id = self.ui.comboBox_3.currentText() #获得新的组号 name = self.ui.comboBox_2.currentText() order = 'update `group_rank` set `group_id`=%d where `name`="%s"' % ( int(new_id), name) Class_info.set_data(order) self.ui.label_4.setText('提示:已修改!') pass
def send_data(self): # 获取当前名字和分数 data = [ self.ui.name_box.currentText(), int(self.ui.score_box.currentText()) ] # print(data) # 根据姓名设置个人的分数 Class_info.set_data("update group_rank " "set `value`=`value`+%d " "where`NAME`='%s'" % (data[1], data[0])) # 计算当前的小组的总分,如果是NULL就设置成0 group_sum_value = Class_info.get_data( "select sum(ifnull(value,0)) " "from group_rank " "where `group_id`=%s" % self.ui.group_id_box.currentText()) Class_info.set_data( "update `group_rank` set `sum_value`=%d where `group_id`=%s" % (group_sum_value[0][0], self.ui.group_id_box.currentText())) #设置加分提示 self.ui.label_5.setText('提示:' + data[0] + ' ' + str(data[1]) + '分!!')
def change_slogan(self): new_slogan = self.ui.lineEdit.text() Class_info.set_data( "update `group_slogan` set `slogan`='%s' where `group_id`=%d" % (new_slogan, self.index)) self.ui.label_5.setText("提示:已修改!请重启系统。")
def change_name(self): new_name = self.ui.lineEdit_2.text() Class_info.set_data( "update `group_slogan` set `group_name`='%s' where `group_id`=%d" % (new_name, self.index)) self.ui.label_9.setText("提示:已修改!请重启系统。")
def reset_group_score(self): #重置小组以及个人分数 order = 'update `group_rank` set `value`=0' Class_info.set_data(order) order = 'update `group_rank` set `sum_value`=0' Class_info.set_data(order) self.ui.label_3.setText('提示:已重置,请重启。')