From f782b994021077fea806ac0b44169950fde95ed5 Mon Sep 17 00:00:00 2001 From: ingvar1995 Date: Sun, 2 Oct 2016 20:20:49 +0300 Subject: [PATCH] db logs and some fixes --- toxygen/history.py | 9 ++++++++- toxygen/mainscreen.py | 1 - toxygen/updater.py | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/toxygen/history.py b/toxygen/history.py index 1cfe56d..f8308ae 100644 --- a/toxygen/history.py +++ b/toxygen/history.py @@ -76,6 +76,7 @@ class History: ')') db.commit() except: + print('Database is locked!') db.rollback() finally: db.close() @@ -89,6 +90,7 @@ class History: cursor.execute('DROP TABLE id' + tox_id + ';') db.commit() except: + print('Database is locked!') db.rollback() finally: db.close() @@ -111,6 +113,7 @@ class History: 'VALUES (?, ?, ?, ?);', messages_iter) db.commit() except: + print('Database is locked!') db.rollback() finally: db.close() @@ -124,6 +127,7 @@ class History: 'WHERE unix_time < ' + str(unsent_time) + ' AND owner = 2;') db.commit() except: + print('Database is locked!') db.rollback() finally: db.close() @@ -137,6 +141,7 @@ class History: cursor.execute('DELETE FROM id' + tox_id + ' WHERE unix_time = ' + str(time) + ';') db.commit() except: + print('Database is locked!') db.rollback() finally: db.close() @@ -149,6 +154,7 @@ class History: cursor.execute('DELETE FROM id' + tox_id + ';') db.commit() except: + print('Database is locked!') db.rollback() finally: db.close() @@ -202,4 +208,5 @@ class History: self._cursor.fetchmany(self._count) def delete_one(self): - self._count -= 1 + if self._count: + self._count -= 1 diff --git a/toxygen/mainscreen.py b/toxygen/mainscreen.py index 322880a..5f8c311 100644 --- a/toxygen/mainscreen.py +++ b/toxygen/mainscreen.py @@ -263,7 +263,6 @@ class MainWindow(QtGui.QMainWindow, Singleton): self.messages.setGeometry(0, 0, 620, 310) self.messages.setObjectName("messages") self.messages.setSpacing(1) - self.messages.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn) self.messages.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff) self.messages.focusOutEvent = lambda event: self.messages.clearSelection() diff --git a/toxygen/updater.py b/toxygen/updater.py index 067e350..fb33ec8 100644 --- a/toxygen/updater.py +++ b/toxygen/updater.py @@ -3,7 +3,7 @@ import settings import platform try: from PySide import QtNetwork, QtCore -except: +except ImportError: from PyQt4 import QtNetwork, QtCore