Skip to content

Commit

Permalink
*: show thanks to contributors (#777)
Browse files Browse the repository at this point in the history
  • Loading branch information
cosven authored Jan 21, 2024
1 parent 9a5d8ec commit c635436
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 3 deletions.
2 changes: 0 additions & 2 deletions feeluown/gui/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ async def get(self, img_url, img_name):
self.cache.update(img_name)
return content
event_loop = asyncio.get_event_loop()
action_msg = 'Downloading image from {}'.format(img_url)
self._app.show_msg(action_msg)
try:
# May return None.
res = await event_loop.run_in_executor(
Expand Down
52 changes: 51 additions & 1 deletion feeluown/gui/tips.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,46 @@
from feeluown.utils import aio
from feeluown.app import App

# (nickname, name), no order.
# Write your Chinese(or other languages) name if you want.
Contributors = [
('cosven', 'Shaowen Yin'),
('felixonmars', ''),
('PhotonQuantum', ''),
('wuliaotc', ''),
('cyliuu', ''),
('light4', ''),
('hjlarry', ''),
('sbwtw', ''),
('oryxfea', ''),
('poly000', ''),
('BruceZhang1993', ''),
('cposture', ''),
('helinb', ''),
('Yexiaoxing', ''),
('albertofwb', ''),
('catsout', ''),
('Torxed', ''),
('RealXuChe', ''),
('rapiz1', ''),
('Heersin', ''),
('chen-chao', ''),
('keter42', ''),
('timgates42', ''),
('junhan-z', ''),
('CareF', ''),
('berberman', ''),
('SaneBow', ''),
('wsyxbcl', ''),
('Thearas', ''),
('reaink', ''),
('wenLiangcan', ''),
('leedagee', ''),
('hanchanli', ''),
('xssss1', ''),
('williamherry', ''),
]


class TipsManager:
"""在合适的时候展示一些使用 Tip"""
Expand All @@ -22,7 +62,17 @@ def __init__(self, app: App):
self._app.started.connect(self.show_random_after_5s)

def show_random(self):
self._app.show_msg(random.choice(self.tips), timeout=2500)
if random.randint(0, 10) < 5:
self._app.show_msg(random.choice(self.tips), timeout=2500)
else:
contributor = random.choice(Contributors)
nickname, name = contributor
if name:
user = f'{name} (@{nickname})'
else:
user = f'@{nickname}'
msg = f'感谢 {user} 的贡献 :)'
self._app.show_msg(msg, timeout=2500)

def show_random_after_5s(self, *_):
async def task():
Expand Down

0 comments on commit c635436

Please sign in to comment.