Skip to content

Commit

Permalink
Merge pull request #17 from csgoh/dev-roadmapper-v1.1.1
Browse files Browse the repository at this point in the history
Dev roadmapper v1.1.1
  • Loading branch information
csgoh authored Apr 1, 2023
2 parents 54aef64 + 15f3c17 commit 1fb4a2f
Show file tree
Hide file tree
Showing 29 changed files with 95 additions and 38 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ src/test/*.png
.VSCodeCounter/
try*.py
tempCode*.py
fonts/
*.json

# C extensions
*.so
Expand Down
Binary file added demo01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/color-theme01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/color-theme02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/color-theme03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/color-theme04.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/color-theme05.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/demo01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/en_NZ-roadmap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/gallery/gallery-BLUEMOUNTAIN-monthly.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/gallery/gallery-DEFAULT-halfyearly.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/gallery/gallery-DEFAULT-monthly.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/gallery/gallery-DEFAULT-quarterly.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/gallery/gallery-DEFAULT-weekly.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/gallery/gallery-DEFAULT-yearly.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/gallery/gallery-GREENTURTLE-monthly.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/gallery/gallery-GREYWOOF-monthly.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/gallery/gallery-ORANGEPEEL-monthly.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/gallery/gallery-marker-monthly.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/ja_JP-roadmap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/ko-KR-roadmap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/my_roadmap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/roadmapper-anatomy-base.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/zh_TW-roadmap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/zh_TW-timeline-roadmap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
85 changes: 62 additions & 23 deletions src/_test_roadmapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,46 @@ def colour_theme_demo(
roadmap.save(file_name)


def colour_theme_demo_without_locale(
mode: TimelineMode = TimelineMode.MONTHLY,
start_date: str = "2022-12-01",
number_of_items: int = 12,
show_generic_dates: bool = False,
file_name: str = "demo01.png",
colour_theme: str = "DEFAULT",
) -> None:
file_name = "T_" + file_name
roadmap = Roadmap(
1200, 1000, auto_height=True, colour_theme=colour_theme, show_marker=True
)
roadmap.set_title("SAMPLE ROADMAP 2022/2023")
roadmap.set_subtitle("ABC Corporation")
roadmap.set_timeline(
mode,
start_date,
number_of_items,
show_generic_dates=show_generic_dates,
)

group = roadmap.add_group("Core Product Work Stream", text_alignment="left")
task = group.add_task("Base Functionality", "2022-11-01", "2023-10-31")
task.add_milestone("v.1.0", "2023-02-15")
task.add_milestone("v.1.1", "2023-08-01")
parellel_task = task.add_parallel_task("Enhancements", "2023-11-15", "2024-03-31")
parellel_task.add_milestone("v.2.0", "2024-03-30")

task = group.add_task("Showcase #1", "2023-03-01", "2023-05-07")
task.add_parallel_task("Showcase #2", "2023-06-01", "2023-08-07")

group = roadmap.add_group("Mobility Work Stream", text_alignment="left")
group.add_task("Mobile App Development", "2023-02-01", "2024-12-07")

roadmap.set_footer("Updated on " + datetime.now().strftime("%Y-%m-%d"))
roadmap.draw()

roadmap.save(file_name)


def chinese_theme_demo(
mode: TimelineMode = TimelineMode.MONTHLY,
start_date: str = "2022-12-01",
Expand Down Expand Up @@ -515,9 +555,8 @@ def logo_demo(
# ),


colour_theme_demo(
file_name="demo-my-colour-rainbow.png",
colour_theme="rainbow.json",
colour_theme_demo_without_locale(
file_name="demo-my-colour-rainbow-no-locale.png",
mode=TimelineMode.MONTHLY,
number_of_items=14,
)
Expand All @@ -544,24 +583,24 @@ def logo_demo(
# show_generic_dates=True,
# )

# chinese_theme_demo(
# file_name="demo-my-colour-chinese.png",
# colour_theme="chinese.json",
# mode=TimelineMode.WEEKLY,
# start_date="2023-01-01",
# number_of_items=14,
# locale_name="zh_TW_timeline_settings.json",
# show_generic_dates=False,
# show_first_day_of_week=True,
# )
chinese_theme_demo(
file_name="demo-my-colour-chinese.png",
colour_theme="chinese.json",
mode=TimelineMode.WEEKLY,
start_date="2023-01-01",
number_of_items=14,
locale_name="zh_TW_timeline_settings.json",
show_generic_dates=False,
show_first_day_of_week=True,
)

# japanese_theme_demo(
# file_name="demo-my-colour-japanese.png",
# colour_theme="chinese.json",
# mode=TimelineMode.MONTHLY,
# start_date="2023-01-01",
# number_of_items=14,
# locale_name="ja_JP_timeline_settings.json",
# show_generic_dates=False,
# show_first_day_of_week=True,
# )
japanese_theme_demo(
file_name="demo-my-colour-japanese.png",
colour_theme="chinese.json",
mode=TimelineMode.MONTHLY,
start_date="2023-01-01",
number_of_items=14,
locale_name="ja_JP_timeline_settings.json",
show_generic_dates=False,
show_first_day_of_week=True,
)
3 changes: 2 additions & 1 deletion src/roadmapper/roadmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,8 @@ def set_timeline(
number_of_items: int = 12,
show_generic_dates: bool = False,
show_first_day_of_week: bool = False,
timeline_locale: str = "en_US",
### v1.1.1 Remove default locale "en_US"
timeline_locale: str = "",
year_font: str = "",
year_font_size: int = 0,
year_font_colour: str = "",
Expand Down
43 changes: 29 additions & 14 deletions src/roadmapper/timelinelocale.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,32 @@
},
}

### v1.1.1 Add generic timeline locale settings
generic_timeline_locale_settings = {
"locale": "",
"settings": {
"year": {
"text": "Year {0}",
"generic_text": "Year {0}",
},
"half_year": {"text": "H{0}"},
"quarter": {"text": "Q{0}"},
"month": {
"text": "{0}",
"generic_text": "Month {0}",
},
"week": {
"text": "{0} {1}",
"generic_text": "W{0}",
},
},
}


TimelineLocaleSettings = [
default_timeline_locale_settings,
### v1.1.1 Add generic timeline locale settings
generic_timeline_locale_settings,
### Add more themes here
]

Expand All @@ -64,24 +87,19 @@ def __init__(self, locale_name: str) -> None:
with open(locale_name, "r", encoding="utf8") as f:
timeline_locale_json = json.load(f)
if "locale" in timeline_locale_json:
# timeline_locale_json["locale"] = locale_name
locale_name = timeline_locale_json["locale"]
TimelineLocaleSettings.append(timeline_locale_json)
else:
raise ValueError(f"Locale {locale_name} not recognised.")
else:
raise ValueError(f"Locale {locale_name} not recognised.")
else:
built_in_locale_found = False
for theme in TimelineLocaleSettings:
if theme["locale"] == locale_name:
built_in_locale_found = True

if built_in_locale_found == False:
raise ValueError(f"Locale {locale_name} not recognised.")

self._timeline_locale_name = locale_name
locale.setlocale(locale.LC_ALL, locale_name)
self._timeline_locale_name = locale_name
locale.setlocale(locale.LC_ALL, locale_name)
else:
## v1.1.1 accept all non-json locale names
self._timeline_locale_name = locale_name
locale.setlocale(locale.LC_ALL, locale_name)

def get_timeline_locale_settings(self, timeline_mode: str) -> tuple:
""" "Get the timeline locale settings for the specified timeline mode.
Expand All @@ -98,7 +116,6 @@ def get_timeline_locale_settings(self, timeline_mode: str) -> tuple:
for _, value in enumerate(TimelineLocaleSettings):
if value["locale"] == self._timeline_locale_name:
locale_settings = value["settings"]
# print(f"Using locale {self._timeline_locale_name}, {timeline_mode}")
break

### get the colour scheme for the specified roadmap component
Expand All @@ -107,5 +124,3 @@ def get_timeline_locale_settings(self, timeline_mode: str) -> tuple:
return tuple(locale_settings[timeline_mode].values())
else:
return tuple(locale_settings[timeline_mode].values())[0]

# return tuple(locale_settings[timeline_mode].values())
Binary file added theme-demo01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 1fb4a2f

Please sign in to comment.