From 4800509ac14d3f22d4c8705cadca78c34f7d8fab Mon Sep 17 00:00:00 2001 From: Martin van Middelkoop Date: Mon, 16 Jan 2023 19:05:26 +0100 Subject: [PATCH 1/4] Tested, looking good --- .../wordclock_config.reference.cfg | 5 +++++ wordclock_plugins/time_default/plugin.py | 18 ++++++++++++++-- wordclock_tools/wordclock_display.py | 21 ++++++++++++++++++- wordclock_tools/wordclock_strip_wx.py | 20 ++++++++++++------ 4 files changed, 55 insertions(+), 9 deletions(-) diff --git a/wordclock_config/wordclock_config.reference.cfg b/wordclock_config/wordclock_config.reference.cfg index 372899b4..38e94ebc 100755 --- a/wordclock_config/wordclock_config.reference.cfg +++ b/wordclock_config/wordclock_config.reference.cfg @@ -17,6 +17,11 @@ animation_fps = 25 # * Maps the port for web-access to 8080 developer_mode = False +# Set to X seconds to test all the times in X seconds per step, from 00:00 onwards +# E.g. 5 seconds will take like 12 minutes total testing one time round the clock +# 0 seconds will disable this mode +developer_mode_step_seconds = 0 + # Additionally available after parsing by the wordclock-software: # base_path = "/path/to/wordclock.py" # e.g.: base_path = "/home/pi/rpi_wordclock" diff --git a/wordclock_plugins/time_default/plugin.py b/wordclock_plugins/time_default/plugin.py index 6ccb0d9c..d260cc48 100644 --- a/wordclock_plugins/time_default/plugin.py +++ b/wordclock_plugins/time_default/plugin.py @@ -23,6 +23,10 @@ def __init__(self, config): self.pretty_name = "The time" self.description = "The minimum, you should expect from a wordclock." + if config.getint('wordclock', 'developer_mode_step_seconds') > 0: + self.step_seconds = config.getint('wordclock', 'developer_mode_step_seconds') + self.step_count = 0 + self.animation = ''.join(config.get('plugin_' + self.name, 'animation')) animations = ["fadeOutIn", "typewriter", "none"] @@ -171,7 +175,7 @@ def run(self, wcd, wci): print("Date and time not set") # Check, if a minute has passed (to render the new time) - if prev_min < now.minute: + if prev_min < now.minute or self.step_seconds > 0: sleepActive = \ self.sleep_begin <= now.time() < self.sleep_end or \ self.sleep_end < self.sleep_begin <= now.time() <= datetime.time(23, 59, 59) or \ @@ -216,7 +220,17 @@ def run(self, wcd, wci): self.color_selection(wcd, wci) def show_time(self, wcd, wci, animation=None, animation_speed=25): - now = datetime.datetime.now() + now = datetime.datetime.now() + + if self.step_seconds > 0: # simulator test + if self.step_count == 0: #initialize time tracker + self.step_currtime = now + self.step_count = 1 # start first cycle + if now > self.step_currtime + datetime.timedelta(seconds=self.step_seconds * self.step_count): + self.step_count = self.step_count + 1 + + now = now.replace(hour=0,minute=0, second=0, microsecond=0) + datetime.timedelta(minutes=5 * (self.step_count - 1)) + # Set background color wcd.setColorToAll(self.bg_color, includeMinutes=True) # Returns indices, which represent the current time, when being illuminated diff --git a/wordclock_tools/wordclock_display.py b/wordclock_tools/wordclock_display.py index cda0614a..2b0fd4bd 100755 --- a/wordclock_tools/wordclock_display.py +++ b/wordclock_tools/wordclock_display.py @@ -22,6 +22,12 @@ import wordclock_plugins.time_default.time_swiss_german as time_swiss_german import wordclock_plugins.time_default.time_swiss_german2 as time_swiss_german2 import wordclock_plugins.time_default.time_swedish as time_swedish +import wordclock_plugins.time_default.time_mmi_dutch as time_mmi_dutch +import wordclock_plugins.time_default.time_mmi_english as time_mmi_english +import wordclock_plugins.time_default.time_mmi_spanish as time_mmi_spanish +import wordclock_plugins.time_default.time_mmi_hindi as time_mmi_hindi +import wordclock_plugins.time_default.time_mmi_chinese as time_mmi_chinese +import wordclock_plugins.time_default.time_mmi_fivelanguages as time_mmi_fivelanguages import wordclock_tools.wordclock_colors as wcc import wordclock_tools.wordclock_screen as wordclock_screen import colorsys @@ -52,7 +58,8 @@ def __init__(self, config, wci): if config.getboolean('wordclock', 'developer_mode'): import wordclock_tools.wordclock_strip_wx as wcs_wx - self.strip = wcs_wx.WxStrip(wci) + self.strip = wcs_wx.WxStrip(wci, config) + else: import wordclock_tools.wordclock_strip_neopixel as wcs_neo self.strip = wcs_neo.wordclock_strip_neopixel(self.wcl) @@ -137,6 +144,18 @@ def __init__(self, config, wci): self.taw = time_swabian2.time_swabian2() elif language == 'swedish': self.taw = time_swedish.time_swedish() + elif language == 'mmi_dutch': + self.taw = time_mmi_dutch.time_mmi_dutch() + elif language == 'mmi_english': + self.taw = time_mmi_english.time_mmi_english() + elif language == 'mmi_spanish': + self.taw = time_mmi_spanish.time_mmi_spanish() + elif language == 'mmi_hindi': + self.taw = time_mmi_hindi.time_mmi_hindi() + elif language == 'mmi_chinese': + self.taw = time_mmi_chinese.time_mmi_chinese() + elif language == 'mmi_fivelanguages': + self.taw = time_mmi_dutch.time_mmi_fivelanguages() elif language == 'swiss_german': self.taw = time_swiss_german.time_swiss_german() elif language == 'swiss_german2': diff --git a/wordclock_tools/wordclock_strip_wx.py b/wordclock_tools/wordclock_strip_wx.py index b259e805..9fefa3f1 100644 --- a/wordclock_tools/wordclock_strip_wx.py +++ b/wordclock_tools/wordclock_strip_wx.py @@ -3,6 +3,7 @@ import threading import os import sys +import ast from wordclock_interfaces import event_handler as weh from wordclock_tools.wordclock_colors import Color @@ -40,11 +41,18 @@ def updateDisplay(self): self.Update() class WxStrip(): - def __init__(self, weh): + def __init__(self, weh, config): self.label = "QTstrip" - chars = "ESKISTLFÜNFZEHNZWANZIGDREIVIERTELTGNACHVORJMHALBQZWÖLFPZWEINSIEBENKDREIRHFÜNFELFNEUNVIERWACHTZEHNRSBSECHSFMUHR...." - + language = ''.join(config.get('wordclock_display', 'language')) + stencil_content = ast.literal_eval(config.get('language_options', language)) + + height = len(stencil_content) + width = len(stencil_content[0]) + chars = "" + for i in range(0, height): + chars = chars + stencil_content[i] + chars = chars + "...." self.labels = [] self.colors = [] @@ -60,7 +68,7 @@ def __init__(self, weh): vbox = wx.BoxSizer(wx.VERTICAL) font = wx.SystemSettings.GetFont(wx.SYS_SYSTEM_FONT) font.SetPointSize(32) - gs = wx.GridSizer(11, 11, 5, 5) + gs = wx.GridSizer(height + 1, width, 5, 5) vbox.Add(gs, proportion=1, flag=wx.EXPAND) for i in str(chars): self.colors.append(Color(0, 0, 0)) @@ -73,12 +81,12 @@ def __init__(self, weh): self.labels.append(st2) x = x + 1; - if x == 11: + if x == width: x = 0 y = y + 1 self.w.SetSizer(vbox) - self.w.SetSize(1024, 1024) + self.w.SetSize(900, 900) else: print("No Main Thread") From 828b38a26c0dea6eb5629a7b4e0ef74778cb0ad3 Mon Sep 17 00:00:00 2001 From: Martin van Middelkoop Date: Wed, 18 Jan 2023 10:54:26 +0100 Subject: [PATCH 2/4] first commit --- .../wordclock_config.reference.cfg | 9 +++ .../time_default/time_chinese.py | 77 +++++++++++++++++++ wordclock_tools/wordclock_display.py | 21 +---- 3 files changed, 89 insertions(+), 18 deletions(-) create mode 100644 wordclock_plugins/time_default/time_chinese.py diff --git a/wordclock_config/wordclock_config.reference.cfg b/wordclock_config/wordclock_config.reference.cfg index 38e94ebc..54a0cb94 100755 --- a/wordclock_config/wordclock_config.reference.cfg +++ b/wordclock_config/wordclock_config.reference.cfg @@ -310,3 +310,12 @@ swedish=["KLOCKANTÄRK", "FEMSFLORSEX", "SJUÅTTAINIO", "TIOELVATOLV"] +chinese=["现在十一两三四五六七", + "八九点一三刻半两三四", + "五十零五享受你的生活", + "XIÀNZÀI佳SÌ", + "SHÍSĀNÈRQĪ", + "JIÛLIÙBĀWÛ", + "YĪ心DIÂN爱ÈR", + "SÌBÀNSĀNWÛ", + "SHÍLING练WÛ"] \ No newline at end of file diff --git a/wordclock_plugins/time_default/time_chinese.py b/wordclock_plugins/time_default/time_chinese.py new file mode 100644 index 00000000..774c3872 --- /dev/null +++ b/wordclock_plugins/time_default/time_chinese.py @@ -0,0 +1,77 @@ + +class time_mmi_chinese: + """ + This class returns a given time as a range of LED-indices. + Illuminating these LEDs represents the current time on a dutch WCA 11x10 + + range(0,3) + range(4,6): HET IS + + range(7,11) + range(40,44): VIJF OVER + range(11,15) + range(40,44): TIEN OVER + range(28,33) + range(40,44): KWART OVER + range(11,15) + range(18,22) + range(33,37): TIEN VOOR HALF + range(7,11) + range(18,22) + range(33,37): VIJF VOOR HALF + range(33,37): HALF + range(7,11) + range(22,26) + range(33,37): VIJF OVER HALF + range(11,15) + range(22,26) + range(33,37): TIEN OVER HALF + range(28,33) + range(44,48): KWART VOOR + range(11,15) + range(44,48): TIEN VOOR + range(7,11) + range(44,48): VIJF VOOR + + range(99,105): TWAALF + range(51,54): EEN + range(55,59): TWEE + range(62,66): DRIE + range(66,70): VIER + range(70,74): VIJF + range(74,77): ZES + range(77,82): ZEVEN + range(88,92): ACHT + range(83,88): NEGEN + range(91,95): TIEN + range(96,99): ELF + range(99,105): TWAALF + + self.full_hour= range(107,110) + """ + + def __init__(self): + self.prefix = list(range(0,2)) + list(range(24,31)) + self.minutes=[[], \ + list(range(21,22)) + list(range(22,23)) + list(range(75,77)), \ + list(range(19,20)) + list(range(72,75)), \ + list(range(14,15)) + list(range(72,75)) + list(range(75,77)), \ + list(range(15,16)) + list(range(19,20)) + list(range(60,62)) + list(range(72,75)), \ + list(range(15,16)) + list(range(19,20)) + list(range(21,22)) + list(range(60,62)) + list(range(72,75)) + list(range(75,77)), \ + list(range(13,14)) + list(range(69,72)), \ + list(range(16,17)) + list(range(19,20)) + list(range(21,22)) + list(range(66,69)) + list(range(72,75)) + list(range(75,77)), \ + list(range(17,18)) + list(range(19,20)) + list(range(62,64)) + list(range(72,75)), \ + list(range(17,18)) + list(range(19,20)) + list(range(21,22)) + list(range(62,64)) + list(range(72,75)) + list(range(75,77)), \ + list(range(18,19)) + list(range(19,20)) + list(range(64,66)) + list(range(72,75)), \ + list(range(18,19)) + list(range(19,20)) + list(range(21,22)) + list(range(64,66)) + list(range(72,75)) + list(range(75,77))] + self.hours= [\ + list(range(2,3)) + list(range(4,5)) + list(range(30,33)) + list(range(35,37)), \ + list(range(3,4)) + list(range(33,35)), \ + list(range(4,5)) + list(range(35,37)), \ + list(range(5,6)) + list(range(37,40)), \ + list(range(6,7)) + list(range(40,42)), \ + list(range(7,8)) + list(range(42,44)), \ + list(range(8,9)) + list(range(44,47)), \ + list(range(9,10)) + list(range(47,49)), \ + list(range(10,11)) + list(range(49,51)), \ + list(range(11,12)) + list(range(51,54)), \ + list(range(2,3)) + list(range(30,33)), \ + list(range(2,3)) + list(range(3,4)) + list(range(30,33)) + list(range(33,35)), \ + list(range(2,3)) + list(range(4,5)) + list(range(30,33)) + list(range(35,37))] + self.full_hour= list(range(12,13)) + list(range(55,59)) + + def get_time(self, time, purist): + hour=time.hour%12 #+(1 if time.minute//5 > 3 else 0) + minute=time.minute//5 + # Assemble indices + return \ + (self.prefix if not purist else []) + \ + self.minutes[int(minute)] + \ + self.hours[hour] + \ + self.full_hour + diff --git a/wordclock_tools/wordclock_display.py b/wordclock_tools/wordclock_display.py index 2b0fd4bd..176edc9d 100755 --- a/wordclock_tools/wordclock_display.py +++ b/wordclock_tools/wordclock_display.py @@ -22,12 +22,7 @@ import wordclock_plugins.time_default.time_swiss_german as time_swiss_german import wordclock_plugins.time_default.time_swiss_german2 as time_swiss_german2 import wordclock_plugins.time_default.time_swedish as time_swedish -import wordclock_plugins.time_default.time_mmi_dutch as time_mmi_dutch -import wordclock_plugins.time_default.time_mmi_english as time_mmi_english -import wordclock_plugins.time_default.time_mmi_spanish as time_mmi_spanish -import wordclock_plugins.time_default.time_mmi_hindi as time_mmi_hindi -import wordclock_plugins.time_default.time_mmi_chinese as time_mmi_chinese -import wordclock_plugins.time_default.time_mmi_fivelanguages as time_mmi_fivelanguages +import wordclock_plugins.time_default.time_chinese as time_chinese import wordclock_tools.wordclock_colors as wcc import wordclock_tools.wordclock_screen as wordclock_screen import colorsys @@ -144,18 +139,8 @@ def __init__(self, config, wci): self.taw = time_swabian2.time_swabian2() elif language == 'swedish': self.taw = time_swedish.time_swedish() - elif language == 'mmi_dutch': - self.taw = time_mmi_dutch.time_mmi_dutch() - elif language == 'mmi_english': - self.taw = time_mmi_english.time_mmi_english() - elif language == 'mmi_spanish': - self.taw = time_mmi_spanish.time_mmi_spanish() - elif language == 'mmi_hindi': - self.taw = time_mmi_hindi.time_mmi_hindi() - elif language == 'mmi_chinese': - self.taw = time_mmi_chinese.time_mmi_chinese() - elif language == 'mmi_fivelanguages': - self.taw = time_mmi_dutch.time_mmi_fivelanguages() + elif language == 'chineseh': + self.taw = time_chinese.time_chinese() elif language == 'swiss_german': self.taw = time_swiss_german.time_swiss_german() elif language == 'swiss_german2': From 014240cad7e09057aae00149e43d13e1b373bb08 Mon Sep 17 00:00:00 2001 From: Martin van Middelkoop Date: Fri, 27 Jan 2023 16:57:54 +0100 Subject: [PATCH 3/4] Finalized, just one last check by a Chinese speaking colleague to be done. --- .../wordclock_config.reference.cfg | 17 ++- .../time_default/time_chinese.py | 126 ++++++++++-------- wordclock_tools/wordclock_display.py | 2 +- 3 files changed, 82 insertions(+), 63 deletions(-) diff --git a/wordclock_config/wordclock_config.reference.cfg b/wordclock_config/wordclock_config.reference.cfg index 54a0cb94..af206e33 100755 --- a/wordclock_config/wordclock_config.reference.cfg +++ b/wordclock_config/wordclock_config.reference.cfg @@ -312,10 +312,13 @@ swedish=["KLOCKANTÄRK", "TIOELVATOLV"] chinese=["现在十一两三四五六七", "八九点一三刻半两三四", - "五十零五享受你的生活", - "XIÀNZÀI佳SÌ", - "SHÍSĀNÈRQĪ", - "JIÛLIÙBĀWÛ", - "YĪ心DIÂN爱ÈR", - "SÌBÀNSĀNWÛ", - "SHÍLING练WÛ"] \ No newline at end of file + "五十零五OXIÀN爱", + "ZÀI心SHÍSĀN", + "YĪÈRLIÙJIÛ", + "WǓSÌQĪBĀ高兴", + "DIǍN佳SĀNYĪ", + "WǓBÀNKÈRSÌ", + "SHÍLÍNG练WǓ"] + + + \ No newline at end of file diff --git a/wordclock_plugins/time_default/time_chinese.py b/wordclock_plugins/time_default/time_chinese.py index 774c3872..52945eb0 100644 --- a/wordclock_plugins/time_default/time_chinese.py +++ b/wordclock_plugins/time_default/time_chinese.py @@ -1,69 +1,85 @@ -class time_mmi_chinese: +class time_chinese: """ This class returns a given time as a range of LED-indices. - Illuminating these LEDs represents the current time on a dutch WCA 11x10 + Illuminating these LEDs represents the current time on a chinese WCA 10x10 (last 2 lines are fully dummy) - range(0,3) + range(4,6): HET IS + It shows the time both in Chinese characters as in how to pronounce them, + and additionally has a bonus sentence and some bonus words in Chinese characters: + * Beautiful - 佳 pronounced as Jiā + * Love - 爱 pronounced as Ài + * Heart - 心 pronounced as Xīn + * Practice/experience - 练 pronounced as Liàn + * Happy - 高兴 pronounced as Gāoxìng + + I have used this explanation https://improvemandarin.com/tell-time-in-chinese/ + In general: It is o'clock / 1 or 3 quarters past / half past + So no term for Minutes (not needed in non-formal chinese) and no X minutes before... + On last thing: when using 5 minutes past, an extra "Ling" must be used for "zero-five". + - range(7,11) + range(40,44): VIJF OVER - range(11,15) + range(40,44): TIEN OVER - range(28,33) + range(40,44): KWART OVER - range(11,15) + range(18,22) + range(33,37): TIEN VOOR HALF - range(7,11) + range(18,22) + range(33,37): VIJF VOOR HALF - range(33,37): HALF - range(7,11) + range(22,26) + range(33,37): VIJF OVER HALF - range(11,15) + range(22,26) + range(33,37): TIEN OVER HALF - range(28,33) + range(44,48): KWART VOOR - range(11,15) + range(44,48): TIEN VOOR - range(7,11) + range(44,48): VIJF VOOR + range(0,2) + range(12,13) + range(21,28) + range(63,67): + It is ... o'clock: 现在 ... 点 and XIÀNZÀI ... DIǍN - range(99,105): TWAALF - range(51,54): EEN - range(55,59): TWEE - range(62,66): DRIE - range(66,70): VIER - range(70,74): VIJF - range(74,77): ZES - range(77,82): ZEVEN - range(88,92): ACHT - range(83,88): NEGEN - range(91,95): TIEN - range(96,99): ELF - range(99,105): TWAALF + 十两 SHÍ ÈR Twelve range(2,3) + range() + 一 YĪ One range(51,54) + 两 ÈR Two range(55,59) + 三 SÃN Three range(62,66) + 四 SÌ Four range(66,70) + 五 WǓ Five range(70,74) + 六 LIÙ Six range(74,77) + 七 QĪ Seven range(77,82) + 八 BÃ Eight range(88,92) + 九 JIÛ Nine range(83,88) + 十 SHÍ Ten range(91,95) + 十一 SHÍ YĪ Eleven range(96,99) + 十两 SHÍ ÈR Twelve range(99,105) - self.full_hour= range(107,110) + 零五 LÍNG WǓ Five past + 十 SHÍ Ten past + 一刻 YĪ KÈ One quarter past + 两十 ÈR SHÍ Twenty past + 两十五 ÈR SHÍ WǓ Twenty five past + 半 BÀN Half past + 三十五 SÃN SHÍ WǓ Thirty five past + 四 SÌ SHÍ Fourty past + 三刻 SÃN KÈ Three quarters past + 五十 WǓ SHÍ Fifty past + 五十五 WǓ SHÍ WǓ Fifty five past + + + self.full_hour= n/a """ def __init__(self): - self.prefix = list(range(0,2)) + list(range(24,31)) - self.minutes=[[], \ - list(range(21,22)) + list(range(22,23)) + list(range(75,77)), \ - list(range(19,20)) + list(range(72,75)), \ - list(range(14,15)) + list(range(72,75)) + list(range(75,77)), \ - list(range(15,16)) + list(range(19,20)) + list(range(60,62)) + list(range(72,75)), \ - list(range(15,16)) + list(range(19,20)) + list(range(21,22)) + list(range(60,62)) + list(range(72,75)) + list(range(75,77)), \ - list(range(13,14)) + list(range(69,72)), \ - list(range(16,17)) + list(range(19,20)) + list(range(21,22)) + list(range(66,69)) + list(range(72,75)) + list(range(75,77)), \ - list(range(17,18)) + list(range(19,20)) + list(range(62,64)) + list(range(72,75)), \ - list(range(17,18)) + list(range(19,20)) + list(range(21,22)) + list(range(62,64)) + list(range(72,75)) + list(range(75,77)), \ - list(range(18,19)) + list(range(19,20)) + list(range(64,66)) + list(range(72,75)), \ - list(range(18,19)) + list(range(19,20)) + list(range(21,22)) + list(range(64,66)) + list(range(72,75)) + list(range(75,77))] + self.prefix = list(range(0,2)) + list(range(12,13)) + list(range(25,29)) + list(range(30,33)) + list(range(60,64)) self.hours= [\ - list(range(2,3)) + list(range(4,5)) + list(range(30,33)) + list(range(35,37)), \ - list(range(3,4)) + list(range(33,35)), \ - list(range(4,5)) + list(range(35,37)), \ - list(range(5,6)) + list(range(37,40)), \ - list(range(6,7)) + list(range(40,42)), \ - list(range(7,8)) + list(range(42,44)), \ - list(range(8,9)) + list(range(44,47)), \ - list(range(9,10)) + list(range(47,49)), \ - list(range(10,11)) + list(range(49,51)), \ - list(range(11,12)) + list(range(51,54)), \ - list(range(2,3)) + list(range(30,33)), \ - list(range(2,3)) + list(range(3,4)) + list(range(30,33)) + list(range(33,35)), \ - list(range(2,3)) + list(range(4,5)) + list(range(30,33)) + list(range(35,37))] - self.full_hour= list(range(12,13)) + list(range(55,59)) + list(range(2,3)) + list(range(4,5)) + list(range(34,37)) + list(range(42,44)), \ + list(range(3,4)) + list(range(40,42)), \ + list(range(4,5)) + list(range(42,44)), \ + list(range(5,6)) + list(range(37,40)), \ + list(range(6,7)) + list(range(52,54)), \ + list(range(7,8)) + list(range(50,52)), \ + list(range(8,9)) + list(range(44,48)), \ + list(range(9,10)) + list(range(54,56)), \ + list(range(10,11)) + list(range(56,58)), \ + list(range(11,12)) + list(range(47,50)), \ + list(range(2,3)) + list(range(34,37)), \ + list(range(2,3)) + list(range(3,4)) + list(range(34,37)) + list(range(40,42)), \ + list(range(2,3)) + list(range(4,5)) + list(range(34,37)) + list(range(42,44))] + self.minutes=[[], \ + list(range(22,23)) + list(range(23,24)) + list(range(83,87)) + list(range(88,90)), \ + list(range(21,22)) + list(range(80,83)), \ + list(range(13,14)) + list(range(15,16)) + list(range(68,70)) + list(range(75,77)), \ + list(range(17,18)) + list(range(21,22)) + list(range(76,78)) + list(range(80,83)), \ + list(range(17,18)) + list(range(21,22)) + list(range(23,24)) + list(range(76,78)) + list(range(80,83)) + list(range(88,90)), \ + list(range(16,17)) + list(range(72,75)), \ + list(range(14,15)) + list(range(21,22)) + list(range(23,24)) + list(range(65,68)) + list(range(80,83)) + list(range(88,90)), \ + list(range(19,20)) + list(range(21,22)) + list(range(78,80)) + list(range(80,83)), \ + list(range(14,15)) + list(range(15,16)) + list(range(65,68)) + list(range(75,77)), \ + list(range(70,72)) + list(range(21,22)) + list(range(70,72)) + list(range(80,83)), \ + list(range(70,72)) + list(range(21,22)) + list(range(23,24)) + list(range(70,72)) + list(range(80,83)) + list(range(88,90))] + self.full_hour= [] def get_time(self, time, purist): hour=time.hour%12 #+(1 if time.minute//5 > 3 else 0) diff --git a/wordclock_tools/wordclock_display.py b/wordclock_tools/wordclock_display.py index 176edc9d..ee6394d2 100755 --- a/wordclock_tools/wordclock_display.py +++ b/wordclock_tools/wordclock_display.py @@ -139,7 +139,7 @@ def __init__(self, config, wci): self.taw = time_swabian2.time_swabian2() elif language == 'swedish': self.taw = time_swedish.time_swedish() - elif language == 'chineseh': + elif language == 'chinese': self.taw = time_chinese.time_chinese() elif language == 'swiss_german': self.taw = time_swiss_german.time_swiss_german() From 728511731d69e85af206447046c69e9ed8efbb2b Mon Sep 17 00:00:00 2001 From: Martin van Middelkoop Date: Sun, 29 Jan 2023 15:16:45 +0100 Subject: [PATCH 4/4] last check to be done with Hindi speaking colleagues --- wordclock_plugins/time_default/time_hindi.py | 85 ++++++++++++++++++++ wordclock_tools/wordclock_display.py | 21 +---- 2 files changed, 88 insertions(+), 18 deletions(-) create mode 100644 wordclock_plugins/time_default/time_hindi.py diff --git a/wordclock_plugins/time_default/time_hindi.py b/wordclock_plugins/time_default/time_hindi.py new file mode 100644 index 00000000..e22cb058 --- /dev/null +++ b/wordclock_plugins/time_default/time_hindi.py @@ -0,0 +1,85 @@ + +class time_hindi: + """ + This class returns a given time as a range of LED-indices. + Illuminating these LEDs represents the current time on a dutch WCA 11x10 + + range(0,3) + range(4,6): HET IS + + range(7,11) + range(40,44): VIJF OVER + range(11,15) + range(40,44): TIEN OVER + range(28,33) + range(40,44): KWART OVER + range(11,15) + range(18,22) + range(33,37): TIEN VOOR HALF + range(7,11) + range(18,22) + range(33,37): VIJF VOOR HALF + range(33,37): HALF + range(7,11) + range(22,26) + range(33,37): VIJF OVER HALF + range(11,15) + range(22,26) + range(33,37): TIEN OVER HALF + range(28,33) + range(44,48): KWART VOOR + range(11,15) + range(44,48): TIEN VOOR + range(7,11) + range(44,48): VIJF VOOR + + range(99,105): TWAALF + range(51,54): EEN + range(55,59): TWEE + range(62,66): DRIE + range(66,70): VIER + range(70,74): VIJF + range(74,77): ZES + range(77,82): ZEVEN + range(88,92): ACHT + range(83,88): NEGEN + range(91,95): TIEN + range(96,99): ELF + range(99,105): TWAALF + + self.full_hour= range(107,110) + """ + + def __init__(self): + self.prefix = list(range(107,110)) + self.minutes=[[], \ + list(range(74,80)) + list(range(95,100)) + list(range(100,105)), \ + list(range(74,80)) + list(range(87,90)) + list(range(100,105)), \ + list(range(10,14)), \ + list(range(74,80)) + list(range(90,93)) + list(range(100,105)), \ + list(range(74,80)) + list(range(80,85)) + list(range(100,105)), \ + list(range(5,10)), \ + list(range(65,72)) + list(range(80,85)) + list(range(100,105)), \ + list(range(65,72)) + list(range(90,93)) + list(range(100,105)), \ + list(range(0,5)), \ + list(range(65,72)) + list(range(87,90)) + list(range(100,105)), \ + list(range(65,72)) + list(range(95,100)) + list(range(100,105)) ] + self.hours= [list(range(50,55)), \ + list(range(35,37)), \ + list(range(18,20)), \ + list(range(37,40)), \ + list(range(46,50)), \ + list(range(30,35)), \ + list(range(33,36)), \ + list(range(22,25)), \ + list(range(23,26)), \ + list(range(55,58)), \ + list(range(20,23)), \ + list(range(40,46)), \ + list(range(50,55))] + self.full_hour= list(range(60,64)) + + def get_time(self, time, purist): + hour=time.hour%12+(1 if time.minute//5 > 6 else 0) + minute=time.minute//5 + + if (minute == 6 and hour == 1): + return (self.prefix if not purist else []) + \ + list(range(26,30)) + \ + self.full_hour + if (minute == 6 and hour == 2): + return (self.prefix if not purist else []) + \ + list(range(14,18)) + \ + self.full_hour + # Assemble indices + return \ + (self.prefix if not purist else []) + \ + self.minutes[int(minute)] + \ + self.hours[hour] + \ + (self.full_hour if (minute == 0) else []) + diff --git a/wordclock_tools/wordclock_display.py b/wordclock_tools/wordclock_display.py index 2b0fd4bd..4108ad1c 100755 --- a/wordclock_tools/wordclock_display.py +++ b/wordclock_tools/wordclock_display.py @@ -22,12 +22,7 @@ import wordclock_plugins.time_default.time_swiss_german as time_swiss_german import wordclock_plugins.time_default.time_swiss_german2 as time_swiss_german2 import wordclock_plugins.time_default.time_swedish as time_swedish -import wordclock_plugins.time_default.time_mmi_dutch as time_mmi_dutch -import wordclock_plugins.time_default.time_mmi_english as time_mmi_english -import wordclock_plugins.time_default.time_mmi_spanish as time_mmi_spanish -import wordclock_plugins.time_default.time_mmi_hindi as time_mmi_hindi -import wordclock_plugins.time_default.time_mmi_chinese as time_mmi_chinese -import wordclock_plugins.time_default.time_mmi_fivelanguages as time_mmi_fivelanguages +import wordclock_plugins.time_default.time_hindi as time_hindi import wordclock_tools.wordclock_colors as wcc import wordclock_tools.wordclock_screen as wordclock_screen import colorsys @@ -144,18 +139,8 @@ def __init__(self, config, wci): self.taw = time_swabian2.time_swabian2() elif language == 'swedish': self.taw = time_swedish.time_swedish() - elif language == 'mmi_dutch': - self.taw = time_mmi_dutch.time_mmi_dutch() - elif language == 'mmi_english': - self.taw = time_mmi_english.time_mmi_english() - elif language == 'mmi_spanish': - self.taw = time_mmi_spanish.time_mmi_spanish() - elif language == 'mmi_hindi': - self.taw = time_mmi_hindi.time_mmi_hindi() - elif language == 'mmi_chinese': - self.taw = time_mmi_chinese.time_mmi_chinese() - elif language == 'mmi_fivelanguages': - self.taw = time_mmi_dutch.time_mmi_fivelanguages() + elif language == 'hindi': + self.taw = time_hindi.time_hindi() elif language == 'swiss_german': self.taw = time_swiss_german.time_swiss_german() elif language == 'swiss_german2':