Skip to content

Commit

Permalink
allow menu items to be hidden (#138)
Browse files Browse the repository at this point in the history
* allow menu items to be hidden

* document changes #138
  • Loading branch information
jaredks committed Jun 27, 2021
1 parent 5a868f4 commit 76ea8c5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Expand Up @@ -4,6 +4,7 @@ Changes
0.3.0.dev
---------

- Allow menu items to be hidden #138
- Fix dark mode alert style #137
- Notifications: fixes, cleanup, and tests #131
- Fix slider for some older macOS versions (10.11 and before?)
Expand Down
17 changes: 17 additions & 0 deletions rumps/rumps.py
Expand Up @@ -528,6 +528,23 @@ def state(self):
def state(self, new_state):
self._menuitem.setState_(new_state)

@property
def hidden(self):
"""Indicates whether the menu item is hidden."""
return self._menuitem.isHidden()

@hidden.setter
def hidden(self, value):
self._menuitem.setHidden_(value)

def hide(self):
"""Hide the menu item."""
self.hidden = True

def show(self):
"""Show the menu item."""
self.hidden = False

def set_callback(self, callback, key=None):
"""Set the function serving as callback for when a click event occurs on this menu item. When `callback` is
``None``, it will disable the callback function and grey out the menu item. If `key` is a string, set as the
Expand Down

0 comments on commit 76ea8c5

Please sign in to comment.