notifications added, some fixes

This commit is contained in:
ingvar1995
2016-02-24 21:38:36 +03:00
parent 568609dfcb
commit 35cf74eff8
4 changed files with 24 additions and 32 deletions

View File

@ -11,32 +11,29 @@ class StatusCircle(QtGui.QWidget):
def __init__(self, parent):
QtGui.QWidget.__init__(self, parent)
self.setGeometry(0, 0, 32, 32)
self.status = TOX_USER_CONNECTION_STATUS['OFFLINE']
self.tox = parent.tox
def mouseReleaseEvent(self, event):
if self.status != TOX_USER_CONNECTION_STATUS['OFFLINE']:
self.status += 1
self.status %= TOX_USER_CONNECTION_STATUS['OFFLINE']
self.tox.self_set_status(self.status)
self.repaint()
pass
def paintEvent(self, event):
paint = QtGui.QPainter()
paint.begin(self)
paint.setRenderHint(QtGui.QPainter.Antialiasing)
paint.setBrush(QtCore.Qt.white)
paint.drawRect(event.rect())
#paint.setBrush(QtCore.Qt.white)
#paint.drawRect(event.rect())
k = 16
rad_x = rad_y = 10
if self.status == TOX_USER_CONNECTION_STATUS['OFFLINE']:
if not self.tox.self_get_connection_status():
color = QtCore.Qt.black
elif self.status == TOX_USER_CONNECTION_STATUS['ONLINE']:
color = QtCore.Qt.green
elif self.status == TOX_USER_CONNECTION_STATUS['AWAY']:
color = QtCore.Qt.yellow
else: # self.status == TOX_USER_CONNECTION_STATUS['BUSY']:
color = QtCore.Qt.red
else:
status = self.tox.self_get_status()
if status == TOX_USER_STATUS['NONE']:
color = QtCore.Qt.green
elif status == TOX_USER_STATUS['AWAY']:
color = QtCore.Qt.yellow
else: # self.status == TOX_USER_STATUS['BUSY']:
color = QtCore.Qt.red
paint.setPen(color)
center = QtCore.QPoint(k, k)