diff --git a/rare/components/tabs/store/shop_widget.py b/rare/components/tabs/store/shop_widget.py
index 6a6cd1c0b..3489f9bb2 100644
--- a/rare/components/tabs/store/shop_widget.py
+++ b/rare/components/tabs/store/shop_widget.py
@@ -24,6 +24,8 @@
from .image_widget import WaitingSpinner
from .shop_api_core import ShopApiCore
+from .api.models.utils import parse_date
+
logger = logging.getLogger("Shop")
@@ -77,7 +79,7 @@ def __init__(self, cache_dir, core: LegendaryCore, shop_api: ShopApiCore, parent
self.search_bar = ButtonLineEdit(
"fa.search", placeholder_text=self.tr("Search Games")
)
- self.ui.left_layout.insertWidget(0, self.search_bar)
+ self.ui.main_layout.addWidget(self.search_bar, 0, 0)
# self.search_bar.textChanged.connect(self.search_games)
@@ -165,7 +167,7 @@ def add_free_games(self, free_games: List[CatalogOfferModel]):
self.free_games_next.setLayout(free_games_next_layout)
self.ui.free_container.layout().addWidget(self.free_games_next)
- date = datetime.datetime.now()
+ date = datetime.datetime.utcnow().replace(tzinfo=datetime.timezone.utc)
free_games_now = []
coming_free_games = []
for game in free_games:
@@ -187,19 +189,13 @@ def add_free_games(self, free_games: List[CatalogOfferModel]):
try:
# parse datetime to check if game is next week or now
try:
- start_date = datetime.datetime.strptime(
- game.promotions["upcomingPromotionalOffers"][0][
- "promotionalOffers"
- ][0]["startDate"],
- "%Y-%m-%dT%H:%M:%S.%fZ",
+ start_date = parse_date(
+ game.promotions["upcomingPromotionalOffers"][0]["promotionalOffers"][0]["startDate"]
)
except Exception:
try:
- start_date = datetime.datetime.strptime(
- game.promotions["promotionalOffers"][0][
- "promotionalOffers"
- ][0]["startDate"],
- "%Y-%m-%dT%H:%M:%S.%fZ",
+ start_date = parse_date(
+ game.promotions["promotionalOffers"][0]["promotionalOffers"][0]["startDate"]
)
except Exception as e:
diff --git a/rare/ui/components/tabs/store/store.py b/rare/ui/components/tabs/store/store.py
index 90c13f3b1..14ea03df0 100644
--- a/rare/ui/components/tabs/store/store.py
+++ b/rare/ui/components/tabs/store/store.py
@@ -14,62 +14,10 @@
class Ui_ShopWidget(object):
def setupUi(self, ShopWidget):
ShopWidget.setObjectName("ShopWidget")
- ShopWidget.resize(350, 382)
+ ShopWidget.resize(788, 662)
ShopWidget.setWindowTitle("Store")
- self.shop_layout = QtWidgets.QHBoxLayout(ShopWidget)
- self.shop_layout.setObjectName("shop_layout")
- self.left_layout = QtWidgets.QVBoxLayout()
- self.left_layout.setObjectName("left_layout")
- self.games_scrollarea = QtWidgets.QScrollArea(ShopWidget)
- self.games_scrollarea.setFrameShape(QtWidgets.QFrame.NoFrame)
- self.games_scrollarea.setFrameShadow(QtWidgets.QFrame.Plain)
- self.games_scrollarea.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustToContents)
- self.games_scrollarea.setWidgetResizable(True)
- self.games_scrollarea.setObjectName("games_scrollarea")
- self.games_container = QtWidgets.QWidget()
- self.games_container.setGeometry(QtCore.QRect(0, 0, 186, 368))
- self.games_container.setObjectName("games_container")
- self.games_container_layout = QtWidgets.QVBoxLayout(self.games_container)
- self.games_container_layout.setContentsMargins(0, 0, 3, 0)
- self.games_container_layout.setObjectName("games_container_layout")
- self.free_scrollarea = QtWidgets.QScrollArea(self.games_container)
- sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
- sizePolicy.setHorizontalStretch(0)
- sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(self.free_scrollarea.sizePolicy().hasHeightForWidth())
- self.free_scrollarea.setSizePolicy(sizePolicy)
- self.free_scrollarea.setFrameShape(QtWidgets.QFrame.NoFrame)
- self.free_scrollarea.setFrameShadow(QtWidgets.QFrame.Plain)
- self.free_scrollarea.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
- self.free_scrollarea.setWidgetResizable(True)
- self.free_scrollarea.setObjectName("free_scrollarea")
- self.free_container = QtWidgets.QWidget()
- self.free_container.setGeometry(QtCore.QRect(0, 0, 16, 16))
- sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
- sizePolicy.setHorizontalStretch(0)
- sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(self.free_container.sizePolicy().hasHeightForWidth())
- self.free_container.setSizePolicy(sizePolicy)
- self.free_container.setObjectName("free_container")
- self.free_container_layout = QtWidgets.QHBoxLayout(self.free_container)
- self.free_container_layout.setContentsMargins(0, 0, 0, 3)
- self.free_container_layout.setObjectName("free_container_layout")
- self.free_scrollarea.setWidget(self.free_container)
- self.games_container_layout.addWidget(self.free_scrollarea)
- self.discounts_group = QtWidgets.QGroupBox(self.games_container)
- self.discounts_group.setObjectName("discounts_group")
- self.games_container_layout.addWidget(self.discounts_group)
- self.games_group = QtWidgets.QGroupBox(self.games_container)
- self.games_group.setObjectName("games_group")
- self.games_container_layout.addWidget(self.games_group)
- self.games_scrollarea.setWidget(self.games_container)
- self.left_layout.addWidget(self.games_scrollarea)
- self.shop_layout.addLayout(self.left_layout)
- self.right_layout = QtWidgets.QVBoxLayout()
- self.right_layout.setObjectName("right_layout")
- self.reset_button = QtWidgets.QPushButton(ShopWidget)
- self.reset_button.setObjectName("reset_button")
- self.right_layout.addWidget(self.reset_button)
+ self.main_layout = QtWidgets.QGridLayout(ShopWidget)
+ self.main_layout.setObjectName("main_layout")
self.filter_scrollarea = QtWidgets.QScrollArea(ShopWidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
@@ -141,17 +89,59 @@ def setupUi(self, ShopWidget):
self.others_layout.setObjectName("others_layout")
self.filter_container_layout.addWidget(self.others_group)
self.filter_scrollarea.setWidget(self.filter_container)
- self.right_layout.addWidget(self.filter_scrollarea)
- self.shop_layout.addLayout(self.right_layout)
- self.shop_layout.setStretch(0, 1)
+ self.main_layout.addWidget(self.filter_scrollarea, 1, 1, 1, 1)
+ self.reset_button = QtWidgets.QPushButton(ShopWidget)
+ self.reset_button.setObjectName("reset_button")
+ self.main_layout.addWidget(self.reset_button, 0, 1, 1, 1)
+ self.games_scrollarea = QtWidgets.QScrollArea(ShopWidget)
+ self.games_scrollarea.setFrameShape(QtWidgets.QFrame.NoFrame)
+ self.games_scrollarea.setFrameShadow(QtWidgets.QFrame.Plain)
+ self.games_scrollarea.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustToContents)
+ self.games_scrollarea.setWidgetResizable(True)
+ self.games_scrollarea.setObjectName("games_scrollarea")
+ self.games_container = QtWidgets.QWidget()
+ self.games_container.setGeometry(QtCore.QRect(0, 0, 628, 618))
+ self.games_container.setObjectName("games_container")
+ self.games_container_layout = QtWidgets.QVBoxLayout(self.games_container)
+ self.games_container_layout.setContentsMargins(0, 0, 3, 0)
+ self.games_container_layout.setObjectName("games_container_layout")
+ self.free_scrollarea = QtWidgets.QScrollArea(self.games_container)
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.free_scrollarea.sizePolicy().hasHeightForWidth())
+ self.free_scrollarea.setSizePolicy(sizePolicy)
+ self.free_scrollarea.setFrameShape(QtWidgets.QFrame.NoFrame)
+ self.free_scrollarea.setFrameShadow(QtWidgets.QFrame.Plain)
+ self.free_scrollarea.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
+ self.free_scrollarea.setWidgetResizable(True)
+ self.free_scrollarea.setObjectName("free_scrollarea")
+ self.free_container = QtWidgets.QWidget()
+ self.free_container.setGeometry(QtCore.QRect(0, 0, 16, 16))
+ sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.free_container.sizePolicy().hasHeightForWidth())
+ self.free_container.setSizePolicy(sizePolicy)
+ self.free_container.setObjectName("free_container")
+ self.free_container_layout = QtWidgets.QHBoxLayout(self.free_container)
+ self.free_container_layout.setContentsMargins(0, 0, 0, 3)
+ self.free_container_layout.setObjectName("free_container_layout")
+ self.free_scrollarea.setWidget(self.free_container)
+ self.games_container_layout.addWidget(self.free_scrollarea)
+ self.discounts_group = QtWidgets.QGroupBox(self.games_container)
+ self.discounts_group.setObjectName("discounts_group")
+ self.games_container_layout.addWidget(self.discounts_group)
+ self.games_group = QtWidgets.QGroupBox(self.games_container)
+ self.games_group.setObjectName("games_group")
+ self.games_container_layout.addWidget(self.games_group)
+ self.games_scrollarea.setWidget(self.games_container)
+ self.main_layout.addWidget(self.games_scrollarea, 1, 0, 1, 1)
self.retranslateUi(ShopWidget)
def retranslateUi(self, ShopWidget):
_translate = QtCore.QCoreApplication.translate
- self.discounts_group.setTitle(_translate("ShopWidget", "Discounts from your wishlist"))
- self.games_group.setTitle(_translate("ShopWidget", "Games"))
- self.reset_button.setText(_translate("ShopWidget", "Reset filters"))
self.price_group.setTitle(_translate("ShopWidget", "Price"))
self.none_price.setText(_translate("ShopWidget", "None"))
self.free_button.setText(_translate("ShopWidget", "Free"))
@@ -164,6 +154,9 @@ def retranslateUi(self, ShopWidget):
self.genre_group.setTitle(_translate("ShopWidget", "Genre"))
self.type_group.setTitle(_translate("ShopWidget", "Type"))
self.others_group.setTitle(_translate("ShopWidget", "Other tags"))
+ self.reset_button.setText(_translate("ShopWidget", "Reset filters"))
+ self.discounts_group.setTitle(_translate("ShopWidget", "Discounts from your wishlist"))
+ self.games_group.setTitle(_translate("ShopWidget", "Games"))
if __name__ == "__main__":
diff --git a/rare/ui/components/tabs/store/store.ui b/rare/ui/components/tabs/store/store.ui
index 90ccdfa83..c46a8bf19 100644
--- a/rare/ui/components/tabs/store/store.ui
+++ b/rare/ui/components/tabs/store/store.ui
@@ -6,282 +6,274 @@
0
0
- 679
- 329
+ 788
+ 662
Store
-
- -
-
-
-
-
-
- QFrame::NoFrame
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+ QFrame::NoFrame
+
+
+ QFrame::Plain
+
+
+ Qt::ScrollBarAlwaysOff
+
+
+ QAbstractScrollArea::AdjustToContents
+
+
+ true
+
+
+
+
+ 0
+ 0
+ 142
+ 390
+
+
+
+
+ 0
+ 0
+
+
+
+
+ 0
-
- QFrame::Plain
+
+ 0
-
- QAbstractScrollArea::AdjustToContents
+
+ 3
-
- true
+
+ 0
-
-
-
- 0
- 0
- 515
- 315
-
-
-
-
- 0
+
-
+
+
+ Price
-
- 0
-
-
- 3
-
-
- 0
-
-
-
-
-
-
- 0
- 0
-
-
-
- QFrame::NoFrame
-
-
- QFrame::Plain
-
-
- Qt::ScrollBarAlwaysOff
-
-
- true
-
-
-
-
- 0
- 0
- 16
- 16
-
+
+
-
+
+
+ None
-
-
- 0
- 0
-
+
+ true
-
-
- 0
-
-
- 0
-
-
- 0
-
-
- 3
-
-
-
-
- -
-
-
- Discounts from your wishlist
-
-
-
- -
-
-
- Games
-
-
-
-
-
-
-
-
+
+ -
+
+
+ Free
+
+
+
+ -
+
+
+ Under 10
+
+
+
+ -
+
+
+ Under 20
+
+
+
+ -
+
+
+ Under 30
+
+
+
+ -
+
+
+ 14.99 and above
+
+
+
+ -
+
+
+ Discount
+
+
+
+
+
+
+ -
+
+
+ Platform
+
+
+
+
+ -
+
+
+ Genre
+
+
+
+
+ -
+
+
+ Type
+
+
+
+
+ -
+
+
+ Other tags
+
+
+
+
+
+
+
- -
-
-
-
-
-
- Reset filters
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- QFrame::NoFrame
-
-
- QFrame::Plain
+
-
+
+
+ Reset filters
+
+
+
+ -
+
+
+ QFrame::NoFrame
+
+
+ QFrame::Plain
+
+
+ QAbstractScrollArea::AdjustToContents
+
+
+ true
+
+
+
+
+ 0
+ 0
+ 628
+ 618
+
+
+
+
+ 0
-
- Qt::ScrollBarAlwaysOff
+
+ 0
-
- QAbstractScrollArea::AdjustToContents
+
+ 3
-
- true
+
+ 0
-
-
-
- 0
- 0
- 142
- 390
-
-
-
-
- 0
- 0
-
-
-
-
- 0
+
-
+
+
+
+ 0
+ 0
+
-
- 0
+
+ QFrame::NoFrame
-
- 3
+
+ QFrame::Plain
-
- 0
+
+ Qt::ScrollBarAlwaysOff
-
-
-
-
- Price
-
-
-
-
-
-
- None
-
-
- true
-
-
-
- -
-
-
- Free
-
-
-
- -
-
-
- Under 10
-
-
-
- -
-
-
- Under 20
-
-
-
- -
-
-
- Under 30
-
-
-
- -
-
-
- 14.99 and above
-
-
-
- -
-
-
- Discount
-
-
-
-
-
-
- -
-
-
- Platform
+
+ true
+
+
+
+
+ 0
+ 0
+ 16
+ 16
+
+
+
+
+ 0
+ 0
+
+
+
+
+ 0
-
-
-
- -
-
-
- Genre
+
+ 0
-
-
-
- -
-
-
- Type
+
+ 0
-
-
-
- -
-
-
- Other tags
+
+ 3
-
-
-
-
-
-
-
-
+
+
+
+
+ -
+
+
+ Discounts from your wishlist
+
+
+
+ -
+
+
+ Games
+
+
+
+
+
+