blob: 3f26df8c6aed955a5167555c596b4ab4fd9bb57a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
from PyQt4 import QtCore, QtGui
appIcon=QtGui.QIcon('gfx/icon.png')
eventLoop=QtCore.QEventLoop()
def doEvents():
"""Make some time for necessary events."""
eventLoop.processEvents(QtCore.QEventLoop.AllEvents)
def sec2min(secs):
"""Converts seconds to min:sec."""
min=int(secs/60)
sec=secs%60
if sec<10:sec='0'+str(sec)
return str(min)+':'+str(sec)
def unique(seq):
"""Retrieve list of unique elements."""
seen = []
return t(c for c in seq if not (c in seen or seen.append(c)))
class Button(QtGui.QPushButton):
"""A simple Button class which calls $onClick when clicked."""
def __init__(self, caption, onClick=None, parent=None):
QtGui.QPushButton.__init__(self, caption, parent)
if onClick:
self.connect(self, QtCore.SIGNAL('clicked(bool)'), onClick)
|