more work
This commit is contained in:
@@ -39,20 +39,28 @@ class BackupManager(QtCore.QObject):
|
||||
pid = self._pid
|
||||
|
||||
con = sqlite3.connect(DB_FILE)
|
||||
cursor = con.execute('DELETE FROM sessions WHERE pid = ?;', (pid,))
|
||||
cursor = con.cursor()
|
||||
|
||||
res = cursor.execute('DELETE FROM sessions WHERE pid = ?;', (pid,))
|
||||
con.commit()
|
||||
|
||||
self.delete_db_if_empty()
|
||||
|
||||
def delete_db_if_empty(self):
|
||||
con = sqlite3.connect(DB_FILE)
|
||||
cursor = con.cursor()
|
||||
res = cursor.execute('SELECT COUNT(sessions.pid) FROM sessions GROUP BY sessions.pid;')
|
||||
con.commit()
|
||||
|
||||
remaining_processes = res.fetchone()
|
||||
con.close()
|
||||
|
||||
if remaining_processes is None:
|
||||
self.delete_db()
|
||||
|
||||
def delete_db(self):
|
||||
Path(DB_FILE).unlink()
|
||||
Path(DB_FILE).unlink()
|
||||
|
||||
def close(self):
|
||||
self.remove_entry()
|
||||
self.delete_db_if_empty()
|
||||
|
||||
def search_unsaved(self):
|
||||
con = sqlite3.connect(DB_FILE)
|
||||
@@ -70,7 +78,9 @@ class BackupManager(QtCore.QObject):
|
||||
except ProcessLookupError:
|
||||
missing_processes.append((pid, fname))
|
||||
|
||||
return missing_processes
|
||||
if missing_processes:
|
||||
msg = QtWidgets.QMessageBox()
|
||||
msg.exec()
|
||||
|
||||
def update_last_save(self):
|
||||
con = sqlite3.connect(DB_FILE)
|
||||
|
||||
Reference in New Issue
Block a user