tag_editor.py 文件源码

python
阅读 16 收藏 0 点赞 0 评论 0

项目:uitester 作者: IfengAutomation 项目源码 文件源码
def tag_save(self):
        tag_id = self.tag_id_line_edit.text()
        tag_name = self.tag_name_line_edit.text()
        tag_description = self.tag_description_text_edit.toPlainText()
        if tag_name == '' or tag_description == '':
            QMessageBox.warning(self, 'tag editor', 'tag name and description can\'t be empty')
        else:
            if len(tag_name) > 8:
                QMessageBox.warning(self, 'tag editor', 'tag name is not greater than 8 characters')
            else:
                if tag_id:
                    self.tag.name = tag_name
                    self.tag.description = tag_description
                    self.db_helper.update_tag()
                    QMessageBox.information(self, 'tag editor', 'tag update success')#todo ??????
                else:
                    tag = self.db_helper.query_tag_by_name(tag_name)
                    if tag is None:
                        tag = self.db_helper.insert_tag(tag_name, tag_description)
                        self.tag_id_line_edit.setText(str(tag.id))
                        self.tag = tag
                        QMessageBox.information(self, 'tag editor', 'tag insert success')#todo ??????
                    else:
                        QMessageBox.warning(self, 'tag editor', 'tag has existed')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号