Skip to content

Commit

Permalink
feat: add PunctuationStripSetting
Browse files Browse the repository at this point in the history
  • Loading branch information
kraanzu committed Dec 18, 2023
1 parent b7cc6ff commit 855c9ea
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion termtyper/ui/widgets/config_strip.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from rich.console import RenderableType
from textual.app import ComposeResult
from textual.widget import Widget
from termtyper.src.parser import config_parser


class StripSetting(Widget):
Expand All @@ -26,6 +27,22 @@ def render(self) -> RenderableType:
return self.setting_name


class PunctuationStripSetting(StripSetting):
def __init__(self):
super().__init__("punctuation", "󰸥")
self.refresh_setting()

def refresh_setting(self) -> None:
self.set_class(config_parser.get("punctuations"), "enabled")

def toggle(self):
config_parser.toggle_punctuations()
self.refresh_setting()

def on_click(self):
self.toggle()


class StripSeparator(Widget):

DEFAULT_CSS = """
Expand Down Expand Up @@ -74,7 +91,7 @@ class TypingConfigStrip(Widget):

def compose(self) -> ComposeResult:
yield Bracket("left")
yield StripSetting("punctuation", "󰸥")
yield PunctuationStripSetting()
yield StripSetting("numbers", "󰲰")
yield StripSeparator()
yield StripSetting("time", "󰥔")
Expand Down

0 comments on commit 855c9ea

Please sign in to comment.