-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathfstatusbar.py
44 lines (36 loc) · 1.27 KB
/
fstatusbar.py
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/python
# -*- coding: utf-8 -*-
from PySide2.QtCore import *
from PySide2.QtGui import *
from PySide2.QtWidgets import *
from datetime import datetime
class FStatusBar(QStatusBar):
def __init__(self, parent=None):
super(FStatusBar, self).__init__(parent)
self.parent = parent
self.initStatusbar()
# self.initUI()
# self.startTimer(1000)
def startTimer(self, interval):
self.timer = QTimer()
self.timer.setInterval(1000)
self.timer.timeout.connect(self.updateDataLabel)
self.timer.start()
def initStatusbar(self):
statusbarSettings = {
'initmessage': u'Ready',
'minimumHeight': 30,
'visual': True,
}
self.showMessage(statusbarSettings['initmessage'])
self.setMinimumHeight(statusbarSettings['minimumHeight'])
self.setVisible(statusbarSettings['visual'])
def initUI(self):
self.datatimelabel = QLabel(self)
self.datatimelabel.setText(
datetime.today().strftime("%Y-%m-%d %H:%M:%S"))
self.datatimelabel.show()
self.addPermanentWidget(self.datatimelabel)
def updateDataLabel(self):
self.datatimelabel.setText(
datetime.today().strftime("%Y-%m-%d %H:%M:%S"))