Merge remote-tracking branch 'lee/master'

# Conflicts:
#	src/educoder/database/database.py
#	src/educoder/database/database_sqlite.py
master
asef 2 years ago
commit 9496d059cd

@ -1,5 +1,36 @@
class Database(object):
def connection(self):
pass
def createAccount(self,id,userName):
def init(self):
pass
def addBook(self, unique_id, isbn, state):
pass
def removeBook(self, unique_id):
pass
def addUser(self, user_id, userpass_word, permission, nick_name):
pass
def removeUser(self, unique_id):
pass
def addBookInformation(self, isbn, author, description, price, made_time, image, category):
pass
def removeBookInformation(self, isbn):
pass
def brownBook(self, unique_id, brownuser):
pass
def stillBook(self, unique_id):
pass
def addCategory(self, category):
pass
def removeCategory(self, category):
pass

@ -1,6 +1,6 @@
import database
import sqlite3
import datetime
class DatabaseSQLite(database.Database):
conn = sqlite3.connect
@ -8,6 +8,107 @@ class DatabaseSQLite(database.Database):
def connection(self):
self.conn = sqlite3.connect("../../../data/lib_manager.db")
def createAccount(self,id,userName):
cursor = self.conn.cursor()
cursor.execute("")
def init(self):
self.conn.cursor().execute('''CREATE TABLE user(account INTEGER, userid INTEGER, password INTEGER,
permission VARCHAR, nickname VARCHAR, PRIMARY KEY(account))''')
self.conn.cursor().execute('''CREATE TABLE book_type(type CHAR, PRIMARY KEY(type))''')
self.conn.cursor().execute(
'''CREATE TABLE book_main(unique_id INTEGER, isbn INTEGER, state INTEGER, PRIMARY KEY(unique_id))''')
self.conn.cursor().execute(
'''CREATE TABLE book_loc(unique_id INTEGER, loc INTEGER, PRIMARY KEY(unique_id) FOREIGN KEY(unique_id)
REFERENCES book_main)''')
self.conn.cursor().execute(
'''CREATE TABLE book_record(unique_id INTEGER, brown_time INTEGER, real_still_time INTEGER,
expect_still_time INTEGER, brown_user VARCHAR, PRIMARY KEY(unique_id) FOREIGN KEY(unique_id)REFERENCES
book_main)''')
self.conn.cursor().execute(
'''CREATE TABLE book_information(isbn INTEGER, author VARCHAR, description, price INTEGER, made_time
INTEGER, image VARCHAR, type CHAR ,PRIMARY KEY(isbn) FOREIGN KEY(type)REFERENCES book_type) FOREIGN KEY(
isbn)REFERENCES book_main)''')
self.conn.commit()
def addBook(self, unique_id, isbn, state):
self.conn.cursor().execute("INSERT INTO book_main(unique_id, isbn, state) VALUES('+unique_id+', '+isbn+', "
"'+state+')")
self.conn.commit()
return True
def removeBook(self, unique_id):
self.conn.cursor().execute("DELETE FORM book_main WHERE unique_id = '+unique_id+'")
self.conn.commit()
return True
def addUser(self, user_id, userpass_word, permission, nick_name):
self.conn.cursor().execute("INSERT INTO user(user_id, userpass_word, permission, nick_name) VALUES ("
"'+user_id+', +userpass_word+', '+permission+', '+nick_name+')")
self.conn.commit()
return True
def removeUser(self, unique_id):
self.conn.cursor().execute("DELETE FORM user WHERE unique_id = '+unique_id+'")
self.conn.commit()
return True
def addBookInformation(self, isbn, author, description, price, made_time, image, category):
self.conn.cursor().execute("INSERT INTO book_information(isbn, author, description, price, made_time, image, "
"category) VALUES ('+isbn+', '+author+', '+description+','+price+', '+made_time+', "
"'+image+','+category+')")
self.conn.commit()
return True
def removeBookInformation(self, isbn):
self.conn.cursor().execute("DELETE FORM book_information WHERE isbn = 'isbn'")
self.conn.commit()
return True
def brownBook(self, unique_id, brown_user):
flag = self.conn.cursor().execute("SELECT state FROM book_main")
if flag:
self.conn.cursor().execute("UPDATE book_main SET state = false")
self.conn.cursor().execute(
"INSERT INTO book_record(unique_id, brown_time, real_still_time, expect_still_time, brown_user) "
"VALUES('+unique_id+', '+datetime.datetime.now()+',+0+, +30+, '+brown_user+')")
self.conn.commit()
return True
else:
return False
def stillBook(self, unique_id):
flag = self.conn.cursor().execute("SELECT state FROM book_main")
if not flag:
self.conn.cursor().execute("UPDATE book_main SET state = true")
self.conn.cursor().execute("UPDATE book_record SET real_still_time = '+datetime.datetime.now()+'")
self.conn.commit()
return True
else:
return False
def addCategory(self, category):
self.conn.cursor().execute("INSERT INTO book_type (type) VALUES (type = '+category+')")

@ -167,10 +167,10 @@ class Ui_MainPages(object):
def retranslateUi(self, MainPages):
MainPages.setWindowTitle(QCoreApplication.translate("MainPages", u"Form", None))
self.label.setText(QCoreApplication.translate("MainPages", u"Welcome To PyOneDark GUI", None))
self.title_label.setText(QCoreApplication.translate("MainPages", u"Custom Widgets Page", None))
self.description_label.setText(QCoreApplication.translate("MainPages", u"Here will be all the custom widgets, they will be added over time on this page.\n"
"I will try to always record a new tutorial when adding a new Widget and updating the project on Patreon before launching on GitHub and GitHub after the public release.", None))
self.label.setText(QCoreApplication.translate("MainPages", u"欢迎使用现代图书管理系统", None))
self.title_label.setText(QCoreApplication.translate("MainPages", u"数据库监控面板", None))
#self.description_label.setText(QCoreApplication.translate("MainPages", u"Here will be all the custom widgets, they will be added over time on this page.\n"
#"I will try to always record a new tutorial when adding a new Widget and updating the project on Patreon before launching on GitHub and GitHub after the public release.", None))
self.empty_page_label.setText(QCoreApplication.translate("MainPages", u"Empty Page", None))
# retranslateUi

@ -78,6 +78,7 @@ class MainWindow(QMainWindow):
# GET BT CLICKED
btn = SetupMainWindow.setup_btns(self)
# Remove Selection If Clicked By "btn_close_left_column"
if btn.objectName() != "btn_settings":
self.ui.left_menu.deselect_all_tab()

Loading…
Cancel
Save