c_dirnotes: added database creation
This commit is contained in:
+13
-5
@@ -275,17 +275,25 @@ class Files():
|
||||
f = os.listdir(directory)
|
||||
for i in f:
|
||||
self.files.append(FileObj(directory + '/' + i))
|
||||
self.sort()
|
||||
|
||||
self.db = None
|
||||
try:
|
||||
self.db = sqlite3.connect(DATABASE_NAME)
|
||||
c = self.db.cursor()
|
||||
c.execute("select * from dirnotes")
|
||||
except sqlite3.OperationalError:
|
||||
# TODO: problem with database....create one?
|
||||
c.execute("create table dirnotes (name TEXT, date DATETIME, size INTEGER, comment TEXT, comment_date DATETIME, author TEXT)")
|
||||
|
||||
try:
|
||||
db = sqlite3.connect(DATABASE_NAME)
|
||||
c = db.cursor()
|
||||
c = self.db.cursor()
|
||||
self.directory.loadDbComment(c)
|
||||
for f in self.files:
|
||||
f.loadDbComment(c)
|
||||
except sqlite3.OperationalError:
|
||||
# TODO: problem with database....create one?
|
||||
pass
|
||||
self.sort()
|
||||
errorBox("serial problem with the database")
|
||||
|
||||
|
||||
def sortName(a):
|
||||
if a.getFileName() == '..':
|
||||
|
||||
Reference in New Issue
Block a user