Add tags in shop_info.py
This commit is contained in:
parent
7cf4f15122
commit
c0f4577870
|
@ -11,6 +11,8 @@ from PyQt5.QtWidgets import QWidget, QVBoxLayout, QLabel
|
|||
from rare.utils.extra_widgets import ImageLabel
|
||||
from rare.utils.utils import get_lang
|
||||
|
||||
logger = logging.getLogger("GameWidgets")
|
||||
|
||||
|
||||
class GameWidget(QWidget):
|
||||
show_info = pyqtSignal(dict)
|
||||
|
@ -38,7 +40,8 @@ class GameWidget(QWidget):
|
|||
self.image.update_image(img["url"], json_info["title"], (self.width, int(self.width * 9 / 16)))
|
||||
break
|
||||
else:
|
||||
print(json_info["keyImages"])
|
||||
logger.info(", ".join([img["type"] for img in json_info["keyImages"]]))
|
||||
# print(json_info["keyImages"])
|
||||
|
||||
save = QSettings().value("cache_images", True, bool)
|
||||
if os.path.exists(p := os.path.join(self.path, f"{json_info['title']}_wide.png")) and save:
|
||||
|
@ -54,7 +57,7 @@ class GameWidget(QWidget):
|
|||
break
|
||||
else:
|
||||
# No image found
|
||||
logging.error(f"No image found for {self.title}")
|
||||
logger.error(f"No image found for {self.title}")
|
||||
|
||||
self.layout.addWidget(self.image)
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ class ShopGameInfo(QWidget, Ui_shop_info):
|
|||
self.dev.setText(self.game.developer)
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
self.tags.setText(", ".join(self.game.tags))
|
||||
# self.price.setText(self.game.price)
|
||||
|
||||
self.request.deleteLater()
|
||||
|
|
|
@ -25,7 +25,7 @@ class ShopGame:
|
|||
# TODO: Copyrights etc
|
||||
def __init__(self, title: str = "", image_urls: _ImageUrlModel = None, social_links: dict = None,
|
||||
langs: list = None, reqs: dict = None, publisher: str = "", developer: str = "",
|
||||
original_price: str = "", discount_price: str = ""):
|
||||
original_price: str = "", discount_price: str = "", tags: list = None):
|
||||
self.title = title
|
||||
self.image_urls = image_urls
|
||||
self.links = []
|
||||
|
@ -41,6 +41,7 @@ class ShopGame:
|
|||
self.developer = developer
|
||||
self.price = original_price
|
||||
self.discount_price = discount_price
|
||||
self.tags = tags
|
||||
|
||||
@classmethod
|
||||
def from_json(cls, api_data: dict, search_data: dict):
|
||||
|
@ -80,5 +81,6 @@ class ShopGame:
|
|||
tmp.developer = i["value"]
|
||||
tmp.price = search_data['price']['totalPrice']['fmtPrice']['originalPrice']
|
||||
tmp.discount_price = search_data['price']['totalPrice']['fmtPrice']['discountPrice']
|
||||
tmp.tags = [i.replace("_", " ").capitalize() for i in api_data["data"]["meta"].get("tags", [])]
|
||||
|
||||
return tmp
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
# run again. Do not edit this file unless you know what you are doing.
|
||||
|
||||
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
from PyQt5 import QtCore, QtWidgets
|
||||
|
||||
|
||||
class Ui_shop_info(object):
|
||||
|
@ -39,12 +39,15 @@ class Ui_shop_info(object):
|
|||
self.owned_label.setObjectName("owned_label")
|
||||
self.verticalLayout_2.addWidget(self.owned_label)
|
||||
self.price = QtWidgets.QLabel(shop_info)
|
||||
self.price.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse|QtCore.Qt.TextSelectableByMouse)
|
||||
self.price.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse | QtCore.Qt.TextSelectableByMouse)
|
||||
self.price.setObjectName("price")
|
||||
self.verticalLayout_2.addWidget(self.price)
|
||||
self.discount_price = QtWidgets.QLabel(shop_info)
|
||||
self.discount_price.setObjectName("discount_price")
|
||||
self.verticalLayout_2.addWidget(self.discount_price)
|
||||
self.tags = QtWidgets.QLabel(shop_info)
|
||||
self.tags.setObjectName("tags")
|
||||
self.verticalLayout_2.addWidget(self.tags)
|
||||
self.open_store_button = QtWidgets.QPushButton(shop_info)
|
||||
self.open_store_button.setObjectName("open_store_button")
|
||||
self.verticalLayout_2.addWidget(self.open_store_button)
|
||||
|
@ -75,6 +78,7 @@ class Ui_shop_info(object):
|
|||
self.owned_label.setText(_translate("shop_info", "You already own this game"))
|
||||
self.price.setText(_translate("shop_info", "TextLabel"))
|
||||
self.discount_price.setText(_translate("shop_info", "TextLabel"))
|
||||
self.tags.setText(_translate("shop_info", "TextLabel"))
|
||||
self.open_store_button.setText(_translate("shop_info", "Buy Game in Epic Games Store"))
|
||||
self.req_group_box.setTitle(_translate("shop_info", "Requirements"))
|
||||
|
||||
|
|
|
@ -76,6 +76,13 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="tags">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="open_store_button">
|
||||
<property name="text">
|
||||
|
|
Loading…
Reference in a new issue