mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
feat: added timestamp to information widget log items
This commit is contained in:
parent
28cf42aeb8
commit
3ad57d995b
@ -1,3 +1,4 @@
|
||||
import datetime
|
||||
|
||||
class Information():
|
||||
|
||||
@ -5,7 +6,12 @@ class Information():
|
||||
self.title = title
|
||||
self.text = text
|
||||
self.turn = turn
|
||||
self.timestamp = datetime.datetime.now()
|
||||
|
||||
def __str__(self):
|
||||
s = "[" + str(self.turn) + "] " + self.title + "\n" + self.text
|
||||
return s
|
||||
return '[{}][{}] {} {}'.format(
|
||||
self.timestamp.strftime("%Y-%m-%d %H:%M:%S") if self.timestamp is not None else '',
|
||||
self.turn,
|
||||
self.title,
|
||||
self.text
|
||||
)
|
||||
@ -8,5 +8,5 @@ class QInfoItem(QStandardItem):
|
||||
def __init__(self, info: Information):
|
||||
super(QInfoItem, self).__init__()
|
||||
self.info = info
|
||||
self.setText("[%02d]" % self.info.turn + " " + self.info.title + ' : {:<16}'.format(info.text))
|
||||
self.setText(str(info))
|
||||
self.setEditable(False)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user