summaryrefslogtreecommitdiff
path: root/scripts/html_menu.py
blob: 052c18dfe0b82e9e6c6d4fb26eece6427e81a277 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
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?folder".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', 'Kieran', 'Laurent', 'Magnus', 'Marek',
                             'Morimoto', 'Niklas', 'Shimoda', 'Wolfram', "NoAssignee"]:
                html("li").print(html("a", {"target":"summary",
                                            "href":"./{}.html?assignee".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?status".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?team".format(status)}).text(status))

    #--------------------
    # menu_bsp
    #--------------------
    def menu_bsp(self, bsp):
        html("a", {"target":"summary",
                   "href":"./{}.html?bsp".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?schedule"}).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)