db logs and some fixes
This commit is contained in:
parent
4c6205cc39
commit
f782b99402
3 changed files with 9 additions and 3 deletions
|
@ -76,6 +76,7 @@ class History:
|
||||||
')')
|
')')
|
||||||
db.commit()
|
db.commit()
|
||||||
except:
|
except:
|
||||||
|
print('Database is locked!')
|
||||||
db.rollback()
|
db.rollback()
|
||||||
finally:
|
finally:
|
||||||
db.close()
|
db.close()
|
||||||
|
@ -89,6 +90,7 @@ class History:
|
||||||
cursor.execute('DROP TABLE id' + tox_id + ';')
|
cursor.execute('DROP TABLE id' + tox_id + ';')
|
||||||
db.commit()
|
db.commit()
|
||||||
except:
|
except:
|
||||||
|
print('Database is locked!')
|
||||||
db.rollback()
|
db.rollback()
|
||||||
finally:
|
finally:
|
||||||
db.close()
|
db.close()
|
||||||
|
@ -111,6 +113,7 @@ class History:
|
||||||
'VALUES (?, ?, ?, ?);', messages_iter)
|
'VALUES (?, ?, ?, ?);', messages_iter)
|
||||||
db.commit()
|
db.commit()
|
||||||
except:
|
except:
|
||||||
|
print('Database is locked!')
|
||||||
db.rollback()
|
db.rollback()
|
||||||
finally:
|
finally:
|
||||||
db.close()
|
db.close()
|
||||||
|
@ -124,6 +127,7 @@ class History:
|
||||||
'WHERE unix_time < ' + str(unsent_time) + ' AND owner = 2;')
|
'WHERE unix_time < ' + str(unsent_time) + ' AND owner = 2;')
|
||||||
db.commit()
|
db.commit()
|
||||||
except:
|
except:
|
||||||
|
print('Database is locked!')
|
||||||
db.rollback()
|
db.rollback()
|
||||||
finally:
|
finally:
|
||||||
db.close()
|
db.close()
|
||||||
|
@ -137,6 +141,7 @@ class History:
|
||||||
cursor.execute('DELETE FROM id' + tox_id + ' WHERE unix_time = ' + str(time) + ';')
|
cursor.execute('DELETE FROM id' + tox_id + ' WHERE unix_time = ' + str(time) + ';')
|
||||||
db.commit()
|
db.commit()
|
||||||
except:
|
except:
|
||||||
|
print('Database is locked!')
|
||||||
db.rollback()
|
db.rollback()
|
||||||
finally:
|
finally:
|
||||||
db.close()
|
db.close()
|
||||||
|
@ -149,6 +154,7 @@ class History:
|
||||||
cursor.execute('DELETE FROM id' + tox_id + ';')
|
cursor.execute('DELETE FROM id' + tox_id + ';')
|
||||||
db.commit()
|
db.commit()
|
||||||
except:
|
except:
|
||||||
|
print('Database is locked!')
|
||||||
db.rollback()
|
db.rollback()
|
||||||
finally:
|
finally:
|
||||||
db.close()
|
db.close()
|
||||||
|
@ -202,4 +208,5 @@ class History:
|
||||||
self._cursor.fetchmany(self._count)
|
self._cursor.fetchmany(self._count)
|
||||||
|
|
||||||
def delete_one(self):
|
def delete_one(self):
|
||||||
self._count -= 1
|
if self._count:
|
||||||
|
self._count -= 1
|
||||||
|
|
|
@ -263,7 +263,6 @@ class MainWindow(QtGui.QMainWindow, Singleton):
|
||||||
self.messages.setGeometry(0, 0, 620, 310)
|
self.messages.setGeometry(0, 0, 620, 310)
|
||||||
self.messages.setObjectName("messages")
|
self.messages.setObjectName("messages")
|
||||||
self.messages.setSpacing(1)
|
self.messages.setSpacing(1)
|
||||||
|
|
||||||
self.messages.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
|
self.messages.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
|
||||||
self.messages.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
|
self.messages.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
|
||||||
self.messages.focusOutEvent = lambda event: self.messages.clearSelection()
|
self.messages.focusOutEvent = lambda event: self.messages.clearSelection()
|
||||||
|
|
|
@ -3,7 +3,7 @@ import settings
|
||||||
import platform
|
import platform
|
||||||
try:
|
try:
|
||||||
from PySide import QtNetwork, QtCore
|
from PySide import QtNetwork, QtCore
|
||||||
except:
|
except ImportError:
|
||||||
from PyQt4 import QtNetwork, QtCore
|
from PyQt4 import QtNetwork, QtCore
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue