rewrite: More restructuring.

This commit is contained in:
2022-12-23 07:19:35 +02:00
parent 1cef97cdd4
commit ee1abcacea
26 changed files with 443 additions and 39 deletions

View File

View File

@@ -0,0 +1,12 @@
import asyncio
import datetime as dt
from src.cards import WeeklyGoalCard
async def get_card():
card = await WeeklyGoalCard.generate_sample()
with open('samples/weekly-sample.png', 'wb') as image_file:
image_file.write(card.fp.read())
if __name__ == '__main__':
asyncio.run(get_card())

View File

@@ -0,0 +1,12 @@
import asyncio
import datetime as dt
from src.cards import LeaderboardCard
async def get_card():
card = await LeaderboardCard.generate_sample()
with open('samples/leaderboard-sample.png', 'wb') as image_file:
image_file.write(card.fp.read())
if __name__ == '__main__':
asyncio.run(get_card())

View File

@@ -0,0 +1,45 @@
import asyncio
import random
import datetime as dt
from src.cards import LeaderboardCard as _Card
highlights = [
"header_text_colour",
"subheader_name_colour",
"subheader_value_colour",
"top_position_colour",
"top_name_colour",
"top_hours_colour",
"entry_position_colour",
"entry_position_highlight_colour",
"entry_name_colour",
"entry_hours_colour",
"entry_bg_colour",
"entry_bg_highlight_colour"
]
highlight_colour = "#E84727"
card_name = "leaderboard"
async def get_cards():
strings = []
random.seed(0)
for highlight in highlights:
card = await _Card.generate_sample(
skin={highlight: highlight_colour}
)
with open(f"../skins/spec/images/{card_name}/{highlight}.png", 'wb') as image_file:
image_file.write(card.fp.read())
esc_highlight = highlight.replace('_', '\\_')
string = f"""\
\\hypertarget{{{card_name}-{highlight.replace('_', '-')}}}{{\\texttt{{{esc_highlight}}}}} & &
\\includegraphics[width=.25\\textwidth,valign=m]{{images/{card_name}/{highlight}.png}}
\\\\"""
strings.append(string)
print('\n'.join(strings))
if __name__ == '__main__':
asyncio.run(get_cards())

View File

@@ -0,0 +1,54 @@
import asyncio
import random
import datetime as dt
from src.cards import MonthlyStatsCard as _Card
highlights = [
'title_colour',
'top_hours_colour',
'top_hours_bg_colour',
'top_line_colour',
'top_date_colour',
'top_this_colour',
'top_last_colour',
'top_this_hours_colour',
'top_last_hours_colour',
'this_month_colour',
'last_month_colour',
'heatmap_empty_colour',
'weekday_background_colour',
'weekday_colour',
'month_background_colour',
'month_colour',
'stats_key_colour',
'stats_value_colour',
'footer_colour',
]
highlight_colour = "#E84727"
card_name = "monthly"
highlights = ['heatmap_colours']
highlight_colour = ["#E84727"]
async def get_cards():
strings = []
random.seed(0)
for highlight in highlights:
card = await _Card.generate_sample(
skin={highlight: highlight_colour}
)
with open(f"../skins/spec/images/{card_name}/{highlight}.png", 'wb') as image_file:
image_file.write(card.fp.read())
esc_highlight = highlight.replace('_', '\\_')
string = f"""\
\\hypertarget{{{card_name}-{highlight.replace('_', '-')}}}{{\\texttt{{{esc_highlight}}}}} & &
\\includegraphics[width=.25\\textwidth,valign=m]{{images/{card_name}/{highlight}.png}}
\\\\"""
strings.append(string)
print('\n'.join(strings))
if __name__ == '__main__':
asyncio.run(get_cards())

View File

@@ -0,0 +1,44 @@
import asyncio
import datetime as dt
from src.cards import ProfileCard as _Card
highlights = [
"header_colour_1",
"header_colour_2",
"counter_bg_colour",
"counter_colour",
"subheader_colour",
"badge_text_colour",
"badge_blob_colour",
"rank_name_colour",
"rank_hours_colour",
"bar_full_colour",
"bar_empty_colour",
"next_rank_colour"
]
highlight_colour = "#E84727"
card_name = "profile"
async def get_cards():
strings = []
for highlight in highlights:
card = await _Card.generate_sample(
skin={highlight: highlight_colour}
)
with open(f"../skins/spec/images/{card_name}/{highlight}.png", 'wb') as image_file:
image_file.write(card.fp.read())
esc_highlight = highlight.replace('_', '\\_')
string = f"""
\\hypertarget{{{card_name}-{highlight.replace('_', '-')}}}{{\\texttt{{{esc_highlight}}}}} & &
\\includegraphics[width=.25\\textwidth,valign=m]{{images/{card_name}/{highlight}.png}}
\\\\
"""
strings.append(string)
print('\n'.join(strings))
if __name__ == '__main__':
asyncio.run(get_cards())

View File

@@ -0,0 +1,30 @@
import asyncio
import datetime as dt
from src.cards import StatsCard
highlights = [
'header_colour',
'stats_subheader_colour',
'stats_text_colour',
'col2_date_colour',
'col2_hours_colour',
'cal_weekday_colour',
'cal_number_colour',
'cal_number_end_colour',
'cal_streak_end_colour',
'cal_streak_middle_colour',
]
highlight_colour = "#E84727"
async def get_cards():
for highlight in highlights:
card = await StatsCard.generate_sample(
skin={highlight: highlight_colour}
)
with open('../skins/spec/images/stats/{}.png'.format(highlight), 'wb') as image_file:
image_file.write(card.fp.read())
if __name__ == '__main__':
asyncio.run(get_cards())

View File

@@ -0,0 +1,17 @@
import asyncio
import datetime as dt
from src.cards import TasklistCard
highlight = "mini_profile_badge_text_colour"
highlight_colour = "#E84727"
async def get_card():
card = await TasklistCard.generate_sample(
skin={highlight: highlight_colour}
)
with open('samples/tasklist-sample.png', 'wb') as image_file:
image_file.write(card.fp.read())
if __name__ == '__main__':
asyncio.run(get_card())

View File

@@ -0,0 +1,28 @@
import asyncio
import datetime as dt
from src.cards import TasklistCard
highlights = [
'mini_profile_badge_colour',
'mini_profile_name_colour',
'mini_profile_discrim_colour',
'task_done_number_colour',
'task_done_text_colour',
'task_undone_text_colour',
'task_undone_number_colour',
'footer_colour'
]
highlight_colour = "#E84727"
async def get_cards():
for highlight in highlights:
card = await TasklistCard.generate_sample(
skin={highlight: highlight_colour}
)
with open('../skins/spec/images/tasklist/{}.png'.format(highlight), 'wb') as image_file:
image_file.write(card.fp.read())
if __name__ == '__main__':
asyncio.run(get_cards())

View File

@@ -0,0 +1,49 @@
import asyncio
import datetime as dt
from src.cards import WeeklyStatsCard as _Card
highlights = [
'title_colour',
'top_hours_colour',
'top_hours_bg_colour',
'top_line_colour',
'top_weekday_colour',
'top_date_colour',
'top_this_colour',
'top_last_colour',
'btm_weekly_background_colour',
'btm_this_colour',
'btm_last_colour',
'btm_weekday_colour',
'btm_day_colour',
'btm_bar_horiz_colour',
'btm_bar_vert_colour',
'this_week_colour',
'last_week_colour',
'footer_colour'
]
highlight_colour = "#E84727"
card_name = "weekly"
async def get_cards():
strings = []
for highlight in highlights:
card = await _Card.generate_sample(
skin={highlight: highlight_colour}
)
with open(f"../skins/spec/images/{card_name}/{highlight}.png", 'wb') as image_file:
image_file.write(card.fp.read())
esc_highlight = highlight.replace('_', '\\_')
string = f"""\
\\hypertarget{{{card_name}-{highlight.replace('_', '-')}}}{{\\texttt{{{esc_highlight}}}}} & &
\\includegraphics[width=.25\\textwidth,valign=m]{{images/{card_name}/{highlight}.png}}
\\\\"""
strings.append(string)
print('\n'.join(strings))
if __name__ == '__main__':
asyncio.run(get_cards())

View File

@@ -0,0 +1,54 @@
import asyncio
import random
import datetime as dt
from src.cards import WeeklyGoalCard as _Card
highlights = [
'title_colour',
'mini_profile_name_colour',
'mini_profile_discrim_colour',
'mini_profile_badge_colour',
'mini_profile_badge_text_colour',
'progress_bg_colour',
'progress_colour',
'task_count_colour',
'task_done_colour',
'task_goal_colour',
'task_goal_number_colour',
'attendance_rate_colour',
'attendance_colour',
'studied_text_colour',
'studied_hour_colour',
'task_header_colour',
'task_done_number_colour',
'task_done_text_colour',
'task_undone_number_colour',
'task_undone_text_colour',
'footer_colour'
]
highlight_colour = "#E84727"
card_name = "weeklygoals"
async def get_cards():
strings = []
random.seed(0)
for highlight in highlights:
card = await _Card.generate_sample(
skin={highlight: highlight_colour}
)
with open(f"../skins/spec/images/{card_name}/{highlight}.png", 'wb') as image_file:
image_file.write(card.fp.read())
esc_highlight = highlight.replace('_', '\\_')
string = f"""\
\\hypertarget{{{card_name}-{highlight.replace('_', '-')}}}{{\\texttt{{{esc_highlight}}}}} & &
\\includegraphics[width=.25\\textwidth,valign=m]{{images/{card_name}/{highlight}.png}}
\\\\"""
strings.append(string)
print('\n'.join(strings))
if __name__ == '__main__':
asyncio.run(get_cards())