2023-08-03 13:37:46 +05:00
|
|
|
# custom widgets, code is largely ripped from placeholders from
|
|
|
|
# a generated gui_base.py file and additional bits slapped on
|
|
|
|
# and some minor changes in create_gui, mostly in naming of
|
|
|
|
# widgets including indexing and subobjects as well with self.i
|
|
|
|
|
2022-11-10 15:16:50 +05:00
|
|
|
from PyQt5 import QtWidgets, QtGui, QtCore
|
|
|
|
|
|
|
|
from datetime import datetime, timedelta
|
2022-11-10 23:03:50 +05:00
|
|
|
import time
|
|
|
|
|
2023-08-03 13:37:46 +05:00
|
|
|
# util for clocks
|
2022-11-10 23:03:50 +05:00
|
|
|
utcoffset = time.time() - time.mktime(time.gmtime())
|
2022-11-10 15:16:50 +05:00
|
|
|
|
|
|
|
class Fissure(QtWidgets.QWidget):
|
2022-11-10 16:26:28 +05:00
|
|
|
def __init__(self, parent, fissure_info = {}, i = 0):
|
2022-11-10 15:16:50 +05:00
|
|
|
super().__init__(parent)
|
|
|
|
self.i = str(i)
|
|
|
|
self.fissure_info = fissure_info
|
|
|
|
self.create_gui()
|
|
|
|
self.update_gui()
|
|
|
|
|
|
|
|
|
|
|
|
def create_gui(self):
|
|
|
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed)
|
|
|
|
sizePolicy.setHorizontalStretch(0)
|
|
|
|
sizePolicy.setVerticalStretch(0)
|
|
|
|
sizePolicy.setHeightForWidth(self.sizePolicy().hasHeightForWidth())
|
|
|
|
self.setSizePolicy(sizePolicy)
|
|
|
|
self.setMinimumSize(QtCore.QSize(0, 100))
|
|
|
|
self.setObjectName("Fissure_" + self.i)
|
|
|
|
self.gridLayout_3 = QtWidgets.QGridLayout(self)
|
|
|
|
self.gridLayout_3.setObjectName("gridLayout_3_" + self.i)
|
|
|
|
self.FissureTier = QtWidgets.QLabel(self)
|
|
|
|
font = QtGui.QFont()
|
|
|
|
font.setPointSize(12)
|
|
|
|
font.setBold(True)
|
|
|
|
font.setWeight(75)
|
|
|
|
self.FissureTier.setFont(font)
|
|
|
|
self.FissureTier.setObjectName("FissureTier_" + self.i)
|
|
|
|
self.gridLayout_3.addWidget(self.FissureTier, 0, 0, 1, 1)
|
|
|
|
self.FissureTimer = QtWidgets.QLabel(self)
|
|
|
|
font = QtGui.QFont()
|
|
|
|
font.setBold(True)
|
|
|
|
font.setWeight(75)
|
|
|
|
self.FissureTimer.setFont(font)
|
|
|
|
self.FissureTimer.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
|
|
|
|
self.FissureTimer.setObjectName("FissureTimer_" + self.i)
|
|
|
|
self.gridLayout_3.addWidget(self.FissureTimer, 0, 1, 1, 1)
|
|
|
|
self.FissureNode = QtWidgets.QLabel(self)
|
|
|
|
font = QtGui.QFont()
|
|
|
|
font.setPointSize(10)
|
|
|
|
self.FissureNode.setFont(font)
|
|
|
|
self.FissureNode.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
|
|
|
|
self.FissureNode.setObjectName("FissureNode_" + self.i)
|
|
|
|
self.gridLayout_3.addWidget(self.FissureNode, 1, 0, 1, 1)
|
2022-11-10 16:26:28 +05:00
|
|
|
self.FissureType = QtWidgets.QLabel(self)
|
2022-11-10 15:16:50 +05:00
|
|
|
self.FissureType.setAlignment(QtCore.Qt.AlignCenter)
|
|
|
|
self.FissureType.setObjectName("FissureType_" + self.i)
|
|
|
|
self.gridLayout_3.addWidget(self.FissureType, 1, 1, 1, 1)
|
|
|
|
|
|
|
|
def update_gui(self):
|
2023-08-03 13:37:46 +05:00
|
|
|
# attempt an update, will fail during initial pass before worldstate init so try-except
|
2022-11-10 16:26:28 +05:00
|
|
|
try:
|
|
|
|
self.FissureTier.setText(f"{self.fissure_info['tier']} - T{self.fissure_info['tierNum']}")
|
2022-11-10 23:03:50 +05:00
|
|
|
self.update_timer()
|
2022-11-10 16:26:28 +05:00
|
|
|
self.FissureNode.setText(f"{self.fissure_info['node']}")
|
|
|
|
self.FissureType.setText(f"{'Steel Path' if self.fissure_info['isHard'] else ('Storm' if self.fissure_info['isStorm'] else '')}")
|
|
|
|
except:
|
|
|
|
pass
|
2022-11-10 15:16:50 +05:00
|
|
|
|
2022-11-10 23:03:50 +05:00
|
|
|
def update_timer(self):
|
2023-08-03 13:37:46 +05:00
|
|
|
# update timer, same as global timers in main
|
2022-11-10 23:03:50 +05:00
|
|
|
eta = round(time.mktime(time.strptime(self.fissure_info['expiry'], '%Y-%m-%dT%H:%M:%S.%fZ')) - time.time() + utcoffset)
|
|
|
|
if eta >= 0:
|
|
|
|
self.FissureTimer.setText(f"{str(eta // 3600) + 'h' if eta // 3600 > 0 else ''} {(eta // 60) % 60}m {eta % 60}s")
|
|
|
|
else:
|
|
|
|
self.FissureTimer.setText("Expired")
|
2022-11-10 15:16:50 +05:00
|
|
|
|
|
|
|
|
|
|
|
class Invasion(QtWidgets.QWidget):
|
2022-11-10 16:26:28 +05:00
|
|
|
def __init__(self, parent, invasion_info = {}, i = 0):
|
2022-11-10 15:16:50 +05:00
|
|
|
super().__init__(parent)
|
|
|
|
self.i = str(i)
|
|
|
|
self.invasion_info = invasion_info
|
|
|
|
self.create_gui()
|
|
|
|
self.update_gui()
|
|
|
|
|
|
|
|
def create_gui(self):
|
|
|
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed)
|
|
|
|
sizePolicy.setHorizontalStretch(0)
|
|
|
|
sizePolicy.setVerticalStretch(0)
|
|
|
|
sizePolicy.setHeightForWidth(self.sizePolicy().hasHeightForWidth())
|
|
|
|
self.setSizePolicy(sizePolicy)
|
|
|
|
self.setMinimumSize(QtCore.QSize(0, 100))
|
|
|
|
self.setObjectName("Invasion_" + self.i)
|
2022-11-10 16:26:28 +05:00
|
|
|
self.gridLayout_4 = QtWidgets.QGridLayout(self)
|
2022-11-10 15:16:50 +05:00
|
|
|
self.gridLayout_4.setObjectName("gridLayout_4_" + self.i)
|
|
|
|
self.Reward2 = QtWidgets.QLabel(self)
|
|
|
|
font = QtGui.QFont()
|
|
|
|
font.setBold(True)
|
|
|
|
font.setWeight(75)
|
|
|
|
self.Reward2.setFont(font)
|
|
|
|
self.Reward2.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
|
|
|
|
self.Reward2.setWordWrap(True)
|
|
|
|
self.Reward2.setObjectName("Reward2_" + self.i)
|
|
|
|
self.gridLayout_4.addWidget(self.Reward2, 0, 1, 1, 1)
|
|
|
|
self.InvasionProgress = QtWidgets.QProgressBar(self)
|
|
|
|
self.InvasionProgress.setStyleSheet("QProgressBar {background-color:red;;border-color:red; border:0px}\n"
|
|
|
|
"QProgressBar::chunk {background-color:blue;}")
|
|
|
|
self.InvasionProgress.setProperty("value", 24)
|
|
|
|
self.InvasionProgress.setTextVisible(False)
|
|
|
|
self.InvasionProgress.setObjectName("InvasionProgress_" + self.i)
|
|
|
|
self.gridLayout_4.addWidget(self.InvasionProgress, 1, 0, 1, 2)
|
|
|
|
self.Reward1 = QtWidgets.QLabel(self)
|
|
|
|
font = QtGui.QFont()
|
|
|
|
font.setBold(True)
|
|
|
|
font.setWeight(75)
|
|
|
|
self.Reward1.setFont(font)
|
|
|
|
self.Reward1.setWordWrap(True)
|
|
|
|
self.Reward1.setObjectName("Reward1_" + self.i)
|
|
|
|
self.gridLayout_4.addWidget(self.Reward1, 0, 0, 1, 1)
|
|
|
|
|
|
|
|
def update_gui(self):
|
2023-08-03 13:37:46 +05:00
|
|
|
# same as Fissures, progress bars are colored according to factions involved, update css
|
2022-11-10 16:26:28 +05:00
|
|
|
try:
|
2022-11-10 23:03:50 +05:00
|
|
|
faction_colors = {'Grineer': 'red', 'Corpus': 'blue', 'Infested': 'green'}
|
2022-11-10 16:26:28 +05:00
|
|
|
self.Reward1.setText(f"{self.invasion_info['attackerReward']['itemString']}")
|
|
|
|
self.Reward2.setText(f"{self.invasion_info['defenderReward']['itemString']}")
|
|
|
|
self.InvasionProgress.setStyleSheet(f'QProgressBar {{background-color:{faction_colors.get(self.invasion_info["defendingFaction"])};border-color:red; border:0px}}\nQProgressBar::chunk {{background-color:{faction_colors.get(self.invasion_info["attackingFaction"])};}}')
|
2022-11-10 23:03:50 +05:00
|
|
|
self.update_progress()
|
|
|
|
except KeyError:
|
2022-11-10 16:26:28 +05:00
|
|
|
pass
|
2022-11-10 15:16:50 +05:00
|
|
|
|
|
|
|
def update_progress(self):
|
2023-08-03 13:37:46 +05:00
|
|
|
# invasion progerss tracked with progressbar, set here as psuedo-timer
|
2022-11-10 15:16:50 +05:00
|
|
|
self.InvasionProgress.setProperty('value', self.invasion_info['completion'])
|
|
|
|
|
|
|
|
class Alert(QtWidgets.QWidget):
|
2022-11-10 16:26:28 +05:00
|
|
|
def __init__(self, parent, alert_info = {}, i = 0):
|
2022-11-10 15:16:50 +05:00
|
|
|
super().__init__(parent)
|
|
|
|
self.i = str(i)
|
|
|
|
self.alert_info = alert_info
|
|
|
|
self.create_gui()
|
|
|
|
self.update_gui()
|
|
|
|
|
|
|
|
def create_gui(self):
|
|
|
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed)
|
|
|
|
sizePolicy.setHorizontalStretch(0)
|
|
|
|
sizePolicy.setVerticalStretch(0)
|
|
|
|
sizePolicy.setHeightForWidth(self.sizePolicy().hasHeightForWidth())
|
|
|
|
self.setSizePolicy(sizePolicy)
|
|
|
|
self.setMinimumSize(QtCore.QSize(0, 100))
|
|
|
|
self.setObjectName("Alert_" + self.i)
|
|
|
|
self.horizontalLayout_6 = QtWidgets.QHBoxLayout(self)
|
|
|
|
self.horizontalLayout_6.setObjectName("horizontalLayout_6")
|
|
|
|
self.AlertReward = QtWidgets.QLabel(self)
|
|
|
|
font = QtGui.QFont()
|
|
|
|
font.setPointSize(10)
|
|
|
|
font.setBold(True)
|
|
|
|
font.setWeight(75)
|
|
|
|
self.AlertReward.setFont(font)
|
|
|
|
self.AlertReward.setWordWrap(True)
|
|
|
|
self.AlertReward.setObjectName("AlertReward_" + self.i)
|
|
|
|
self.horizontalLayout_6.addWidget(self.AlertReward)
|
|
|
|
self.AlertTimer = QtWidgets.QLabel(self)
|
|
|
|
font = QtGui.QFont()
|
|
|
|
font.setBold(True)
|
|
|
|
font.setWeight(75)
|
|
|
|
self.AlertTimer.setFont(font)
|
|
|
|
self.AlertTimer.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
|
|
|
|
self.AlertTimer.setObjectName("AlertTimer_" + self.i)
|
|
|
|
self.horizontalLayout_6.addWidget(self.AlertTimer)
|
|
|
|
|
|
|
|
def update_gui(self):
|
2023-08-03 13:37:46 +05:00
|
|
|
# same as fissure
|
2022-11-10 16:26:28 +05:00
|
|
|
try:
|
|
|
|
self.AlertReward.setText(self.alert_info['mission']['reward']['itemString'])
|
|
|
|
self.update_timer()
|
|
|
|
except:
|
|
|
|
pass
|
2022-11-10 15:16:50 +05:00
|
|
|
|
|
|
|
def update_timer(self):
|
2023-08-03 13:37:46 +05:00
|
|
|
# same as fissure
|
2022-11-10 23:03:50 +05:00
|
|
|
eta = round(time.mktime(time.strptime(self.alert_info['expiry'], '%Y-%m-%dT%H:%M:%S.%fZ')) - time.time() + utcoffset)
|
|
|
|
if eta > 0:
|
|
|
|
self.AlertTimer.setText(f'{str(eta // 86400) + "d " if eta // 86400 > 0 else ""}{str((eta // 3600) % 24) + "h" if eta // 3600 > 0 else ""} {(eta // 60) % 60}m {eta % 60}s')
|
|
|
|
else:
|
|
|
|
self.AlertTimer.setText('Expired')
|
2022-11-10 15:16:50 +05:00
|
|
|
|
|
|
|
class BaroItem(QtWidgets.QWidget):
|
2022-11-10 16:26:28 +05:00
|
|
|
def __init__(self, parent, item_info = {}, i = 0):
|
2022-11-10 15:16:50 +05:00
|
|
|
super().__init__(parent)
|
|
|
|
self.item_info = item_info
|
|
|
|
self.i = str(i)
|
|
|
|
self.create_gui()
|
|
|
|
self.update_gui()
|
|
|
|
|
|
|
|
def create_gui(self):
|
|
|
|
self.setMaximumSize(QtCore.QSize(250, 250))
|
|
|
|
self.setObjectName("BaroItem_" + self.i)
|
|
|
|
self.gridLayout_7 = QtWidgets.QGridLayout(self)
|
|
|
|
self.gridLayout_7.setObjectName("gridLayout_7_" + self.i)
|
|
|
|
self.ItemName = QtWidgets.QLabel(self)
|
|
|
|
font = QtGui.QFont()
|
|
|
|
font.setBold(True)
|
|
|
|
font.setWeight(75)
|
|
|
|
self.ItemName.setFont(font)
|
|
|
|
self.ItemName.setAlignment(QtCore.Qt.AlignCenter)
|
|
|
|
self.ItemName.setObjectName("ItemName_" + self.i)
|
|
|
|
self.gridLayout_7.addWidget(self.ItemName, 0, 0, 1, 1)
|
|
|
|
|
|
|
|
def update_gui(self):
|
2023-08-03 13:37:46 +05:00
|
|
|
# same as fissure, except no dynamic timer needing updates
|
2022-11-10 16:26:28 +05:00
|
|
|
try:
|
|
|
|
self.ItemName.setText(self.item_info['item'])
|
|
|
|
except:
|
|
|
|
pass
|
2022-11-10 15:16:50 +05:00
|
|
|
|
|
|
|
class Event(QtWidgets.QWidget):
|
2022-11-10 16:26:28 +05:00
|
|
|
def __init__(self, parent, event_info = {}, i = 0):
|
2022-11-10 15:16:50 +05:00
|
|
|
super().__init__(parent)
|
|
|
|
self.event_info = event_info
|
|
|
|
self.i = str(i)
|
|
|
|
self.create_gui()
|
|
|
|
self.update_gui()
|
|
|
|
|
|
|
|
def create_gui(self):
|
|
|
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed)
|
|
|
|
sizePolicy.setHorizontalStretch(0)
|
|
|
|
sizePolicy.setVerticalStretch(0)
|
|
|
|
sizePolicy.setHeightForWidth(self.sizePolicy().hasHeightForWidth())
|
|
|
|
self.setSizePolicy(sizePolicy)
|
|
|
|
self.setMinimumSize(QtCore.QSize(0, 100))
|
|
|
|
self.setObjectName("Event_" + self.i)
|
|
|
|
self.horizontalLayout_11 = QtWidgets.QHBoxLayout(self)
|
|
|
|
self.horizontalLayout_11.setObjectName("horizontalLayout_11_" + self.i)
|
|
|
|
self.EventName = QtWidgets.QLabel(self)
|
|
|
|
font = QtGui.QFont()
|
|
|
|
font.setPointSize(12)
|
|
|
|
font.setBold(True)
|
|
|
|
font.setWeight(75)
|
|
|
|
self.EventName.setFont(font)
|
|
|
|
self.EventName.setObjectName("EventName_" + self.i)
|
|
|
|
self.horizontalLayout_11.addWidget(self.EventName)
|
|
|
|
self.EventTimer = QtWidgets.QLabel(self)
|
|
|
|
font = QtGui.QFont()
|
|
|
|
font.setBold(True)
|
|
|
|
font.setWeight(75)
|
|
|
|
self.EventTimer.setFont(font)
|
|
|
|
self.EventTimer.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
|
|
|
|
self.EventTimer.setObjectName("EventTimer_" + self.i)
|
|
|
|
self.horizontalLayout_11.addWidget(self.EventTimer)
|
|
|
|
|
|
|
|
def update_gui(self):
|
2023-08-03 13:37:46 +05:00
|
|
|
# same as fissure
|
2022-11-10 16:26:28 +05:00
|
|
|
try:
|
|
|
|
self.EventName.setText(self.event_info['description'])
|
|
|
|
self.update_timer()
|
|
|
|
except:
|
|
|
|
pass
|
2022-11-10 15:16:50 +05:00
|
|
|
|
|
|
|
def update_timer(self):
|
2023-08-03 13:37:46 +05:00
|
|
|
# same as fissure
|
2022-11-10 23:03:50 +05:00
|
|
|
eta = round(time.mktime(time.strptime(self.event_info['expiry'], '%Y-%m-%dT%H:%M:%S.%fZ')) - time.time() + utcoffset)
|
|
|
|
if eta > 0:
|
|
|
|
self.EventTimer.setText(f'{str(eta // 86400) + "d " if eta // 86400 > 0 else ""}{(eta // 3600) % 24}h')
|
|
|
|
else:
|
|
|
|
self.EventTimer.setText('Expired')
|
2022-11-10 15:16:50 +05:00
|
|
|
|
|
|
|
class NewsBlurb(QtWidgets.QWidget):
|
2022-11-10 16:26:28 +05:00
|
|
|
def __init__(self, parent, news_info = {}, i = 0):
|
2022-11-10 15:16:50 +05:00
|
|
|
super().__init__(parent)
|
|
|
|
self.i = str(i)
|
|
|
|
self.news_info = news_info
|
|
|
|
self.create_gui()
|
|
|
|
self.update_gui()
|
|
|
|
|
|
|
|
def create_gui(self):
|
|
|
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed)
|
|
|
|
sizePolicy.setHorizontalStretch(0)
|
|
|
|
sizePolicy.setVerticalStretch(0)
|
|
|
|
sizePolicy.setHeightForWidth(self.sizePolicy().hasHeightForWidth())
|
|
|
|
self.setSizePolicy(sizePolicy)
|
|
|
|
self.setMinimumSize(QtCore.QSize(0, 100))
|
|
|
|
self.setObjectName("NewsBlurb_" + self.i)
|
|
|
|
self.horizontalLayout_12 = QtWidgets.QHBoxLayout(self)
|
|
|
|
self.horizontalLayout_12.setObjectName("horizontalLayout_12_" + self.i)
|
|
|
|
self.NewsBlurbHyperLink = QtWidgets.QLabel(self)
|
|
|
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
|
|
|
|
sizePolicy.setHorizontalStretch(3)
|
|
|
|
sizePolicy.setVerticalStretch(0)
|
|
|
|
sizePolicy.setHeightForWidth(self.NewsBlurbHyperLink.sizePolicy().hasHeightForWidth())
|
|
|
|
self.NewsBlurbHyperLink.setSizePolicy(sizePolicy)
|
|
|
|
font = QtGui.QFont()
|
|
|
|
font.setPointSize(11)
|
|
|
|
font.setUnderline(True)
|
|
|
|
self.NewsBlurbHyperLink.setFont(font)
|
|
|
|
self.NewsBlurbHyperLink.setWordWrap(True)
|
|
|
|
self.NewsBlurbHyperLink.setOpenExternalLinks(True)
|
|
|
|
self.NewsBlurbHyperLink.setObjectName("NewsBlurbHyperLink")
|
|
|
|
self.horizontalLayout_12.addWidget(self.NewsBlurbHyperLink)
|
|
|
|
self.NewsBlurbRelTimer = QtWidgets.QLabel(self)
|
|
|
|
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
|
|
|
|
sizePolicy.setHorizontalStretch(1)
|
|
|
|
sizePolicy.setVerticalStretch(0)
|
|
|
|
sizePolicy.setHeightForWidth(self.NewsBlurbRelTimer.sizePolicy().hasHeightForWidth())
|
|
|
|
self.NewsBlurbRelTimer.setSizePolicy(sizePolicy)
|
|
|
|
self.NewsBlurbRelTimer.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)
|
|
|
|
self.NewsBlurbRelTimer.setObjectName("NewsBlurbRelTimer")
|
|
|
|
self.horizontalLayout_12.addWidget(self.NewsBlurbRelTimer)
|
|
|
|
|
|
|
|
def update_gui(self):
|
2023-08-03 13:37:46 +05:00
|
|
|
# same as fissure, except populate hyperlink instead of setting labels.
|
2022-11-10 16:26:28 +05:00
|
|
|
try:
|
|
|
|
self.NewsBlurbHyperLink.setText(f'<a href=\"{self.news_info["link"]}\">{self.news_info["message"]}</a>')
|
|
|
|
self.update_timer()
|
|
|
|
except:
|
|
|
|
pass
|
2022-11-10 15:16:50 +05:00
|
|
|
|
|
|
|
def update_timer(self):
|
2023-08-03 13:37:46 +05:00
|
|
|
# timers are wonkier than fissure since there can be both start and end dates
|
|
|
|
# chosen strat:
|
|
|
|
# if event starts in the future:
|
|
|
|
# starts in
|
|
|
|
# elif event has started and end date not reached:
|
|
|
|
# ends in
|
|
|
|
# else if no end date and start date past if it even existed:
|
|
|
|
# just display time difference to date, as in 1d ago
|
|
|
|
#
|
|
|
|
# if time delta is > 1d, only display day, else h and min
|
2022-11-27 22:39:25 +05:00
|
|
|
prefix = ''
|
2022-11-11 23:21:41 +05:00
|
|
|
if self.news_info.get('startDate'):
|
|
|
|
eta = round(time.mktime(time.strptime(self.news_info.get('startDate'), '%Y-%m-%dT%H:%M:%S.%fZ')) - time.time() + utcoffset)
|
2022-11-27 22:39:25 +05:00
|
|
|
if eta > 0:
|
|
|
|
prefix = 'Starts in '
|
|
|
|
if self.news_info.get('endDate') and not prefix:
|
2022-11-11 23:21:41 +05:00
|
|
|
eta = round(time.mktime(time.strptime(self.news_info.get('endDate'), '%Y-%m-%dT%H:%M:%S.%fZ')) - time.time() + utcoffset)
|
2022-11-27 22:39:25 +05:00
|
|
|
if eta > 0:
|
|
|
|
prefix = 'Ends in '
|
2022-11-11 23:21:41 +05:00
|
|
|
else:
|
|
|
|
eta = round(time.mktime(time.strptime(self.news_info.get('date'), '%Y-%m-%dT%H:%M:%S.%fZ')) - time.time() + utcoffset)
|
2022-11-10 23:03:50 +05:00
|
|
|
if abs(eta) // 86400 >= 1:
|
2022-11-27 22:39:25 +05:00
|
|
|
self.NewsBlurbRelTimer.setText(f'{prefix}{abs(eta) // 86400}d')
|
2022-11-10 15:16:50 +05:00
|
|
|
else:
|
2022-11-27 22:39:25 +05:00
|
|
|
self.NewsBlurbRelTimer.setText(f'{prefix}{(abs(eta) // 3600) % 24}h {(abs(eta) // 60) % 60}m')
|
2022-11-10 15:16:50 +05:00
|
|
|
|