model.py 文件源码

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

项目:Osdag 作者: osdag-admin 项目源码 文件源码
def set_databaseconnection():
    '''
    Setting connection with SQLite
    '''
    # TODO explicitly close database connection on exit
    filepath = os.path.join(os.path.dirname(__file__), '..', '..', '..', 'ResourceFiles', 'Database', 'Intg_osdag.sqlite')
    db = QSqlDatabase.addDatabase("QSQLITE")
    db.setDatabaseName(filepath)
    if not db.open():
        QMessageBox.critical(None, qApp.tr("Cannot open database"),
                                   qApp.tr("Unable to establish a database connection.\n"
                                                 "This example needs SQLite support. Please read "
                                                 "the Qt SQL driver documentation for information "
                                                 "how to build it.\n\n"
                                                 "Click Cancel to exit."),
                                   QMessageBox.Cancel)
        return False
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号