summaryrefslogtreecommitdiff
path: root/scripts/timesheet.py
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2021-02-08 12:25:57 +0900
committerKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2021-02-08 12:27:41 +0900
commitedd2189ab2c0c9131b3ebb27d77e2ad9d6e251d6 (patch)
tree87bf68994d90cd0ce6110765dc0a216a2490c0a0 /scripts/timesheet.py
parentdbdd23b384c08435ce1f35b0d8da9c21bd1448ef (diff)
Add Schedule support
This patch adds SoC/BSP schedule support. PeriPeri member can know the Renesas plan from it. It is based on timesheet JavaScript which from below with small customize. https://github.com/sbstjn/timesheet.js.git Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Diffstat (limited to 'scripts/timesheet.py')
-rwxr-xr-xscripts/timesheet.py64
1 files changed, 64 insertions, 0 deletions
diff --git a/scripts/timesheet.py b/scripts/timesheet.py
new file mode 100755
index 0000000..a508fec
--- /dev/null
+++ b/scripts/timesheet.py
@@ -0,0 +1,64 @@
+#! /usr/bin/env python3
+#===============================
+#
+# timesheet
+#
+# This schedule is based on
+# https://github.com/sbstjn/timesheet.js.git
+#
+# 2021/02/08 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+#===============================
+import schedule
+import datetime
+
+class timesheet(schedule.schedule):
+ def print(self):
+ color = ['lorem', 'ipsum', 'dolor', 'default']
+ txt_b = """
+<html>
+ <link rel="stylesheet" type="text/css" href="../scripts/timesheet.min.css">
+ <script type="text/javascript" src="../scripts/timesheet.min.js"></script>
+ <h1>PeriPeri Schedule</h1>
+ <div id="timesheet"></div>
+ <script>
+"""
+ txt_e = """
+ </script>
+</html>
+"""
+ txt = "new Timesheet('timesheet', "
+ date_s = datetime.datetime(9999, 12, 31, 10, 0, 0)
+ date_e = datetime.datetime(1000, 1, 1, 10, 0, 0)
+
+ # check earliest/latest date
+ for lst in self.list:
+ ds = datetime.datetime.strptime(lst[0], "%m/%Y")
+ de = datetime.datetime.strptime(lst[1], "%m/%Y")
+ if ds < date_s:
+ date_s = ds
+ if (de > date_e):
+ date_e = de
+
+ txt += "{}, {}, [".format(date_s.strftime("%Y"),
+ date_e.strftime("%Y"))
+
+ c = 0
+ for lst in self.list:
+ txt += "['{}', '{}', '{}', '{}'],".\
+ format(lst[0], lst[1], lst[2], color[c])
+ c += 1
+ if (c >= len(color)):
+ c = 0
+ txt += "]);"
+
+ print(txt_b)
+ print(txt)
+ print(txt_e)
+
+#====================================
+#
+# As command
+#
+#====================================
+if __name__=='__main__':
+ timesheet().print()