Skip to content

Commit

Permalink
tray-tip directive refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
filantus committed Apr 27, 2024
1 parent ba5fe31 commit 2d9d64e
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions ahk/directives.py
Expand Up @@ -159,19 +159,17 @@ class WinActivateForce(Directive):

class TrayTip(Directive):
def __init__(self, text: str, **kwargs: Any):
self.text: str = (text or '').replace('\n', ' ')
if not isinstance(text, str):
raise TypeError('Parameter "text" must be a string.')

self.text: str = text.replace('"', '').replace('\n', ' ')

super().__init__(**kwargs)

def __str__(self) -> str:
if self.text:
return f'A_IconTip := "{self.text}"'
return ''
return f'A_IconTip := "{self.text}"'


class ExecutorTrayTip(TrayTip):
def __init__(self, text: str, **kwargs: Any):
self.text: str = (text or '').replace('\n', ' ')

kwargs['apply_to_hotkeys_process'] = True
super().__init__(text=text, **kwargs)
super().__init__(text=text, **kwargs, apply_to_hotkeys_process=True)

0 comments on commit 2d9d64e

Please sign in to comment.