This repository has been archived on 2024-12-14. You can view files and clone it, but cannot push or open issues or pull requests.
PyBitmessage-2024-12-14/src/bitmessageqt/statusbar.py
Peter Surda fefb959338
Notify if C PoW missing
- Linux users often don't know that the C PoW is available and complain
  it's slow. This will try to build it, and adds availability
  notification in the status bar
- also, the updateStatusBar signal now allows emphasised notifications,
  which will remain visible for a longer period of time and also
  reappear if a status change happened in the meantime
2016-12-15 16:11:29 +01:00

39 lines
1.2 KiB
Python

from PyQt4 import QtCore, QtGui
from Queue import Queue
from time import time
class BMStatusBar(QtGui.QStatusBar):
duration = 10000
deleteAfter = 60
def __init__(self, parent=None):
super(BMStatusBar, self).__init__(parent)
self.important = []
self.timer = self.startTimer(BMStatusBar.duration)
self.iterator = 0
def timerEvent(self, event):
while len(self.important) > 0:
self.iterator += 1
try:
if time() > self.important[self.iterator][1] + BMStatusBar.deleteAfter:
del self.important[self.iterator]
self.iterator -= 1
continue
except IndexError:
self.iterator = -1
continue
super(BMStatusBar, self).showMessage(self.important[self.iterator][0], 0)
break
def addImportant(self, message):
self.important.append([message, time()])
self.iterator = len(self.important) - 2
self.timerEvent(None)
def showMessage(self, message, timeout=0):
super(BMStatusBar, self).showMessage(message, timeout)
def clearMessage(self):
super(BMStatusBar, self).clearMessage()