diff options
Diffstat (limited to 'scripts/html_menu.py')
-rwxr-xr-x | scripts/html_menu.py | 132 |
1 files changed, 132 insertions, 0 deletions
diff --git a/scripts/html_menu.py b/scripts/html_menu.py new file mode 100755 index 0000000..1199529 --- /dev/null +++ b/scripts/html_menu.py @@ -0,0 +1,132 @@ +#! /usr/bin/env python3 +#=============================== +# +# html_menu +# +# 2021/02/09 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> +#=============================== +import sys +import os +import datetime + +import view +import html_base +from html_base import html +#==================================== +# +# periject_html +# +#==================================== +class periject_html(html_base.myhtml): + + #-------------------- + # menu_wiki + #-------------------- + def menu_wiki(self): + html("a", {"target":"_blank", + "href":"./wiki/top.html"}).print("Peri Peri Wiki") + + #-------------------- + # menu_folder + #-------------------- + def menu_folder(self, current): + folders = self.runl("cd {}; ls -F | grep /".format(current)) + path = current.replace("./projects", ".") + link = html("a", {"target":"summary", + "href":"{}/summary.html".format(path)}) + + html("li").print(link.text(os.path.basename(current))) + + if (not folders): + return + + with html("ul"): + for folder in folders: + dir = os.path.basename(folder) + self.menu_folder("{}/{}".format(current, folder[:-1])) + + #-------------------- + # menu_assignee + #-------------------- + def menu_assignee(self): + # from project.schema.yaml + with html("ul"): + for assignee in ['BSP', 'Geert', 'Jacopo', 'Kaneko', 'Kieran', 'Laurent', 'Magnus', 'Marek', + 'Morimoto', 'Niklas', 'Shimoda', 'Simon', 'Ulrich', 'Wolfram', "NoAssignee"]: + html("li").print(html("a", {"target":"summary", + "href":"./{}.html".format(assignee)}).text(assignee)) + + #-------------------- + # menu_status + #-------------------- + def menu_status(self): + # from project.schema.yaml + with html("ul"): + for status in ['New', 'Active', 'Blocked', 'Paused', 'Done', 'Abandoned']: + html("li").print(html("a", {"target":"summary", + "href":"./{}.html".format(status)}).text(status)) + + #-------------------- + # menu_team + #-------------------- + def menu_team(self): + # from project.schema.yaml + with html("ul"): + for status in ['Core', 'IO', 'MM']: + html("li").print(html("a", {"target":"summary", + "href":"./{}.html".format(status)}).text(status)) + + #-------------------- + # menu_bsp + #-------------------- + def menu_bsp(self, bsp): + html("a", {"target":"summary", + "href":"./{}.html".format(bsp)}).print(bsp) + + #-------------------- + # print + #-------------------- + def print(self, argv): + + # remove this script + argv.pop(0) + + self.print_css("html") + with html("body"): + html("h1").print("Wiki") + self.menu_wiki() + + html("h1").print("Schedule") + html("a", {"target":"summary", + "href":"./schedule.html"}).print("schedule") + + html("h1").print("Folder") + with html("ul"): + self.menu_folder("./projects") + + html("h1").print("Assignee") + self.menu_assignee() + + html("h1").print("Status") + self.menu_status() + + html("h1").print("Team") + self.menu_team() + + html("h1").print("BSP") + with html("ul"): + for bsp in argv: + with html("li"): + self.menu_bsp(bsp) + + html("div").print("<br><br>update<br>{}".format( + datetime.datetime.now().strftime("%Y/%m/%d %H:%M"))) + +#==================================== +# +# As command +# +#==================================== +if __name__=='__main__': + # html_menu.py bsp39x + periject_html().print(sys.argv) |