diff --git a/locales/de_DE.json b/locales/de_DE.json index 209defd..3e7988a 100644 --- a/locales/de_DE.json +++ b/locales/de_DE.json @@ -1,8 +1,9 @@ { - "actions.digital-clock.twenty-four-format": "24h Format", - "actions.digital-clock.twenty-four-format.tooltip": "Verwende 24h Format (hh:mm:ss) statt 12h Format (hh:mm:ss am/pm)", - "actions.digital-clock.show-seconds": "Sekunden anzeigen", - "actions.analog-clock.name": "Analoge Uhr", - "actions.digital-clock.name": "Digitale Uhr", - "plugin.name": "Uhren" -} \ No newline at end of file + "actions.digital-clock.twenty-four-format": "24h Format", + "actions.digital-clock.twenty-four-format.tooltip": "Verwende 24h Format (hh:mm:ss) statt 12h Format (hh:mm:ss am/pm)", + "actions.digital-clock.show-seconds": "Sekunden anzeigen", + "actions.digital-clock.blink-colon": "Doppelpunkt blinken", + "actions.analog-clock.name": "Analoge Uhr", + "actions.digital-clock.name": "Digitale Uhr", + "plugin.name": "Uhren" +} diff --git a/locales/en_US.json b/locales/en_US.json index f348954..598fa2c 100644 --- a/locales/en_US.json +++ b/locales/en_US.json @@ -1,8 +1,9 @@ { - "actions.digital-clock.twenty-four-format": "24h format", - "actions.digital-clock.twenty-four-format.tooltip": "Use the 24h format (hh:mm:ss) instead of the 12h format (hh:mm:ss am/pm)", - "actions.digital-clock.show-seconds": "Show seconds", - "actions.analog-clock.name": "Analog clock", - "actions.digital-clock.name": "Digital clock", - "plugin.name": "Clocks" -} \ No newline at end of file + "actions.digital-clock.twenty-four-format": "24h format", + "actions.digital-clock.twenty-four-format.tooltip": "Use the 24h format (hh:mm:ss) instead of the 12h format (hh:mm:ss am/pm)", + "actions.digital-clock.show-seconds": "Show seconds", + "actions.digital-clock.blink-colon": "Blink colon", + "actions.analog-clock.name": "Analog clock", + "actions.digital-clock.name": "Digital clock", + "plugin.name": "Clocks" +} diff --git a/locales/fr_FR.json b/locales/fr_FR.json index 6b8e769..5b7c034 100644 --- a/locales/fr_FR.json +++ b/locales/fr_FR.json @@ -1,8 +1,9 @@ { - "actions.digital-clock.twenty-four-format": "24h format", - "actions.digital-clock.twenty-four-format.tooltip": "Utiliser le format 24h (hh:mm:ss) au lieu du format 12h (hh:mm:ss am/pm)", - "actions.digital-clock.show-seconds": "Afficher les secondes", - "actions.analog-clock.name": "Montre analogique", - "actions.digital-clock.name": "Montre numerique", - "plugin.name": "Montres" -} \ No newline at end of file + "actions.digital-clock.twenty-four-format": "24h format", + "actions.digital-clock.twenty-four-format.tooltip": "Utiliser le format 24h (hh:mm:ss) au lieu du format 12h (hh:mm:ss am/pm)", + "actions.digital-clock.show-seconds": "Afficher les secondes", + "actions.digital-clock.blink-colon": "Faire clignoter les deux-points", + "actions.analog-clock.name": "Montre analogique", + "actions.digital-clock.name": "Montre numerique", + "plugin.name": "Montres" +} diff --git a/main.py b/main.py index 25e4908..b213537 100644 --- a/main.py +++ b/main.py @@ -156,13 +156,18 @@ def get_config_rows(self) -> list: title=self.plugin_base.lm.get("actions.digital-clock.show-seconds") ) + self.blink_colon_switch = Adw.SwitchRow( + title=self.plugin_base.lm.get("actions.digital-clock.blink-colon") + ) + self.load_defaults() self.twenty_four_format_switch.connect("notify::active", self.on_twenty_four_format_switch_toggled) self.show_seconds_switch.connect("notify::active", self.on_show_seconds_switch_toggled) + self.blink_colon_switch.connect("notify::active", self.on_blink_colon_switch_toggled) self.label_position_row.connect("notify::selected", self.on_label_position_changed) - return [self.twenty_four_format_switch, self.show_seconds_switch, self.label_position_row] + return [self.twenty_four_format_switch, self.show_seconds_switch, self.blink_colon_switch, self.label_position_row] return rows + [self.twenty_four_format_switch, self.show_seconds_switch] @@ -170,6 +175,7 @@ def load_defaults(self): settings = self.get_settings() self.twenty_four_format_switch.set_active(settings.get("twenty-four-format", True)) self.show_seconds_switch.set_active(settings.get("show-seconds", False)) + self.blink_colon_switch.set_active(settings.get("blink-colon", True)) self.label_position_row.set_selected_item_by_key(settings.get("label-position"), 1) def on_twenty_four_format_switch_toggled(self, *args): @@ -185,6 +191,13 @@ def on_show_seconds_switch_toggled(self, *args): self.show() + def on_blink_colon_switch_toggled(self, *args): + settings = self.get_settings() + settings["blink-colon"] = self.blink_colon_switch.get_active() + self.set_settings(settings) + + self.show() + def on_label_position_changed(self, *args): settings = self.get_settings() settings["label-position"] = self.label_position_row.get_selected_item().key @@ -202,12 +215,14 @@ def on_tick(self): def show(self): settings = self.get_settings() label_position = settings.get("label-position", "center") + blink_colon = settings.get("blink-colon", True) if label_position not in ["top", "center", "bottom"]: return - seperator = " " if self.points_visible else ":" - if settings.get("show-seconds", False): + if blink_colon and not settings.get("show-seconds", False): + seperator = " " if self.points_visible else ":" + else: seperator = ":" now = self.get_current_time() @@ -226,7 +241,8 @@ def show(self): self.set_label(label, font_size=font_size, position=label_position) - self.points_visible = not self.points_visible + if blink_colon and not settings.get("show-seconds", False): + self.points_visible = not self.points_visible class Date(TimeActionBase):