Skip to main content

Ridiculously Uncomplicated Mac os x Python Statusbar apps.

Project description

rumps
=====

**R**idiculously **U**ncomplicated **M**ac os x **P**ython **S**tatusbar apps.

![pic](https://raw.github.com/jaredks/rumps/master/examples/rumps_example.png)

```python
import rumps

class AwesomeStatusBarApp(rumps.App):
def __init__(self):
super(AwesomeStatusBarApp, self).__init__("Awesome App")
self.menu = ["Preferences", "Silly button", "Say hi"]

@rumps.clicked("Preferences")
def prefs(self, _):
rumps.alert("jk! no preferences available!")

@rumps.clicked("Silly button")
def onoff(self, sender):
sender.state = not sender.state

@rumps.clicked("Say hi")
def sayhi(self, _):
rumps.notification("Awesome title", "amazing subtitle", "hi!!1")

if __name__ == "__main__":
AwesomeStatusBarApp().run()
```

How fun!?

`rumps` can greatly shorten the code required to generate a working app. No `PyObjC` underscore syntax required!


Use case
--------

`rumps` is for any console-based program that would benefit from a simple configuration toolbar or launch menu.

Good for:

* Notification-center-based app
* Controlling daemons / launching separate programs
* Updating simple info from web APIs on a timer

Not good for:

* Any app that is first and foremost a GUI application


Required
--------

* PyObjC


Recommended
-----------

* py2app

For creating standalone apps, just make sure to include `rumps` in the `packages` list. Most simple statusbar-based
apps are just "background" apps (no icon in the dock; inability to tab to the application) so it is likely that you
would want to set `'LSUIElement'` to `True`. A basic `setup.py` would look like,

```python
from setuptools import setup

APP = ['example_class.py']
DATA_FILES = []
OPTIONS = {
'argv_emulation': True,
'plist': {
'LSUIElement': True,
},
'packages': ['rumps'],
}

setup(
app=APP,
data_files=DATA_FILES,
options={'py2app': OPTIONS},
setup_requires=['py2app'],
)
```

With this you can then create a standalone,

python setup.py py2app


Installation
------------

python setup.py install


License
-------

"Modified BSD License". See LICENSE for details. Copyright Jared Suttles, 2013.


Changes
=======

0.1.4 (2013-08-21)
------------------

- Menu class subclassing ListDict, a subclass of OrderedDict with additional insertion operations
- `update` method of Menu works like old App.menu parsing - consumes various nested Python containers and creates menus


0.1.3 (2013-08-19)
------------------

- `separator` global for marking menu separators (in addition to None in context of a menu)
- Can now have separators in sub menus using either `separator` or None
- Key and menu title not matching doesn't raise an exception since the situation would occur if the title is changed
dynamically
- Instead, a warning in the log
- Refactored MenuItem such that it subclasses new Menu class
- Menu class created
- Wraps NSMenu using __setitem__, __delitem__, etc.
- Allows for main menu to be easily changed during runtime as it now uses Menu class instead of vanilla OrderedDict
- `clear` method for MenuItem + other irrelevant methods inherited from OrderedDict raise NotImplementedError
- As result of refactoring, could simplify menu parsing for App


0.1.2 (2013-08-11)
------------------

- Interval access and modification added to Timer objects
- timers function for iterating over timers
- Timer class now directly in module namespace
- More specfic case for trying callback with instance of App subclass as first argument
- Point is to avoid catching a completely different TypeError, then sending 2 variables to a function consuming 1


0.1.1 (2013-08-07)
------------------

- Parsing data structures for creating menus is now more robust
- Fixed MenuItem __repr__ for printing instances where no callback function has been given
- Added `example_menu.py` to examples serving also as a test for new MenuItem changes
- Can now `del` MenuItems of submenus and it will be reflected in the actual menu
- `add` method for more convenient addition of MenuItems to a MenuItem's submenu
- Created module docstring


0.1.0 (2013-07-31)
------------------

- world, hello! meet rumps.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rumps-0.1.5.tar.gz (11.2 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page