This commit is contained in:
DevilXD
2022-08-22 10:00:24 +02:00
5 changed files with 15 additions and 8 deletions

1
.gitignore vendored
View File

@@ -11,6 +11,7 @@ __pycache__
# Dev files
/env
/cache
log.txt
cookies.jar
settings.json
/lang/English.json

12
gui.py
View File

@@ -1213,21 +1213,23 @@ class InventoryOverview:
self._campaigns.clear()
def get_progress(self, drop: TimedDrop) -> tuple[str, tk._Color]:
progress_text: str
progress_color: tk._Color = ''
progress_text: str = _("gui", "inventory", "minutes_progress").format(
minutes=drop.required_minutes
)
if drop.is_claimed:
progress_color = "green"
progress_text = _("gui", "inventory", "status", "claimed")
elif drop.can_claim:
progress_color = "goldenrod"
progress_text = _("gui", "inventory", "status", "ready")
elif drop.can_earn():
progress_text = _("gui", "inventory", "status", "ready_to_claim")
elif drop.current_minutes or drop.can_earn():
progress_text = _("gui", "inventory", "percent_progress").format(
percent=f"{drop.progress:3.1%}",
minutes=drop.required_minutes,
)
else:
progress_text = _("gui", "inventory", "minutes_progress").format(
minutes=drop.required_minutes
)
return (progress_text, progress_color)
def update_drop(self, drop: TimedDrop) -> None:

View File

@@ -112,7 +112,7 @@
"upcoming": "即将上线 \u23f3",
"expired": "已结束 \u274c",
"claimed": "声明 \u2714",
"ready": "准备掉宝 \u23f3"
"ready_to_claim": "准备掉宝 \u23f3"
},
"starts": "开始时间: {time}",
"ends": "结束时间: {time}",

View File

@@ -133,7 +133,7 @@ class GUIInvStatus(TypedDict):
expired: str
upcoming: str
claimed: str
ready: str
ready_to_claim: str
class GUIInventory(TypedDict):
@@ -318,7 +318,7 @@ default_translation: Translation = {
"upcoming": "Upcoming ⏳",
"expired": "Expired ❌",
"claimed": "Claimed ✔",
"ready": "Ready to claim ⏳",
"ready_to_claim": "Ready to claim ⏳",
},
"starts": "Starts: {time}",
"ends": "Ends: {time}",

View File

@@ -880,7 +880,11 @@ class Twitch:
# just so that quick 2nd retries that often happen, aren't shown
if delay > 1:
self.print(_("error", "no_connection").format(seconds=round(delay)))
if self.gui.close_requested:
raise ExitRequest()
await asyncio.sleep(delay)
if self.gui.close_requested:
raise ExitRequest()
async def gql_request(self, op: GQLOperation) -> JsonType:
gql_logger.debug(f"GQL Request: {op}")